Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub Actions Bot committed Jan 10, 2024
2 parents c9941ae + d9e6c60 commit c48f247
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 311 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.3.22
### Added

## fixed
- default value for registry authentication has been corrected to 'true' in the documentation
- Refactored DuplicateKey Exception handling
- Removed deprecated /query-Endpoint
- Mark idShort in openApi mandatory

## 0.3.21
### Added

Expand Down
6 changes: 3 additions & 3 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ By default, the Registry includes an `Ingress` that exposes the API on https://m
For that to work, you need to append `/etc/hosts` by running `echo "$(minikube ip) minikube" | sudo tee -a /etc/hosts`.

For automated certificate generation, use and configure [cert-manager](https://cert-manager.io/).
By default, authentication is deactivated, please adjust `registry.authentication` if needed
By default, authentication is activated, please adjust `registry.authentication` if needed

## Parameters
The Helm Chart can be configured using the following parameters (incomplete list). For a full overview, please see the [values.yaml](./backend/deployment/registry/values.yaml).
Expand All @@ -35,7 +35,7 @@ The Helm Chart can be configured using the following parameters (incomplete list
| --- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------|
| `registry.image` | The image of the Registry | `registry:latest` |
| `registry.host` | This value is used by the `Ingress` object (if enabled) to route traffic. | `minikube` |
| `registry.authentication` | Enables OAuth2 based authentication/authorization. | `false` |
| `registry.authentication` | Enables OAuth2 based authentication/authorization. | `true` |
| `registry.idpIssuerUri` | The issuer URI of the OAuth2 identity provider. | `http://localhost:8080/auth/realms/catenax` |
| `registry.dataSource.driverClassName` | The driver class name for the database connection. | `org.postgresql.Driver` |
| `registry.dataSource.url` | The url of the relational database (ignored if `enablePostgres` is set to `true`) | `jdbc:postgresql://database:5432` |
Expand All @@ -49,7 +49,7 @@ The Helm Chart can be configured using the following parameters (incomplete list
| `registry.ingress.annotations` | Annotations to further configure the `Ingress` resource, e.g. for using with `cert-manager`. | |
| `registry.tenantId` | TenantId which is the owner of the DTR. | |
| `registry.externalSubjectIdWildcardPrefix` | WildcardPrefix to make a specificAssetId visible for everyone. | `PUBLIC_READABLE` |
| `registry.externalSubjectIdWildcardAllowedTypes` | List of allowed types that can be made visible to everyone. | `manufacturerPartId,assetLifecyclePhase` |
| `registry.externalSubjectIdWildcardAllowedTypes` | List of allowed types that can be made visible to everyone. | `manufacturerPartId,assetLifecyclePhase` |

### PostgreSQL
| Parameter | Description | Default value |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;

import org.eclipse.tractusx.semantics.aas.registry.model.Message;
import org.eclipse.tractusx.semantics.aas.registry.model.Result;
import org.eclipse.tractusx.semantics.registry.model.support.DatabaseExceptionTranslation;
import org.eclipse.tractusx.semantics.registry.service.EntityNotFoundException;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.http.HttpHeaders;
Expand Down Expand Up @@ -97,9 +95,9 @@ public ResponseEntity<Object> handleMethodArgumentNotSupportedException( final H

@ExceptionHandler( { DuplicateKeyException.class } )
@ResponseStatus( HttpStatus.BAD_REQUEST )
public ResponseEntity<Object> handleDuplicateKeyException( DuplicateKeyException e ) {
public ResponseEntity<Object> handleDuplicateKeyException( DuplicateKeyException duplicateKeyException ) {
return new ResponseEntity<>(
new Result().messages( List.of( new Message().messageType( Message.MessageTypeEnum.ERROR ).text( DatabaseExceptionTranslation.translate( e ) ) ) ),
new Result().messages( List.of( new Message().messageType( Message.MessageTypeEnum.ERROR ).text(duplicateKeyException.getMessage() ) ) ),
HttpStatus.BAD_REQUEST );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,23 @@
********************************************************************************/
package org.eclipse.tractusx.semantics.registry.controller;

import java.io.IOException;
import java.util.*;
import java.util.Base64;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;

import org.eclipse.tractusx.semantics.aas.registry.api.DescriptionApiDelegate;
import org.eclipse.tractusx.semantics.aas.registry.api.LookupApiDelegate;
import org.eclipse.tractusx.semantics.aas.registry.api.ShellDescriptorsApiDelegate;
import org.eclipse.tractusx.semantics.aas.registry.model.*;
import org.eclipse.tractusx.semantics.aas.registry.model.AssetAdministrationShellDescriptor;
import org.eclipse.tractusx.semantics.aas.registry.model.AssetKind;
import org.eclipse.tractusx.semantics.aas.registry.model.GetAllAssetAdministrationShellIdsByAssetLink200Response;
import org.eclipse.tractusx.semantics.aas.registry.model.GetAssetAdministrationShellDescriptorsResult;
import org.eclipse.tractusx.semantics.aas.registry.model.GetSubmodelDescriptorsResult;
import org.eclipse.tractusx.semantics.aas.registry.model.ServiceDescription;
import org.eclipse.tractusx.semantics.aas.registry.model.SpecificAssetId;
import org.eclipse.tractusx.semantics.aas.registry.model.SubmodelDescriptor;
import org.eclipse.tractusx.semantics.registry.dto.ShellCollectionDto;
import org.eclipse.tractusx.semantics.registry.dto.SubmodelCollectionDto;
import org.eclipse.tractusx.semantics.registry.mapper.ShellMapper;
Expand Down Expand Up @@ -189,17 +198,6 @@ public ResponseEntity<List<SpecificAssetId>> postAllAssetLinksById(byte[] aasIde
return new ResponseEntity<>(list, HttpStatus.CREATED);
}

/**
* Since /query is not part of AAS 3.0, so this method is not used.
* Keeping it for the reason that it might come up in next version.
*/
@Deprecated
public ResponseEntity<List<String>> postQueryAllAssetAdministrationShellIds(ShellLookup shellLookup,@RequestHeader String externalSubjectId) {
List<SpecificAssetId> assetIds = shellLookup.getQuery().getAssetIds();
List<String> externalIds = shellService.findExternalShellIdsByIdentifiersByAnyMatch(shellMapper.fromApiDto(assetIds),getExternalSubjectIdOrEmpty(externalSubjectId));
return new ResponseEntity<>(externalIds, HttpStatus.OK);
}

private String getExternalSubjectIdOrEmpty(String externalSubjectId) {
return (null ==externalSubjectId) ? "" : externalSubjectId;
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import org.eclipse.tractusx.semantics.registry.model.ShellIdentifier;
import org.eclipse.tractusx.semantics.registry.model.Submodel;
import org.eclipse.tractusx.semantics.registry.model.projection.ShellMinimal;
import org.eclipse.tractusx.semantics.registry.model.support.DatabaseExceptionTranslation;
import org.eclipse.tractusx.semantics.registry.repository.ShellIdentifierRepository;
import org.eclipse.tractusx.semantics.registry.repository.ShellRepository;
import org.eclipse.tractusx.semantics.registry.repository.SubmodelRepository;
Expand Down Expand Up @@ -429,9 +428,8 @@ public List<BatchResultDto> saveBatch(List<Shell> shells) {
return new BatchResultDto("AssetAdministrationShell successfully created.",
shell.getIdExternal(), HttpStatus.OK.value());
} catch (Exception e) {
if (e.getCause() instanceof DuplicateKeyException) {
DuplicateKeyException duplicateKeyException = (DuplicateKeyException) e.getCause();
return new BatchResultDto(DatabaseExceptionTranslation.translate(duplicateKeyException),
if ( e.getCause() instanceof DuplicateKeyException duplicateKeyException ) {
return new BatchResultDto(duplicateKeyException.getMessage(),
shell.getIdExternal(),
HttpStatus.BAD_REQUEST.value());
}
Expand Down
Loading

0 comments on commit c48f247

Please sign in to comment.