Skip to content

Commit

Permalink
Merge pull request #188 from bci-oss/feature/refactoring-dtr-models
Browse files Browse the repository at this point in the history
Feat: Refactoring DTR models to align with AAS 3.0
  • Loading branch information
tunacicek authored Aug 14, 2023
2 parents 721a0de + aa78dc1 commit 637cc9f
Show file tree
Hide file tree
Showing 48 changed files with 274 additions and 3,303 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- In this version the models have been adjusted to new version AAS 3.0.

## fixed
- Refactored existing models to align with AAS 3.0. Removed /query from lookup api because it is not a part of AAS 3.0 version.

## 0.3.12-M1
### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@ public ResponseEntity<List<SpecificAssetId>> postAllAssetLinksById(byte[] aasIde
return new ResponseEntity<>(list, HttpStatus.CREATED);
}

@Override
/**
* 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.
*/
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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public interface ShellMapper {
@Mapping(target = "shellKind", source = "assetKind"),
@Mapping(target = "id", ignore = true),
@Mapping(target = "displayNames", source = "displayName"),
@Mapping(target = "shellExtensions", source = "extensions"),
})
Shell fromApiDto(AssetAdministrationShellDescriptor apiDto);

Expand All @@ -67,19 +66,6 @@ public interface ShellMapper {

ShellIdentifierExternalSubjectReference maptoShellIdentifierExternalSubjectReference ( Reference externalSubjectId );

@Mappings({
@Mapping(target = "supplementalSemanticIds", source = "supplementalSemanticIds"),
@Mapping(target = "semanticId", source = "semanticId"),
@Mapping(target = "refersTo", source = "refersTo"),
})
ShellExtension fromApiDto( Extension apiDto);

ShellExtensionSupplemSemanticIdReference maptoShellExtensionSupplemSemanticReference ( Reference supplementalSemanticId );

ShellExtensionSemanticIdReference maptoShellExtensionSemanticReference ( Reference semanticId );

ShellExtensionRefersToReference maptoShellExtensionRefersToReference ( Reference refersTo );

Set<ShellIdentifier> fromApiDto(List<SpecificAssetId> apiDto);

@Mappings({
Expand All @@ -93,7 +79,6 @@ public interface ShellMapper {
@Mapping(source = "descriptions", target = "description"),
@Mapping(source = "submodels", target = "submodelDescriptors"),
@Mapping(source = "displayNames", target = "displayName"),
@Mapping(source = "shellExtensions", target = "extensions"),
})
@InheritInverseConfiguration
AssetAdministrationShellDescriptor toApiDto(Shell shell);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,12 @@ public interface SubmodelMapper {
@Mapping(target="semanticId", source = "semanticId"),
@Mapping(target = "id", ignore = true),
@Mapping(target = "displayNames", source = "displayName"),
@Mapping(target = "submodelExtensions", source = "extensions"),
@Mapping(target = "submodelSupplemSemanticIds", source = "supplementalSemanticId")
})
Submodel fromApiDto(SubmodelDescriptor apiDto);

SubmodelDescription mapShellDescription (LangStringTextType description);

@Mappings({
@Mapping(target="submodSemanticId", source = "semanticId"),
@Mapping(target="submodSupplementalIds", source = "supplementalSemanticIds"),
@Mapping(target="name", source = "name"),
@Mapping(target="valueType", source = "valueType"),
@Mapping(target="value", source = "value"),
@Mapping(target="refersTo", source = "refersTo")
})
SubmodelExtension mapSubmodelExtension (Extension submodelExtensions);

@Mappings({
@Mapping(target="interfaceName", source = "interface"),
@Mapping(target="endpointAddress", source = "protocolInformation.href"),
Expand Down Expand Up @@ -103,19 +92,6 @@ default List<String> protocolVersionDescriptor(String version){

LangStringTextType mapSubModelDescription (SubmodelDescription description);

@Mappings({
@Mapping(source = "submodelExtensions", target = "extensions"),
})
@InheritInverseConfiguration
List<SubmodelDescriptor> toApiDto( Set<Submodel> submodels );

@Mappings({
@Mapping(source="submodSemanticId", target = "semanticId"),
@Mapping(source="submodSupplementalIds", target = "supplementalSemanticIds"),
@Mapping(source="name", target = "name"),
@Mapping(source="valueType", target = "valueType"),
@Mapping(source="value", target = "value"),
@Mapping(source="refersTo", target = "refersTo")
})
Extension mapExtension (SubmodelExtension submodelExtension);
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,6 @@ public class Shell {
private ShellKind shellKind;
private String shellType;

@JsonManagedReference
@OneToMany(cascade = CascadeType.ALL, mappedBy = "shellId")
Set<ShellExtension> shellExtensions= new HashSet<>();

public void setShellExtensions(Set<ShellExtension> shellExtensions) {
if(shellExtensions==null) {shellExtensions = new HashSet<>();}
this.shellExtensions = shellExtensions;
for(ShellExtension s : shellExtensions) {
s.setShellId(this);
}
}

public void setDisplayNames(Set<ShellDisplayName> displayNames) {
if(displayNames==null) {displayNames = new HashSet<>();}
this.displayNames = displayNames;
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 637cc9f

Please sign in to comment.