Skip to content

Commit e86b5e8

Browse files
authored
Merge pull request #13 from FriedJannik/feat/noExtSubj
Final fix final
2 parents 158b704 + 9a0c9e8 commit e86b5e8

2 files changed

Lines changed: 30 additions & 24 deletions

File tree

basyx.aasregistry/basyx.aasregistry-feature-search/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/feature/search/SearchAasRegistryApiHTTPController.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public ResponseEntity<QueryResponse> queryAssetAdministrationShellDescriptors(In
8181
String identifier = ((ObjectNode) id).get("id").asText();
8282
AssetAdministrationShellDescriptor desc = backend.getAasDescriptor(identifier);
8383
aasDescs.add(desc);
84+
try {
8485
if (desc.getSpecificAssetIds() != null || !desc.getSpecificAssetIds().isEmpty()) {
8586
List<SpecificAssetId> newIdsWithoutExternalSubjectID = new ArrayList<>();
8687
for(SpecificAssetId sId : desc.getSpecificAssetIds()) {
@@ -95,6 +96,7 @@ public ResponseEntity<QueryResponse> queryAssetAdministrationShellDescriptors(In
9596
}
9697
desc.setSpecificAssetIds(newIdsWithoutExternalSubjectID);
9798
}
99+
}catch(Exception ignored){}
98100
}
99101
queryResponse.result = aasDescs.stream()
100102
.map(aasDesc -> (Object) aasDesc)

basyx.aasregistry/basyx.aasregistry-service/src/main/java/org/eclipse/digitaltwin/basyx/aasregistry/service/api/BasyxRegistryApiDelegate.java

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,22 @@ public ResponseEntity<GetAssetAdministrationShellDescriptorsResult> getAllAssetA
7575
result.setResult(allDescriptors.getResult());
7676
for(int i = 0; i<allDescriptors.getResult().size(); i++) {
7777
AssetAdministrationShellDescriptor desc = allDescriptors.getResult().get(i);
78-
if (desc.getSpecificAssetIds() != null || !desc.getSpecificAssetIds().isEmpty()) {
79-
List<SpecificAssetId> newIdsWithoutExternalSubjectID = new ArrayList<>();
80-
for(SpecificAssetId sId : desc.getSpecificAssetIds()) {
81-
SpecificAssetId newId = new SpecificAssetId(sId.getName(), sId.getValue());
82-
if (sId.getSupplementalSemanticIds() != null) {
83-
newId.setSupplementalSemanticIds(sId.getSupplementalSemanticIds());
78+
try {
79+
if (desc.getSpecificAssetIds() != null || !desc.getSpecificAssetIds().isEmpty()) {
80+
List<SpecificAssetId> newIdsWithoutExternalSubjectID = new ArrayList<>();
81+
for (SpecificAssetId sId : desc.getSpecificAssetIds()) {
82+
SpecificAssetId newId = new SpecificAssetId(sId.getName(), sId.getValue());
83+
if (sId.getSupplementalSemanticIds() != null) {
84+
newId.setSupplementalSemanticIds(sId.getSupplementalSemanticIds());
85+
}
86+
if (sId.getSemanticId() != null) {
87+
newId.setSemanticId(sId.getSemanticId());
88+
}
89+
newIdsWithoutExternalSubjectID.add(newId);
8490
}
85-
if (sId.getSemanticId() != null) {
86-
newId.setSemanticId(sId.getSemanticId());
87-
}
88-
newIdsWithoutExternalSubjectID.add(newId);
91+
desc.setSpecificAssetIds(newIdsWithoutExternalSubjectID);
8992
}
90-
desc.setSpecificAssetIds(newIdsWithoutExternalSubjectID);
91-
}
93+
}catch(Exception ignored){}
9294
}
9395
return new ResponseEntity<>(result, HttpStatus.OK);
9496
}
@@ -109,20 +111,22 @@ public ResponseEntity<GetSubmodelDescriptorsResult> getAllSubmodelDescriptorsThr
109111
public ResponseEntity<AssetAdministrationShellDescriptor> getAssetAdministrationShellDescriptorById(String aasIdentifier) {
110112
AssetAdministrationShellDescriptor desc = storage.getAasDescriptor(aasIdentifier);
111113

112-
if (desc.getSpecificAssetIds() != null || !desc.getSpecificAssetIds().isEmpty()) {
113-
List<SpecificAssetId> newIdsWithoutExternalSubjectID = new ArrayList<>();
114-
for(SpecificAssetId sId : desc.getSpecificAssetIds()) {
115-
SpecificAssetId newId = new SpecificAssetId(sId.getName(), sId.getValue());
116-
if (sId.getSupplementalSemanticIds() != null) {
117-
newId.setSupplementalSemanticIds(sId.getSupplementalSemanticIds());
118-
}
119-
if (sId.getSemanticId() != null) {
120-
newId.setSemanticId(sId.getSemanticId());
114+
try {
115+
if (desc.getSpecificAssetIds() != null || !desc.getSpecificAssetIds().isEmpty()) {
116+
List<SpecificAssetId> newIdsWithoutExternalSubjectID = new ArrayList<>();
117+
for(SpecificAssetId sId : desc.getSpecificAssetIds()) {
118+
SpecificAssetId newId = new SpecificAssetId(sId.getName(), sId.getValue());
119+
if (sId.getSupplementalSemanticIds() != null) {
120+
newId.setSupplementalSemanticIds(sId.getSupplementalSemanticIds());
121+
}
122+
if (sId.getSemanticId() != null) {
123+
newId.setSemanticId(sId.getSemanticId());
124+
}
125+
newIdsWithoutExternalSubjectID.add(newId);
121126
}
122-
newIdsWithoutExternalSubjectID.add(newId);
127+
desc.setSpecificAssetIds(newIdsWithoutExternalSubjectID);
123128
}
124-
desc.setSpecificAssetIds(newIdsWithoutExternalSubjectID);
125-
}
129+
}catch(Exception ignored){}
126130
return new ResponseEntity<>(desc, HttpStatus.OK);
127131
}
128132

0 commit comments

Comments
 (0)