@@ -90,24 +90,24 @@ public CursorResult<List<AssetAdministrationShellDescriptor>> getAllAasDescripto
9090 AggregationResults <AssetAdministrationShellDescriptor > results = template .aggregate (Aggregation .newAggregation (allAggregations ), collectionName , AssetAdministrationShellDescriptor .class );
9191 List <AssetAdministrationShellDescriptor > foundDescriptors = results .getMappedResults ();
9292 String cursor = resolveCursor (pRequest , foundDescriptors , AssetAdministrationShellDescriptor ::getId );
93- try {
94- foundDescriptors .forEach ( desc -> {
95- List < SpecificAssetId > newIdsWithoutExternalSubjectID = new ArrayList <>( );
93+
94+ for ( int i = 0 ; i < foundDescriptors .size (); i ++) {
95+ AssetAdministrationShellDescriptor desc = foundDescriptors . get ( i );
9696 if (desc .getSpecificAssetIds () != null || !desc .getSpecificAssetIds ().isEmpty ()) {
97- desc .getSpecificAssetIds ().forEach (sId -> {
97+ List <SpecificAssetId > newIdsWithoutExternalSubjectID = new ArrayList <>();
98+ for (SpecificAssetId sId : desc .getSpecificAssetIds ()) {
9899 SpecificAssetId newId = new SpecificAssetId (sId .getName (), sId .getValue ());
99- if (! sId .getSupplementalSemanticIds (). isEmpty () ) {
100+ if (sId .getSupplementalSemanticIds () != null ) {
100101 newId .setSupplementalSemanticIds (sId .getSupplementalSemanticIds ());
101102 }
102103 if (sId .getSemanticId () != null ) {
103104 newId .setSemanticId (sId .getSemanticId ());
104105 }
105106 newIdsWithoutExternalSubjectID .add (newId );
106- });
107+ }
107108 desc .setSpecificAssetIds (newIdsWithoutExternalSubjectID );
108109 }
109- });
110- } catch (Exception ignored ){}
110+ }
111111 return new CursorResult <>(cursor , foundDescriptors );
112112 }
113113
@@ -166,22 +166,21 @@ public AssetAdministrationShellDescriptor getAasDescriptor(@NonNull String aasDe
166166 if (descriptor == null ) {
167167 throw new AasDescriptorNotFoundException (aasDescriptorId );
168168 }
169- try {
170- List <SpecificAssetId > newIdsWithoutExternalSubjectID = new ArrayList <>();
171169 if (descriptor .getSpecificAssetIds () != null || !descriptor .getSpecificAssetIds ().isEmpty ()) {
172- descriptor .getSpecificAssetIds ().forEach (sId -> {
170+ List <SpecificAssetId > newIdsWithoutExternalSubjectID = new ArrayList <>();
171+ for (SpecificAssetId sId : descriptor .getSpecificAssetIds ()) {
173172 SpecificAssetId newId = new SpecificAssetId (sId .getName (), sId .getValue ());
174- if (! sId .getSupplementalSemanticIds (). isEmpty () ) {
173+ if (sId .getSupplementalSemanticIds () != null ) {
175174 newId .setSupplementalSemanticIds (sId .getSupplementalSemanticIds ());
176175 }
177176 if (sId .getSemanticId () != null ) {
178177 newId .setSemanticId (sId .getSemanticId ());
179178 }
180179 newIdsWithoutExternalSubjectID .add (newId );
181- });
180+ }
182181 descriptor .setSpecificAssetIds (newIdsWithoutExternalSubjectID );
183182 }
184- } catch ( Exception ignored ){}
183+
185184
186185 return descriptor ;
187186 }
0 commit comments