|
36 | 36 | import java.util.stream.Collectors; |
37 | 37 | import lombok.NonNull; |
38 | 38 | import lombok.RequiredArgsConstructor; |
39 | | -import org.eclipse.digitaltwin.basyx.aasregistry.model.AssetAdministrationShellDescriptor; |
40 | | -import org.eclipse.digitaltwin.basyx.aasregistry.model.AssetKind; |
41 | | -import org.eclipse.digitaltwin.basyx.aasregistry.model.ShellDescriptorQuery; |
42 | | -import org.eclipse.digitaltwin.basyx.aasregistry.model.ShellDescriptorSearchRequest; |
43 | | -import org.eclipse.digitaltwin.basyx.aasregistry.model.ShellDescriptorSearchResponse; |
44 | | -import org.eclipse.digitaltwin.basyx.aasregistry.model.SubmodelDescriptor; |
| 39 | +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultReference; |
| 40 | +import org.eclipse.digitaltwin.basyx.aasregistry.model.*; |
45 | 41 | import org.eclipse.digitaltwin.basyx.aasregistry.service.errors.AasDescriptorAlreadyExistsException; |
46 | 42 | import org.eclipse.digitaltwin.basyx.aasregistry.service.errors.AasDescriptorNotFoundException; |
47 | 43 | import org.eclipse.digitaltwin.basyx.aasregistry.service.errors.SubmodelAlreadyExistsException; |
@@ -95,9 +91,18 @@ public CursorResult<List<AssetAdministrationShellDescriptor>> getAllAasDescripto |
95 | 91 | List<AssetAdministrationShellDescriptor> foundDescriptors = results.getMappedResults(); |
96 | 92 | String cursor = resolveCursor(pRequest, foundDescriptors, AssetAdministrationShellDescriptor::getId); |
97 | 93 | foundDescriptors.forEach(desc -> { |
| 94 | + List<SpecificAssetId> newIdsWithoutExternalSubjectID = new ArrayList<>(); |
98 | 95 | desc.getSpecificAssetIds().forEach(sId -> { |
99 | | - sId.setExternalSubjectId(null); |
| 96 | + SpecificAssetId newId = new SpecificAssetId(sId.getName(), sId.getValue()); |
| 97 | + if (!sId.getSupplementalSemanticIds().isEmpty()){ |
| 98 | + newId.setSupplementalSemanticIds(sId.getSupplementalSemanticIds()); |
| 99 | + } |
| 100 | + if (sId.getSemanticId() != null) { |
| 101 | + newId.setSemanticId(sId.getSemanticId()); |
| 102 | + } |
| 103 | + newIdsWithoutExternalSubjectID.add(newId); |
100 | 104 | }); |
| 105 | + desc.setSpecificAssetIds(newIdsWithoutExternalSubjectID); |
101 | 106 | }); |
102 | 107 | return new CursorResult<>(cursor, foundDescriptors); |
103 | 108 | } |
@@ -157,9 +162,18 @@ public AssetAdministrationShellDescriptor getAasDescriptor(@NonNull String aasDe |
157 | 162 | if (descriptor == null) { |
158 | 163 | throw new AasDescriptorNotFoundException(aasDescriptorId); |
159 | 164 | } |
| 165 | + List<SpecificAssetId> newIdsWithoutExternalSubjectID = new ArrayList<>(); |
160 | 166 | descriptor.getSpecificAssetIds().forEach(sId -> { |
161 | | - sId.setExternalSubjectId(null); |
| 167 | + SpecificAssetId newId = new SpecificAssetId(sId.getName(), sId.getValue()); |
| 168 | + if (!sId.getSupplementalSemanticIds().isEmpty()){ |
| 169 | + newId.setSupplementalSemanticIds(sId.getSupplementalSemanticIds()); |
| 170 | + } |
| 171 | + if (sId.getSemanticId() != null) { |
| 172 | + newId.setSemanticId(sId.getSemanticId()); |
| 173 | + } |
| 174 | + newIdsWithoutExternalSubjectID.add(newId); |
162 | 175 | }); |
| 176 | + descriptor.setSpecificAssetIds(newIdsWithoutExternalSubjectID); |
163 | 177 | return descriptor; |
164 | 178 | } |
165 | 179 |
|
|
0 commit comments