|
27 | 27 | import co.elastic.clients.elasticsearch.ElasticsearchClient; |
28 | 28 | import com.fasterxml.jackson.databind.node.ObjectNode; |
29 | 29 | import org.eclipse.digitaltwin.basyx.aasregistry.model.AssetAdministrationShellDescriptor; |
| 30 | +import org.eclipse.digitaltwin.basyx.aasregistry.model.SpecificAssetId; |
30 | 31 | import org.eclipse.digitaltwin.basyx.aasregistry.service.storage.AasRegistryStorage; |
31 | 32 | import org.eclipse.digitaltwin.basyx.http.pagination.Base64UrlEncodedCursor; |
32 | 33 | import org.eclipse.digitaltwin.basyx.querycore.query.model.AASQuery; |
@@ -78,9 +79,22 @@ public ResponseEntity<QueryResponse> queryAssetAdministrationShellDescriptors(In |
78 | 79 | List<AssetAdministrationShellDescriptor> aasDescs = new ArrayList<>(); |
79 | 80 | for (Object id : queryResponse.result) { |
80 | 81 | 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 | + } |
84 | 98 | } |
85 | 99 | queryResponse.result = aasDescs.stream() |
86 | 100 | .map(aasDesc -> (Object) aasDesc) |
|
0 commit comments