Skip to content

Commit 158b704

Browse files
authored
Merge pull request #12 from FriedJannik/feat/noExtSubj
Final fix
2 parents c058732 + 67cf68e commit 158b704

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

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

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import co.elastic.clients.elasticsearch.ElasticsearchClient;
2828
import com.fasterxml.jackson.databind.node.ObjectNode;
2929
import org.eclipse.digitaltwin.basyx.aasregistry.model.AssetAdministrationShellDescriptor;
30+
import org.eclipse.digitaltwin.basyx.aasregistry.model.SpecificAssetId;
3031
import org.eclipse.digitaltwin.basyx.aasregistry.service.storage.AasRegistryStorage;
3132
import org.eclipse.digitaltwin.basyx.http.pagination.Base64UrlEncodedCursor;
3233
import org.eclipse.digitaltwin.basyx.querycore.query.model.AASQuery;
@@ -78,9 +79,22 @@ public ResponseEntity<QueryResponse> queryAssetAdministrationShellDescriptors(In
7879
List<AssetAdministrationShellDescriptor> aasDescs = new ArrayList<>();
7980
for (Object id : queryResponse.result) {
8081
String identifier = ((ObjectNode) id).get("id").asText();
81-
AssetAdministrationShellDescriptor aasDesc = backend.getAasDescriptor(identifier);
82-
aasDescs.add(aasDesc);
83-
82+
AssetAdministrationShellDescriptor desc = backend.getAasDescriptor(identifier);
83+
aasDescs.add(desc);
84+
if (desc.getSpecificAssetIds() != null || !desc.getSpecificAssetIds().isEmpty()) {
85+
List<SpecificAssetId> newIdsWithoutExternalSubjectID = new ArrayList<>();
86+
for(SpecificAssetId sId : desc.getSpecificAssetIds()) {
87+
SpecificAssetId newId = new SpecificAssetId(sId.getName(), sId.getValue());
88+
if (sId.getSupplementalSemanticIds() != null) {
89+
newId.setSupplementalSemanticIds(sId.getSupplementalSemanticIds());
90+
}
91+
if (sId.getSemanticId() != null) {
92+
newId.setSemanticId(sId.getSemanticId());
93+
}
94+
newIdsWithoutExternalSubjectID.add(newId);
95+
}
96+
desc.setSpecificAssetIds(newIdsWithoutExternalSubjectID);
97+
}
8498
}
8599
queryResponse.result = aasDescs.stream()
86100
.map(aasDesc -> (Object) aasDesc)

0 commit comments

Comments
 (0)