From 3902a6799fa90a72bb48b321755033d9c3abfcda Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Wed, 20 Dec 2023 13:31:40 +0100 Subject: [PATCH 01/49] chore(fileimport): TRACEFOSS-2741 Added mapping logic to parse importrequest to be an assetbase including relationships --- .../assets/application/ImportController.java | 2 + .../domain/importpoc/AssetWrapperRequest.java | 39 ++++- .../domain/importpoc/ImportRequest.java | 144 +++++++++++++++++- .../importpoc/service/ImportServiceImpl.java | 22 ++- 4 files changed, 201 insertions(+), 6 deletions(-) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java index c424550ca0..d940dd8ab4 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java @@ -112,6 +112,8 @@ public class ImportController { schema = @Schema(implementation = ErrorResponse.class)))}) @PostMapping(value = "/import", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) public ResponseEntity importJson(@ValidJsonFile @RequestParam("file") MultipartFile file) { + // JsonValidatorService.validate(file); + importService.importAssets(file); return ResponseEntity.noContent().build(); } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java index ab972c251d..828af348e3 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java @@ -18,11 +18,46 @@ ********************************************************************************/ package org.eclipse.tractusx.traceability.assets.domain.importpoc; +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; +import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.Submodel; +import java.util.Collections; import java.util.List; -public record AssetWrapperRequest(@JsonProperty("assetMetaInfo") AssetMetaInfoRequest assetMetaInfoRequest, - @JsonProperty("submodels") List submodels) { +public record AssetWrapperRequest(AssetMetaInfoRequest assetMetaInfoRequest, + List mainAspectModels, + List upwardRelationship, + List downwardRelationship +) { + + + @JsonCreator + static AssetWrapperRequest of( + @JsonProperty("assetMetaInfo") AssetMetaInfoRequest assetMetaInfoRequest, + @JsonProperty("submodels") List submodels + ) { + List upwardSubmodels = submodels.stream().filter(submodel -> isUpwardRelationship(submodel.getAspectType())).toList(); + List downwardSubmodels = submodels.stream().filter(submodel -> isDownwardRelationship(submodel.getAspectType())).toList(); + List mainAspectSubmodels = submodels.stream().filter(submodel -> isMainAspect(submodel.getAspectType())).toList(); + return new AssetWrapperRequest(assetMetaInfoRequest, mainAspectSubmodels, upwardSubmodels, downwardSubmodels); + + } + + public List convertAssets() { + return Collections.emptyList(); + } + + private static boolean isUpwardRelationship(final String aspectType) { + return aspectType.contains("BOM"); + } + + private static boolean isDownwardRelationship(final String aspectType) { + return aspectType.contains("Usage"); + } + + private static boolean isMainAspect(final String aspectType) { + return !isDownwardRelationship(aspectType) && !isUpwardRelationship(aspectType); + } } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java index 6161829e6d..fc475018be 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java @@ -18,12 +18,154 @@ ********************************************************************************/ package org.eclipse.tractusx.traceability.assets.domain.importpoc; +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.extern.slf4j.Slf4j; +import org.eclipse.tractusx.traceability.assets.domain.asbuilt.model.aspect.DetailAspectDataTractionBatteryCode; +import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; +import org.eclipse.tractusx.traceability.assets.domain.base.model.ImportState; +import org.eclipse.tractusx.traceability.assets.domain.base.model.Owner; +import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.Submodel; +import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect; +import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Relationship; +import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.semanticdatamodel.SemanticDataModel; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; +import static org.eclipse.tractusx.traceability.assets.domain.base.model.aspect.DetailAspectType.SINGLE_LEVEL_BOM_AS_BUILT; +import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.SINGLE_LEVEL_USAGE_AS_BUILT; +import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.TRACTION_BATTERY_CODE; -public record ImportRequest(@JsonProperty("assets") List assetRawRequestList) { +@Slf4j +public record ImportRequest( + List assetAsBuiltWrapperRequest, + List assetAsPlannedWrapperRequest +) { + + + @JsonCreator + static ImportRequest of( + @JsonProperty("assets") List assetRawRequestList + ) { + List assetAsBuiltWrapperRequest = new ArrayList<>(); + List assetAsPlannedWrapperRequest = new ArrayList<>(); + + for (AssetWrapperRequest assetWrapperRequest : assetRawRequestList) { + AssetMetaInfoRequest assetMetaInfoRequest = assetWrapperRequest.assetMetaInfoRequest(); + + List mainAspectsAsPlanned = assetWrapperRequest.mainAspectModels().stream().filter(submodel -> isAsPlanned(submodel.getAspectType())).toList(); + List upwardAspectsAsPlanned = assetWrapperRequest.upwardRelationship().stream().filter(submodel -> isAsPlanned(submodel.getAspectType())).toList(); + List downwardAspectsAsPlanned = assetWrapperRequest.downwardRelationship().stream().filter(submodel -> isAsPlanned(submodel.getAspectType())).toList(); + + List mainAspectsAsBuilt = assetWrapperRequest.mainAspectModels().stream().filter(submodel -> !isAsPlanned(submodel.getAspectType())).toList(); + List upwardAspectsAsBuilt = assetWrapperRequest.upwardRelationship().stream().filter(submodel -> !isAsPlanned(submodel.getAspectType())).toList(); + List downwardAspectsAsasBuilt = assetWrapperRequest.downwardRelationship().stream().filter(submodel -> !isAsPlanned(submodel.getAspectType())).toList(); + + assetAsPlannedWrapperRequest.add(new AssetWrapperRequest(assetMetaInfoRequest, mainAspectsAsPlanned, upwardAspectsAsPlanned, downwardAspectsAsPlanned)); + assetAsBuiltWrapperRequest.add(new AssetWrapperRequest(assetMetaInfoRequest, mainAspectsAsBuilt, upwardAspectsAsBuilt, downwardAspectsAsasBuilt)); + + } + + return new ImportRequest( + assetAsBuiltWrapperRequest, assetAsPlannedWrapperRequest + ); + } + + public List convertAssetsAsBuilt() { + return new ArrayList<>(mapToOwnPartsAsBuilt(null, null)); + } + + public List convertAssetsAsPlanned() { + return new ArrayList<>(mapToOwnPartsAsPlanned(null, null)); + } + + private List mapToOwnPartsAsBuilt(Map shortIds, Map bpnMapping) { + List assetWrapperRequests = assetAsBuiltWrapperRequest(); + + List ownParts = semanticDataModels().stream() + .filter(semanticDataModel -> Aspect.isMasterAspect(semanticDataModel.getAspectType())) + .filter(semanticDataModel -> isOwnPart(semanticDataModel, jobStatus)) + .toList(); + log.info(":: mapToOwnPartsAsBuilt()"); + log.info(":: ownParts: {}", ownParts); + // The Relationship on supplierPart catenaXId contains the id of the asset which has a relationship + Map> supplierPartsMap = relationships().stream() + .filter(relationship -> SINGLE_LEVEL_BOM_AS_BUILT.equals(relationship.aspectType().getAspectName())) + .collect(Collectors.groupingBy(Relationship::catenaXId, Collectors.toList())); + + // The Relationship on customerPart childCatenaXId contains the id of the asset which has a relationship + Map> customerPartsMap = relationships().stream() + .filter(relationship -> SINGLE_LEVEL_USAGE_AS_BUILT.equals(relationship.aspectType().getAspectName())) + .collect(Collectors.groupingBy(Relationship::childCatenaXId, Collectors.toList())); + + //TRACEFOSS-2333: A tractionBatteryCode has no catenaxId. If a tractionBatteryCode is present for the requested + // global_asset_id, then it can be automatically mapped to the own SerialPart + Optional tractionBatteryCodeOptional = semanticDataModels.stream() + .filter(semanticDataModel -> semanticDataModel.getAspectType().contains(TRACTION_BATTERY_CODE.getAspectName())) + .map(DetailAspectDataTractionBatteryCode.class::cast).findFirst(); + + final List assets = ownParts + .stream() + .map(semanticDataModel -> semanticDataModel.toDomainAsBuilt(semanticDataModel.localIdentifiers(), shortIds, Owner.OWN, bpnMapping, + getParentParts(customerPartsMap, shortIds, semanticDataModel.catenaXId()), + getChildParts(supplierPartsMap, shortIds, semanticDataModel.catenaXId()), + tractionBatteryCodeOptional, ImportState.TRANSIENT)) + .toList(); + log.info(":: mapped assets: {}", assets); + return assets; + } + + private List mapToOwnPartsAsPlanned(Map shortIds, Map bpnMapping) { + + List ownPartsAsPlanned = + semanticDataModels().stream() + .filter(semanticDataModel -> isOwnPart(semanticDataModel, jobStatus)) + .filter(semanticDataModel -> Aspect.isMasterAspect(semanticDataModel.aspectType())).toList(); + + List isPartSiteInformationAsPlanned = + semanticDataModels().stream() + .filter(semanticDataModel -> isOwnPart(semanticDataModel, jobStatus)) + .filter(semanticDataModel -> semanticDataModel.aspectType().contains(Aspect.PART_SITE_INFORMATION_AS_PLANNED.getAspectName())).toList(); + + addPartSiteInformationAsPlannedToOwnPartsAsPlanned(ownPartsAsPlanned, isPartSiteInformationAsPlanned); + + log.info(":: mapToOwnPartsAsPlanned()"); + log.info(":: ownPartsAsPlanned: {}", ownPartsAsPlanned); + + Map> singleLevelBomRelationship = relationships().stream() + .filter(relationship -> SINGLE_LEVEL_BOM_AS_PLANNED.equals(relationship.aspectType().getAspectName())) + .collect(Collectors.groupingBy(Relationship::catenaXId, Collectors.toList())); + + String ownerBpn = jobStatus.parameter().bpn(); + + final List assets = ownPartsAsPlanned + .stream() + .map(semanticDataModel -> semanticDataModel.toDomainAsPlanned( + shortIds, + Owner.OWN, + bpnMapping, + Collections.emptyList(), + getChildParts(singleLevelBomRelationship, shortIds, semanticDataModel.catenaXId()), + ownerBpn, + ImportState.PERSISTENT + )) + .toList(); + log.info(":: mapped assets: {}", assets); + return assets; + } + + private static boolean isAsPlanned(final String aspectType) { + return aspectType.contains("AsPlanned"); + } + + private static boolean isAsBuilt(final String aspectType) { + return !aspectType.contains("AsPlanned"); + } } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java index b21be142a4..e19120c5da 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java @@ -21,19 +21,26 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.eclipse.tractusx.traceability.assets.application.base.service.AssetBaseService; import org.eclipse.tractusx.traceability.assets.application.importpoc.ImportService; +import org.eclipse.tractusx.traceability.assets.domain.asbuilt.repository.AssetAsBuiltRepository; +import org.eclipse.tractusx.traceability.assets.domain.asplanned.repository.AssetAsPlannedRepository; +import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; import org.eclipse.tractusx.traceability.assets.domain.importpoc.ImportRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.exception.ImportException; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; import java.nio.charset.StandardCharsets; +import java.util.List; @Slf4j @RequiredArgsConstructor @Service public class ImportServiceImpl implements ImportService { private final ObjectMapper objectMapper; + private final AssetAsPlannedRepository assetAsPlannedRepository; + private final AssetAsBuiltRepository assetAsBuiltRepository; @Override public void importAssets(MultipartFile file) { @@ -46,9 +53,18 @@ public void importAssets(MultipartFile file) { String fileContent = new String(file.getBytes(), StandardCharsets.UTF_8); log.info("Imported file: " + fileContent); ImportRequest importRequest = objectMapper.readValue(fileContent, ImportRequest.class); - //Submodels per assetId - // importRequest.assetRawRequestList().get(0).assetMetaInfoRequest().catenaXId(); - // importRequest.assetRawRequestList().get(0).submodels(); + List persistedAsBuilts = this.assetAsBuiltRepository.saveAll(importRequest.convertAssetsAsBuilt()); + try { + log.info("persistedAsBuilts as JSON {}", objectMapper.writeValueAsString(persistedAsBuilts)); + } catch (Exception e) { + log.error("exception", e); + } + List persistedAsPlanned = this.assetAsPlannedRepository.saveAll(importRequest.convertAssetsAsPlanned()); + try { + log.info("persistedAsPlanned as JSON {}", objectMapper.writeValueAsString(persistedAsPlanned)); + } catch (Exception e) { + log.error("exception", e); + } } catch (Exception e) { throw new ImportException(e.getMessage()); } From d0f0a51b95ecc7af0e2c103d1ea3e88d3f3744be Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Wed, 20 Dec 2023 19:47:34 +0100 Subject: [PATCH 02/49] chore(fileimport): TRACEFOSS-2741 Added test / importtest data. --- .../domain/importpoc/AssetWrapperRequest.java | 6 - .../domain/importpoc/ImportRequest.java | 51 +- .../domain/importpoc/ImportRequestTest.java | 53 + .../resources/testdata/import-request.json | 1335 +++++++++++++++++ 4 files changed, 1412 insertions(+), 33 deletions(-) create mode 100644 tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequestTest.java create mode 100644 tx-backend/src/test/resources/testdata/import-request.json diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java index 828af348e3..3c3541baf6 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java @@ -20,10 +20,8 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; -import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.Submodel; -import java.util.Collections; import java.util.List; public record AssetWrapperRequest(AssetMetaInfoRequest assetMetaInfoRequest, @@ -42,12 +40,8 @@ static AssetWrapperRequest of( List downwardSubmodels = submodels.stream().filter(submodel -> isDownwardRelationship(submodel.getAspectType())).toList(); List mainAspectSubmodels = submodels.stream().filter(submodel -> isMainAspect(submodel.getAspectType())).toList(); return new AssetWrapperRequest(assetMetaInfoRequest, mainAspectSubmodels, upwardSubmodels, downwardSubmodels); - } - public List convertAssets() { - return Collections.emptyList(); - } private static boolean isUpwardRelationship(final String aspectType) { return aspectType.contains("BOM"); diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java index fc475018be..96234c7560 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java @@ -21,30 +21,19 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.extern.slf4j.Slf4j; -import org.eclipse.tractusx.traceability.assets.domain.asbuilt.model.aspect.DetailAspectDataTractionBatteryCode; import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; -import org.eclipse.tractusx.traceability.assets.domain.base.model.ImportState; -import org.eclipse.tractusx.traceability.assets.domain.base.model.Owner; +import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.request.BomLifecycle; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.Submodel; -import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect; -import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Relationship; -import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.semanticdatamodel.SemanticDataModel; import java.util.ArrayList; import java.util.Collections; +import java.util.EnumMap; import java.util.List; import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; - -import static org.eclipse.tractusx.traceability.assets.domain.base.model.aspect.DetailAspectType.SINGLE_LEVEL_BOM_AS_BUILT; -import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.SINGLE_LEVEL_USAGE_AS_BUILT; -import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.TRACTION_BATTERY_CODE; @Slf4j public record ImportRequest( - List assetAsBuiltWrapperRequest, - List assetAsPlannedWrapperRequest + Map> bomLifecycleToAssetWrapperRequestList ) { @@ -64,16 +53,20 @@ static ImportRequest of( List mainAspectsAsBuilt = assetWrapperRequest.mainAspectModels().stream().filter(submodel -> !isAsPlanned(submodel.getAspectType())).toList(); List upwardAspectsAsBuilt = assetWrapperRequest.upwardRelationship().stream().filter(submodel -> !isAsPlanned(submodel.getAspectType())).toList(); - List downwardAspectsAsasBuilt = assetWrapperRequest.downwardRelationship().stream().filter(submodel -> !isAsPlanned(submodel.getAspectType())).toList(); - - assetAsPlannedWrapperRequest.add(new AssetWrapperRequest(assetMetaInfoRequest, mainAspectsAsPlanned, upwardAspectsAsPlanned, downwardAspectsAsPlanned)); - assetAsBuiltWrapperRequest.add(new AssetWrapperRequest(assetMetaInfoRequest, mainAspectsAsBuilt, upwardAspectsAsBuilt, downwardAspectsAsasBuilt)); - + List downwardAspectsAsBuilt = assetWrapperRequest.downwardRelationship().stream().filter(submodel -> !isAsPlanned(submodel.getAspectType())).toList(); + + if (!mainAspectsAsPlanned.isEmpty()) { + assetAsPlannedWrapperRequest.add(new AssetWrapperRequest(assetMetaInfoRequest, mainAspectsAsPlanned, upwardAspectsAsPlanned, downwardAspectsAsPlanned)); + } + if (!mainAspectsAsBuilt.isEmpty()) { + assetAsBuiltWrapperRequest.add(new AssetWrapperRequest(assetMetaInfoRequest, mainAspectsAsBuilt, upwardAspectsAsBuilt, downwardAspectsAsBuilt)); + } } + Map> bomLifecycleToAssetWrapperList = new EnumMap<>(BomLifecycle.class); - return new ImportRequest( - assetAsBuiltWrapperRequest, assetAsPlannedWrapperRequest - ); + bomLifecycleToAssetWrapperList.put(BomLifecycle.AS_BUILT, assetAsBuiltWrapperRequest); + bomLifecycleToAssetWrapperList.put(BomLifecycle.AS_PLANNED, assetAsPlannedWrapperRequest); + return new ImportRequest(bomLifecycleToAssetWrapperList); } public List convertAssetsAsBuilt() { @@ -85,7 +78,9 @@ public List convertAssetsAsPlanned() { } private List mapToOwnPartsAsBuilt(Map shortIds, Map bpnMapping) { - List assetWrapperRequests = assetAsBuiltWrapperRequest(); + + List assetWrapperRequests = bomLifecycleToAssetWrapperRequestList.get(BomLifecycle.AS_BUILT); +/* List assetWrapperRequests = assetAsBuiltWrapperRequest(); List ownParts = semanticDataModels().stream() .filter(semanticDataModel -> Aspect.isMasterAspect(semanticDataModel.getAspectType())) @@ -117,12 +112,13 @@ private List mapToOwnPartsAsBuilt(Map shortIds, Map mapToOwnPartsAsPlanned(Map shortIds, Map bpnMapping) { - - List ownPartsAsPlanned = + List assetWrapperRequests = bomLifecycleToAssetWrapperRequestList.get(BomLifecycle.AS_PLANNED); + /* List ownPartsAsPlanned = semanticDataModels().stream() .filter(semanticDataModel -> isOwnPart(semanticDataModel, jobStatus)) .filter(semanticDataModel -> Aspect.isMasterAspect(semanticDataModel.aspectType())).toList(); @@ -156,7 +152,8 @@ private List mapToOwnPartsAsPlanned(Map shortIds, Map )) .toList(); log.info(":: mapped assets: {}", assets); - return assets; + return assets;*/ + return Collections.emptyList(); } private static boolean isAsPlanned(final String aspectType) { diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequestTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequestTest.java new file mode 100644 index 0000000000..81951dacc6 --- /dev/null +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequestTest.java @@ -0,0 +1,53 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +package org.eclipse.tractusx.traceability.assets.domain.importpoc; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; + +@ExtendWith(MockitoExtension.class) +class ImportRequestTest { + + @Test + void testMapper() throws IOException { + // Specify the path to your JSON file + String filePath = "src/test/resources/testdata/import-request.json"; + + // Read the JSON file into a String + String jsonString = Files.readString(Path.of(filePath)); + + + // Parse the JSON string into a JsonNode using Jackson ObjectMapper + ObjectMapper objectMapper = new ObjectMapper(); + ImportRequest importRequest = objectMapper.readValue(jsonString, ImportRequest.class); + + + // Your test logic goes here + Assertions.assertNotNull(importRequest); + } + + +} diff --git a/tx-backend/src/test/resources/testdata/import-request.json b/tx-backend/src/test/resources/testdata/import-request.json new file mode 100644 index 0000000000..63cdcb6f89 --- /dev/null +++ b/tx-backend/src/test/resources/testdata/import-request.json @@ -0,0 +1,1335 @@ +{ + "assets" : [ + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:6b2296cc-26c0-4f38-8a22-092338c36e22" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003CML1", + "key" : "manufacturerId" + }, + { + "value" : "3500076-05", + "key" : "manufacturerPartId" + }, + { + "value" : "OMAOYGBDTSRCMYSCX", + "key" : "partInstanceId" + }, + { + "value" : "OMAOYGBDTSRCMYSCX", + "key" : "van" + } + ], + "manufacturingInformation" : { + "date" : "2018-09-28T04:15:57.000Z", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:6b2296cc-26c0-4f38-8a22-092338c36e22", + "partTypeInformation" : { + "manufacturerPartId" : "3500076-05", + "classification" : "product", + "nameAtManufacturer" : "a/dev Vehicle Hybrid" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:6b2296cc-26c0-4f38-8a22-092338c36e22", + "childItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "hasAlternatives" : true, + "createdOn" : "2022-02-03T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z", + "catenaXId" : "urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd", + "businessPartner" : "BPNL00000003CNKC" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:d8030bbf-a874-49fb-b2e1-7610f0ccad12" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003CML1", + "key" : "manufacturerId" + }, + { + "value" : "4922009-56", + "key" : "manufacturerPartId" + }, + { + "value" : "OMAYSKEITUGNVHKKX", + "key" : "partInstanceId" + }, + { + "value" : "OMAYSKEITUGNVHKKX", + "key" : "van" + } + ], + "manufacturingInformation" : { + "date" : "2015-03-07T19:38:12.000Z", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:d8030bbf-a874-49fb-b2e1-7610f0ccad12", + "partTypeInformation" : { + "manufacturerPartId" : "4922009-56", + "classification" : "product", + "nameAtManufacturer" : "a/dev Vehicle Hybrid" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:d8030bbf-a874-49fb-b2e1-7610f0ccad12", + "childItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "hasAlternatives" : true, + "createdOn" : "2021-01-15T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z", + "catenaXId" : "urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a", + "businessPartner" : "BPNL00000003CNKC" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:4e390dab-707f-446e-bfbe-653f6f5b1f37" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003CML1", + "key" : "manufacturerId" + }, + { + "value" : "6683834-82", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-493575190274381019348907", + "key" : "partInstanceId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:4e390dab-707f-446e-bfbe-653f6f5b1f37", + "partTypeInformation" : { + "manufacturerPartId" : "6683834-82", + "customerPartId" : "6683834-82", + "classification" : "component", + "nameAtManufacturer" : "Door Key", + "nameAtCustomer" : "Door Key" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:4e390dab-707f-446e-bfbe-653f6f5b1f37", + "customers" : [ + { + "parentItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "catenaXId" : "urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a", + "createdOn" : "2023-12-05T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ], + "businessPartner" : "BPNL00000003CNKC", + "createdOn" : "2023-02-03T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:7c7d5aec-b15d-491c-8fbd-c61c6c02c69a" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003CML1", + "key" : "manufacturerId" + }, + { + "value" : "5519583-63", + "key" : "manufacturerPartId" + }, + { + "value" : "OMAZRXWWMSPTQUEKI", + "key" : "partInstanceId" + }, + { + "value" : "OMAZRXWWMSPTQUEKI", + "key" : "van" + } + ], + "manufacturingInformation" : { + "date" : "2015-07-04T14:30:31.000Z", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:7c7d5aec-b15d-491c-8fbd-c61c6c02c69a", + "partTypeInformation" : { + "manufacturerPartId" : "5519583-63", + "classification" : "product", + "nameAtManufacturer" : "Vehicle Hybrid" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:7c7d5aec-b15d-491c-8fbd-c61c6c02c69a", + "childItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "hasAlternatives" : true, + "createdOn" : "2022-11-22T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z", + "catenaXId" : "urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd", + "businessPartner" : "BPNL00000003CNKC" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:4a5e9ff6-2d5c-4510-a90e-d55af3ba502f" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003CML1", + "key" : "manufacturerId" + }, + { + "value" : "8770123-80", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-246880451848384868750731", + "key" : "partInstanceId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:4a5e9ff6-2d5c-4510-a90e-d55af3ba502f", + "partTypeInformation" : { + "manufacturerPartId" : "8770123-80", + "customerPartId" : "8770123-80", + "classification" : "component", + "nameAtManufacturer" : "a/dev Door Key", + "nameAtCustomer" : "Door Key" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:4a5e9ff6-2d5c-4510-a90e-d55af3ba502f", + "customers" : [ + { + "parentItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "catenaXId" : "urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd", + "createdOn" : "2023-04-13T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ], + "businessPartner" : "BPNL00000003CNKC", + "createdOn" : "2023-02-03T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:6ec3f1db-2798-454b-a73f-0d21a8966c74" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003CML1", + "key" : "manufacturerId" + }, + { + "value" : "5756987-94", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-613963493493659233961306", + "key" : "partInstanceId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:6ec3f1db-2798-454b-a73f-0d21a8966c74", + "partTypeInformation" : { + "manufacturerPartId" : "5756987-94", + "customerPartId" : "5756987-94", + "classification" : "component", + "nameAtManufacturer" : "a/dev Door Key", + "nameAtCustomer" : "Door Key" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:6ec3f1db-2798-454b-a73f-0d21a8966c74", + "customers" : [ + { + "parentItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "catenaXId" : "urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d", + "createdOn" : "2023-08-21T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ], + "businessPartner" : "BPNL00000003CNKC", + "createdOn" : "2023-02-03T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa01" + }, + "submodels" : [ + { + "aspectType" : "urn:samm:io.catenax.batch:2.0.0#Batch", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003CML1", + "key" : "manufacturerId" + }, + { + "value" : "9858559-85", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-341449848714937445621543", + "key" : "batchId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa01", + "partTypeInformation" : { + "manufacturerPartId" : "9858559-85", + "classification" : "component", + "nameAtManufacturer" : "a/dev Door Key" + } + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa02" + }, + "submodels" : [ + { + "aspectType" : "urn:samm:io.catenax.batch:2.0.0#Batch", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003CML1", + "key" : "manufacturerId" + }, + { + "value" : "9623673-66", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-341449848714937445621543", + "key" : "batchId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa02", + "partTypeInformation" : { + "manufacturerPartId" : "9623673-66", + "classification" : "component", + "nameAtManufacturer" : "a/dev Door Key" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa02", + "childItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "hasAlternatives" : true, + "createdOn" : "2016-01-20T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z", + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb01", + "businessPartner" : "BPNL00000003CNKC" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa03" + }, + "submodels" : [ + { + "aspectType" : "urn:samm:io.catenax.batch:2.0.0#Batch", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003CML1", + "key" : "manufacturerId" + }, + { + "value" : "4902203-92", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-341449848714937445621543", + "key" : "batchId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa03", + "partTypeInformation" : { + "manufacturerPartId" : "4902203-92", + "classification" : "component", + "nameAtManufacturer" : "a/dev Door Key" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa03", + "customers" : [ + { + "parentItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb02", + "createdOn" : "2022-07-03T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ], + "businessPartner" : "BPNL00000003CNKC", + "createdOn" : "2023-02-03T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4da01" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", + "payload" : { + "validityPeriod" : { + "validFrom" : "2019-04-04T03:19:03.000Z", + "validTo" : "2024-12-29T10:25:12.000Z" + }, + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4da01", + "partTypeInformation" : { + "manufacturerPartId" : "9649571-63", + "classification" : "product", + "nameAtManufacturer" : "a/dev Vehicle Model A" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4da01", + "childItems" : [ + { + "validityPeriod" : { + "validFrom" : "2023-03-21T08:17:29.187+01:00", + "validTo" : "2024-07-01T16:10:00.000+01:00" + }, + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "createdOn" : "2022-08-03T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z", + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4eb01", + "businessPartner" : "BPNL00000003CNKC" + } + ] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4da01", + "sites" : [ + { + "functionValidUntil" : "2025-02-08T04:30:48.000Z", + "function" : "production", + "functionValidFrom" : "2019-08-21T02:10:36.000Z", + "catenaXSiteId" : "BPNS000004711DMY" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e43842" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.just_in_sequence_part:1.0.0#JustInSequencePart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003CML1", + "key" : "manufacturerId" + }, + { + "value" : "12345678ABC", + "key" : "jisNumber" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "HUN" + }, + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e43842", + "partTypeInformation" : { + "manufacturerPartId" : "8397292-13", + "customerPartId" : "PRT-12345", + "classification" : "product", + "nameAtManufacturer" : "Mirror left", + "nameAtCustomer" : "a/dev side element A" + } + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef127c" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", + "payload" : { + "validityPeriod" : { + "validFrom" : "2015-05-18T23:10:44.000Z", + "validTo" : "2025-10-23T14:46:01.000Z" + }, + "catenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef127c", + "partTypeInformation" : { + "manufacturerPartId" : "38049661-08", + "classification" : "product", + "nameAtManufacturer" : "a/dev OEM A High Voltage Battery" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef127c", + "childItems" : [ + { + "validityPeriod" : { + "validFrom" : "2023-03-21T08:17:29.187+01:00", + "validTo" : "2024-07-01T16:10:00.000+01:00" + }, + "catenaXId" : "urn:uuid:e5c96ab5-896a-482c-8761-efd74777ca97", + "quantity" : { + "quantityNumber" : 6, + "measurementUnit" : "unit:litre" + }, + "businessPartner" : "BPNL00000003CML1", + "createdOn" : "2022-10-03T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z" + } + ] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_planned:1.1.0#SingleLevelUsageAsPlanned", + "payload" : { + "parentParts" : [ + { + "validityPeriod" : { + "validFrom" : "2023-03-21T08:47:14.438+01:00", + "validTo" : "2024-08-02T09:00:00.000+01:00" + }, + "parentCatenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e", + "quantity" : { + "quantityNumber" : 2.5, + "measurementUnit" : "unit:litre" + }, + "createdOn" : "2022-11-03T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z" + } + ], + "businessPartner" : "BPNL00000003CNKC", + "catenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef127c" + } + }, + { + "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef127c", + "sites" : [ + { + "functionValidUntil" : "2027-05-23T09:16:30.000Z", + "catenaXSiteId" : "BPNS000004711DMY", + "function" : "production", + "functionValidFrom" : "2013-11-17T23:59:54.000Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:e5c96ab5-896a-482c-8761-efd74777ca98" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", + "payload" : { + "validityPeriod" : { + "validFrom" : "2018-01-25T08:42:58.000Z", + "validTo" : "2029-02-10T03:24:30.000Z" + }, + "catenaXId" : "urn:uuid:e5c96ab5-896a-482c-8761-efd74777ca98", + "partTypeInformation" : { + "manufacturerPartId" : "8840838-04", + "classification" : "product", + "nameAtManufacturer" : "a/dev HV Modul" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:e5c96ab5-896a-482c-8761-efd74777ca98", + "childItems" : [ + { + "validityPeriod" : { + "validFrom" : "2023-03-21T08:17:29.187+01:00", + "validTo" : "2024-07-01T16:10:00.000+01:00" + }, + "catenaXId" : "urn:uuid:c7a2b803-f8fe-4b79-b6fc-967ce847c9a1", + "quantity" : { + "quantityNumber" : 10, + "measurementUnit" : "unit:litre" + }, + "businessPartner" : "BPNL00000003CNKC", + "createdOn" : "2022-01-03T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z" + } + ] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_planned:1.1.0#SingleLevelUsageAsPlanned", + "payload" : { + "parentParts" : [ + { + "validityPeriod" : { + "validFrom" : "2023-03-21T08:47:14.438+01:00", + "validTo" : "2024-08-02T09:00:00.000+01:00" + }, + "parentCatenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef128c", + "quantity" : { + "quantityNumber" : 2.5, + "measurementUnit" : "unit:litre" + }, + "createdOn" : "2022-02-06T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z" + } + ], + "businessPartner" : "BPNL00000003CNKC", + "catenaXId" : "urn:uuid:e5c96ab5-896a-482c-8761-efd74777ca98" + } + }, + { + "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:e5c96ab5-896a-482c-8761-efd74777ca98", + "sites" : [ + { + "functionValidUntil" : "2031-11-21T03:24:27.000Z", + "catenaXSiteId" : "BPNS000004711DMY", + "function" : "production", + "functionValidFrom" : "2020-06-07T07:30:47.000Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:4f7b1cf2-a598-4027-bc78-63f6d8e55699" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", + "payload" : { + "validityPeriod" : { + "validFrom" : "2013-11-24T00:27:33.000Z", + "validTo" : "2025-08-16T09:18:35.000Z" + }, + "catenaXId" : "urn:uuid:4f7b1cf2-a598-4027-bc78-63f6d8e55699", + "partTypeInformation" : { + "manufacturerPartId" : "7A047C7-01", + "classification" : "product", + "nameAtManufacturer" : "a/dev N Tier A CathodeMaterial" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:4f7b1cf2-a598-4027-bc78-63f6d8e55699", + "sites" : [ + { + "functionValidUntil" : "2025-03-05T00:33:55.000Z", + "catenaXSiteId" : "BPNS00000003B0Q0", + "function" : "production", + "functionValidFrom" : "2019-09-10T14:41:50.000Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:bee5614f-9e46-4c98-9209-61a6f2b2a7fc" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", + "payload" : { + "validityPeriod" : { + "validFrom" : "2013-06-18T03:47:22.000Z", + "validTo" : "2030-12-31T23:33:25.000Z" + }, + "catenaXId" : "urn:uuid:bee5614f-9e46-4c98-9209-61a6f2b2a7fc", + "partTypeInformation" : { + "manufacturerPartId" : "6740244-02", + "classification" : "product", + "nameAtManufacturer" : "a/dev Sub Tier A Sensor" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_planned:1.1.0#SingleLevelUsageAsPlanned", + "payload" : { + "parentParts" : [ + { + "validityPeriod" : { + "validFrom" : "2023-03-21T08:47:14.438+01:00", + "validTo" : "2024-08-02T09:00:00.000+01:00" + }, + "parentCatenaXId" : "urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7", + "quantity" : { + "quantityNumber" : 2.5, + "measurementUnit" : "unit:litre" + }, + "createdOn" : "2022-02-11T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z" + } + ], + "businessPartner" : "BPNL00000003CNKC", + "catenaXId" : "urn:uuid:bee5614f-9e46-4c98-9209-61a6f2b2a7fc" + } + }, + { + "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:bee5614f-9e46-4c98-9209-61a6f2b2a7fc", + "sites" : [ + { + "functionValidUntil" : "2031-04-16T11:07:09.000Z", + "catenaXSiteId" : "BPNS00000003B3NX", + "function" : "production", + "functionValidFrom" : "2013-12-07T09:33:50.000Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:4518c080-14fb-4252-b8de-4362d615868d" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", + "payload" : { + "validityPeriod" : { + "validFrom" : "2015-01-23T16:24:59.000Z", + "validTo" : "2031-05-04T12:01:38.000Z" + }, + "catenaXId" : "urn:uuid:4518c080-14fb-4252-b8de-4362d615868d", + "partTypeInformation" : { + "manufacturerPartId" : "7A987KK-04", + "classification" : "product", + "nameAtManufacturer" : "a/dev N Tier A Plastics" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:4518c080-14fb-4252-b8de-4362d615868d", + "childItems" : [] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_planned:1.1.0#SingleLevelUsageAsPlanned", + "payload" : { + "parentParts" : [ + { + "validityPeriod" : { + "validFrom" : "2023-03-21T08:47:14.438+01:00", + "validTo" : "2024-08-02T09:00:00.000+01:00" + }, + "parentCatenaXId" : "urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7", + "quantity" : { + "quantityNumber" : 2.5, + "measurementUnit" : "unit:litre" + }, + "createdOn" : "2022-02-12T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z" + } + ], + "businessPartner" : "BPNL00000003CNKC", + "catenaXId" : "urn:uuid:4518c080-14fb-4252-b8de-4362d615868d" + } + }, + { + "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:4518c080-14fb-4252-b8de-4362d615868d", + "sites" : [ + { + "functionValidUntil" : "2030-01-29T19:43:54.000Z", + "catenaXSiteId" : "BPNS00000003B0Q0", + "function" : "production", + "functionValidFrom" : "2015-11-17T18:35:23.000Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:3cdd2826-5df0-4c7b-b540-9eeccecb2301" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", + "payload" : { + "validityPeriod" : { + "validFrom" : "2019-08-17T14:14:30.000Z", + "validTo" : "2032-08-30T04:32:28.000Z" + }, + "catenaXId" : "urn:uuid:3cdd2826-5df0-4c7b-b540-9eeccecb2301", + "partTypeInformation" : { + "manufacturerPartId" : "6775244-06", + "classification" : "product", + "nameAtManufacturer" : "a/dev Sub Tier B Glue" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_planned:1.1.0#SingleLevelUsageAsPlanned", + "payload" : { + "parentParts" : [ + { + "validityPeriod" : { + "validFrom" : "2023-03-21T08:47:14.438+01:00", + "validTo" : "2024-08-02T09:00:00.000+01:00" + }, + "parentCatenaXId" : "urn:uuid:07cb071f-8716-45fe-89f1-f2f77a1ce93b", + "quantity" : { + "quantityNumber" : 2.5, + "measurementUnit" : "unit:litre" + }, + "createdOn" : "2022-02-15T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z" + } + ], + "businessPartner" : "BPNL00000003CML1", + "catenaXId" : "urn:uuid:3cdd2826-5df0-4c7b-b540-9eeccecb2301" + } + }, + { + "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:3cdd2826-5df0-4c7b-b540-9eeccecb2301", + "sites" : [ + { + "functionValidUntil" : "2032-01-21T11:22:57.000Z", + "catenaXSiteId" : "BPNS00000003AXS3", + "function" : "production", + "functionValidFrom" : "2017-05-27T13:54:13.000Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:68904173-ad59-4a77-8412-3e73fcafbd8b" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", + "payload" : { + "validityPeriod" : { + "validFrom" : "2016-04-09T20:41:14.000Z", + "validTo" : "2023-12-09T04:46:33.000Z" + }, + "catenaXId" : "urn:uuid:68904173-ad59-4a77-8412-3e73fcafbd8b", + "partTypeInformation" : { + "manufacturerPartId" : "6004474-20", + "classification" : "product", + "nameAtManufacturer" : "a/dev Vehicle Model B" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:68904173-ad59-4a77-8412-3e73fcafbd8b", + "childItems" : [ + { + "validityPeriod" : { + "validFrom" : "2023-03-21T08:17:29.187+01:00", + "validTo" : "2024-07-01T16:10:00.000+01:00" + }, + "catenaXId" : "urn:uuid:07cb071f-8716-45fe-89f1-f2f77a1ce93b", + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:litre" + }, + "businessPartner" : "BPNL00000003CNKC", + "createdOn" : "2022-02-16T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z" + } + ] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:68904173-ad59-4a77-8412-3e73fcafbd8b", + "sites" : [ + { + "functionValidUntil" : "2030-05-16T19:21:46.000Z", + "catenaXSiteId" : "BPNS000000815DMY", + "function" : "production", + "functionValidFrom" : "2019-10-17T03:16:09.000Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:44347dec-21d1-47aa-b2a7-f959bf9d424b" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003CML1", + "key" : "manufacturerId" + }, + { + "value" : "8840837-48", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-282209222605524629600815", + "key" : "partInstanceId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:44347dec-21d1-47aa-b2a7-f959bf9d424b", + "partTypeInformation" : { + "manufacturerPartId" : "8840837-48", + "customerPartId" : "9560617-12", + "classification" : "component", + "nameAtManufacturer" : "a/dev HV MODUL", + "nameAtCustomer" : "HV MODUL" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.traction_battery_code:1.0.0#TractionBatteryCode", + "payload" : { + "tractionBatteryCode" : "X12MCPM27KLPCLX2M2382320", + "subcomponents" : [ + { + "tractionBatteryCode" : "X12MCPM27KLPCLX2M2382320", + "productType" : "module" + }, + { + "tractionBatteryCode" : "X12MCPM27KLPCLX2M2382321", + "productType" : "module" + }, + { + "tractionBatteryCode" : "X12MCPM27KLPCLX2M2382322", + "productType" : "module" + }, + { + "tractionBatteryCode" : "X12MCPM27KLPCLX2M2382323", + "productType" : "module" + }, + { + "tractionBatteryCode" : "X12MCPM27KLPCLX2M2382324", + "productType" : "module" + }, + { + "tractionBatteryCode" : "X12MCPM27KLPCLX2M2382325", + "productType" : "module" + }, + { + "tractionBatteryCode" : "X12MCPM27KLPCLX2M2382326", + "productType" : "module" + } + ], + "productType" : "module" + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:1233b405-5ac8-4867-93f8-6fdf37733737" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003CML1", + "key" : "manufacturerId" + }, + { + "value" : "4683655-00", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-135342108157438763234738", + "key" : "partInstanceId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:1233b405-5ac8-4867-93f8-6fdf37733737", + "partTypeInformation" : { + "manufacturerPartId" : "4683655-00", + "customerPartId" : "4683655-00", + "classification" : "component", + "nameAtManufacturer" : "a/dev ZB ZELLE", + "nameAtCustomer" : "ZB ZELLE" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.traction_battery_code:1.0.0#TractionBatteryCode", + "payload" : { + "tractionBatteryCode" : "X12MCPM27KLPCLX2M2382320", + "subcomponents" : [ + { + "tractionBatteryCode" : "X12MCPM27KLPCLX2M2382320", + "productType" : "cell" + } + ], + "productType" : "cell" + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:bcfae197-40fa-4be0-821d-5c1873a1b7c2" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003CML1", + "key" : "manufacturerId" + }, + { + "value" : "1261027-41", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-200738629800530338038454", + "key" : "partInstanceId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:bcfae197-40fa-4be0-821d-5c1873a1b7c2", + "partTypeInformation" : { + "manufacturerPartId" : "1261027-41", + "customerPartId" : "1261027-41", + "classification" : "component", + "nameAtManufacturer" : "a/dev Door Key", + "nameAtCustomer" : "Door Key" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.just_in_sequence_part:1.0.0#JustInSequencePart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "85851549CBX", + "key" : "jisNumber" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "HUN" + }, + "catenaXId" : "urn:uuid:bcfae197-40fa-4be0-821d-5c1873a1b7c2", + "partTypeInformation" : { + "manufacturerPartId" : "5464168-83", + "customerPartId" : "PRT-12345", + "classification" : "product", + "nameAtManufacturer" : "a/dev Door Key", + "nameAtCustomer" : "Door Key" + } + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:254604ab-2153-45fb-8cad-54ef09f4070e" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003CML1", + "key" : "manufacturerId" + }, + { + "value" : "8840837-48", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-570196089623842018037372", + "key" : "partInstanceId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:254604ab-2153-45fb-8cad-54ef09f4070e", + "partTypeInformation" : { + "manufacturerPartId" : "8840838-04", + "customerPartId" : "8840838-04", + "classification" : "component", + "nameAtManufacturer" : "HV MODUL", + "nameAtCustomer" : "HV MODUL" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:254604ab-2153-45fb-8cad-54ef09f4070e", + "childItems" : [ + { + "catenaXId" : "urn:uuid:e3b2f5e2-5be5-4ea6-98f0-6876de0fca4f", + "quantity" : { + "quantityNumber" : 2.5, + "measurementUnit" : "unit:litre" + }, + "hasAlternatives" : true, + "businessPartner" : "BPNL00000003CML1", + "createdOn" : "2022-02-03T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z" + } + ] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:254604ab-2153-45fb-8cad-54ef09f4070e", + "customers" : [ + { + "businessPartner" : "BPNL00000003CML1", + "parentItems" : [], + "createdOn" : "2022-02-03T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:e3b2f5e2-5be5-4ea6-98f0-6876de0fca4f" + }, + "submodels" : [ + { + "aspectType" : "urn:samm:io.catenax.batch:2.0.0#Batch", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003CML1", + "key" : "manufacturerId" + }, + { + "value" : "BID12345678", + "key" : "batchId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "HUN" + }, + "catenaXId" : "urn:uuid:e3b2f5e2-5be5-4ea6-98f0-6876de0fca4f", + "partTypeInformation" : { + "manufacturerPartId" : "123-0.740-3434-A", + "classification" : "product", + "nameAtManufacturer" : "Sealant" + } + } + } + ] + } + ] +} From 854e0863c65961a0dfb7dc91e722a96321b13361 Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Wed, 20 Dec 2023 19:58:12 +0100 Subject: [PATCH 03/49] chore(fileimport): TRACEFOSS-2741 Added test / importtest data. --- .../assets/domain/importpoc/AssetWrapperRequest.java | 2 +- .../traceability/assets/domain/importpoc/ImportRequestTest.java | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java index 3c3541baf6..3d87847a33 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java @@ -44,7 +44,7 @@ static AssetWrapperRequest of( private static boolean isUpwardRelationship(final String aspectType) { - return aspectType.contains("BOM"); + return aspectType.contains("Bom"); } private static boolean isDownwardRelationship(final String aspectType) { diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequestTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequestTest.java index 81951dacc6..830c83ec1f 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequestTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequestTest.java @@ -44,7 +44,6 @@ void testMapper() throws IOException { ObjectMapper objectMapper = new ObjectMapper(); ImportRequest importRequest = objectMapper.readValue(jsonString, ImportRequest.class); - // Your test logic goes here Assertions.assertNotNull(importRequest); } From c3bcb351def4a8c9fa38a5628bb08d344e312560 Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Thu, 21 Dec 2023 10:56:42 +0100 Subject: [PATCH 04/49] chore(fileimport): TRACEFOSS-2741 Added test / importtest data. --- .../domain/importpoc/AssetWrapperRequest.java | 30 ++++-- .../domain/importpoc/ImportRequest.java | 96 +++++++++++-------- .../PartSiteInformationAsPlannedRequest.java | 32 +++++++ .../SingelLevelUsageAsBuiltRequest.java | 34 +++++++ .../SingleLevelBomAsBuiltRequest.java | 38 ++++++++ .../irs/model/response/GenericSubmodel.java | 94 ++++++++++++++++++ .../service/ImportServiceImplTest.java | 54 +++++++++++ 7 files changed, 327 insertions(+), 51 deletions(-) create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/PartSiteInformationAsPlannedRequest.java create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingelLevelUsageAsBuiltRequest.java create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingleLevelBomAsBuiltRequest.java create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java create mode 100644 tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java index 3d87847a33..96651334c2 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java @@ -20,26 +20,38 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; +import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.request.BomLifecycle; +import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.Submodel; +import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.semanticdatamodel.SemanticDataModel; import java.util.List; public record AssetWrapperRequest(AssetMetaInfoRequest assetMetaInfoRequest, - List mainAspectModels, - List upwardRelationship, - List downwardRelationship + List mainAspectModels, + List upwardRelationship, + List downwardRelationship, + BomLifecycle bomLifecycle ) { - @JsonCreator static AssetWrapperRequest of( @JsonProperty("assetMetaInfo") AssetMetaInfoRequest assetMetaInfoRequest, - @JsonProperty("submodels") List submodels + @JsonProperty("submodels") List submodels ) { - List upwardSubmodels = submodels.stream().filter(submodel -> isUpwardRelationship(submodel.getAspectType())).toList(); - List downwardSubmodels = submodels.stream().filter(submodel -> isDownwardRelationship(submodel.getAspectType())).toList(); - List mainAspectSubmodels = submodels.stream().filter(submodel -> isMainAspect(submodel.getAspectType())).toList(); - return new AssetWrapperRequest(assetMetaInfoRequest, mainAspectSubmodels, upwardSubmodels, downwardSubmodels); + List upwardSubmodels = submodels.stream().filter(submodel -> isUpwardRelationship(submodel.getAspectType())).toList(); + List downwardSubmodels = submodels.stream().filter(submodel -> isDownwardRelationship(submodel.getAspectType())).toList(); + List mainAspectSubmodels = submodels.stream().filter(submodel -> isMainAspect(submodel.getAspectType())).toList(); + List mainAspectSemanticDataModel = transformMainAspectModel(mainAspectSubmodels); + BomLifecycle bom = mainAspectSubmodels.stream().findAny() + .map(submodel -> submodel.getAspectType().contains("AsPlanned") ? BomLifecycle.AS_PLANNED : BomLifecycle.AS_BUILT).orElseThrow(); + + return new AssetWrapperRequest(assetMetaInfoRequest, mainAspectSemanticDataModel, upwardSubmodels, downwardSubmodels, bom); + } + + private static List transformMainAspectModel(List submodels) { + return submodels.stream() + .map(submodel -> (SemanticDataModel) submodel.getPayload()).toList(); } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java index 96234c7560..21ce8454f9 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java @@ -21,15 +21,27 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.extern.slf4j.Slf4j; +import org.eclipse.tractusx.traceability.assets.domain.asbuilt.model.aspect.DetailAspectDataTractionBatteryCode; import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; +import org.eclipse.tractusx.traceability.assets.domain.base.model.Descriptions; +import org.eclipse.tractusx.traceability.assets.domain.base.model.ImportState; +import org.eclipse.tractusx.traceability.assets.domain.base.model.Owner; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.request.BomLifecycle; +import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.Submodel; +import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Relationship; +import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.semanticdatamodel.LocalId; +import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.semanticdatamodel.SemanticDataModel; import java.util.ArrayList; import java.util.Collections; import java.util.EnumMap; +import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; +import java.util.stream.Stream; @Slf4j public record ImportRequest( @@ -47,20 +59,21 @@ static ImportRequest of( for (AssetWrapperRequest assetWrapperRequest : assetRawRequestList) { AssetMetaInfoRequest assetMetaInfoRequest = assetWrapperRequest.assetMetaInfoRequest(); - List mainAspectsAsPlanned = assetWrapperRequest.mainAspectModels().stream().filter(submodel -> isAsPlanned(submodel.getAspectType())).toList(); - List upwardAspectsAsPlanned = assetWrapperRequest.upwardRelationship().stream().filter(submodel -> isAsPlanned(submodel.getAspectType())).toList(); - List downwardAspectsAsPlanned = assetWrapperRequest.downwardRelationship().stream().filter(submodel -> isAsPlanned(submodel.getAspectType())).toList(); + if (BomLifecycle.AS_BUILT.equals(assetWrapperRequest.bomLifecycle())){ + List mainAspectsAsBuilt = assetWrapperRequest.mainAspectModels(); + List upwardAspectsAsBuilt = assetWrapperRequest.upwardRelationship(); + List downwardAspectsAsBuilt = assetWrapperRequest.downwardRelationship(); + assetAsBuiltWrapperRequest.add(new AssetWrapperRequest(assetMetaInfoRequest, mainAspectsAsBuilt, upwardAspectsAsBuilt, downwardAspectsAsBuilt, BomLifecycle.AS_BUILT)); + } - List mainAspectsAsBuilt = assetWrapperRequest.mainAspectModels().stream().filter(submodel -> !isAsPlanned(submodel.getAspectType())).toList(); - List upwardAspectsAsBuilt = assetWrapperRequest.upwardRelationship().stream().filter(submodel -> !isAsPlanned(submodel.getAspectType())).toList(); - List downwardAspectsAsBuilt = assetWrapperRequest.downwardRelationship().stream().filter(submodel -> !isAsPlanned(submodel.getAspectType())).toList(); + if (BomLifecycle.AS_PLANNED.equals(assetWrapperRequest.bomLifecycle())){ + List mainAspectsAsPlanned = assetWrapperRequest.mainAspectModels(); + List upwardAspectsAsPlanned = assetWrapperRequest.upwardRelationship(); + List downwardAspectsAsPlanned = assetWrapperRequest.downwardRelationship(); + assetAsPlannedWrapperRequest.add(new AssetWrapperRequest(assetMetaInfoRequest, mainAspectsAsPlanned, upwardAspectsAsPlanned, downwardAspectsAsPlanned, BomLifecycle.AS_PLANNED)); - if (!mainAspectsAsPlanned.isEmpty()) { - assetAsPlannedWrapperRequest.add(new AssetWrapperRequest(assetMetaInfoRequest, mainAspectsAsPlanned, upwardAspectsAsPlanned, downwardAspectsAsPlanned)); - } - if (!mainAspectsAsBuilt.isEmpty()) { - assetAsBuiltWrapperRequest.add(new AssetWrapperRequest(assetMetaInfoRequest, mainAspectsAsBuilt, upwardAspectsAsBuilt, downwardAspectsAsBuilt)); } + } Map> bomLifecycleToAssetWrapperList = new EnumMap<>(BomLifecycle.class); @@ -70,49 +83,48 @@ static ImportRequest of( } public List convertAssetsAsBuilt() { - return new ArrayList<>(mapToOwnPartsAsBuilt(null, null)); + return new ArrayList<>(mapToOwnPartsAsBuilt()); } public List convertAssetsAsPlanned() { return new ArrayList<>(mapToOwnPartsAsPlanned(null, null)); } - private List mapToOwnPartsAsBuilt(Map shortIds, Map bpnMapping) { + private List mapToOwnPartsAsBuilt() { List assetWrapperRequests = bomLifecycleToAssetWrapperRequestList.get(BomLifecycle.AS_BUILT); -/* List assetWrapperRequests = assetAsBuiltWrapperRequest(); + for (AssetWrapperRequest assetWrapperRequest : assetWrapperRequests){ - List ownParts = semanticDataModels().stream() - .filter(semanticDataModel -> Aspect.isMasterAspect(semanticDataModel.getAspectType())) - .filter(semanticDataModel -> isOwnPart(semanticDataModel, jobStatus)) - .toList(); - log.info(":: mapToOwnPartsAsBuilt()"); - log.info(":: ownParts: {}", ownParts); - // The Relationship on supplierPart catenaXId contains the id of the asset which has a relationship - Map> supplierPartsMap = relationships().stream() - .filter(relationship -> SINGLE_LEVEL_BOM_AS_BUILT.equals(relationship.aspectType().getAspectName())) - .collect(Collectors.groupingBy(Relationship::catenaXId, Collectors.toList())); + AssetMetaInfoRequest assetMetaInfoRequest = assetWrapperRequest.assetMetaInfoRequest(); + List mainAspectModels = assetWrapperRequest.mainAspectModels(); + List downwardModels = assetWrapperRequest.downwardRelationship(); + List upwardModels = assetWrapperRequest.upwardRelationship(); - // The Relationship on customerPart childCatenaXId contains the id of the asset which has a relationship - Map> customerPartsMap = relationships().stream() - .filter(relationship -> SINGLE_LEVEL_USAGE_AS_BUILT.equals(relationship.aspectType().getAspectName())) - .collect(Collectors.groupingBy(Relationship::childCatenaXId, Collectors.toList())); - //TRACEFOSS-2333: A tractionBatteryCode has no catenaxId. If a tractionBatteryCode is present for the requested - // global_asset_id, then it can be automatically mapped to the own SerialPart - Optional tractionBatteryCodeOptional = semanticDataModels.stream() - .filter(semanticDataModel -> semanticDataModel.getAspectType().contains(TRACTION_BATTERY_CODE.getAspectName())) - .map(DetailAspectDataTractionBatteryCode.class::cast).findFirst(); +/* Map> supplierPartsMap = relationships().stream() + .filter(relationship -> SINGLE_LEVEL_BOM_AS_BUILT.equals(relationship.aspectType().getAspectName())) + .collect(Collectors.groupingBy(Relationship::catenaXId, Collectors.toList())); + + // The Relationship on customerPart childCatenaXId contains the id of the asset which has a relationship + Map> customerPartsMap = relationships().stream() + .filter(relationship -> SINGLE_LEVEL_USAGE_AS_BUILT.equals(relationship.aspectType().getAspectName())) + .collect(Collectors.groupingBy(Relationship::childCatenaXId, Collectors.toList()));*/ + + + List localIds = Collections.emptyList(); + Map shortIds = new HashMap<>(); + Owner owner = Owner.OWN; + Map bpns = new HashMap<>(); + List parentRelations = Collections.emptyList(); + List childRelations = Collections.emptyList(); + Optional< DetailAspectDataTractionBatteryCode > tractionBatteryCodeOptional = Optional.empty(); + ImportState assetImportState = ImportState.TRANSIENT; + + List list = mainAspectModels.stream().map(semanticDataModel -> semanticDataModel.toDomainAsBuilt(localIds, shortIds, owner, bpns, parentRelations, childRelations, tractionBatteryCodeOptional, assetImportState)).toList(); + return list; + + } - final List assets = ownParts - .stream() - .map(semanticDataModel -> semanticDataModel.toDomainAsBuilt(semanticDataModel.localIdentifiers(), shortIds, Owner.OWN, bpnMapping, - getParentParts(customerPartsMap, shortIds, semanticDataModel.catenaXId()), - getChildParts(supplierPartsMap, shortIds, semanticDataModel.catenaXId()), - tractionBatteryCodeOptional, ImportState.TRANSIENT)) - .toList(); - log.info(":: mapped assets: {}", assets); - return assets;*/ return Collections.emptyList(); } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/PartSiteInformationAsPlannedRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/PartSiteInformationAsPlannedRequest.java new file mode 100644 index 0000000000..def46ac69c --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/PartSiteInformationAsPlannedRequest.java @@ -0,0 +1,32 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +package org.eclipse.tractusx.traceability.assets.domain.importpoc; + +import java.util.List; + +public record PartSiteInformationAsPlannedRequest(String catenaXId, List sites) { + + public record Site( + String functionValidUntil, + String function, + String functionValidFrom, + String catenaXSiteId + ) { + } +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingelLevelUsageAsBuiltRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingelLevelUsageAsBuiltRequest.java new file mode 100644 index 0000000000..dc2b1d94be --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingelLevelUsageAsBuiltRequest.java @@ -0,0 +1,34 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +package org.eclipse.tractusx.traceability.assets.domain.importpoc; + +import java.util.List; + +public record SingelLevelUsageAsBuiltRequest(String catenaXId, List customers) { + + public record Customer(List parentItems, String businessPartner, String createdOn, String lastModifiedOn) { + } + + public record ParentItem(Quantity quantity, String catenaXId, String createdOn, String lastModifiedOn) { + } + + public record Quantity(int quantityNumber, String measurementUnit) { + } + +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingleLevelBomAsBuiltRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingleLevelBomAsBuiltRequest.java new file mode 100644 index 0000000000..5f679b504f --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingleLevelBomAsBuiltRequest.java @@ -0,0 +1,38 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +package org.eclipse.tractusx.traceability.assets.domain.importpoc; + +import java.util.List; + +public record SingleLevelBomAsBuiltRequest(String catenaXId, List childItems) { + + public record ChildItem( + Quantity quantity, + boolean hasAlternatives, + String createdOn, + String lastModifiedOn, + String catenaXId, + String businessPartner + ) { + } + + public record Quantity(int quantityNumber, String measurementUnit) { + } +} + diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java new file mode 100644 index 0000000000..93bb677581 --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java @@ -0,0 +1,94 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +package org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonSubTypes.Type; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.eclipse.tractusx.traceability.assets.domain.asbuilt.model.aspect.DetailAspectDataTractionBatteryCode; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.SingelLevelUsageAsBuiltRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.SingleLevelBomAsBuiltRequest; +import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.semanticdatamodel.SemanticDataModel; + +public class GenericSubmodel { + @JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXTERNAL_PROPERTY, + defaultImpl = Void.class, + property = "aspectType") + @JsonSubTypes({ + @Type(value = SemanticDataModel.class, names = { + "urn:samm:io.catenax.serial_part:1.0.0#SerialPart", + "urn:bamm:io.catenax.serial_part:1.0.0#SerialPart", + "urn:bamm:io.catenax.serial_part:1.1.0#SerialPart", + "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart" + + }), + @Type(value = SemanticDataModel.class, names = { + "urn:bamm:com.catenax.batch:1.0.0#Batch", + "urn:bamm:io.catenax.batch:1.0.0#Batch", + "urn:bamm:io.catenax.batch:1.0.2#Batch", + "urn:samm:io.catenax.batch:2.0.0#Batch" + }), + @Type(value = SemanticDataModel.class, names = { + "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", + "urn:bamm:io.catenax.part_as_planned:1.0.0#PartAsPlanned" + }), + @Type(value = SemanticDataModel.class, names = { + "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned" + }), + @Type(value = SemanticDataModel.class, names = { + "urn:bamm:io.catenax.just_in_sequence_part:1.0.0#JustInSequencePart" + }), + @Type(value = DetailAspectDataTractionBatteryCode.class, names = { + "urn:bamm:io.catenax.traction_battery_code:1.0.0#TractionBatteryCode" + }), + @Type(value = SingelLevelUsageAsBuiltRequest.class, names = { + "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt" + }), + @Type(value = SingleLevelBomAsBuiltRequest.class, names = { + "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt" + }) + }) + private Object payload; + + @JsonProperty("aspectType") + private String aspectType; + + @JsonCreator + public GenericSubmodel(@JsonProperty("aspectType") String aspectType, @JsonProperty("payload") Object payload) { + this.aspectType = aspectType; + this.payload = payload; + } + + public Object getPayload() { + return payload; + } + + public String getAspectType() { + return aspectType; + } + +} + + + diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java new file mode 100644 index 0000000000..8c91f56647 --- /dev/null +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java @@ -0,0 +1,54 @@ +package org.eclipse.tractusx.traceability.assets.domain.importpoc.service; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.eclipse.tractusx.traceability.assets.domain.asbuilt.repository.AssetAsBuiltRepository; +import org.eclipse.tractusx.traceability.assets.domain.asplanned.repository.AssetAsPlannedRepository; + + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.mock.web.MockMultipartFile; + +import java.io.IOException; +import java.io.InputStream; + +@ExtendWith(MockitoExtension.class) +class ImportServiceImplTest { + + @InjectMocks + private ImportServiceImpl importService; + + @Mock + private AssetAsPlannedRepository assetAsPlannedRepository; + @Mock + private AssetAsBuiltRepository assetAsBuiltRepository; + + @BeforeEach + public void testSetup(){ + ObjectMapper objectMapper = new ObjectMapper(); + importService = new ImportServiceImpl(objectMapper, assetAsPlannedRepository, assetAsBuiltRepository); + + } + @Test + void testService() throws IOException { + + InputStream file = ImportServiceImplTest.class.getResourceAsStream("/testdata/import-request.json"); + // Convert the file to a MockMultipartFile + MockMultipartFile multipartFile = new MockMultipartFile( + "file", // Parameter name in the multipart request + "import-request", // Original file name + "application/json", // Content type + file + ); + + importService.importAssets(multipartFile); + + + } + +} From 6c36543fcefe7a9b9a8acf56be0f9212c157cce5 Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Thu, 21 Dec 2023 16:41:29 +0100 Subject: [PATCH 05/49] chore(fileimport): TRACEFOSS-2741 Added mapping for main aspects / child / parent relations --- .../domain/importpoc/AssetWrapperRequest.java | 14 +++- .../domain/importpoc/ImportRequest.java | 74 ++++++++++++------- .../irs/model/response/GenericSubmodel.java | 6 +- 3 files changed, 62 insertions(+), 32 deletions(-) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java index 96651334c2..a7c6fb17e7 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java @@ -25,6 +25,7 @@ import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.Submodel; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.semanticdatamodel.SemanticDataModel; +import java.util.ArrayList; import java.util.List; public record AssetWrapperRequest(AssetMetaInfoRequest assetMetaInfoRequest, @@ -50,17 +51,22 @@ static AssetWrapperRequest of( } private static List transformMainAspectModel(List submodels) { - return submodels.stream() - .map(submodel -> (SemanticDataModel) submodel.getPayload()).toList(); + List semanticDataModels = new ArrayList<>(); + for (GenericSubmodel submodel : submodels){ + SemanticDataModel payload = (SemanticDataModel) submodel.getPayload(); + payload.setAspectType(submodel.getAspectType()); + semanticDataModels.add(payload); + } + return semanticDataModels; } private static boolean isUpwardRelationship(final String aspectType) { - return aspectType.contains("Bom"); + return aspectType.contains("Usage"); } private static boolean isDownwardRelationship(final String aspectType) { - return aspectType.contains("Usage"); + return aspectType.contains("Bom"); } private static boolean isMainAspect(final String aspectType) { diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java index 21ce8454f9..b172134dab 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java @@ -28,8 +28,6 @@ import org.eclipse.tractusx.traceability.assets.domain.base.model.Owner; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.request.BomLifecycle; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; -import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.Submodel; -import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Relationship; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.semanticdatamodel.LocalId; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.semanticdatamodel.SemanticDataModel; @@ -40,8 +38,6 @@ import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.stream.Collectors; -import java.util.stream.Stream; @Slf4j public record ImportRequest( @@ -59,16 +55,33 @@ static ImportRequest of( for (AssetWrapperRequest assetWrapperRequest : assetRawRequestList) { AssetMetaInfoRequest assetMetaInfoRequest = assetWrapperRequest.assetMetaInfoRequest(); - if (BomLifecycle.AS_BUILT.equals(assetWrapperRequest.bomLifecycle())){ + if (BomLifecycle.AS_BUILT.equals(assetWrapperRequest.bomLifecycle())) { List mainAspectsAsBuilt = assetWrapperRequest.mainAspectModels(); - List upwardAspectsAsBuilt = assetWrapperRequest.upwardRelationship(); + + + /* List upwardAspectsAsBuilt = assetWrapperRequest.upwardRelationship().stream() + .map(SingleLevelBomAsBuiltRequest.class::cast).toList();*/ + + List upwardAspectsAsBuilt = assetWrapperRequest.upwardRelationship().stream() + .map(request -> { + // Assuming there is a method getSubmodel() in SingleLevelBomAsBuiltRequest + SingelLevelUsageAsBuiltRequest submodel = (SingelLevelUsageAsBuiltRequest) request.getPayload(); + + // Perform any additional operations on submodel if needed + + // Create a new SingleLevelBomAsBuiltRequest with the casted submodel + return new GenericSubmodel(request.getAspectType(), submodel/* pass other parameters and the modified submodel */); + }).toList(); + + List downwardAspectsAsBuilt = assetWrapperRequest.downwardRelationship(); assetAsBuiltWrapperRequest.add(new AssetWrapperRequest(assetMetaInfoRequest, mainAspectsAsBuilt, upwardAspectsAsBuilt, downwardAspectsAsBuilt, BomLifecycle.AS_BUILT)); } - if (BomLifecycle.AS_PLANNED.equals(assetWrapperRequest.bomLifecycle())){ + if (BomLifecycle.AS_PLANNED.equals(assetWrapperRequest.bomLifecycle())) { List mainAspectsAsPlanned = assetWrapperRequest.mainAspectModels(); List upwardAspectsAsPlanned = assetWrapperRequest.upwardRelationship(); + List downwardAspectsAsPlanned = assetWrapperRequest.downwardRelationship(); assetAsPlannedWrapperRequest.add(new AssetWrapperRequest(assetMetaInfoRequest, mainAspectsAsPlanned, upwardAspectsAsPlanned, downwardAspectsAsPlanned, BomLifecycle.AS_PLANNED)); @@ -93,39 +106,50 @@ public List convertAssetsAsPlanned() { private List mapToOwnPartsAsBuilt() { List assetWrapperRequests = bomLifecycleToAssetWrapperRequestList.get(BomLifecycle.AS_BUILT); - for (AssetWrapperRequest assetWrapperRequest : assetWrapperRequests){ + List list = new ArrayList<>(); + for (AssetWrapperRequest assetWrapperRequest : assetWrapperRequests) { AssetMetaInfoRequest assetMetaInfoRequest = assetWrapperRequest.assetMetaInfoRequest(); - List mainAspectModels = assetWrapperRequest.mainAspectModels(); + List mainAspectModels = assetWrapperRequest.mainAspectModels().stream().filter(semanticDataModel -> !semanticDataModel.aspectType().contains("traction_battery_code")).toList(); + List detailAspectDataTractionBatteryCodes = assetWrapperRequest.mainAspectModels().stream().filter(semanticDataModel -> semanticDataModel.aspectType().contains("traction_battery_code")).toList(); + List downwardModels = assetWrapperRequest.downwardRelationship(); List upwardModels = assetWrapperRequest.upwardRelationship(); -/* Map> supplierPartsMap = relationships().stream() - .filter(relationship -> SINGLE_LEVEL_BOM_AS_BUILT.equals(relationship.aspectType().getAspectName())) - .collect(Collectors.groupingBy(Relationship::catenaXId, Collectors.toList())); - - // The Relationship on customerPart childCatenaXId contains the id of the asset which has a relationship - Map> customerPartsMap = relationships().stream() - .filter(relationship -> SINGLE_LEVEL_USAGE_AS_BUILT.equals(relationship.aspectType().getAspectName())) - .collect(Collectors.groupingBy(Relationship::childCatenaXId, Collectors.toList()));*/ - - List localIds = Collections.emptyList(); Map shortIds = new HashMap<>(); Owner owner = Owner.OWN; Map bpns = new HashMap<>(); - List parentRelations = Collections.emptyList(); - List childRelations = Collections.emptyList(); - Optional< DetailAspectDataTractionBatteryCode > tractionBatteryCodeOptional = Optional.empty(); + + + List parentRelations = upwardModels.stream() + .map(genericSubmodel -> { + SingelLevelUsageAsBuiltRequest payload = (SingelLevelUsageAsBuiltRequest) genericSubmodel.getPayload(); + return payload.customers().stream() + .flatMap(customer -> customer.parentItems().stream()) + .map(parentItem -> new Descriptions(parentItem.catenaXId(), null)).toList(); + }) + .flatMap(List::stream).toList(); + + + List childRelations = downwardModels.stream() + .map(genericSubmodel -> { + SingleLevelBomAsBuiltRequest payload = (SingleLevelBomAsBuiltRequest) genericSubmodel.getPayload(); + return payload.childItems().stream() + .map(childItem -> new Descriptions(childItem.catenaXId(), null)).toList(); + }) + .flatMap(List::stream).toList(); + + Optional tractionBatteryCodeOptional = Optional.empty(); ImportState assetImportState = ImportState.TRANSIENT; - List list = mainAspectModels.stream().map(semanticDataModel -> semanticDataModel.toDomainAsBuilt(localIds, shortIds, owner, bpns, parentRelations, childRelations, tractionBatteryCodeOptional, assetImportState)).toList(); - return list; + + list.addAll(mainAspectModels.stream().map(semanticDataModel -> semanticDataModel.toDomainAsBuilt(localIds, shortIds, owner, bpns, parentRelations, childRelations, tractionBatteryCodeOptional, assetImportState)).toList()); } - return Collections.emptyList(); + return list; } private List mapToOwnPartsAsPlanned(Map shortIds, Map bpnMapping) { diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java index 93bb677581..dcb68b4cbd 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java @@ -62,11 +62,11 @@ public class GenericSubmodel { @Type(value = DetailAspectDataTractionBatteryCode.class, names = { "urn:bamm:io.catenax.traction_battery_code:1.0.0#TractionBatteryCode" }), - @Type(value = SingelLevelUsageAsBuiltRequest.class, names = { - "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt" - }), @Type(value = SingleLevelBomAsBuiltRequest.class, names = { "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt" + }), + @Type(value = SingelLevelUsageAsBuiltRequest.class, names = { + "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt" }) }) private Object payload; From 8a9344f9e4a216d7ee03d37605f1018a183f8aa6 Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Fri, 22 Dec 2023 08:32:26 +0100 Subject: [PATCH 06/49] chore(fileimport): TRACEFOSS-2741 Added mapping for main aspects / child / parent relations --- .../domain/importpoc/ImportRequest.java | 111 ++++++++---------- .../SingleLevelBomAsPlannedRequest.java | 48 ++++++++ .../SingleLevelUsageAsPlannedRequest.java | 50 ++++++++ .../importpoc/service/ImportServiceImpl.java | 12 +- .../irs/model/response/GenericSubmodel.java | 8 ++ .../irs/model/response/JobDetailResponse.java | 2 +- .../semanticdatamodel/SemanticDataModel.java | 93 ++++++++++++++- .../service/ImportServiceImplTest.java | 12 +- 8 files changed, 263 insertions(+), 73 deletions(-) create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingleLevelBomAsPlannedRequest.java create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingleLevelUsageAsPlannedRequest.java diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java index b172134dab..c6eef5ad96 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java @@ -24,20 +24,17 @@ import org.eclipse.tractusx.traceability.assets.domain.asbuilt.model.aspect.DetailAspectDataTractionBatteryCode; import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; import org.eclipse.tractusx.traceability.assets.domain.base.model.Descriptions; -import org.eclipse.tractusx.traceability.assets.domain.base.model.ImportState; -import org.eclipse.tractusx.traceability.assets.domain.base.model.Owner; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.request.BomLifecycle; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; -import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.semanticdatamodel.LocalId; +import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.semanticdatamodel.SemanticDataModel; import java.util.ArrayList; -import java.util.Collections; import java.util.EnumMap; -import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Optional; + +import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.JobDetailResponse.addPartSiteInformationAsPlannedToOwnPartsAsPlanned; @Slf4j public record ImportRequest( @@ -99,8 +96,8 @@ public List convertAssetsAsBuilt() { return new ArrayList<>(mapToOwnPartsAsBuilt()); } - public List convertAssetsAsPlanned() { - return new ArrayList<>(mapToOwnPartsAsPlanned(null, null)); + public List convertAssetsAsPlanned(final String bpn) { + return new ArrayList<>(mapToOwnPartsAsPlanned(bpn)); } private List mapToOwnPartsAsBuilt() { @@ -109,20 +106,18 @@ private List mapToOwnPartsAsBuilt() { List list = new ArrayList<>(); for (AssetWrapperRequest assetWrapperRequest : assetWrapperRequests) { - AssetMetaInfoRequest assetMetaInfoRequest = assetWrapperRequest.assetMetaInfoRequest(); List mainAspectModels = assetWrapperRequest.mainAspectModels().stream().filter(semanticDataModel -> !semanticDataModel.aspectType().contains("traction_battery_code")).toList(); - List detailAspectDataTractionBatteryCodes = assetWrapperRequest.mainAspectModels().stream().filter(semanticDataModel -> semanticDataModel.aspectType().contains("traction_battery_code")).toList(); + + List detailAspectDataTractionBatteryCodes = assetWrapperRequest + .mainAspectModels() + .stream() + .filter(semanticDataModel -> semanticDataModel.aspectType().contains("traction_battery_code")) + .map(semanticDataModel -> (DetailAspectDataTractionBatteryCode) semanticDataModel).toList(); List downwardModels = assetWrapperRequest.downwardRelationship(); List upwardModels = assetWrapperRequest.upwardRelationship(); - List localIds = Collections.emptyList(); - Map shortIds = new HashMap<>(); - Owner owner = Owner.OWN; - Map bpns = new HashMap<>(); - - List parentRelations = upwardModels.stream() .map(genericSubmodel -> { SingelLevelUsageAsBuiltRequest payload = (SingelLevelUsageAsBuiltRequest) genericSubmodel.getPayload(); @@ -141,64 +136,54 @@ private List mapToOwnPartsAsBuilt() { }) .flatMap(List::stream).toList(); - Optional tractionBatteryCodeOptional = Optional.empty(); - ImportState assetImportState = ImportState.TRANSIENT; - - list.addAll(mainAspectModels.stream().map(semanticDataModel -> semanticDataModel.toDomainAsBuilt(localIds, shortIds, owner, bpns, parentRelations, childRelations, tractionBatteryCodeOptional, assetImportState)).toList()); + list.addAll(mainAspectModels.stream().map(semanticDataModel -> semanticDataModel.toDomainAsBuiltLight(parentRelations, childRelations, detailAspectDataTractionBatteryCodes)).toList()); } return list; } - private List mapToOwnPartsAsPlanned(Map shortIds, Map bpnMapping) { + private List mapToOwnPartsAsPlanned(final String bpn) { List assetWrapperRequests = bomLifecycleToAssetWrapperRequestList.get(BomLifecycle.AS_PLANNED); - /* List ownPartsAsPlanned = - semanticDataModels().stream() - .filter(semanticDataModel -> isOwnPart(semanticDataModel, jobStatus)) - .filter(semanticDataModel -> Aspect.isMasterAspect(semanticDataModel.aspectType())).toList(); - - List isPartSiteInformationAsPlanned = - semanticDataModels().stream() - .filter(semanticDataModel -> isOwnPart(semanticDataModel, jobStatus)) - .filter(semanticDataModel -> semanticDataModel.aspectType().contains(Aspect.PART_SITE_INFORMATION_AS_PLANNED.getAspectName())).toList(); - - addPartSiteInformationAsPlannedToOwnPartsAsPlanned(ownPartsAsPlanned, isPartSiteInformationAsPlanned); - - log.info(":: mapToOwnPartsAsPlanned()"); - log.info(":: ownPartsAsPlanned: {}", ownPartsAsPlanned); - - Map> singleLevelBomRelationship = relationships().stream() - .filter(relationship -> SINGLE_LEVEL_BOM_AS_PLANNED.equals(relationship.aspectType().getAspectName())) - .collect(Collectors.groupingBy(Relationship::catenaXId, Collectors.toList())); - - String ownerBpn = jobStatus.parameter().bpn(); - - final List assets = ownPartsAsPlanned - .stream() - .map(semanticDataModel -> semanticDataModel.toDomainAsPlanned( - shortIds, - Owner.OWN, - bpnMapping, - Collections.emptyList(), - getChildParts(singleLevelBomRelationship, shortIds, semanticDataModel.catenaXId()), - ownerBpn, - ImportState.PERSISTENT - )) - .toList(); - log.info(":: mapped assets: {}", assets); - return assets;*/ - return Collections.emptyList(); - } + List list = new ArrayList<>(); + for (AssetWrapperRequest assetWrapperRequest : assetWrapperRequests) { + + List mainAspectModels = assetWrapperRequest.mainAspectModels().stream().filter(semanticDataModel -> !semanticDataModel.aspectType().contains(Aspect.PART_SITE_INFORMATION_AS_PLANNED.getAspectName())).toList(); + List partSiteInfoAsPlanned = + mainAspectModels.stream() + .filter(semanticDataModel -> semanticDataModel.aspectType().contains(Aspect.PART_SITE_INFORMATION_AS_PLANNED.getAspectName())).toList(); + + addPartSiteInformationAsPlannedToOwnPartsAsPlanned(mainAspectModels, partSiteInfoAsPlanned); + + List downwardModels = assetWrapperRequest.downwardRelationship(); + List upwardModels = assetWrapperRequest.upwardRelationship(); - private static boolean isAsPlanned(final String aspectType) { - return aspectType.contains("AsPlanned"); - } - private static boolean isAsBuilt(final String aspectType) { - return !aspectType.contains("AsPlanned"); + List parentRelations = upwardModels.stream() + .map(genericSubmodel -> { + SingleLevelUsageAsPlannedRequest payload = (SingleLevelUsageAsPlannedRequest) genericSubmodel.getPayload(); + return payload.parentParts().stream() + .map(parentPart -> new Descriptions(parentPart.parentCatenaXId(), null)).toList(); + }) + .flatMap(List::stream).toList(); + + + List childRelations = downwardModels.stream() + .map(genericSubmodel -> { + SingleLevelBomAsPlannedRequest payload = (SingleLevelBomAsPlannedRequest) genericSubmodel.getPayload(); + return payload.childItems().stream() + .map(childItem -> new Descriptions(childItem.catenaXId(), null)).toList(); + }) + .flatMap(List::stream).toList(); + + list.addAll(mainAspectModels.stream().map(semanticDataModel -> semanticDataModel.toDomainAsPlannedLight(parentRelations, childRelations, bpn)).toList()); + + } + + return list; } + } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingleLevelBomAsPlannedRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingleLevelBomAsPlannedRequest.java new file mode 100644 index 0000000000..be2efe2ed0 --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingleLevelBomAsPlannedRequest.java @@ -0,0 +1,48 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +package org.eclipse.tractusx.traceability.assets.domain.importpoc; + +import java.time.OffsetDateTime; +import java.util.List; + +public record SingleLevelBomAsPlannedRequest(String catenaXId, List childItems) { + + public record ChildItem( + ValidityPeriod validityPeriod, + String catenaXId, + Quantity quantity, + String businessPartner, + String createdOn, + String lastModifiedOn + ) { + } + + public record ValidityPeriod( + OffsetDateTime validFrom, + OffsetDateTime validTo + ) { + } + + public record Quantity( + double quantityNumber, + String measurementUnit + ) { + } +} + diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingleLevelUsageAsPlannedRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingleLevelUsageAsPlannedRequest.java new file mode 100644 index 0000000000..9e5fadca2c --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingleLevelUsageAsPlannedRequest.java @@ -0,0 +1,50 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +package org.eclipse.tractusx.traceability.assets.domain.importpoc; + +import java.time.OffsetDateTime; +import java.util.List; + +public record SingleLevelUsageAsPlannedRequest( + List parentParts, + String businessPartner, + String catenaXId +) { + + public record ParentPart( + ValidityPeriod validityPeriod, + String parentCatenaXId, + Quantity quantity, + String createdOn, + String lastModifiedOn + ) { + } + + public record ValidityPeriod( + OffsetDateTime validFrom, + OffsetDateTime validTo + ) { + } + + public record Quantity( + double quantityNumber, + String measurementUnit + ) { + } +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java index e19120c5da..2f0ff95a57 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java @@ -28,6 +28,7 @@ import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; import org.eclipse.tractusx.traceability.assets.domain.importpoc.ImportRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.exception.ImportException; +import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; @@ -41,17 +42,13 @@ public class ImportServiceImpl implements ImportService { private final ObjectMapper objectMapper; private final AssetAsPlannedRepository assetAsPlannedRepository; private final AssetAsBuiltRepository assetAsBuiltRepository; - + private final TraceabilityProperties traceabilityProperties; @Override public void importAssets(MultipartFile file) { try { - // TODO - build a json schema construct which consists of the assetmetainfo and the submodels. - // The submodels needs to be pulled by (example for serialpart) https://github.com/eclipse-tractusx/sldt-semantic-models/blob/main/io.catenax.serial_part/2.0.0/gen/SerialPart-schema.json - // It is okay to download the schemas and put them in a folder as we need to have control over the schemas - // For the validation see: https://github.com/eclipse-tractusx/item-relationship-service/blob/main/irs-api/src/main/java/org/eclipse/tractusx/irs/services/validation/JsonValidatorService.java#L43 - String fileContent = new String(file.getBytes(), StandardCharsets.UTF_8); log.info("Imported file: " + fileContent); + ImportRequest importRequest = objectMapper.readValue(fileContent, ImportRequest.class); List persistedAsBuilts = this.assetAsBuiltRepository.saveAll(importRequest.convertAssetsAsBuilt()); try { @@ -59,7 +56,8 @@ public void importAssets(MultipartFile file) { } catch (Exception e) { log.error("exception", e); } - List persistedAsPlanned = this.assetAsPlannedRepository.saveAll(importRequest.convertAssetsAsPlanned()); + final String bpn = traceabilityProperties.getBpn().toString(); + List persistedAsPlanned = this.assetAsPlannedRepository.saveAll(importRequest.convertAssetsAsPlanned(bpn)); try { log.info("persistedAsPlanned as JSON {}", objectMapper.writeValueAsString(persistedAsPlanned)); } catch (Exception e) { diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java index dcb68b4cbd..b4c38092db 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java @@ -27,6 +27,8 @@ import org.eclipse.tractusx.traceability.assets.domain.asbuilt.model.aspect.DetailAspectDataTractionBatteryCode; import org.eclipse.tractusx.traceability.assets.domain.importpoc.SingelLevelUsageAsBuiltRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.SingleLevelBomAsBuiltRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.SingleLevelBomAsPlannedRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.SingleLevelUsageAsPlannedRequest; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.semanticdatamodel.SemanticDataModel; public class GenericSubmodel { @@ -67,6 +69,12 @@ public class GenericSubmodel { }), @Type(value = SingelLevelUsageAsBuiltRequest.class, names = { "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt" + }), + @Type(value = SingleLevelUsageAsPlannedRequest.class, names = { + "urn:bamm:io.catenax.single_level_usage_as_planned:1.1.0#SingleLevelUsageAsPlanned" + }), + @Type(value = SingleLevelBomAsPlannedRequest.class, names = { + "urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned" }) }) private Object payload; diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/JobDetailResponse.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/JobDetailResponse.java index 2f936e8eb0..6a87eab74c 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/JobDetailResponse.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/JobDetailResponse.java @@ -238,7 +238,7 @@ private List mapToOwnPartsAsPlanned(Map shortIds, Map return assets; } - private static void addPartSiteInformationAsPlannedToOwnPartsAsPlanned(List ownPartsAsPlanned, List partSiteInformationAsPlanned) { + public static void addPartSiteInformationAsPlannedToOwnPartsAsPlanned(List ownPartsAsPlanned, List partSiteInformationAsPlanned) { for (SemanticDataModel semanticDataModel : ownPartsAsPlanned) { for (SemanticDataModel partSiteSemanticDataModel : partSiteInformationAsPlanned) { if (semanticDataModel.getCatenaXId().equals(partSiteSemanticDataModel.getCatenaXId())) { diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/semanticdatamodel/SemanticDataModel.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/semanticdatamodel/SemanticDataModel.java index ac25dc709a..2dedf7c870 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/semanticdatamodel/SemanticDataModel.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/semanticdatamodel/SemanticDataModel.java @@ -27,9 +27,9 @@ import lombok.extern.slf4j.Slf4j; import org.eclipse.tractusx.traceability.assets.domain.asbuilt.model.aspect.DetailAspectDataTractionBatteryCode; import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; +import org.eclipse.tractusx.traceability.assets.domain.base.model.Descriptions; import org.eclipse.tractusx.traceability.assets.domain.base.model.ImportNote; import org.eclipse.tractusx.traceability.assets.domain.base.model.ImportState; -import org.eclipse.tractusx.traceability.assets.domain.base.model.Descriptions; import org.eclipse.tractusx.traceability.assets.domain.base.model.Owner; import org.eclipse.tractusx.traceability.assets.domain.base.model.QualityType; import org.eclipse.tractusx.traceability.assets.domain.base.model.aspect.DetailAspectModel; @@ -150,6 +150,97 @@ public AssetBase toDomainAsBuilt(List localIds, Map sho .build(); } + public AssetBase toDomainAsBuiltLight(List parentRelations, List childRelations, + List detailAspectDataTractionBatteryCodes) { + + ArrayList detailAspectModels = new ArrayList<>(); + + final AtomicReference semanticModelId = new AtomicReference<>(); + final AtomicReference semanticDataModel = new AtomicReference<>(); + + localIdentifiers.stream().filter(localId -> localId.key().equals(LocalIdKey.PART_INSTANCE_ID)).findFirst().ifPresent(s -> { + semanticModelId.set(s.value()); + semanticDataModel.set(org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.SERIALPART); + detailAspectDataTractionBatteryCodes.forEach(detailAspectDataTractionBatteryCode -> { + detailAspectModels.add(extractDetailAspectModelTractionBatteryCode(detailAspectDataTractionBatteryCode)); + }); + }); + + localIdentifiers.stream().filter(localId -> localId.key().equals(LocalIdKey.BATCH_ID)).findFirst().ifPresent(s -> { + semanticModelId.set(s.value()); + semanticDataModel.set(org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.BATCH); + }); + + localIdentifiers.stream().filter(localId -> localId.key().equals(LocalIdKey.JIS_NUMBER)).findFirst().ifPresent(s -> { + semanticModelId.set(s.value()); + semanticDataModel.set(org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.JUSTINSEQUENCE); + }); + + if (semanticDataModel.get() == null) { + semanticDataModel.set(org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.UNKNOWN); + } + + detailAspectModels.add(extractDetailAspectModelsAsBuilt(manufacturingInformation, partTypeInformation)); + + return AssetBase.builder() + .id(catenaXId()) + // only in shell object existing basically just a trim of the nameAtManufacturer + // .idShort(defaultValue(shortIds.get(catenaXId()))) + .semanticModelId(semanticModelId.get()) + .detailAspectModels(detailAspectModels) + .manufacturerId(manufacturerId()) + // we dont have the manufacturername + //.manufacturerName(defaultValue(manufacturerName)) + .nameAtManufacturer(partTypeInformation.nameAtManufacturer()) + .manufacturerPartId(partTypeInformation.manufacturerPartId()) + .parentRelations(parentRelations) + .childRelations(childRelations) + .owner(Owner.OWN) + .activeAlert(false) + .inInvestigation(false) + .classification(partTypeInformation.classification()) + .qualityType(QualityType.OK) + .semanticDataModel(semanticDataModel.get()) + .van(van()) + .importState(ImportState.TRANSIENT) + .importNote(ImportNote.TRANSIENT_CREATED) + .build(); + } + + public AssetBase toDomainAsPlannedLight( + List parentRelations, + List childRelations, + String ownerBpn + ) { + + + List partSiteInfoAsPlanned = extractDetailAspectModelsPartSiteInformationAsPlanned(sites()); + DetailAspectModel asPlanned = extractDetailAspectModelsAsPlanned(validityPeriod); + + final List aspectModels = new ArrayList<>(partSiteInfoAsPlanned); + aspectModels.add(asPlanned); + + return AssetBase.builder() + .id(catenaXId()) + // .idShort(defaultValue(shortIds.get(catenaXId()))) + .manufacturerId(ownerBpn) + // .manufacturerName(defaultValue(manufacturerName)) + .nameAtManufacturer(partTypeInformation.nameAtManufacturer()) + .manufacturerPartId(partTypeInformation.manufacturerPartId()) + .parentRelations(parentRelations) + .detailAspectModels(aspectModels) + .childRelations(childRelations) + .owner(Owner.OWN) + .activeAlert(false) + .classification(partTypeInformation.classification()) + .inInvestigation(false) + .qualityType(QualityType.OK) + .semanticDataModel(org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.PARTASPLANNED) + .van(van()) + .importState(ImportState.TRANSIENT) + .importNote(ImportNote.TRANSIENT_CREATED) + .build(); + } public AssetBase toDomainAsPlanned( Map shortIds, diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java index 8c91f56647..62c002c907 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java @@ -1,10 +1,13 @@ package org.eclipse.tractusx.traceability.assets.domain.importpoc.service; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import org.eclipse.tractusx.traceability.assets.domain.asbuilt.repository.AssetAsBuiltRepository; import org.eclipse.tractusx.traceability.assets.domain.asplanned.repository.AssetAsPlannedRepository; +import org.eclipse.tractusx.traceability.common.model.BPN; +import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -17,6 +20,8 @@ import java.io.IOException; import java.io.InputStream; +import static org.mockito.Mockito.when; + @ExtendWith(MockitoExtension.class) class ImportServiceImplTest { @@ -28,10 +33,15 @@ class ImportServiceImplTest { @Mock private AssetAsBuiltRepository assetAsBuiltRepository; + @Mock + private TraceabilityProperties traceabilityProperties; + @BeforeEach public void testSetup(){ ObjectMapper objectMapper = new ObjectMapper(); - importService = new ImportServiceImpl(objectMapper, assetAsPlannedRepository, assetAsBuiltRepository); + objectMapper.registerModule(new JavaTimeModule()); + when(traceabilityProperties.getBpn()).thenReturn(BPN.of("ABC")); + importService = new ImportServiceImpl(objectMapper, assetAsPlannedRepository, assetAsBuiltRepository, traceabilityProperties); } @Test From 048e36b3bc725685233d5e23bf4a895065ad2911 Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Fri, 22 Dec 2023 09:25:55 +0100 Subject: [PATCH 07/49] chore(fileimport): TRACEFOSS-2741 Added mapping for main aspects / child / parent relations --- .../traceability/assets/domain/importpoc/ImportRequest.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java index c6eef5ad96..d688c260d2 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java @@ -56,9 +56,6 @@ static ImportRequest of( List mainAspectsAsBuilt = assetWrapperRequest.mainAspectModels(); - /* List upwardAspectsAsBuilt = assetWrapperRequest.upwardRelationship().stream() - .map(SingleLevelBomAsBuiltRequest.class::cast).toList();*/ - List upwardAspectsAsBuilt = assetWrapperRequest.upwardRelationship().stream() .map(request -> { // Assuming there is a method getSubmodel() in SingleLevelBomAsBuiltRequest @@ -70,7 +67,6 @@ static ImportRequest of( return new GenericSubmodel(request.getAspectType(), submodel/* pass other parameters and the modified submodel */); }).toList(); - List downwardAspectsAsBuilt = assetWrapperRequest.downwardRelationship(); assetAsBuiltWrapperRequest.add(new AssetWrapperRequest(assetMetaInfoRequest, mainAspectsAsBuilt, upwardAspectsAsBuilt, downwardAspectsAsBuilt, BomLifecycle.AS_BUILT)); } From a58c565c1db2ae1e2319c367aed85305a1ebeb90 Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Fri, 22 Dec 2023 09:43:10 +0100 Subject: [PATCH 08/49] chore(fileimport): TRACEFOSS-2741 Added mapping for main aspects / child / parent relations --- tx-backend/openapi/traceability-foss-backend.json | 2 +- .../traceability/assets/domain/importpoc/ImportRequestTest.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tx-backend/openapi/traceability-foss-backend.json b/tx-backend/openapi/traceability-foss-backend.json index 33bfae39c5..ce90881f04 100644 --- a/tx-backend/openapi/traceability-foss-backend.json +++ b/tx-backend/openapi/traceability-foss-backend.json @@ -1 +1 @@ -{"openapi":"3.0.1","info":{"title":"Trace-FOSS - OpenAPI Documentation","description":"Trace-FOSS is a system for tracking parts along the supply chain. A high level of transparency across the supplier network enables faster intervention based on a recorded event in the supply chain. This saves costs by seamlessly tracking parts and creates trust through clearly defined and secure data access by the companies and persons involved in the process.","license":{"name":"License: Apache 2.0"},"version":"1.0.0"},"servers":[{"url":"http://localhost:9998/api","description":"Generated server url"}],"security":[{"oAuth2":["profile email"]}],"tags":[{"name":"ShellDescriptorController","description":"Shell Descriptor Controller"},{"name":"Investigations","description":"Operations on Investigation Notification"}],"paths":{"/bpn-config":{"get":{"tags":["BpnEdcMapping"],"summary":"Get BPN EDC URL mappings","description":"The endpoint returns a result of BPN EDC URL mappings.","operationId":"getBpnEdcs","responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the paged result found","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]},"put":{"tags":["BpnEdcMapping"],"summary":"Updates BPN EDC URL mappings","description":"The endpoint updates BPN EDC URL mappings","operationId":"updateBpnEdcMappings","requestBody":{"content":{"application/json":{"schema":{"maxItems":1000,"minItems":0,"type":"array","items":{"$ref":"#/components/schemas/BpnMappingRequest"}}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the paged result found for BpnEdcMapping","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]},"post":{"tags":["BpnEdcMapping"],"summary":"Creates BPN EDC URL mappings","description":"The endpoint creates BPN EDC URL mappings","operationId":"createBpnEdcUrlMappings","requestBody":{"content":{"application/json":{"schema":{"maxItems":1000,"minItems":0,"type":"array","items":{"$ref":"#/components/schemas/BpnMappingRequest"}}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the paged result found for BpnEdcMapping","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/submodel/data/{submodelId}":{"get":{"tags":["Submodel"],"summary":"Gets Submodel by its id","description":"The endpoint returns Submodel for given id. Used for data providing functionality","operationId":"getSubmodelById","parameters":[{"name":"submodelId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the paged result found","content":{"application/json":{}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]},"post":{"tags":["Submodel"],"summary":"Save Submodel","description":"This endpoint allows you to save a Submodel identified by its ID.","operationId":"saveSubmodel","parameters":[{"name":"submodelId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"string"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Ok."},"204":{"description":"No Content."},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/investigations":{"get":{"tags":["Investigations"],"summary":"Gets investigations","description":"The endpoint returns investigations as paged result.","operationId":"getInvestigations","parameters":[{"name":"pageable","in":"query","required":true,"schema":{"$ref":"#/components/schemas/OwnPageable"}},{"name":"filter","in":"query","required":true,"schema":{"$ref":"#/components/schemas/SearchCriteriaRequestParam"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the paged result found for Asset","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]},"post":{"tags":["Investigations"],"summary":"Start investigations by part ids","description":"The endpoint starts investigations based on part ids provided.","operationId":"investigateAssets","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartQualityNotificationRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"201":{"description":"Created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QualityNotificationIdResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/investigations/{investigationId}/update":{"post":{"tags":["Investigations"],"summary":"Update investigations by id","description":"The endpoint updates investigations by their id.","operationId":"updateInvestigation","parameters":[{"name":"investigationId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateQualityNotificationRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Ok."},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"No content."},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/investigations/{investigationId}/close":{"post":{"tags":["Investigations"],"summary":"Close investigations by id","description":"The endpoint closes investigations by their id.","operationId":"closeInvestigation","parameters":[{"name":"investigationId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloseQualityNotificationRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Ok."},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"No content."},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/investigations/{investigationId}/cancel":{"post":{"tags":["Investigations"],"summary":"Cancles investigations by id","description":"The endpoint cancles investigations by their id.","operationId":"cancelInvestigation","parameters":[{"name":"investigationId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Ok."},"204":{"description":"No content."},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/investigations/{investigationId}/approve":{"post":{"tags":["Investigations"],"summary":"Approves investigations by id","description":"The endpoint approves investigations by their id.","operationId":"approveInvestigation","parameters":[{"name":"investigationId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Ok."},"204":{"description":"No content."},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/edc/notification/contract":{"post":{"tags":["Notifications"],"summary":"Triggers EDC notification contract","description":"The endpoint Triggers EDC notification contract based on notification type and method","operationId":"createNotificationContract","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateNotificationContractRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"201":{"description":"Created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateNotificationContractResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/import":{"post":{"tags":["AssetsImport"],"summary":"asset upload","description":"This endpoint stores assets in the application. Those can be later published in the Catena-X network.","operationId":"importJson","requestBody":{"content":{"multipart/form-data":{"schema":{"required":["file"],"type":"object","properties":{"file":{"type":"string","format":"binary"}}}}}},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"OK.","content":{"application/json":{}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"No Content."},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-planned/sync":{"post":{"tags":["AssetsAsPlanned"],"summary":"Synchronizes assets from IRS","description":"The endpoint synchronizes the assets from irs.","operationId":"sync","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SyncAssetsRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"201":{"description":"Created."},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-planned/detail-information":{"post":{"tags":["AssetsAsPlanned"],"summary":"Searches for assets by ids.","description":"The endpoint searchs for assets by id and returns a list of them.","operationId":"getDetailInformation","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetDetailInformationRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the paged result found for Asset","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-built/sync":{"post":{"tags":["AssetsAsBuilt"],"summary":"Synchronizes assets from IRS","description":"The endpoint synchronizes the assets from irs.","operationId":"sync_1","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SyncAssetsRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"201":{"description":"Created."},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-built/detail-information":{"post":{"tags":["AssetsAsBuilt"],"summary":"Searches for assets by ids.","description":"The endpoint searchs for assets by id and returns a list of them.","operationId":"getDetailInformation_1","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetDetailInformationRequest"}}},"required":true},"responses":{"200":{"description":"Returns the paged result found for Asset","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}},"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/alerts":{"get":{"tags":["Alerts"],"summary":"Gets alerts","description":"The endpoint returns alerts as paged result.","operationId":"getAlerts","parameters":[{"name":"pageable","in":"query","required":true,"schema":{"$ref":"#/components/schemas/OwnPageable"}},{"name":"filter","in":"query","required":true,"schema":{"$ref":"#/components/schemas/SearchCriteriaRequestParam"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the paged result found for Asset","content":{"application/json":{"schema":{"maxItems":2147483647,"type":"array"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]},"post":{"tags":["Alerts"],"summary":"Start alert by part ids","description":"The endpoint starts alert based on part ids provided.","operationId":"alertAssets","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartQualityNotificationRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"201":{"description":"Created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QualityNotificationIdResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/alerts/{alertId}/update":{"post":{"tags":["Alerts"],"summary":"Update alert by id","description":"The endpoint updates alert by their id.","operationId":"updateAlert","parameters":[{"name":"alertId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateQualityNotificationRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"No content."},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/alerts/{alertId}/close":{"post":{"tags":["Alerts"],"summary":"Close alert by id","description":"The endpoint closes alert by id.","operationId":"closeAlert","parameters":[{"name":"alertId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloseQualityNotificationRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Ok."},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"No content."},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/alerts/{alertId}/cancel":{"post":{"tags":["Alerts"],"summary":"Cancels alert by id","description":"The endpoint cancels alert by id.","operationId":"cancelAlert","parameters":[{"name":"alertId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Ok."},"204":{"description":"No content."},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/alerts/{alertId}/approve":{"post":{"tags":["Alerts"],"summary":"Approves alert by id","description":"The endpoint approves alert by id.","operationId":"approveAlert","parameters":[{"name":"alertId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Ok."},"204":{"description":"No content."},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-planned/{assetId}":{"get":{"tags":["AssetsAsPlanned"],"summary":"Get asset by id","description":"The endpoint returns an asset filtered by id .","operationId":"assetById","parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Returns the assets found","content":{"application/json":{"schema":{"maxItems":2147483647,"type":"array","description":"Assets","items":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"},"semanticModelId":{"maxLength":255,"minLength":0,"type":"string"},"businessPartner":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerName":{"maxLength":255,"minLength":0,"type":"string"},"nameAtManufacturer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerPartId":{"maxLength":255,"minLength":0,"type":"string"},"owner":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]},"childRelations":{"maxItems":2147483647,"type":"array","description":"Child relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"parentRelations":{"maxItems":2147483647,"type":"array","description":"Parent relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"activeAlert":{"type":"boolean"},"underInvestigation":{"type":"boolean"},"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]},"van":{"maxLength":255,"minLength":0,"type":"string"},"semanticDataModel":{"type":"string","enum":["BATCH","SERIALPART","UNKNOWN","PARTASPLANNED","JUSTINSEQUENCE"]},"classification":{"maxLength":255,"minLength":0,"type":"string"},"detailAspectModels":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectModelResponse"}},"sentQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"sentQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"importState":{"type":"string","enum":["TRANSIENT","PERSISTENT","ERROR","IN_SYNCHRONIZATION","UNSET"]},"importNote":{"type":"string"}}}}}}},"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]},"patch":{"tags":["AssetsAsPlanned"],"summary":"Updates asset","description":"The endpoint updates asset by provided quality type.","operationId":"updateAsset","parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAssetRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the updated asset","content":{"application/json":{"schema":{"maxItems":2147483647,"type":"array","description":"Assets","items":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"},"semanticModelId":{"maxLength":255,"minLength":0,"type":"string"},"businessPartner":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerName":{"maxLength":255,"minLength":0,"type":"string"},"nameAtManufacturer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerPartId":{"maxLength":255,"minLength":0,"type":"string"},"owner":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]},"childRelations":{"maxItems":2147483647,"type":"array","description":"Child relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"parentRelations":{"maxItems":2147483647,"type":"array","description":"Parent relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"activeAlert":{"type":"boolean"},"underInvestigation":{"type":"boolean"},"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]},"van":{"maxLength":255,"minLength":0,"type":"string"},"semanticDataModel":{"type":"string","enum":["BATCH","SERIALPART","UNKNOWN","PARTASPLANNED","JUSTINSEQUENCE"]},"classification":{"maxLength":255,"minLength":0,"type":"string"},"detailAspectModels":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectModelResponse"}},"sentQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"sentQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"importState":{"type":"string","enum":["TRANSIENT","PERSISTENT","ERROR","IN_SYNCHRONIZATION","UNSET"]},"importNote":{"type":"string"}}}}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-built/{assetId}":{"get":{"tags":["AssetsAsBuilt"],"summary":"Get asset by id","description":"The endpoint returns an asset filtered by id .","operationId":"assetById_1","parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the assets found","content":{"application/json":{"schema":{"maxItems":2147483647,"type":"array","description":"Assets","items":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"},"semanticModelId":{"maxLength":255,"minLength":0,"type":"string"},"businessPartner":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerName":{"maxLength":255,"minLength":0,"type":"string"},"nameAtManufacturer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerPartId":{"maxLength":255,"minLength":0,"type":"string"},"owner":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]},"childRelations":{"maxItems":2147483647,"type":"array","description":"Child relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"parentRelations":{"maxItems":2147483647,"type":"array","description":"Parent relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"activeAlert":{"type":"boolean"},"underInvestigation":{"type":"boolean"},"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]},"van":{"maxLength":255,"minLength":0,"type":"string"},"semanticDataModel":{"type":"string","enum":["BATCH","SERIALPART","UNKNOWN","PARTASPLANNED","JUSTINSEQUENCE"]},"classification":{"maxLength":255,"minLength":0,"type":"string"},"detailAspectModels":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectModelResponse"}},"sentQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"sentQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"importState":{"type":"string","enum":["TRANSIENT","PERSISTENT","ERROR","IN_SYNCHRONIZATION","UNSET"]},"importNote":{"type":"string"}}}}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]},"patch":{"tags":["AssetsAsBuilt"],"summary":"Updates asset","description":"The endpoint updates asset by provided quality type.","operationId":"updateAsset_1","parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAssetRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the updated asset","content":{"application/json":{"schema":{"maxItems":2147483647,"type":"array","description":"Assets","items":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"},"semanticModelId":{"maxLength":255,"minLength":0,"type":"string"},"businessPartner":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerName":{"maxLength":255,"minLength":0,"type":"string"},"nameAtManufacturer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerPartId":{"maxLength":255,"minLength":0,"type":"string"},"owner":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]},"childRelations":{"maxItems":2147483647,"type":"array","description":"Child relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"parentRelations":{"maxItems":2147483647,"type":"array","description":"Parent relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"activeAlert":{"type":"boolean"},"underInvestigation":{"type":"boolean"},"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]},"van":{"maxLength":255,"minLength":0,"type":"string"},"semanticDataModel":{"type":"string","enum":["BATCH","SERIALPART","UNKNOWN","PARTASPLANNED","JUSTINSEQUENCE"]},"classification":{"maxLength":255,"minLength":0,"type":"string"},"detailAspectModels":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectModelResponse"}},"sentQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"sentQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"importState":{"type":"string","enum":["TRANSIENT","PERSISTENT","ERROR","IN_SYNCHRONIZATION","UNSET"]},"importNote":{"type":"string"}}}}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/shelldescriptors":{"get":{"tags":["ShellDescriptorController"],"summary":"FindAll shell descriptors","description":"The endpoint returns all shell descriptors.","operationId":"findAll","responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"ShellDescriptors found.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ShellDescriptorResponse"}}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]},"delete":{"tags":["Registry","ShellDescriptorController"],"summary":"Triggers deleteAll of shell descriptors list","description":"The endpoint deletes all shell descriptors.","operationId":"deleteAll","responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"Deleted."},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/registry/reload":{"get":{"tags":["Registry"],"summary":"Triggers reload of shell descriptors","description":"The endpoint Triggers reload of shell descriptors.","operationId":"reload","responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"202":{"description":"Created registry reload job."},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/investigations/{investigationId}":{"get":{"tags":["Investigations"],"summary":"Gets investigations by id","description":"The endpoint returns investigations as paged result by their id.","operationId":"getInvestigation","parameters":[{"name":"investigationId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"OK.","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":-2147483648,"type":"array","description":"Investigations","items":{"$ref":"#/components/schemas/InvestigationResponse"}}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/investigations/distinctFilterValues":{"get":{"tags":["Assets","Investigations"],"summary":"getDistinctFilterValues","description":"The endpoint returns a distinct filter values for given fieldName.","operationId":"distinctFilterValues","parameters":[{"name":"fieldName","in":"query","required":true,"schema":{"type":"string"}},{"name":"size","in":"query","required":true,"schema":{"type":"integer","format":"int32"}},{"name":"startWith","in":"query","required":true,"schema":{"type":"string"}},{"name":"channel","in":"query","required":true,"schema":{"type":"string","enum":["SENDER","RECEIVER"]}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns a distinct filter values for given fieldName.","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/dashboard":{"get":{"tags":["Dashboard"],"summary":"Returns dashboard related data","description":"The endpoint can return limited data based on the user role","operationId":"dashboard","responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns dashboard data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-planned":{"get":{"tags":["AssetsAsPlanned"],"summary":"Get assets by pagination","description":"The endpoint returns a paged result of assets.","operationId":"AssetsAsPlanned","parameters":[{"name":"pageable","in":"query","required":true,"schema":{"$ref":"#/components/schemas/OwnPageable"}},{"name":"filter","in":"query","required":true,"schema":{"$ref":"#/components/schemas/SearchCriteriaRequestParam"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the paged result found for Asset","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array","items":{"maxItems":2147483647,"type":"array","description":"Assets","items":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"},"semanticModelId":{"maxLength":255,"minLength":0,"type":"string"},"businessPartner":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerName":{"maxLength":255,"minLength":0,"type":"string"},"nameAtManufacturer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerPartId":{"maxLength":255,"minLength":0,"type":"string"},"owner":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]},"childRelations":{"maxItems":2147483647,"type":"array","description":"Child relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"parentRelations":{"maxItems":2147483647,"type":"array","description":"Parent relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"activeAlert":{"type":"boolean"},"underInvestigation":{"type":"boolean"},"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]},"van":{"maxLength":255,"minLength":0,"type":"string"},"semanticDataModel":{"type":"string","enum":["BATCH","SERIALPART","UNKNOWN","PARTASPLANNED","JUSTINSEQUENCE"]},"classification":{"maxLength":255,"minLength":0,"type":"string"},"detailAspectModels":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectModelResponse"}},"sentQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"sentQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"importState":{"type":"string","enum":["TRANSIENT","PERSISTENT","ERROR","IN_SYNCHRONIZATION","UNSET"]},"importNote":{"type":"string"}}}}}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-planned/{assetId}/children/{childId}":{"get":{"tags":["AssetsAsPlanned"],"summary":"Get asset by child id","description":"The endpoint returns an asset filtered by child id.","operationId":"assetByChildId","parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"}},{"name":"childId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the asset by childId","content":{"application/json":{"schema":{"maxItems":2147483647,"type":"array","description":"Assets","items":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"},"semanticModelId":{"maxLength":255,"minLength":0,"type":"string"},"businessPartner":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerName":{"maxLength":255,"minLength":0,"type":"string"},"nameAtManufacturer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerPartId":{"maxLength":255,"minLength":0,"type":"string"},"owner":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]},"childRelations":{"maxItems":2147483647,"type":"array","description":"Child relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"parentRelations":{"maxItems":2147483647,"type":"array","description":"Parent relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"activeAlert":{"type":"boolean"},"underInvestigation":{"type":"boolean"},"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]},"van":{"maxLength":255,"minLength":0,"type":"string"},"semanticDataModel":{"type":"string","enum":["BATCH","SERIALPART","UNKNOWN","PARTASPLANNED","JUSTINSEQUENCE"]},"classification":{"maxLength":255,"minLength":0,"type":"string"},"detailAspectModels":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectModelResponse"}},"sentQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"sentQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"importState":{"type":"string","enum":["TRANSIENT","PERSISTENT","ERROR","IN_SYNCHRONIZATION","UNSET"]},"importNote":{"type":"string"}}}}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-planned/distinctFilterValues":{"get":{"tags":["Assets","AssetsAsPlanned"],"summary":"getDistinctFilterValues","description":"The endpoint returns a distinct filter values for given fieldName.","operationId":"distinctFilterValues_1","parameters":[{"name":"fieldName","in":"query","required":true,"schema":{"type":"string"}},{"name":"size","in":"query","required":true,"schema":{"type":"integer","format":"int32"}},{"name":"startWith","in":"query","required":true,"schema":{"type":"string"}},{"name":"owner","in":"query","required":true,"schema":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns a distinct filter values for given fieldName.","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-built":{"get":{"tags":["AssetsAsBuilt"],"summary":"Get assets by pagination","description":"The endpoint returns a paged result of assets.","operationId":"assets","parameters":[{"name":"pageable","in":"query","required":true,"schema":{"$ref":"#/components/schemas/OwnPageable"}},{"name":"searchCriteriaRequestParam","in":"query","required":true,"schema":{"$ref":"#/components/schemas/SearchCriteriaRequestParam"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the paged result found for Asset","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array","items":{"maxItems":2147483647,"type":"array","description":"Assets","items":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"},"semanticModelId":{"maxLength":255,"minLength":0,"type":"string"},"businessPartner":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerName":{"maxLength":255,"minLength":0,"type":"string"},"nameAtManufacturer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerPartId":{"maxLength":255,"minLength":0,"type":"string"},"owner":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]},"childRelations":{"maxItems":2147483647,"type":"array","description":"Child relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"parentRelations":{"maxItems":2147483647,"type":"array","description":"Parent relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"activeAlert":{"type":"boolean"},"underInvestigation":{"type":"boolean"},"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]},"van":{"maxLength":255,"minLength":0,"type":"string"},"semanticDataModel":{"type":"string","enum":["BATCH","SERIALPART","UNKNOWN","PARTASPLANNED","JUSTINSEQUENCE"]},"classification":{"maxLength":255,"minLength":0,"type":"string"},"detailAspectModels":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectModelResponse"}},"sentQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"sentQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"importState":{"type":"string","enum":["TRANSIENT","PERSISTENT","ERROR","IN_SYNCHRONIZATION","UNSET"]},"importNote":{"type":"string"}}}}}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-built/{assetId}/children/{childId}":{"get":{"tags":["AssetsAsBuilt"],"summary":"Get asset by child id","description":"The endpoint returns an asset filtered by child id.","operationId":"assetByChildId_1","parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"}},{"name":"childId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the asset by childId","content":{"application/json":{"schema":{"maxItems":2147483647,"type":"array","description":"Assets","items":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"},"semanticModelId":{"maxLength":255,"minLength":0,"type":"string"},"businessPartner":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerName":{"maxLength":255,"minLength":0,"type":"string"},"nameAtManufacturer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerPartId":{"maxLength":255,"minLength":0,"type":"string"},"owner":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]},"childRelations":{"maxItems":2147483647,"type":"array","description":"Child relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"parentRelations":{"maxItems":2147483647,"type":"array","description":"Parent relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"activeAlert":{"type":"boolean"},"underInvestigation":{"type":"boolean"},"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]},"van":{"maxLength":255,"minLength":0,"type":"string"},"semanticDataModel":{"type":"string","enum":["BATCH","SERIALPART","UNKNOWN","PARTASPLANNED","JUSTINSEQUENCE"]},"classification":{"maxLength":255,"minLength":0,"type":"string"},"detailAspectModels":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectModelResponse"}},"sentQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"sentQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"importState":{"type":"string","enum":["TRANSIENT","PERSISTENT","ERROR","IN_SYNCHRONIZATION","UNSET"]},"importNote":{"type":"string"}}}}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-built/distinctFilterValues":{"get":{"tags":["AssetsAsBuilt","Assets"],"summary":"getDistinctFilterValues","description":"The endpoint returns a distinct filter values for given fieldName.","operationId":"distinctFilterValues_2","parameters":[{"name":"fieldName","in":"query","required":true,"schema":{"type":"string"}},{"name":"size","in":"query","required":true,"schema":{"type":"integer","format":"int32"}},{"name":"startWith","in":"query","required":true,"schema":{"type":"string"}},{"name":"owner","in":"query","required":true,"schema":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns a distinct filter values for given fieldName.","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-built/countries":{"get":{"tags":["AssetsAsBuilt"],"summary":"Get map of assets","description":"The endpoint returns a map for assets consumed by the map.","operationId":"assetsCountryMap","responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the assets found","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"integer","format":"int64"}}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/alerts/{alertId}":{"get":{"tags":["Alerts"],"summary":"Gets Alert by id","description":"The endpoint returns alert by id.","operationId":"getAlert","parameters":[{"name":"alertId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"OK.","content":{"application/json":{"schema":{"maxItems":2147483647,"type":"array","description":"Alerts","items":{"$ref":"#/components/schemas/AlertResponse"}}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/alerts/distinctFilterValues":{"get":{"tags":["Assets","Alerts"],"summary":"getDistinctFilterValues","description":"The endpoint returns a distinct filter values for given fieldName.","operationId":"distinctFilterValues_3","parameters":[{"name":"fieldName","in":"query","required":true,"schema":{"type":"string"}},{"name":"size","in":"query","required":true,"schema":{"type":"integer","format":"int32"}},{"name":"startWith","in":"query","required":true,"schema":{"type":"string"}},{"name":"channel","in":"query","required":true,"schema":{"type":"string","enum":["SENDER","RECEIVER"]}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns a distinct filter values for given fieldName.","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/submodel/data":{"delete":{"tags":["Submodel"],"summary":"Delete All Submodels","description":"Deletes all submodels from the system.","operationId":"deleteSubmodels","responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Ok."},"204":{"description":"No Content."},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/bpn-config/{bpn}":{"delete":{"tags":["BpnEdcMapping"],"summary":"Deletes BPN EDC URL mappings","description":"The endpoint deletes BPN EDC URL mappings","operationId":"deleteBpnEdcUrlMappings","parameters":[{"name":"bpn","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Okay"},"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"Deleted."},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}}},"components":{"schemas":{"BpnMappingRequest":{"required":["bpn","url"],"type":"object","properties":{"bpn":{"maxLength":255,"minLength":0,"type":"string"},"url":{"maxLength":255,"minLength":0,"type":"string"}}},"ErrorResponse":{"type":"object","properties":{"message":{"maxLength":1000,"minLength":0,"pattern":"^.*$","type":"string"}}},"StartQualityNotificationRequest":{"required":["severity"],"type":"object","properties":{"partIds":{"maxItems":100,"minItems":1,"type":"array","items":{"type":"string"}},"description":{"maxLength":1000,"minLength":15,"type":"string"},"targetDate":{"type":"string","format":"date-time"},"severity":{"type":"string","enum":["MINOR","MAJOR","CRITICAL","LIFE_THREATENING"]},"receiverBpn":{"type":"string"},"asBuilt":{"type":"boolean"}}},"QualityNotificationIdResponse":{"type":"object","properties":{"id":{"type":"integer","format":"int64"}}},"UpdateQualityNotificationRequest":{"required":["status"],"type":"object","properties":{"status":{"type":"string","description":"The UpdateInvestigationStatus","enum":["ACKNOWLEDGED","ACCEPTED","DECLINED"]},"reason":{"type":"string"}}},"CloseQualityNotificationRequest":{"type":"object","properties":{"reason":{"maxLength":1000,"minLength":15,"type":"string"}}},"CreateNotificationContractRequest":{"required":["notificationMethod","notificationType"],"type":"object","properties":{"notificationType":{"type":"string","enum":["QUALITY_INVESTIGATION","QUALITY_ALERT"]},"notificationMethod":{"type":"string","enum":["RECEIVE","UPDATE","RESOLVE"]}}},"CreateNotificationContractResponse":{"type":"object","properties":{"notificationAssetId":{"type":"string"},"accessPolicyId":{"type":"string"},"contractDefinitionId":{"type":"string"}}},"SyncAssetsRequest":{"type":"object","properties":{"globalAssetIds":{"maxItems":100,"minItems":1,"type":"array","description":"Assets","items":{"type":"string"}}}},"GetDetailInformationRequest":{"type":"object","properties":{"assetIds":{"maxItems":50,"minItems":1,"type":"array","items":{"type":"string"}}}},"UpdateAssetRequest":{"required":["qualityType"],"type":"object","properties":{"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]}}},"DescriptionsResponse":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"}}},"DetailAspectDataAsBuiltResponse":{"type":"object","properties":{"partId":{"maxLength":255,"minLength":0,"type":"string"},"customerPartId":{"maxLength":255,"minLength":0,"type":"string"},"nameAtCustomer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturingCountry":{"maxLength":255,"minLength":0,"type":"string"},"manufacturingDate":{"maxLength":255,"minLength":0,"type":"string"}}},"DetailAspectDataAsPlannedResponse":{"type":"object","properties":{"validityPeriodFrom":{"maxLength":255,"minLength":0,"type":"string"},"validityPeriodTo":{"maxLength":255,"minLength":0,"type":"string"}}},"DetailAspectDataResponse":{"type":"object","oneOf":[{"$ref":"#/components/schemas/DetailAspectDataAsBuiltResponse"},{"$ref":"#/components/schemas/DetailAspectDataAsPlannedResponse"},{"$ref":"#/components/schemas/PartSiteInformationAsPlannedResponse"},{"$ref":"#/components/schemas/DetailAspectDataTractionBatteryCodeResponse"}]},"DetailAspectDataTractionBatteryCodeResponse":{"type":"object","properties":{"productType":{"maxLength":255,"minLength":0,"type":"string"},"tractionBatteryCode":{"maxLength":255,"minLength":0,"type":"string"},"subcomponents":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectDataTractionBatteryCodeSubcomponentResponse"}}}},"DetailAspectDataTractionBatteryCodeSubcomponentResponse":{"type":"object","properties":{"productType":{"maxLength":255,"minLength":0,"type":"string"},"tractionBatteryCode":{"maxLength":255,"minLength":0,"type":"string"}}},"DetailAspectModelResponse":{"type":"object","properties":{"type":{"type":"string","enum":["AS_BUILT","AS_PLANNED","TRACTION_BATTERY_CODE","SINGLE_LEVEL_BOM_AS_BUILT","SINGLE_LEVEL_USAGE_AS_BUILT","SINGLE_LEVEL_BOM_AS_PLANNED","PART_SITE_INFORMATION_AS_PLANNED"]},"data":{"$ref":"#/components/schemas/DetailAspectDataResponse"}}},"PartSiteInformationAsPlannedResponse":{"type":"object","properties":{"functionValidUntil":{"type":"string"},"function":{"type":"string"},"functionValidFrom":{"type":"string"},"catenaXSiteId":{"type":"string"}}},"ShellDescriptorResponse":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"globalAssetId":{"type":"string"}}},"OwnPageable":{"type":"object","properties":{"page":{"type":"integer","format":"int32"},"size":{"type":"integer","format":"int32"},"sort":{"maxItems":2147483647,"type":"array","description":"Content of Assets PageResults","example":"manufacturerPartId,desc","items":{"type":"string"}}}},"SearchCriteriaRequestParam":{"type":"object","properties":{"filter":{"maxItems":2147483647,"type":"array","description":"Filter Criteria","example":"owner,EQUAL,OWN","items":{"type":"string"}}}},"InvestigationResponse":{"type":"object","properties":{"id":{"maximum":255,"minimum":0,"type":"integer","format":"int64"},"status":{"maxLength":255,"minLength":0,"type":"string","enum":["CREATED","SENT","RECEIVED","ACKNOWLEDGED","ACCEPTED","DECLINED","CANCELED","CLOSED"]},"description":{"maxLength":1000,"minLength":0,"type":"string"},"createdBy":{"maxLength":255,"minLength":0,"type":"string"},"createdByName":{"maxLength":255,"minLength":0,"type":"string"},"createdDate":{"maxLength":50,"minLength":0,"type":"string"},"assetIds":{"maxItems":1000,"minItems":0,"type":"array","description":"assetIds","items":{"type":"string"}},"channel":{"maxLength":255,"minLength":0,"type":"string","enum":["SENDER","RECEIVER"]},"reason":{"$ref":"#/components/schemas/QualityNotificationReasonResponse"},"sendTo":{"maxLength":255,"minLength":0,"type":"string"},"sendToName":{"maxLength":255,"minLength":0,"type":"string"},"severity":{"maxLength":255,"minLength":0,"type":"string","enum":["MINOR","MAJOR","CRITICAL","LIFE-THREATENING"]},"targetDate":{"maxLength":50,"minLength":0,"type":"string"},"errorMessage":{"maxLength":255,"minLength":0,"type":"string"}}},"QualityNotificationReasonResponse":{"type":"object","properties":{"close":{"maxLength":1000,"minLength":0,"type":"string"},"accept":{"maxLength":1000,"minLength":0,"type":"string"},"decline":{"maxLength":1000,"minLength":0,"type":"string"}}},"DashboardResponse":{"type":"object","properties":{"asBuiltCustomerParts":{"type":"integer","format":"int64"},"asPlannedCustomerParts":{"type":"integer","format":"int64"},"asBuiltSupplierParts":{"type":"integer","format":"int64"},"asPlannedSupplierParts":{"type":"integer","format":"int64"},"asBuiltOwnParts":{"type":"integer","format":"int64"},"asPlannedOwnParts":{"type":"integer","format":"int64"},"myPartsWithOpenAlerts":{"type":"integer","format":"int64"},"myPartsWithOpenInvestigations":{"type":"integer","format":"int64"},"supplierPartsWithOpenAlerts":{"type":"integer","format":"int64"},"customerPartsWithOpenAlerts":{"type":"integer","format":"int64"},"supplierPartsWithOpenInvestigations":{"type":"integer","format":"int64"},"customerPartsWithOpenInvestigations":{"type":"integer","format":"int64"},"receivedActiveAlerts":{"type":"integer","format":"int64"},"receivedActiveInvestigations":{"type":"integer","format":"int64"},"sentActiveAlerts":{"type":"integer","format":"int64"},"sentActiveInvestigations":{"type":"integer","format":"int64"}}},"AlertResponse":{"type":"object","properties":{"id":{"maximum":255,"minimum":0,"type":"integer","format":"int64"},"status":{"maxLength":255,"minLength":0,"type":"string","enum":["CREATED","SENT","RECEIVED","ACKNOWLEDGED","ACCEPTED","DECLINED","CANCELED","CLOSED"]},"description":{"maxLength":1000,"minLength":0,"type":"string"},"createdBy":{"maxLength":255,"minLength":0,"type":"string"},"createdByName":{"maxLength":255,"minLength":0,"type":"string"},"createdDate":{"maxLength":50,"minLength":0,"type":"string"},"assetIds":{"maxItems":1000,"minItems":0,"type":"array","description":"assetIds","items":{"type":"string"}},"channel":{"maxLength":255,"minLength":0,"type":"string","enum":["SENDER","RECEIVER"]},"reason":{"$ref":"#/components/schemas/QualityNotificationReasonResponse"},"sendTo":{"maxLength":255,"minLength":0,"type":"string"},"sendToName":{"maxLength":255,"minLength":0,"type":"string"},"severity":{"maxLength":255,"minLength":0,"type":"string","enum":["MINOR","MAJOR","CRITICAL","LIFE-THREATENING"]},"targetDate":{"maxLength":50,"minLength":0,"type":"string"},"errorMessage":{"maxLength":255,"minLength":0,"type":"string"}}}},"securitySchemes":{"oAuth2":{"type":"oauth2","flows":{"clientCredentials":{"scopes":{"profile email":""}}}}}}} \ No newline at end of file +{"openapi":"3.0.1","info":{"title":"Trace-FOSS - OpenAPI Documentation","description":"Trace-FOSS is a system for tracking parts along the supply chain. A high level of transparency across the supplier network enables faster intervention based on a recorded event in the supply chain. This saves costs by seamlessly tracking parts and creates trust through clearly defined and secure data access by the companies and persons involved in the process.","license":{"name":"License: Apache 2.0"},"version":"1.0.0"},"servers":[{"url":"http://localhost:9998/api","description":"Generated server url"}],"security":[{"oAuth2":["profile email"]}],"tags":[{"name":"ShellDescriptorController","description":"Shell Descriptor Controller"},{"name":"Investigations","description":"Operations on Investigation Notification"}],"paths":{"/bpn-config":{"get":{"tags":["BpnEdcMapping"],"summary":"Get BPN EDC URL mappings","description":"The endpoint returns a result of BPN EDC URL mappings.","operationId":"getBpnEdcs","responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the paged result found","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}}},"security":[{"oAuth2":["profile email"]}]},"put":{"tags":["BpnEdcMapping"],"summary":"Updates BPN EDC URL mappings","description":"The endpoint updates BPN EDC URL mappings","operationId":"updateBpnEdcMappings","requestBody":{"content":{"application/json":{"schema":{"maxItems":1000,"minItems":0,"type":"array","items":{"$ref":"#/components/schemas/BpnMappingRequest"}}}},"required":true},"responses":{"200":{"description":"Returns the paged result found for BpnEdcMapping","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}},"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]},"post":{"tags":["BpnEdcMapping"],"summary":"Creates BPN EDC URL mappings","description":"The endpoint creates BPN EDC URL mappings","operationId":"createBpnEdcUrlMappings","requestBody":{"content":{"application/json":{"schema":{"maxItems":1000,"minItems":0,"type":"array","items":{"$ref":"#/components/schemas/BpnMappingRequest"}}}},"required":true},"responses":{"200":{"description":"Returns the paged result found for BpnEdcMapping","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}},"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/submodel/data/{submodelId}":{"get":{"tags":["Submodel"],"summary":"Gets Submodel by its id","description":"The endpoint returns Submodel for given id. Used for data providing functionality","operationId":"getSubmodelById","parameters":[{"name":"submodelId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the paged result found","content":{"application/json":{}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]},"post":{"tags":["Submodel"],"summary":"Save Submodel","description":"This endpoint allows you to save a Submodel identified by its ID.","operationId":"saveSubmodel","parameters":[{"name":"submodelId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"string"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Ok."},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"No Content."},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/investigations":{"get":{"tags":["Investigations"],"summary":"Gets investigations","description":"The endpoint returns investigations as paged result.","operationId":"getInvestigations","parameters":[{"name":"pageable","in":"query","required":true,"schema":{"$ref":"#/components/schemas/OwnPageable"}},{"name":"filter","in":"query","required":true,"schema":{"$ref":"#/components/schemas/SearchCriteriaRequestParam"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the paged result found for Asset","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]},"post":{"tags":["Investigations"],"summary":"Start investigations by part ids","description":"The endpoint starts investigations based on part ids provided.","operationId":"investigateAssets","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartQualityNotificationRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"201":{"description":"Created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QualityNotificationIdResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/investigations/{investigationId}/update":{"post":{"tags":["Investigations"],"summary":"Update investigations by id","description":"The endpoint updates investigations by their id.","operationId":"updateInvestigation","parameters":[{"name":"investigationId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateQualityNotificationRequest"}}},"required":true},"responses":{"204":{"description":"No content."},"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Ok."},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/investigations/{investigationId}/close":{"post":{"tags":["Investigations"],"summary":"Close investigations by id","description":"The endpoint closes investigations by their id.","operationId":"closeInvestigation","parameters":[{"name":"investigationId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloseQualityNotificationRequest"}}},"required":true},"responses":{"204":{"description":"No content."},"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Ok."},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/investigations/{investigationId}/cancel":{"post":{"tags":["Investigations"],"summary":"Cancles investigations by id","description":"The endpoint cancles investigations by their id.","operationId":"cancelInvestigation","parameters":[{"name":"investigationId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Ok."},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"No content."},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/investigations/{investigationId}/approve":{"post":{"tags":["Investigations"],"summary":"Approves investigations by id","description":"The endpoint approves investigations by their id.","operationId":"approveInvestigation","parameters":[{"name":"investigationId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Ok."},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"No content."},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/edc/notification/contract":{"post":{"tags":["Notifications"],"summary":"Triggers EDC notification contract","description":"The endpoint Triggers EDC notification contract based on notification type and method","operationId":"createNotificationContract","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateNotificationContractRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"201":{"description":"Created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateNotificationContractResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/import":{"post":{"tags":["AssetsImport"],"summary":"asset upload","description":"This endpoint stores assets in the application. Those can be later published in the Catena-X network.","operationId":"importJson","requestBody":{"content":{"multipart/form-data":{"schema":{"required":["file"],"type":"object","properties":{"file":{"type":"string","format":"binary"}}}}}},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"OK.","content":{"application/json":{}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"No Content."}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-planned/sync":{"post":{"tags":["AssetsAsPlanned"],"summary":"Synchronizes assets from IRS","description":"The endpoint synchronizes the assets from irs.","operationId":"sync","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SyncAssetsRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"201":{"description":"Created."}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-planned/detail-information":{"post":{"tags":["AssetsAsPlanned"],"summary":"Searches for assets by ids.","description":"The endpoint searchs for assets by id and returns a list of them.","operationId":"getDetailInformation","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetDetailInformationRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the paged result found for Asset","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-built/sync":{"post":{"tags":["AssetsAsBuilt"],"summary":"Synchronizes assets from IRS","description":"The endpoint synchronizes the assets from irs.","operationId":"sync_1","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SyncAssetsRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"201":{"description":"Created."}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-built/detail-information":{"post":{"tags":["AssetsAsBuilt"],"summary":"Searches for assets by ids.","description":"The endpoint searchs for assets by id and returns a list of them.","operationId":"getDetailInformation_1","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetDetailInformationRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the paged result found for Asset","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/alerts":{"get":{"tags":["Alerts"],"summary":"Gets alerts","description":"The endpoint returns alerts as paged result.","operationId":"getAlerts","parameters":[{"name":"pageable","in":"query","required":true,"schema":{"$ref":"#/components/schemas/OwnPageable"}},{"name":"filter","in":"query","required":true,"schema":{"$ref":"#/components/schemas/SearchCriteriaRequestParam"}}],"responses":{"200":{"description":"Returns the paged result found for Asset","content":{"application/json":{"schema":{"maxItems":2147483647,"type":"array"}}}},"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]},"post":{"tags":["Alerts"],"summary":"Start alert by part ids","description":"The endpoint starts alert based on part ids provided.","operationId":"alertAssets","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartQualityNotificationRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"201":{"description":"Created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QualityNotificationIdResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/alerts/{alertId}/update":{"post":{"tags":["Alerts"],"summary":"Update alert by id","description":"The endpoint updates alert by their id.","operationId":"updateAlert","parameters":[{"name":"alertId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateQualityNotificationRequest"}}},"required":true},"responses":{"204":{"description":"No content."},"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/alerts/{alertId}/close":{"post":{"tags":["Alerts"],"summary":"Close alert by id","description":"The endpoint closes alert by id.","operationId":"closeAlert","parameters":[{"name":"alertId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloseQualityNotificationRequest"}}},"required":true},"responses":{"204":{"description":"No content."},"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Ok."},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/alerts/{alertId}/cancel":{"post":{"tags":["Alerts"],"summary":"Cancels alert by id","description":"The endpoint cancels alert by id.","operationId":"cancelAlert","parameters":[{"name":"alertId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Ok."},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"No content."},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/alerts/{alertId}/approve":{"post":{"tags":["Alerts"],"summary":"Approves alert by id","description":"The endpoint approves alert by id.","operationId":"approveAlert","parameters":[{"name":"alertId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Ok."},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"No content."},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-planned/{assetId}":{"get":{"tags":["AssetsAsPlanned"],"summary":"Get asset by id","description":"The endpoint returns an asset filtered by id .","operationId":"assetById","parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Returns the assets found","content":{"application/json":{"schema":{"maxItems":2147483647,"type":"array","description":"Assets","items":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"},"semanticModelId":{"maxLength":255,"minLength":0,"type":"string"},"businessPartner":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerName":{"maxLength":255,"minLength":0,"type":"string"},"nameAtManufacturer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerPartId":{"maxLength":255,"minLength":0,"type":"string"},"owner":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]},"childRelations":{"maxItems":2147483647,"type":"array","description":"Child relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"parentRelations":{"maxItems":2147483647,"type":"array","description":"Parent relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"activeAlert":{"type":"boolean"},"underInvestigation":{"type":"boolean"},"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]},"van":{"maxLength":255,"minLength":0,"type":"string"},"semanticDataModel":{"type":"string","enum":["BATCH","SERIALPART","UNKNOWN","PARTASPLANNED","JUSTINSEQUENCE"]},"classification":{"maxLength":255,"minLength":0,"type":"string"},"detailAspectModels":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectModelResponse"}},"sentQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"sentQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"importState":{"type":"string","enum":["TRANSIENT","PERSISTENT","ERROR","IN_SYNCHRONIZATION","UNSET"]},"importNote":{"type":"string"}}}}}}},"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]},"patch":{"tags":["AssetsAsPlanned"],"summary":"Updates asset","description":"The endpoint updates asset by provided quality type.","operationId":"updateAsset","parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAssetRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the updated asset","content":{"application/json":{"schema":{"maxItems":2147483647,"type":"array","description":"Assets","items":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"},"semanticModelId":{"maxLength":255,"minLength":0,"type":"string"},"businessPartner":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerName":{"maxLength":255,"minLength":0,"type":"string"},"nameAtManufacturer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerPartId":{"maxLength":255,"minLength":0,"type":"string"},"owner":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]},"childRelations":{"maxItems":2147483647,"type":"array","description":"Child relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"parentRelations":{"maxItems":2147483647,"type":"array","description":"Parent relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"activeAlert":{"type":"boolean"},"underInvestigation":{"type":"boolean"},"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]},"van":{"maxLength":255,"minLength":0,"type":"string"},"semanticDataModel":{"type":"string","enum":["BATCH","SERIALPART","UNKNOWN","PARTASPLANNED","JUSTINSEQUENCE"]},"classification":{"maxLength":255,"minLength":0,"type":"string"},"detailAspectModels":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectModelResponse"}},"sentQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"sentQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"importState":{"type":"string","enum":["TRANSIENT","PERSISTENT","ERROR","IN_SYNCHRONIZATION","UNSET"]},"importNote":{"type":"string"}}}}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-built/{assetId}":{"get":{"tags":["AssetsAsBuilt"],"summary":"Get asset by id","description":"The endpoint returns an asset filtered by id .","operationId":"assetById_1","parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the assets found","content":{"application/json":{"schema":{"maxItems":2147483647,"type":"array","description":"Assets","items":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"},"semanticModelId":{"maxLength":255,"minLength":0,"type":"string"},"businessPartner":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerName":{"maxLength":255,"minLength":0,"type":"string"},"nameAtManufacturer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerPartId":{"maxLength":255,"minLength":0,"type":"string"},"owner":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]},"childRelations":{"maxItems":2147483647,"type":"array","description":"Child relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"parentRelations":{"maxItems":2147483647,"type":"array","description":"Parent relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"activeAlert":{"type":"boolean"},"underInvestigation":{"type":"boolean"},"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]},"van":{"maxLength":255,"minLength":0,"type":"string"},"semanticDataModel":{"type":"string","enum":["BATCH","SERIALPART","UNKNOWN","PARTASPLANNED","JUSTINSEQUENCE"]},"classification":{"maxLength":255,"minLength":0,"type":"string"},"detailAspectModels":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectModelResponse"}},"sentQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"sentQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"importState":{"type":"string","enum":["TRANSIENT","PERSISTENT","ERROR","IN_SYNCHRONIZATION","UNSET"]},"importNote":{"type":"string"}}}}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]},"patch":{"tags":["AssetsAsBuilt"],"summary":"Updates asset","description":"The endpoint updates asset by provided quality type.","operationId":"updateAsset_1","parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAssetRequest"}}},"required":true},"responses":{"200":{"description":"Returns the updated asset","content":{"application/json":{"schema":{"maxItems":2147483647,"type":"array","description":"Assets","items":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"},"semanticModelId":{"maxLength":255,"minLength":0,"type":"string"},"businessPartner":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerName":{"maxLength":255,"minLength":0,"type":"string"},"nameAtManufacturer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerPartId":{"maxLength":255,"minLength":0,"type":"string"},"owner":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]},"childRelations":{"maxItems":2147483647,"type":"array","description":"Child relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"parentRelations":{"maxItems":2147483647,"type":"array","description":"Parent relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"activeAlert":{"type":"boolean"},"underInvestigation":{"type":"boolean"},"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]},"van":{"maxLength":255,"minLength":0,"type":"string"},"semanticDataModel":{"type":"string","enum":["BATCH","SERIALPART","UNKNOWN","PARTASPLANNED","JUSTINSEQUENCE"]},"classification":{"maxLength":255,"minLength":0,"type":"string"},"detailAspectModels":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectModelResponse"}},"sentQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"sentQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"importState":{"type":"string","enum":["TRANSIENT","PERSISTENT","ERROR","IN_SYNCHRONIZATION","UNSET"]},"importNote":{"type":"string"}}}}}}},"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/shelldescriptors":{"get":{"tags":["ShellDescriptorController"],"summary":"FindAll shell descriptors","description":"The endpoint returns all shell descriptors.","operationId":"findAll","responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"ShellDescriptors found.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ShellDescriptorResponse"}}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]},"delete":{"tags":["Registry","ShellDescriptorController"],"summary":"Triggers deleteAll of shell descriptors list","description":"The endpoint deletes all shell descriptors.","operationId":"deleteAll","responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"Deleted."},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/registry/reload":{"get":{"tags":["Registry"],"summary":"Triggers reload of shell descriptors","description":"The endpoint Triggers reload of shell descriptors.","operationId":"reload","responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"202":{"description":"Created registry reload job."},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/investigations/{investigationId}":{"get":{"tags":["Investigations"],"summary":"Gets investigations by id","description":"The endpoint returns investigations as paged result by their id.","operationId":"getInvestigation","parameters":[{"name":"investigationId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"OK.","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":-2147483648,"type":"array","description":"Investigations","items":{"$ref":"#/components/schemas/InvestigationResponse"}}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/investigations/distinctFilterValues":{"get":{"tags":["Assets","Investigations"],"summary":"getDistinctFilterValues","description":"The endpoint returns a distinct filter values for given fieldName.","operationId":"distinctFilterValues","parameters":[{"name":"fieldName","in":"query","required":true,"schema":{"type":"string"}},{"name":"size","in":"query","required":true,"schema":{"type":"integer","format":"int32"}},{"name":"startWith","in":"query","required":true,"schema":{"type":"string"}},{"name":"channel","in":"query","required":true,"schema":{"type":"string","enum":["SENDER","RECEIVER"]}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns a distinct filter values for given fieldName.","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/dashboard":{"get":{"tags":["Dashboard"],"summary":"Returns dashboard related data","description":"The endpoint can return limited data based on the user role","operationId":"dashboard","responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns dashboard data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-planned":{"get":{"tags":["AssetsAsPlanned"],"summary":"Get assets by pagination","description":"The endpoint returns a paged result of assets.","operationId":"AssetsAsPlanned","parameters":[{"name":"pageable","in":"query","required":true,"schema":{"$ref":"#/components/schemas/OwnPageable"}},{"name":"filter","in":"query","required":true,"schema":{"$ref":"#/components/schemas/SearchCriteriaRequestParam"}}],"responses":{"200":{"description":"Returns the paged result found for Asset","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array","items":{"maxItems":2147483647,"type":"array","description":"Assets","items":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"},"semanticModelId":{"maxLength":255,"minLength":0,"type":"string"},"businessPartner":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerName":{"maxLength":255,"minLength":0,"type":"string"},"nameAtManufacturer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerPartId":{"maxLength":255,"minLength":0,"type":"string"},"owner":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]},"childRelations":{"maxItems":2147483647,"type":"array","description":"Child relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"parentRelations":{"maxItems":2147483647,"type":"array","description":"Parent relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"activeAlert":{"type":"boolean"},"underInvestigation":{"type":"boolean"},"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]},"van":{"maxLength":255,"minLength":0,"type":"string"},"semanticDataModel":{"type":"string","enum":["BATCH","SERIALPART","UNKNOWN","PARTASPLANNED","JUSTINSEQUENCE"]},"classification":{"maxLength":255,"minLength":0,"type":"string"},"detailAspectModels":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectModelResponse"}},"sentQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"sentQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"importState":{"type":"string","enum":["TRANSIENT","PERSISTENT","ERROR","IN_SYNCHRONIZATION","UNSET"]},"importNote":{"type":"string"}}}}}}}},"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-planned/{assetId}/children/{childId}":{"get":{"tags":["AssetsAsPlanned"],"summary":"Get asset by child id","description":"The endpoint returns an asset filtered by child id.","operationId":"assetByChildId","parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"}},{"name":"childId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the asset by childId","content":{"application/json":{"schema":{"maxItems":2147483647,"type":"array","description":"Assets","items":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"},"semanticModelId":{"maxLength":255,"minLength":0,"type":"string"},"businessPartner":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerName":{"maxLength":255,"minLength":0,"type":"string"},"nameAtManufacturer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerPartId":{"maxLength":255,"minLength":0,"type":"string"},"owner":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]},"childRelations":{"maxItems":2147483647,"type":"array","description":"Child relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"parentRelations":{"maxItems":2147483647,"type":"array","description":"Parent relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"activeAlert":{"type":"boolean"},"underInvestigation":{"type":"boolean"},"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]},"van":{"maxLength":255,"minLength":0,"type":"string"},"semanticDataModel":{"type":"string","enum":["BATCH","SERIALPART","UNKNOWN","PARTASPLANNED","JUSTINSEQUENCE"]},"classification":{"maxLength":255,"minLength":0,"type":"string"},"detailAspectModels":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectModelResponse"}},"sentQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"sentQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"importState":{"type":"string","enum":["TRANSIENT","PERSISTENT","ERROR","IN_SYNCHRONIZATION","UNSET"]},"importNote":{"type":"string"}}}}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-planned/distinctFilterValues":{"get":{"tags":["Assets","AssetsAsPlanned"],"summary":"getDistinctFilterValues","description":"The endpoint returns a distinct filter values for given fieldName.","operationId":"distinctFilterValues_1","parameters":[{"name":"fieldName","in":"query","required":true,"schema":{"type":"string"}},{"name":"size","in":"query","required":true,"schema":{"type":"integer","format":"int32"}},{"name":"startWith","in":"query","required":true,"schema":{"type":"string"}},{"name":"owner","in":"query","required":true,"schema":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns a distinct filter values for given fieldName.","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-built":{"get":{"tags":["AssetsAsBuilt"],"summary":"Get assets by pagination","description":"The endpoint returns a paged result of assets.","operationId":"assets","parameters":[{"name":"pageable","in":"query","required":true,"schema":{"$ref":"#/components/schemas/OwnPageable"}},{"name":"searchCriteriaRequestParam","in":"query","required":true,"schema":{"$ref":"#/components/schemas/SearchCriteriaRequestParam"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the paged result found for Asset","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array","items":{"maxItems":2147483647,"type":"array","description":"Assets","items":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"},"semanticModelId":{"maxLength":255,"minLength":0,"type":"string"},"businessPartner":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerName":{"maxLength":255,"minLength":0,"type":"string"},"nameAtManufacturer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerPartId":{"maxLength":255,"minLength":0,"type":"string"},"owner":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]},"childRelations":{"maxItems":2147483647,"type":"array","description":"Child relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"parentRelations":{"maxItems":2147483647,"type":"array","description":"Parent relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"activeAlert":{"type":"boolean"},"underInvestigation":{"type":"boolean"},"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]},"van":{"maxLength":255,"minLength":0,"type":"string"},"semanticDataModel":{"type":"string","enum":["BATCH","SERIALPART","UNKNOWN","PARTASPLANNED","JUSTINSEQUENCE"]},"classification":{"maxLength":255,"minLength":0,"type":"string"},"detailAspectModels":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectModelResponse"}},"sentQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"sentQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"importState":{"type":"string","enum":["TRANSIENT","PERSISTENT","ERROR","IN_SYNCHRONIZATION","UNSET"]},"importNote":{"type":"string"}}}}}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-built/{assetId}/children/{childId}":{"get":{"tags":["AssetsAsBuilt"],"summary":"Get asset by child id","description":"The endpoint returns an asset filtered by child id.","operationId":"assetByChildId_1","parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"}},{"name":"childId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Returns the asset by childId","content":{"application/json":{"schema":{"maxItems":2147483647,"type":"array","description":"Assets","items":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"},"semanticModelId":{"maxLength":255,"minLength":0,"type":"string"},"businessPartner":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerName":{"maxLength":255,"minLength":0,"type":"string"},"nameAtManufacturer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturerPartId":{"maxLength":255,"minLength":0,"type":"string"},"owner":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]},"childRelations":{"maxItems":2147483647,"type":"array","description":"Child relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"parentRelations":{"maxItems":2147483647,"type":"array","description":"Parent relationships","items":{"$ref":"#/components/schemas/DescriptionsResponse"}},"activeAlert":{"type":"boolean"},"underInvestigation":{"type":"boolean"},"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]},"van":{"maxLength":255,"minLength":0,"type":"string"},"semanticDataModel":{"type":"string","enum":["BATCH","SERIALPART","UNKNOWN","PARTASPLANNED","JUSTINSEQUENCE"]},"classification":{"maxLength":255,"minLength":0,"type":"string"},"detailAspectModels":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectModelResponse"}},"sentQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityAlertIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"sentQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"receivedQualityInvestigationIdsInStatusActive":{"type":"array","items":{"type":"integer","format":"int64"}},"importState":{"type":"string","enum":["TRANSIENT","PERSISTENT","ERROR","IN_SYNCHRONIZATION","UNSET"]},"importNote":{"type":"string"}}}}}}},"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-built/distinctFilterValues":{"get":{"tags":["AssetsAsBuilt","Assets"],"summary":"getDistinctFilterValues","description":"The endpoint returns a distinct filter values for given fieldName.","operationId":"distinctFilterValues_2","parameters":[{"name":"fieldName","in":"query","required":true,"schema":{"type":"string"}},{"name":"size","in":"query","required":true,"schema":{"type":"integer","format":"int32"}},{"name":"startWith","in":"query","required":true,"schema":{"type":"string"}},{"name":"owner","in":"query","required":true,"schema":{"type":"string","enum":["SUPPLIER","CUSTOMER","OWN","UNKNOWN"]}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns a distinct filter values for given fieldName.","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/assets/as-built/countries":{"get":{"tags":["AssetsAsBuilt"],"summary":"Get map of assets","description":"The endpoint returns a map for assets consumed by the map.","operationId":"assetsCountryMap","responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns the assets found","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"integer","format":"int64"}}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/alerts/{alertId}":{"get":{"tags":["Alerts"],"summary":"Gets Alert by id","description":"The endpoint returns alert by id.","operationId":"getAlert","parameters":[{"name":"alertId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"OK.","content":{"application/json":{"schema":{"maxItems":2147483647,"type":"array","description":"Alerts","items":{"$ref":"#/components/schemas/AlertResponse"}}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/alerts/distinctFilterValues":{"get":{"tags":["Assets","Alerts"],"summary":"getDistinctFilterValues","description":"The endpoint returns a distinct filter values for given fieldName.","operationId":"distinctFilterValues_3","parameters":[{"name":"fieldName","in":"query","required":true,"schema":{"type":"string"}},{"name":"size","in":"query","required":true,"schema":{"type":"integer","format":"int32"}},{"name":"startWith","in":"query","required":true,"schema":{"type":"string"}},{"name":"channel","in":"query","required":true,"schema":{"type":"string","enum":["SENDER","RECEIVER"]}}],"responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Returns a distinct filter values for given fieldName.","content":{"application/json":{"schema":{"maxItems":2147483647,"minItems":0,"type":"array"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/submodel/data":{"delete":{"tags":["Submodel"],"summary":"Delete All Submodels","description":"Deletes all submodels from the system.","operationId":"deleteSubmodels","responses":{"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Ok."},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"No Content."},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}},"/bpn-config/{bpn}":{"delete":{"tags":["BpnEdcMapping"],"summary":"Deletes BPN EDC URL mappings","description":"The endpoint deletes BPN EDC URL mappings","operationId":"deleteBpnEdcUrlMappings","parameters":[{"name":"bpn","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Okay"},"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"415":{"description":"Unsupported media type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"204":{"description":"Deleted."},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authorization failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oAuth2":["profile email"]}]}}},"components":{"schemas":{"BpnMappingRequest":{"required":["bpn","url"],"type":"object","properties":{"bpn":{"maxLength":255,"minLength":0,"type":"string"},"url":{"maxLength":255,"minLength":0,"type":"string"}}},"ErrorResponse":{"type":"object","properties":{"message":{"maxLength":1000,"minLength":0,"pattern":"^.*$","type":"string"}}},"StartQualityNotificationRequest":{"required":["severity"],"type":"object","properties":{"partIds":{"maxItems":100,"minItems":1,"type":"array","items":{"type":"string"}},"description":{"maxLength":1000,"minLength":15,"type":"string"},"targetDate":{"type":"string","format":"date-time"},"severity":{"type":"string","enum":["MINOR","MAJOR","CRITICAL","LIFE_THREATENING"]},"receiverBpn":{"type":"string"},"asBuilt":{"type":"boolean"}}},"QualityNotificationIdResponse":{"type":"object","properties":{"id":{"type":"integer","format":"int64"}}},"UpdateQualityNotificationRequest":{"required":["status"],"type":"object","properties":{"status":{"type":"string","description":"The UpdateInvestigationStatus","enum":["ACKNOWLEDGED","ACCEPTED","DECLINED"]},"reason":{"type":"string"}}},"CloseQualityNotificationRequest":{"type":"object","properties":{"reason":{"maxLength":1000,"minLength":15,"type":"string"}}},"CreateNotificationContractRequest":{"required":["notificationMethod","notificationType"],"type":"object","properties":{"notificationType":{"type":"string","enum":["QUALITY_INVESTIGATION","QUALITY_ALERT"]},"notificationMethod":{"type":"string","enum":["RECEIVE","UPDATE","RESOLVE"]}}},"CreateNotificationContractResponse":{"type":"object","properties":{"notificationAssetId":{"type":"string"},"accessPolicyId":{"type":"string"},"contractDefinitionId":{"type":"string"}}},"SyncAssetsRequest":{"type":"object","properties":{"globalAssetIds":{"maxItems":100,"minItems":1,"type":"array","description":"Assets","items":{"type":"string"}}}},"GetDetailInformationRequest":{"type":"object","properties":{"assetIds":{"maxItems":50,"minItems":1,"type":"array","items":{"type":"string"}}}},"UpdateAssetRequest":{"required":["qualityType"],"type":"object","properties":{"qualityType":{"type":"string","enum":["Ok","Minor","Major","Critical","LifeThreatening"]}}},"DescriptionsResponse":{"type":"object","properties":{"id":{"maxLength":255,"minLength":0,"type":"string"},"idShort":{"maxLength":255,"minLength":0,"type":"string"}}},"DetailAspectDataAsBuiltResponse":{"type":"object","properties":{"partId":{"maxLength":255,"minLength":0,"type":"string"},"customerPartId":{"maxLength":255,"minLength":0,"type":"string"},"nameAtCustomer":{"maxLength":255,"minLength":0,"type":"string"},"manufacturingCountry":{"maxLength":255,"minLength":0,"type":"string"},"manufacturingDate":{"maxLength":255,"minLength":0,"type":"string"}}},"DetailAspectDataAsPlannedResponse":{"type":"object","properties":{"validityPeriodFrom":{"maxLength":255,"minLength":0,"type":"string"},"validityPeriodTo":{"maxLength":255,"minLength":0,"type":"string"}}},"DetailAspectDataResponse":{"type":"object","oneOf":[{"$ref":"#/components/schemas/DetailAspectDataAsBuiltResponse"},{"$ref":"#/components/schemas/DetailAspectDataAsPlannedResponse"},{"$ref":"#/components/schemas/PartSiteInformationAsPlannedResponse"},{"$ref":"#/components/schemas/DetailAspectDataTractionBatteryCodeResponse"}]},"DetailAspectDataTractionBatteryCodeResponse":{"type":"object","properties":{"productType":{"maxLength":255,"minLength":0,"type":"string"},"tractionBatteryCode":{"maxLength":255,"minLength":0,"type":"string"},"subcomponents":{"type":"array","items":{"$ref":"#/components/schemas/DetailAspectDataTractionBatteryCodeSubcomponentResponse"}}}},"DetailAspectDataTractionBatteryCodeSubcomponentResponse":{"type":"object","properties":{"productType":{"maxLength":255,"minLength":0,"type":"string"},"tractionBatteryCode":{"maxLength":255,"minLength":0,"type":"string"}}},"DetailAspectModelResponse":{"type":"object","properties":{"type":{"type":"string","enum":["AS_BUILT","AS_PLANNED","TRACTION_BATTERY_CODE","SINGLE_LEVEL_BOM_AS_BUILT","SINGLE_LEVEL_USAGE_AS_BUILT","SINGLE_LEVEL_BOM_AS_PLANNED","PART_SITE_INFORMATION_AS_PLANNED"]},"data":{"$ref":"#/components/schemas/DetailAspectDataResponse"}}},"PartSiteInformationAsPlannedResponse":{"type":"object","properties":{"functionValidUntil":{"type":"string"},"function":{"type":"string"},"functionValidFrom":{"type":"string"},"catenaXSiteId":{"type":"string"}}},"ShellDescriptorResponse":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"globalAssetId":{"type":"string"}}},"OwnPageable":{"type":"object","properties":{"page":{"type":"integer","format":"int32"},"size":{"type":"integer","format":"int32"},"sort":{"maxItems":2147483647,"type":"array","description":"Content of Assets PageResults","example":"manufacturerPartId,desc","items":{"type":"string"}}}},"SearchCriteriaRequestParam":{"type":"object","properties":{"filter":{"maxItems":2147483647,"type":"array","description":"Filter Criteria","example":"owner,EQUAL,OWN","items":{"type":"string"}}}},"InvestigationResponse":{"type":"object","properties":{"id":{"maximum":255,"minimum":0,"type":"integer","format":"int64"},"status":{"maxLength":255,"minLength":0,"type":"string","enum":["CREATED","SENT","RECEIVED","ACKNOWLEDGED","ACCEPTED","DECLINED","CANCELED","CLOSED"]},"description":{"maxLength":1000,"minLength":0,"type":"string"},"createdBy":{"maxLength":255,"minLength":0,"type":"string"},"createdByName":{"maxLength":255,"minLength":0,"type":"string"},"createdDate":{"maxLength":50,"minLength":0,"type":"string"},"assetIds":{"maxItems":1000,"minItems":0,"type":"array","description":"assetIds","items":{"type":"string"}},"channel":{"maxLength":255,"minLength":0,"type":"string","enum":["SENDER","RECEIVER"]},"reason":{"$ref":"#/components/schemas/QualityNotificationReasonResponse"},"sendTo":{"maxLength":255,"minLength":0,"type":"string"},"sendToName":{"maxLength":255,"minLength":0,"type":"string"},"severity":{"maxLength":255,"minLength":0,"type":"string","enum":["MINOR","MAJOR","CRITICAL","LIFE-THREATENING"]},"targetDate":{"maxLength":50,"minLength":0,"type":"string"},"errorMessage":{"maxLength":255,"minLength":0,"type":"string"}}},"QualityNotificationReasonResponse":{"type":"object","properties":{"close":{"maxLength":1000,"minLength":0,"type":"string"},"accept":{"maxLength":1000,"minLength":0,"type":"string"},"decline":{"maxLength":1000,"minLength":0,"type":"string"}}},"DashboardResponse":{"type":"object","properties":{"asBuiltCustomerParts":{"type":"integer","format":"int64"},"asPlannedCustomerParts":{"type":"integer","format":"int64"},"asBuiltSupplierParts":{"type":"integer","format":"int64"},"asPlannedSupplierParts":{"type":"integer","format":"int64"},"asBuiltOwnParts":{"type":"integer","format":"int64"},"asPlannedOwnParts":{"type":"integer","format":"int64"},"myPartsWithOpenAlerts":{"type":"integer","format":"int64"},"myPartsWithOpenInvestigations":{"type":"integer","format":"int64"},"supplierPartsWithOpenAlerts":{"type":"integer","format":"int64"},"customerPartsWithOpenAlerts":{"type":"integer","format":"int64"},"supplierPartsWithOpenInvestigations":{"type":"integer","format":"int64"},"customerPartsWithOpenInvestigations":{"type":"integer","format":"int64"},"receivedActiveAlerts":{"type":"integer","format":"int64"},"receivedActiveInvestigations":{"type":"integer","format":"int64"},"sentActiveAlerts":{"type":"integer","format":"int64"},"sentActiveInvestigations":{"type":"integer","format":"int64"}}},"AlertResponse":{"type":"object","properties":{"id":{"maximum":255,"minimum":0,"type":"integer","format":"int64"},"status":{"maxLength":255,"minLength":0,"type":"string","enum":["CREATED","SENT","RECEIVED","ACKNOWLEDGED","ACCEPTED","DECLINED","CANCELED","CLOSED"]},"description":{"maxLength":1000,"minLength":0,"type":"string"},"createdBy":{"maxLength":255,"minLength":0,"type":"string"},"createdByName":{"maxLength":255,"minLength":0,"type":"string"},"createdDate":{"maxLength":50,"minLength":0,"type":"string"},"assetIds":{"maxItems":1000,"minItems":0,"type":"array","description":"assetIds","items":{"type":"string"}},"channel":{"maxLength":255,"minLength":0,"type":"string","enum":["SENDER","RECEIVER"]},"reason":{"$ref":"#/components/schemas/QualityNotificationReasonResponse"},"sendTo":{"maxLength":255,"minLength":0,"type":"string"},"sendToName":{"maxLength":255,"minLength":0,"type":"string"},"severity":{"maxLength":255,"minLength":0,"type":"string","enum":["MINOR","MAJOR","CRITICAL","LIFE-THREATENING"]},"targetDate":{"maxLength":50,"minLength":0,"type":"string"},"errorMessage":{"maxLength":255,"minLength":0,"type":"string"}}}},"securitySchemes":{"oAuth2":{"type":"oauth2","flows":{"clientCredentials":{"scopes":{"profile email":""}}}}}}} \ No newline at end of file diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequestTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequestTest.java index 830c83ec1f..d54ae407f4 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequestTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequestTest.java @@ -19,6 +19,7 @@ package org.eclipse.tractusx.traceability.assets.domain.importpoc; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -42,6 +43,7 @@ void testMapper() throws IOException { // Parse the JSON string into a JsonNode using Jackson ObjectMapper ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.registerModule(new JavaTimeModule()); ImportRequest importRequest = objectMapper.readValue(jsonString, ImportRequest.class); // Your test logic goes here From 4fe5bc5c7cab8167bd3bbc11ff687af1b2996b6e Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Fri, 22 Dec 2023 13:22:37 +0100 Subject: [PATCH 09/49] chore(fix): TRACEFOSS-XXX int env update --- .../assets/domain/importpoc/ImportRequest.java | 11 +---------- .../irs/model/response/GenericSubmodel.java | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java index d688c260d2..ce7322d993 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java @@ -56,16 +56,7 @@ static ImportRequest of( List mainAspectsAsBuilt = assetWrapperRequest.mainAspectModels(); - List upwardAspectsAsBuilt = assetWrapperRequest.upwardRelationship().stream() - .map(request -> { - // Assuming there is a method getSubmodel() in SingleLevelBomAsBuiltRequest - SingelLevelUsageAsBuiltRequest submodel = (SingelLevelUsageAsBuiltRequest) request.getPayload(); - - // Perform any additional operations on submodel if needed - - // Create a new SingleLevelBomAsBuiltRequest with the casted submodel - return new GenericSubmodel(request.getAspectType(), submodel/* pass other parameters and the modified submodel */); - }).toList(); + List upwardAspectsAsBuilt = assetWrapperRequest.upwardRelationship(); List downwardAspectsAsBuilt = assetWrapperRequest.downwardRelationship(); assetAsBuiltWrapperRequest.add(new AssetWrapperRequest(assetMetaInfoRequest, mainAspectsAsBuilt, upwardAspectsAsBuilt, downwardAspectsAsBuilt, BomLifecycle.AS_BUILT)); diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java index b4c38092db..7b4164134b 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java @@ -24,6 +24,7 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonSubTypes.Type; import com.fasterxml.jackson.annotation.JsonTypeInfo; +import lombok.extern.slf4j.Slf4j; import org.eclipse.tractusx.traceability.assets.domain.asbuilt.model.aspect.DetailAspectDataTractionBatteryCode; import org.eclipse.tractusx.traceability.assets.domain.importpoc.SingelLevelUsageAsBuiltRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.SingleLevelBomAsBuiltRequest; @@ -31,6 +32,7 @@ import org.eclipse.tractusx.traceability.assets.domain.importpoc.SingleLevelUsageAsPlannedRequest; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.semanticdatamodel.SemanticDataModel; +@Slf4j public class GenericSubmodel { @JsonTypeInfo( use = JsonTypeInfo.Id.NAME, @@ -86,6 +88,22 @@ public class GenericSubmodel { public GenericSubmodel(@JsonProperty("aspectType") String aspectType, @JsonProperty("payload") Object payload) { this.aspectType = aspectType; this.payload = payload; + // Cast payload to SemanticDataModel if it's an instance of SemanticDataModel + + + /* ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.registerModule(new JavaTimeModule()); + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + + try { + this.payloadString = objectMapper.writeValueAsString(payload); + } catch (JsonProcessingException e) { + // Handle the exception appropriately (e.g., log it) + log.error("Could not write payload for aspectType {}", aspectType, e); + throw new ImportException(e.getMessage()); + }*/ } public Object getPayload() { From 50483cd5b7f634698be2802f3bc0852ca0c11710 Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Fri, 22 Dec 2023 20:08:17 +0100 Subject: [PATCH 10/49] chore(fix): TRACEFOSS-XXX refactored properties --- .../properties/SupportedAspectTypes.java | 53 +++++++++++++++++++ .../properties/TraceabilityProperties.java | 1 + .../application-integration-spring-boot.yml | 38 +++++++++++++ tx-backend/src/main/resources/application.yml | 39 +++++++++++++- .../TraceabilityPropertiesTest.java | 16 +++++- 5 files changed, 144 insertions(+), 3 deletions(-) create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/properties/SupportedAspectTypes.java diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/properties/SupportedAspectTypes.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/properties/SupportedAspectTypes.java new file mode 100644 index 0000000000..be9af2e9cb --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/properties/SupportedAspectTypes.java @@ -0,0 +1,53 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +package org.eclipse.tractusx.traceability.common.properties; + +import java.util.List; + +public record SupportedAspectTypes(AsBuiltType asBuiltTypes, AsPlannedType asPlannedTypes) { + + public record AsBuiltType(MainAsBuiltAspectType mainAsBuiltAspectType, DetailAsBuiltAspectType detailAsBuiltAspectType, + RelationAsBuiltAspectType relationAsBuiltAspectType) { + + + } + public record MainAsBuiltAspectType(List serialParts, List batches, List justInSequences) { + } + + public record DetailAsBuiltAspectType(List tractionBatteryCodes) { + } + + public record RelationAsBuiltAspectType(List upwardRelations, List downwardRelations) { + } + + public record AsPlannedType(MainAsPlannedAspectType mainAsPlannedAspectType, + DetailAsPlannedAspectType detailAsBuiltAspectType, + RelationAsPlannedAspectType relationAsPlannedAspectType) { + record MainAsPlannedAspectType(List asPlanned) { + } + + record DetailAsPlannedAspectType(List partSiteInformationAsPlanned) { + } + + record RelationAsPlannedAspectType(List upwardRelations, List downwardRelations) { + } + } + + +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/properties/TraceabilityProperties.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/properties/TraceabilityProperties.java index b4fcb408f7..eb985ca47e 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/properties/TraceabilityProperties.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/properties/TraceabilityProperties.java @@ -46,5 +46,6 @@ public class TraceabilityProperties { @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) private OffsetDateTime validUntil; + private SupportedAspectTypes supportedAspectTypes; } diff --git a/tx-backend/src/main/resources/application-integration-spring-boot.yml b/tx-backend/src/main/resources/application-integration-spring-boot.yml index d5fa6c08eb..e59757788c 100644 --- a/tx-backend/src/main/resources/application-integration-spring-boot.yml +++ b/tx-backend/src/main/resources/application-integration-spring-boot.yml @@ -26,6 +26,44 @@ traceability: operatorType: "eq" rightOperand: "ID Trace 3.1" validUntil: "2023-07-04T16:01:05.309Z" + supportedAspectTypes: + asBuiltTypes: + mainAsBuiltAspectType: + serialParts: + - "urn:samm:io.catenax.serial_part:1.0.0#SerialPart" + - "urn:bamm:io.catenax.serial_part:1.0.0#SerialPart" + - "urn:bamm:io.catenax.serial_part:1.1.0#SerialPart" + - "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart" + batches: + - "urn:bamm:com.catenax.batch:1.0.0#Batch" + - "urn:bamm:io.catenax.batch:1.0.0#Batch" + - "urn:bamm:io.catenax.batch:1.0.2#Batch" + - "urn:samm:io.catenax.batch:2.0.0#Batch" + justInSequences: + - "urn:bamm:io.catenax.just_in_sequence_part:1.0.0#JustInSequencePart" + detailAsBuiltAspectType: + tractionBatteryCodes: + - "urn:bamm:io.catenax.traction_battery_code:1.0.0#TractionBatteryCode" + relationAsBuiltAspectType: + upwardRelations: + - "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt" + downwardRelations: + - "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt" + + asPlannedTypes: + mainAsPlannedAspectType: + asPlanned: + - "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned" + - "urn:bamm:io.catenax.part_as_planned:1.0.0#PartAsPlanned" + detailAsBuiltAspectType: + partSiteInformationAsPlanned: + - "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned" + relationAsPlannedAspectType: + upwardRelations: + - "urn:bamm:io.catenax.single_level_usage_as_planned:1.1.0#SingleLevelUsageAsPlanned" + downwardRelations: + - "urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned" + edc: api-auth-key: "integration-tests" diff --git a/tx-backend/src/main/resources/application.yml b/tx-backend/src/main/resources/application.yml index 09bbdef01e..d9c66c6c1e 100644 --- a/tx-backend/src/main/resources/application.yml +++ b/tx-backend/src/main/resources/application.yml @@ -26,8 +26,43 @@ traceability: operatorType: ${TRACEABILITY_OPERATOR_TYPE} rightOperand: ${TRACEABILITY_RIGHT_OPERAND} validUntil: ${TRACEABILITY_VALID_UNTIL} - - + supportedAspectTypes: + asBuiltTypes: + mainAsBuiltAspectType: + serialParts: + - "urn:samm:io.catenax.serial_part:1.0.0#SerialPart" + - "urn:bamm:io.catenax.serial_part:1.0.0#SerialPart" + - "urn:bamm:io.catenax.serial_part:1.1.0#SerialPart" + - "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart" + batches: + - "urn:bamm:com.catenax.batch:1.0.0#Batch" + - "urn:bamm:io.catenax.batch:1.0.0#Batch" + - "urn:bamm:io.catenax.batch:1.0.2#Batch" + - "urn:samm:io.catenax.batch:2.0.0#Batch" + justInSequences: + - "urn:bamm:io.catenax.just_in_sequence_part:1.0.0#JustInSequencePart" + detailAsBuiltAspectType: + tractionBatteryCodes: + - "urn:bamm:io.catenax.traction_battery_code:1.0.0#TractionBatteryCode" + relationAsBuiltAspectType: + upwardRelations: + - "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt" + downwardRelations: + - "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt" + + asPlannedTypes: + mainAsPlannedAspectType: + asPlanned: + - "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned" + - "urn:bamm:io.catenax.part_as_planned:1.0.0#PartAsPlanned" + detailAsBuiltAspectType: + partSiteInformationAsPlanned: + - "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned" + relationAsPlannedAspectType: + upwardRelations: + - "urn:bamm:io.catenax.single_level_usage_as_planned:1.1.0#SingleLevelUsageAsPlanned" + downwardRelations: + - "urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned" edc: ids: diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/common/properties/TraceabilityPropertiesTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/common/properties/TraceabilityPropertiesTest.java index 1a7db6cf61..d98f77f9b3 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/common/properties/TraceabilityPropertiesTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/common/properties/TraceabilityPropertiesTest.java @@ -39,7 +39,7 @@ class TraceabilityPropertiesTest { System.setProperty("TRACEABILITY_VALID_UNTIL", "2023-07-04T16:01:05.309Z"); } @Test - public void test_traceabilityProperties() { + void test_traceabilityProperties() { //GIVEN //WHEN //THEN @@ -50,6 +50,20 @@ public void test_traceabilityProperties() { assertThat(traceabilityProperties.getOperatorType()).isNotEmpty(); assertThat(traceabilityProperties.getRightOperand()).isNotEmpty(); + assertThat(traceabilityProperties.getSupportedAspectTypes().asPlannedTypes().mainAsPlannedAspectType().asPlanned()).hasSizeGreaterThan(0); + assertThat(traceabilityProperties.getSupportedAspectTypes().asPlannedTypes().detailAsBuiltAspectType().partSiteInformationAsPlanned()).hasSizeGreaterThan(0); + assertThat(traceabilityProperties.getSupportedAspectTypes().asPlannedTypes().relationAsPlannedAspectType().upwardRelations()).hasSizeGreaterThan(0); + assertThat(traceabilityProperties.getSupportedAspectTypes().asPlannedTypes().relationAsPlannedAspectType().downwardRelations()).hasSizeGreaterThan(0); + + assertThat(traceabilityProperties.getSupportedAspectTypes().asBuiltTypes().mainAsBuiltAspectType().serialParts()).hasSizeGreaterThan(0); + assertThat(traceabilityProperties.getSupportedAspectTypes().asBuiltTypes().mainAsBuiltAspectType().batches()).hasSizeGreaterThan(0); + assertThat(traceabilityProperties.getSupportedAspectTypes().asBuiltTypes().mainAsBuiltAspectType().justInSequences()).hasSizeGreaterThan(0); + + assertThat(traceabilityProperties.getSupportedAspectTypes().asBuiltTypes().detailAsBuiltAspectType().tractionBatteryCodes()).hasSizeGreaterThan(0); + assertThat(traceabilityProperties.getSupportedAspectTypes().asBuiltTypes().relationAsBuiltAspectType().upwardRelations()).hasSizeGreaterThan(0); + assertThat(traceabilityProperties.getSupportedAspectTypes().asBuiltTypes().relationAsBuiltAspectType().downwardRelations()).hasSizeGreaterThan(0); + + } } From 28c0069583117a207feedffc9195ab11c0ea615a Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Fri, 22 Dec 2023 20:11:01 +0100 Subject: [PATCH 11/49] chore(fix): TRACEFOSS-XXX refactored properties --- .../traceability/assets/application/ImportController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java index bc1f85d55a..0e2c69e2e2 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java @@ -123,7 +123,7 @@ public ResponseEntity importJson(@RequestPart("file") Multip .body(new ValidationResponse(validationResult)); } - importService.importAssets(file); + importService.importAssets(file); return ResponseEntity.noContent().build(); } } From 33cf1f5ce8deec36312b5a757735b6e2fd669031 Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Mon, 8 Jan 2024 11:05:02 +0100 Subject: [PATCH 12/49] feat(mapping): TRACEFOSS-2741 alternative approach --- .../application/importpoc/ImportService.java | 2 + .../domain/importpoc/AssetWrapperRequest.java | 7 ++- .../domain/importpoc/ImportRequest.java | 3 +- .../domain/importpoc/ImportRequestV2.java | 16 ++++++ .../importpoc/service/ImportServiceImpl.java | 46 ++++++++++++++++- .../service/LifecycleMappingStrategy.java | 9 ++++ .../importpoc/v2/AsBuiltMainAspectV2.java | 19 +++++++ .../assets/domain/importpoc/v2/BatchV2.java | 21 ++++++++ .../domain/importpoc/v2/JustInSequenceV2.java | 26 ++++++++++ .../domain/importpoc/v2/MappingStrategy.java | 5 ++ .../domain/importpoc/v2/PartAsPlannedV2.java | 17 +++++++ .../assets/domain/importpoc/v2/PartBase.java | 10 ++++ .../v2/PartSiteInformationAsPlannedV2.java | 32 ++++++++++++ .../domain/importpoc/v2/SerialPartV2.java | 25 ++++++++++ .../v2/SingelLevelUsageAsBuiltV2.java | 34 +++++++++++++ .../importpoc/v2/SingleLevelBomAsBuiltV2.java | 38 ++++++++++++++ .../v2/SingleLevelBomAsPlannedV2.java | 48 ++++++++++++++++++ .../v2/SingleLevelUsageAsPlannedV2.java | 50 +++++++++++++++++++ .../irs/model/response/GenericSubmodel.java | 32 ++++-------- .../service/ImportServiceImplTest.java | 8 +-- .../testdata/importfiles/validImportFile.json | 7 --- 21 files changed, 417 insertions(+), 38 deletions(-) create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequestV2.java create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/LifecycleMappingStrategy.java create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsBuiltMainAspectV2.java create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/BatchV2.java create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/JustInSequenceV2.java create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/MappingStrategy.java create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/PartAsPlannedV2.java create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/PartBase.java create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/PartSiteInformationAsPlannedV2.java create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SerialPartV2.java create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingelLevelUsageAsBuiltV2.java create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingleLevelBomAsBuiltV2.java create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingleLevelBomAsPlannedV2.java create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingleLevelUsageAsPlannedV2.java diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/importpoc/ImportService.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/importpoc/ImportService.java index 876df7a2ea..277c45f0fb 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/importpoc/ImportService.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/importpoc/ImportService.java @@ -24,4 +24,6 @@ public interface ImportService { void importAssets(MultipartFile file); + + void importAssetV2(MultipartFile file); } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java index a7c6fb17e7..8e613fe156 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java @@ -22,7 +22,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.request.BomLifecycle; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; -import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.Submodel; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.semanticdatamodel.SemanticDataModel; import java.util.ArrayList; @@ -44,15 +43,15 @@ static AssetWrapperRequest of( List downwardSubmodels = submodels.stream().filter(submodel -> isDownwardRelationship(submodel.getAspectType())).toList(); List mainAspectSubmodels = submodels.stream().filter(submodel -> isMainAspect(submodel.getAspectType())).toList(); List mainAspectSemanticDataModel = transformMainAspectModel(mainAspectSubmodels); - BomLifecycle bom = mainAspectSubmodels.stream().findAny() - .map(submodel -> submodel.getAspectType().contains("AsPlanned") ? BomLifecycle.AS_PLANNED : BomLifecycle.AS_BUILT).orElseThrow(); + BomLifecycle bom = mainAspectSubmodels.stream().findAny() + .map(submodel -> submodel.getAspectType().contains("AsPlanned") ? BomLifecycle.AS_PLANNED : BomLifecycle.AS_BUILT).orElseThrow(); return new AssetWrapperRequest(assetMetaInfoRequest, mainAspectSemanticDataModel, upwardSubmodels, downwardSubmodels, bom); } private static List transformMainAspectModel(List submodels) { List semanticDataModels = new ArrayList<>(); - for (GenericSubmodel submodel : submodels){ + for (GenericSubmodel submodel : submodels) { SemanticDataModel payload = (SemanticDataModel) submodel.getPayload(); payload.setAspectType(submodel.getAspectType()); semanticDataModels.add(payload); diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java index ce7322d993..318ba83e56 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java @@ -41,7 +41,6 @@ public record ImportRequest( Map> bomLifecycleToAssetWrapperRequestList ) { - @JsonCreator static ImportRequest of( @JsonProperty("assets") List assetRawRequestList @@ -99,7 +98,7 @@ private List mapToOwnPartsAsBuilt() { .mainAspectModels() .stream() .filter(semanticDataModel -> semanticDataModel.aspectType().contains("traction_battery_code")) - .map(semanticDataModel -> (DetailAspectDataTractionBatteryCode) semanticDataModel).toList(); + .map(DetailAspectDataTractionBatteryCode.class::cast).toList(); List downwardModels = assetWrapperRequest.downwardRelationship(); List upwardModels = assetWrapperRequest.upwardRelationship(); diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequestV2.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequestV2.java new file mode 100644 index 0000000000..7ad0861b5f --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequestV2.java @@ -0,0 +1,16 @@ +package org.eclipse.tractusx.traceability.assets.domain.importpoc; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.ToString; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.AssetMetaInfoRequest; +import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; + +import java.util.List; + +public record ImportRequestV2(@JsonProperty("assets") List assets) { + public record AssetImportRequestV2(@JsonProperty("assetMetaInfo") AssetMetaInfoRequest assetMetaInfoRequest, + @JsonProperty("submodels") List submodels) { + } + + +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java index 2f0ff95a57..be048bbb72 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java @@ -21,18 +21,24 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.eclipse.tractusx.traceability.assets.application.base.service.AssetBaseService; import org.eclipse.tractusx.traceability.assets.application.importpoc.ImportService; import org.eclipse.tractusx.traceability.assets.domain.asbuilt.repository.AssetAsBuiltRepository; import org.eclipse.tractusx.traceability.assets.domain.asplanned.repository.AssetAsPlannedRepository; import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.AssetWrapperRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.ImportRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.exception.ImportException; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.AsBuiltMainAspectV2; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.ImportRequestV2; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.PartAsPlannedV2; +import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; @Slf4j @@ -43,6 +49,7 @@ public class ImportServiceImpl implements ImportService { private final AssetAsPlannedRepository assetAsPlannedRepository; private final AssetAsBuiltRepository assetAsBuiltRepository; private final TraceabilityProperties traceabilityProperties; + @Override public void importAssets(MultipartFile file) { try { @@ -50,6 +57,7 @@ public void importAssets(MultipartFile file) { log.info("Imported file: " + fileContent); ImportRequest importRequest = objectMapper.readValue(fileContent, ImportRequest.class); + List persistedAsBuilts = this.assetAsBuiltRepository.saveAll(importRequest.convertAssetsAsBuilt()); try { log.info("persistedAsBuilts as JSON {}", objectMapper.writeValueAsString(persistedAsBuilts)); @@ -67,4 +75,40 @@ public void importAssets(MultipartFile file) { throw new ImportException(e.getMessage()); } } + + @Override + public void importAssetV2(MultipartFile file) { + try { + ImportRequestV2 importRequest = objectMapper.readValue(file.getBytes(), ImportRequestV2.class); + log.info(importRequest.toString()); + + + List asBuilt = new ArrayList<>(); + List asPlanned = new ArrayList<>(); + + + for (ImportRequestV2.AssetImportRequestV2 asset : importRequest.assets()) { + + String catenaXId = asset.assetMetaInfoRequest().catenaXId(); + for (GenericSubmodel genericSubmodel : asset.submodels()) { + + if (genericSubmodel.getPayload() instanceof AsBuiltMainAspectV2) { + + } + if (genericSubmodel.getPayload() instanceof PartAsPlannedV2){ + + } + + } + } + + } catch (Exception e) { + log.error("did not work"); + } + } + + public List toAssetBase(ImportRequestV2 importRequestV2) { + List list = new ArrayList<>(); + return Collections.emptyList(); + } } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/LifecycleMappingStrategy.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/LifecycleMappingStrategy.java new file mode 100644 index 0000000000..18c1c2ed99 --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/LifecycleMappingStrategy.java @@ -0,0 +1,9 @@ +package org.eclipse.tractusx.traceability.assets.domain.importpoc.service; + +import org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel; + +import java.util.List; + +public interface LifecycleMappingStrategy { + +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsBuiltMainAspectV2.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsBuiltMainAspectV2.java new file mode 100644 index 0000000000..22537d71be --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsBuiltMainAspectV2.java @@ -0,0 +1,19 @@ +package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; + +import java.util.List; + +public record AsBuiltMainAspectV2(List localIdentifiers, + ManufacturingInformation manufacturingInformation, + String catenaXId, + PartTypeInformation partTypeInformation) { + + public record LocalIdentifier(String value, String key) { + } + + public record ManufacturingInformation(String date, String country) { + } + + public record PartTypeInformation(String manufacturerPartId, String classification, String nameAtManufacturer) { + } + +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/BatchV2.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/BatchV2.java new file mode 100644 index 0000000000..18f39271cf --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/BatchV2.java @@ -0,0 +1,21 @@ +package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; + +import lombok.Getter; + +import java.util.List; + +public record BatchV2(List localIdentifiers, + ManufacturingInformation manufacturingInformation, + String catenaXId, + PartTypeInformation partTypeInformation) { + + public record LocalIdentifier(String value, String key) { + } + + public record ManufacturingInformation(String date, String country) { + } + + public record PartTypeInformation(String manufacturerPartId, String classification, String nameAtManufacturer) { + } + +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/JustInSequenceV2.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/JustInSequenceV2.java new file mode 100644 index 0000000000..3240fa09eb --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/JustInSequenceV2.java @@ -0,0 +1,26 @@ +package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; + +import java.time.LocalDateTime; +import java.util.List; + +public record JustInSequenceV2(String catenaXId, List localIdentifiers, + SerialPartV2.PartTypeInformation partTypeInformation, + SerialPartV2.ManufacturingInformation manufacturingInformation) { + + public record LocalIdentifier(String value, String key) { + } + + public record ManufacturingInformation(LocalDateTime date, String country) { + } + + public record PartTypeInformation(String manufacturerPartId, String classification, String nameAtManufacturer, String customerPartId, String nameAtCustomer) { + } + +} + + + + + + + diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/MappingStrategy.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/MappingStrategy.java new file mode 100644 index 0000000000..7610e27145 --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/MappingStrategy.java @@ -0,0 +1,5 @@ +package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; + +public interface MappingStrategy { + T map(); +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/PartAsPlannedV2.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/PartAsPlannedV2.java new file mode 100644 index 0000000000..e37991f5d0 --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/PartAsPlannedV2.java @@ -0,0 +1,17 @@ +package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; + +import java.time.LocalDateTime; +import java.util.List; + +public record PartAsPlannedV2(String catenaXId, ValidityPeriod validityPeriod, + PartTypeInformation partTypeInformation +) { + + public record ValidityPeriod(LocalDateTime validFrom, LocalDateTime validTo) { + } + + public record PartTypeInformation(String manufacturerPartId, String classification, String nameAtManufacturer) { + } + + +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/PartBase.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/PartBase.java new file mode 100644 index 0000000000..674924a9a7 --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/PartBase.java @@ -0,0 +1,10 @@ +package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; + +import lombok.AllArgsConstructor; + +@AllArgsConstructor +public class PartBase { + private String catenaXId; + private SerialPartV2.PartTypeInformation partTypeInformation; + +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/PartSiteInformationAsPlannedV2.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/PartSiteInformationAsPlannedV2.java new file mode 100644 index 0000000000..038f4728c5 --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/PartSiteInformationAsPlannedV2.java @@ -0,0 +1,32 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; + +import java.util.List; + +public record PartSiteInformationAsPlannedV2(String catenaXId, List sites) { + + public record Site( + String functionValidUntil, + String function, + String functionValidFrom, + String catenaXSiteId + ) { + } +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SerialPartV2.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SerialPartV2.java new file mode 100644 index 0000000000..5194627861 --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SerialPartV2.java @@ -0,0 +1,25 @@ +package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; + +import java.time.LocalDateTime; +import java.util.List; + +public record SerialPartV2(String catenaXId, List localIdentifiers, + PartTypeInformation partTypeInformation, + ManufacturingInformation manufacturingInformation) { + + public record LocalIdentifier(String value, String key) { + } + + public record ManufacturingInformation(LocalDateTime date, String country) { + } + + public record PartTypeInformation(String manufacturerPartId, String classification, String nameAtManufacturer, String customerPartId, String nameAtCustomer) { + } + +} + + + + + + diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingelLevelUsageAsBuiltV2.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingelLevelUsageAsBuiltV2.java new file mode 100644 index 0000000000..a24cc53700 --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingelLevelUsageAsBuiltV2.java @@ -0,0 +1,34 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; + +import java.util.List; + +public record SingelLevelUsageAsBuiltV2(String catenaXId, List customers) { + + public record Customer(List parentItems, String businessPartner, String createdOn, String lastModifiedOn) { + } + + public record ParentItem(Quantity quantity, String catenaXId, String createdOn, String lastModifiedOn) { + } + + public record Quantity(int quantityNumber, String measurementUnit) { + } + +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingleLevelBomAsBuiltV2.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingleLevelBomAsBuiltV2.java new file mode 100644 index 0000000000..76c6875e80 --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingleLevelBomAsBuiltV2.java @@ -0,0 +1,38 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; + +import java.util.List; + +public record SingleLevelBomAsBuiltV2(String catenaXId, List childItems) { + + public record ChildItem( + Quantity quantity, + boolean hasAlternatives, + String createdOn, + String lastModifiedOn, + String catenaXId, + String businessPartner + ) { + } + + public record Quantity(int quantityNumber, String measurementUnit) { + } +} + diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingleLevelBomAsPlannedV2.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingleLevelBomAsPlannedV2.java new file mode 100644 index 0000000000..b242f8b797 --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingleLevelBomAsPlannedV2.java @@ -0,0 +1,48 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; + +import java.time.OffsetDateTime; +import java.util.List; + +public record SingleLevelBomAsPlannedV2(String catenaXId, List childItems) { + + public record ChildItem( + ValidityPeriod validityPeriod, + String catenaXId, + Quantity quantity, + String businessPartner, + String createdOn, + String lastModifiedOn + ) { + } + + public record ValidityPeriod( + OffsetDateTime validFrom, + OffsetDateTime validTo + ) { + } + + public record Quantity( + double quantityNumber, + String measurementUnit + ) { + } +} + diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingleLevelUsageAsPlannedV2.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingleLevelUsageAsPlannedV2.java new file mode 100644 index 0000000000..11b85cc35b --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingleLevelUsageAsPlannedV2.java @@ -0,0 +1,50 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; + +import java.time.OffsetDateTime; +import java.util.List; + +public record SingleLevelUsageAsPlannedV2( + List parentParts, + String businessPartner, + String catenaXId +) { + + public record ParentPart( + ValidityPeriod validityPeriod, + String parentCatenaXId, + Quantity quantity, + String createdOn, + String lastModifiedOn + ) { + } + + public record ValidityPeriod( + OffsetDateTime validFrom, + OffsetDateTime validTo + ) { + } + + public record Quantity( + double quantityNumber, + String measurementUnit + ) { + } +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java index 7b4164134b..45aed4428d 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java @@ -30,6 +30,12 @@ import org.eclipse.tractusx.traceability.assets.domain.importpoc.SingleLevelBomAsBuiltRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.SingleLevelBomAsPlannedRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.SingleLevelUsageAsPlannedRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.AsBuiltMainAspectV2; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.BatchV2; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.JustInSequenceV2; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.PartAsPlannedV2; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.PartSiteInformationAsPlannedV2; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.SerialPartV2; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.semanticdatamodel.SemanticDataModel; @Slf4j @@ -40,27 +46,27 @@ public class GenericSubmodel { defaultImpl = Void.class, property = "aspectType") @JsonSubTypes({ - @Type(value = SemanticDataModel.class, names = { + @Type(value = AsBuiltMainAspectV2.class, names = { "urn:samm:io.catenax.serial_part:1.0.0#SerialPart", "urn:bamm:io.catenax.serial_part:1.0.0#SerialPart", "urn:bamm:io.catenax.serial_part:1.1.0#SerialPart", "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart" }), - @Type(value = SemanticDataModel.class, names = { + @Type(value = AsBuiltMainAspectV2.class, names = { "urn:bamm:com.catenax.batch:1.0.0#Batch", "urn:bamm:io.catenax.batch:1.0.0#Batch", "urn:bamm:io.catenax.batch:1.0.2#Batch", "urn:samm:io.catenax.batch:2.0.0#Batch" }), - @Type(value = SemanticDataModel.class, names = { + @Type(value = AsBuiltMainAspectV2.class, names = { "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", "urn:bamm:io.catenax.part_as_planned:1.0.0#PartAsPlanned" }), - @Type(value = SemanticDataModel.class, names = { + @Type(value = PartSiteInformationAsPlannedV2.class, names = { "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned" }), - @Type(value = SemanticDataModel.class, names = { + @Type(value = AsBuiltMainAspectV2.class, names = { "urn:bamm:io.catenax.just_in_sequence_part:1.0.0#JustInSequencePart" }), @Type(value = DetailAspectDataTractionBatteryCode.class, names = { @@ -88,22 +94,6 @@ public class GenericSubmodel { public GenericSubmodel(@JsonProperty("aspectType") String aspectType, @JsonProperty("payload") Object payload) { this.aspectType = aspectType; this.payload = payload; - // Cast payload to SemanticDataModel if it's an instance of SemanticDataModel - - - /* ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.registerModule(new JavaTimeModule()); - objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); - objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - - try { - this.payloadString = objectMapper.writeValueAsString(payload); - } catch (JsonProcessingException e) { - // Handle the exception appropriately (e.g., log it) - log.error("Could not write payload for aspectType {}", aspectType, e); - throw new ImportException(e.getMessage()); - }*/ } public Object getPayload() { diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java index 62c002c907..454a1aed38 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java @@ -40,7 +40,7 @@ class ImportServiceImplTest { public void testSetup(){ ObjectMapper objectMapper = new ObjectMapper(); objectMapper.registerModule(new JavaTimeModule()); - when(traceabilityProperties.getBpn()).thenReturn(BPN.of("ABC")); + //when(traceabilityProperties.getBpn()).thenReturn(BPN.of("ABC")); importService = new ImportServiceImpl(objectMapper, assetAsPlannedRepository, assetAsBuiltRepository, traceabilityProperties); } @@ -56,9 +56,11 @@ void testService() throws IOException { file ); - importService.importAssets(multipartFile); - + //importService.importAssets(multipartFile); + importService.importAssetV2(multipartFile); } + + } diff --git a/tx-backend/src/test/resources/testdata/importfiles/validImportFile.json b/tx-backend/src/test/resources/testdata/importfiles/validImportFile.json index 1d8473b45f..462f8f7572 100644 --- a/tx-backend/src/test/resources/testdata/importfiles/validImportFile.json +++ b/tx-backend/src/test/resources/testdata/importfiles/validImportFile.json @@ -1067,13 +1067,6 @@ } } ] - }, - { - "assetMetaInfo" : { - "catenaXId" : "urn:uuid:e3b2f5e2-5be5-4ea6-98f0-6876de0fcb5f" - }, - "submodels" : [ - ] } ] } From 4a43d75ae95d5d9cc2d154a477a8a8515b201cd5 Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Mon, 8 Jan 2024 13:26:40 +0100 Subject: [PATCH 13/49] feat(mapping): TRACEFOSS-2741 alternative approach --- .../importpoc/service/ImportServiceImpl.java | 46 ++++++++-------- .../v2/AsBuiltMainAspectStrategy.java | 41 ++++++++++++++ .../importpoc/v2/AsBuiltMainAspectV2.java | 2 +- .../v2/AsPlannedMainAspectStrategy.java | 41 ++++++++++++++ .../domain/importpoc/v2/MappingStrategy.java | 7 ++- .../domain/importpoc/v2/StrategyFactory.java | 53 +++++++++++++++++++ .../irs/model/response/GenericSubmodel.java | 2 +- .../irs/model/response/JobDetailResponse.java | 6 +-- .../model/response/relationship/Aspect.java | 13 ++++- .../service/ImportServiceImplTest.java | 5 +- 10 files changed, 182 insertions(+), 34 deletions(-) create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsBuiltMainAspectStrategy.java create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsPlannedMainAspectStrategy.java create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/StrategyFactory.java diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java index be048bbb72..6b59cc7626 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java @@ -21,17 +21,15 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.eclipse.tractusx.irs.component.enums.BomLifecycle; import org.eclipse.tractusx.traceability.assets.application.importpoc.ImportService; import org.eclipse.tractusx.traceability.assets.domain.asbuilt.repository.AssetAsBuiltRepository; import org.eclipse.tractusx.traceability.assets.domain.asplanned.repository.AssetAsPlannedRepository; import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.AssetWrapperRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.ImportRequest; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.exception.ImportException; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.AsBuiltMainAspectV2; import org.eclipse.tractusx.traceability.assets.domain.importpoc.ImportRequestV2; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.PartAsPlannedV2; -import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.exception.ImportException; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.StrategyFactory; import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; @@ -40,6 +38,11 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isAsBuiltMainAspect; @Slf4j @RequiredArgsConstructor @@ -49,6 +52,7 @@ public class ImportServiceImpl implements ImportService { private final AssetAsPlannedRepository assetAsPlannedRepository; private final AssetAsBuiltRepository assetAsBuiltRepository; private final TraceabilityProperties traceabilityProperties; + private final StrategyFactory strategyFactory; @Override public void importAssets(MultipartFile file) { @@ -81,26 +85,18 @@ public void importAssetV2(MultipartFile file) { try { ImportRequestV2 importRequest = objectMapper.readValue(file.getBytes(), ImportRequestV2.class); log.info(importRequest.toString()); - - - List asBuilt = new ArrayList<>(); - List asPlanned = new ArrayList<>(); - - - for (ImportRequestV2.AssetImportRequestV2 asset : importRequest.assets()) { - - String catenaXId = asset.assetMetaInfoRequest().catenaXId(); - for (GenericSubmodel genericSubmodel : asset.submodels()) { - - if (genericSubmodel.getPayload() instanceof AsBuiltMainAspectV2) { - - } - if (genericSubmodel.getPayload() instanceof PartAsPlannedV2){ - - } - - } - } + Map> map = + importRequest.assets().stream().map(strategyFactory::map).filter(Objects::nonNull).collect(Collectors.groupingBy(assetBase -> { + if (isAsBuiltMainAspect(assetBase.getSemanticDataModel().name())) { + return BomLifecycle.AS_BUILT; + } else { + return BomLifecycle.AS_PLANNED; + } + })); + + + this.assetAsBuiltRepository.saveAll(map.get(BomLifecycle.AS_BUILT)); + this.assetAsPlannedRepository.saveAll(map.get(BomLifecycle.AS_PLANNED)); } catch (Exception e) { log.error("did not work"); diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsBuiltMainAspectStrategy.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsBuiltMainAspectStrategy.java new file mode 100644 index 0000000000..e7e0c81bb3 --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsBuiltMainAspectStrategy.java @@ -0,0 +1,41 @@ +/******************************************************************************** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; + +import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.ImportRequestV2; +import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; + +import java.util.List; + +import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isAsBuiltMainAspect; + +public class AsBuiltMainAspectStrategy implements MappingStrategy { + @Override + public AssetBase map(ImportRequestV2.AssetImportRequestV2 assetImportRequestV2) { + + GenericSubmodel mainAspectSubmodel = assetImportRequestV2.submodels().stream().filter(genericSubmodel -> isAsBuiltMainAspect(genericSubmodel.getAspectType())).findFirst().get(); + + List otherAspectTypes = assetImportRequestV2.submodels().stream().filter(genericSubmodel -> !(genericSubmodel.getPayload() instanceof AsBuiltMainAspectV2)).toList(); + + return AssetBase.builder().build(); + } + + +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsBuiltMainAspectV2.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsBuiltMainAspectV2.java index 22537d71be..3a92f9ea70 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsBuiltMainAspectV2.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsBuiltMainAspectV2.java @@ -13,7 +13,7 @@ public record LocalIdentifier(String value, String key) { public record ManufacturingInformation(String date, String country) { } - public record PartTypeInformation(String manufacturerPartId, String classification, String nameAtManufacturer) { + public record PartTypeInformation(String nameAtCustomer, String customerPartId, String manufacturerPartId, String classification, String nameAtManufacturer) { } } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsPlannedMainAspectStrategy.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsPlannedMainAspectStrategy.java new file mode 100644 index 0000000000..93f971206a --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsPlannedMainAspectStrategy.java @@ -0,0 +1,41 @@ +/******************************************************************************** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; + +import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.ImportRequestV2; +import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; + +import java.util.List; + +import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isAsPlannedMainAspect; + +public class AsPlannedMainAspectStrategy implements MappingStrategy { + @Override + public AssetBase map(ImportRequestV2.AssetImportRequestV2 assetImportRequestV2) { + + GenericSubmodel mainAspectSubmodel = assetImportRequestV2.submodels().stream().filter(genericSubmodel -> isAsPlannedMainAspect(genericSubmodel.getAspectType())).findFirst().get(); + + List otherAspectTypes = assetImportRequestV2.submodels().stream().filter(genericSubmodel -> !(genericSubmodel.getPayload() instanceof AsBuiltMainAspectV2)).toList(); + + return AssetBase.builder().build(); + } + + +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/MappingStrategy.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/MappingStrategy.java index 7610e27145..bab4fd34bc 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/MappingStrategy.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/MappingStrategy.java @@ -1,5 +1,8 @@ package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; -public interface MappingStrategy { - T map(); +import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.ImportRequestV2; + +public interface MappingStrategy { + AssetBase map(ImportRequestV2.AssetImportRequestV2 assetImportRequestV2); } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/StrategyFactory.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/StrategyFactory.java new file mode 100644 index 0000000000..cfc8f2d89f --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/StrategyFactory.java @@ -0,0 +1,53 @@ +/******************************************************************************** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; + +import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.ImportRequestV2; +import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; +import org.springframework.stereotype.Component; + +import java.util.Optional; + +import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isAsBuiltMainAspect; +import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isAsPlannedMainAspect; +import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isMainAspect; + +@Component +public class StrategyFactory { + + //use getShape method to get object of type shape + public AssetBase map(ImportRequestV2.AssetImportRequestV2 importRequestV2) { + + Optional isMainAspectSubmodel = importRequestV2.submodels().stream().filter(genericSubmodel -> isMainAspect(genericSubmodel.getAspectType())).map(GenericSubmodel::getAspectType).findFirst(); + + if (isMainAspectSubmodel.isEmpty()) { + return null; + } + if (isAsPlannedMainAspect(isMainAspectSubmodel.get())) { + return new AsPlannedMainAspectStrategy().map(importRequestV2); + } + if (isAsBuiltMainAspect(isMainAspectSubmodel.get())) { + return new AsBuiltMainAspectStrategy().map(importRequestV2); + } + + return null; + } +} + diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java index 45aed4428d..432757e9fd 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java @@ -59,7 +59,7 @@ public class GenericSubmodel { "urn:bamm:io.catenax.batch:1.0.2#Batch", "urn:samm:io.catenax.batch:2.0.0#Batch" }), - @Type(value = AsBuiltMainAspectV2.class, names = { + @Type(value = PartAsPlannedV2.class, names = { "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", "urn:bamm:io.catenax.part_as_planned:1.0.0#PartAsPlanned" }), diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/JobDetailResponse.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/JobDetailResponse.java index 6a87eab74c..89126fc1cb 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/JobDetailResponse.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/JobDetailResponse.java @@ -173,7 +173,7 @@ private List mapToOtherPartsAsBuilt(Map shortIds, Own } private List mapToOtherPartsAsPlanned(Map shortIds, Owner owner, Map bpnMapping) { - List otherParts = semanticDataModels().stream().filter(semanticDataModel -> !isOwnPart(semanticDataModel, jobStatus)).filter(semanticDataModel -> Aspect.isMasterAspect(semanticDataModel.getAspectType())).toList(); + List otherParts = semanticDataModels().stream().filter(semanticDataModel -> !isOwnPart(semanticDataModel, jobStatus)).filter(semanticDataModel -> Aspect.isMainAspect(semanticDataModel.getAspectType())).toList(); List isPartSiteInformationAsPlanned = semanticDataModels().stream() .filter(semanticDataModel -> !isOwnPart(semanticDataModel, jobStatus)) @@ -204,7 +204,7 @@ private List mapToOwnPartsAsPlanned(Map shortIds, Map List ownPartsAsPlanned = semanticDataModels().stream() .filter(semanticDataModel -> isOwnPart(semanticDataModel, jobStatus)) - .filter(semanticDataModel -> Aspect.isMasterAspect(semanticDataModel.aspectType())).toList(); + .filter(semanticDataModel -> Aspect.isMainAspect(semanticDataModel.aspectType())).toList(); List isPartSiteInformationAsPlanned = semanticDataModels().stream() @@ -250,7 +250,7 @@ public static void addPartSiteInformationAsPlannedToOwnPartsAsPlanned(List mapToOwnPartsAsBuilt(Map shortIds, Map bpnMapping) { List ownParts = semanticDataModels().stream() - .filter(semanticDataModel -> Aspect.isMasterAspect(semanticDataModel.getAspectType())) + .filter(semanticDataModel -> Aspect.isMainAspect(semanticDataModel.getAspectType())) .filter(semanticDataModel -> isOwnPart(semanticDataModel, jobStatus)) .toList(); log.info(":: mapToOwnPartsAsBuilt()"); diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/relationship/Aspect.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/relationship/Aspect.java index 9b871cf6ec..71be945a2d 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/relationship/Aspect.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/relationship/Aspect.java @@ -61,11 +61,22 @@ public static List downwardAspectsForAssetsAsPlanned() { } - public static boolean isMasterAspect(String aspect) { + public static boolean isMainAspect(String aspect) { assert Objects.nonNull(aspect); return aspect.contains(Aspect.PART_AS_PLANNED.getAspectName()) || aspect.contains(Aspect.SERIAL_PART.getAspectName()) || aspect.contains(Aspect.BATCH.getAspectName()) || aspect.contains(Aspect.JUST_IN_SEQUENCE_PART.getAspectName()); } + + public static boolean isAsBuiltMainAspect(String aspect) { + return aspect.contains(Aspect.SERIAL_PART.getAspectName()) || + aspect.contains(Aspect.BATCH.getAspectName()) || + aspect.contains(Aspect.JUST_IN_SEQUENCE_PART.getAspectName()); + } + + public static boolean isAsPlannedMainAspect(String aspect) { + return aspect.contains(Aspect.PART_AS_PLANNED.getAspectName()); + + } } diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java index 454a1aed38..f0124fb9fd 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java @@ -6,6 +6,7 @@ import org.eclipse.tractusx.traceability.assets.domain.asplanned.repository.AssetAsPlannedRepository; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.StrategyFactory; import org.eclipse.tractusx.traceability.common.model.BPN; import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties; import org.junit.jupiter.api.BeforeAll; @@ -33,6 +34,8 @@ class ImportServiceImplTest { @Mock private AssetAsBuiltRepository assetAsBuiltRepository; + @Mock + private StrategyFactory strategyFactory; @Mock private TraceabilityProperties traceabilityProperties; @@ -41,7 +44,7 @@ public void testSetup(){ ObjectMapper objectMapper = new ObjectMapper(); objectMapper.registerModule(new JavaTimeModule()); //when(traceabilityProperties.getBpn()).thenReturn(BPN.of("ABC")); - importService = new ImportServiceImpl(objectMapper, assetAsPlannedRepository, assetAsBuiltRepository, traceabilityProperties); + importService = new ImportServiceImpl(objectMapper, assetAsPlannedRepository, assetAsBuiltRepository, traceabilityProperties, strategyFactory); } @Test From f34c80861d5968727a7e47d36a1ad60dcaffb685 Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Mon, 8 Jan 2024 15:22:08 +0100 Subject: [PATCH 14/49] feat(mapping): TRACEFOSS-2741 alternative approach --- .../importpoc/service/ImportServiceImpl.java | 37 ++++--- .../service/LifecycleMappingStrategy.java | 9 -- .../v2/AsBuiltMainAspectStrategy.java | 89 ++++++++++++++++- .../v2/AsPlannedMainAspectStrategy.java | 96 ++++++++++++++++++- .../assets/domain/importpoc/v2/BatchV2.java | 21 ---- .../domain/importpoc/v2/JustInSequenceV2.java | 26 ----- .../domain/importpoc/v2/MappingStrategy.java | 3 +- ...ctory.java => MappingStrategyFactory.java} | 18 ++-- .../assets/domain/importpoc/v2/PartBase.java | 10 -- .../domain/importpoc/v2/SerialPartV2.java | 25 ----- .../irs/model/response/GenericSubmodel.java | 4 - .../model/response/relationship/Aspect.java | 24 +++++ .../service/ImportServiceImplTest.java | 8 +- 13 files changed, 231 insertions(+), 139 deletions(-) delete mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/LifecycleMappingStrategy.java delete mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/BatchV2.java delete mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/JustInSequenceV2.java rename tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/{StrategyFactory.java => MappingStrategyFactory.java} (76%) delete mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/PartBase.java delete mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SerialPartV2.java diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java index 6b59cc7626..798192b34c 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java @@ -29,17 +29,15 @@ import org.eclipse.tractusx.traceability.assets.domain.importpoc.ImportRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.ImportRequestV2; import org.eclipse.tractusx.traceability.assets.domain.importpoc.exception.ImportException; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.StrategyFactory; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.MappingStrategyFactory; import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.Map; -import java.util.Objects; +import java.util.Optional; import java.util.stream.Collectors; import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isAsBuiltMainAspect; @@ -52,7 +50,7 @@ public class ImportServiceImpl implements ImportService { private final AssetAsPlannedRepository assetAsPlannedRepository; private final AssetAsBuiltRepository assetAsBuiltRepository; private final TraceabilityProperties traceabilityProperties; - private final StrategyFactory strategyFactory; + private final MappingStrategyFactory strategyFactory; @Override public void importAssets(MultipartFile file) { @@ -84,27 +82,24 @@ public void importAssets(MultipartFile file) { public void importAssetV2(MultipartFile file) { try { ImportRequestV2 importRequest = objectMapper.readValue(file.getBytes(), ImportRequestV2.class); - log.info(importRequest.toString()); Map> map = - importRequest.assets().stream().map(strategyFactory::map).filter(Objects::nonNull).collect(Collectors.groupingBy(assetBase -> { - if (isAsBuiltMainAspect(assetBase.getSemanticDataModel().name())) { - return BomLifecycle.AS_BUILT; - } else { - return BomLifecycle.AS_PLANNED; - } - })); - - + importRequest.assets() + .stream() + .map(strategyFactory::mapToAssetBase) + .filter(Optional::isPresent) + .map(Optional::get) + .collect(Collectors.groupingBy(assetBase -> { + if (isAsBuiltMainAspect(assetBase.getSemanticDataModel().name())) { + return BomLifecycle.AS_BUILT; + } else { + return BomLifecycle.AS_PLANNED; + } + })); this.assetAsBuiltRepository.saveAll(map.get(BomLifecycle.AS_BUILT)); this.assetAsPlannedRepository.saveAll(map.get(BomLifecycle.AS_PLANNED)); } catch (Exception e) { - log.error("did not work"); + throw new ImportException(e.getMessage()); } } - - public List toAssetBase(ImportRequestV2 importRequestV2) { - List list = new ArrayList<>(); - return Collections.emptyList(); - } } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/LifecycleMappingStrategy.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/LifecycleMappingStrategy.java deleted file mode 100644 index 18c1c2ed99..0000000000 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/LifecycleMappingStrategy.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.eclipse.tractusx.traceability.assets.domain.importpoc.service; - -import org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel; - -import java.util.List; - -public interface LifecycleMappingStrategy { - -} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsBuiltMainAspectStrategy.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsBuiltMainAspectStrategy.java index e7e0c81bb3..f2b1d1c2a1 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsBuiltMainAspectStrategy.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsBuiltMainAspectStrategy.java @@ -18,24 +18,105 @@ ********************************************************************************/ package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; +import org.eclipse.tractusx.traceability.assets.domain.asbuilt.model.aspect.DetailAspectDataAsBuilt; +import org.eclipse.tractusx.traceability.assets.domain.asbuilt.model.aspect.DetailAspectDataTractionBatteryCode; import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; +import org.eclipse.tractusx.traceability.assets.domain.base.model.Descriptions; +import org.eclipse.tractusx.traceability.assets.domain.base.model.ImportNote; +import org.eclipse.tractusx.traceability.assets.domain.base.model.ImportState; +import org.eclipse.tractusx.traceability.assets.domain.base.model.Owner; +import org.eclipse.tractusx.traceability.assets.domain.base.model.QualityType; +import org.eclipse.tractusx.traceability.assets.domain.base.model.aspect.DetailAspectModel; +import org.eclipse.tractusx.traceability.assets.domain.base.model.aspect.DetailAspectType; import org.eclipse.tractusx.traceability.assets.domain.importpoc.ImportRequestV2; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.SingleLevelBomAsBuiltRequest; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; +import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties; + +import java.time.OffsetDateTime; +import java.util.ArrayList; import java.util.List; import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isAsBuiltMainAspect; +import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isDownwardRelationshipAsBuilt; +import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isTractionBatteryCode; +import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isUpwardRelationshipAsBuilt; public class AsBuiltMainAspectStrategy implements MappingStrategy { @Override - public AssetBase map(ImportRequestV2.AssetImportRequestV2 assetImportRequestV2) { + public AssetBase mapToAssetBase(ImportRequestV2.AssetImportRequestV2 assetImportRequestV2, TraceabilityProperties traceabilityProperties) { + + List submodels = assetImportRequestV2.submodels(); + AsBuiltMainAspectV2 asBuiltAspect = submodels.stream() + .filter(genericSubmodel -> isAsBuiltMainAspect(genericSubmodel.getAspectType())) + .map(GenericSubmodel::getPayload) + .filter(AsBuiltMainAspectV2.class::isInstance) + .map(AsBuiltMainAspectV2.class::cast) + .findFirst() + .orElse(null); + + List detailAspectDataTractionBatteryCodes = submodels.stream() + .filter(genericSubmodel -> isTractionBatteryCode(genericSubmodel.getAspectType())) + .map(GenericSubmodel::getPayload) + .filter(DetailAspectDataTractionBatteryCode.class::isInstance) + .map(DetailAspectDataTractionBatteryCode.class::cast) + .toList(); + + List parentRelations = submodels.stream() + .filter(genericSubmodel -> isUpwardRelationshipAsBuilt(genericSubmodel.getAspectType())) + .map(GenericSubmodel::getPayload) + .filter(SingelLevelUsageAsBuiltV2.class::isInstance) + .map(SingelLevelUsageAsBuiltV2.class::cast) + .map(singelLevelUsageAsBuiltV2 -> new Descriptions(singelLevelUsageAsBuiltV2.catenaXId(), null)) + .toList(); - GenericSubmodel mainAspectSubmodel = assetImportRequestV2.submodels().stream().filter(genericSubmodel -> isAsBuiltMainAspect(genericSubmodel.getAspectType())).findFirst().get(); - List otherAspectTypes = assetImportRequestV2.submodels().stream().filter(genericSubmodel -> !(genericSubmodel.getPayload() instanceof AsBuiltMainAspectV2)).toList(); + List childRelations = submodels.stream() + .filter(genericSubmodel -> isDownwardRelationshipAsBuilt(genericSubmodel.getAspectType())) + .map(GenericSubmodel::getPayload) + .filter(SingleLevelBomAsBuiltRequest.class::isInstance) + .map(SingleLevelBomAsBuiltRequest.class::cast) + .map(singleLevelBomAsBuiltRequest -> new Descriptions(singleLevelBomAsBuiltRequest.catenaXId(), null)) + .toList(); - return AssetBase.builder().build(); + + String semanticModelId = null; + List detailAspectModels = new ArrayList<>(); + + extractDetailAspectModelsAsBuilt(asBuiltAspect.manufacturingInformation(), asBuiltAspect.partTypeInformation()) + return AssetBase.builder() + .id(assetImportRequestV2.assetMetaInfoRequest().catenaXId()) + .semanticModelId(semanticModelId) + .detailAspectModels(detailAspectModels) + .manufacturerId(traceabilityProperties.getBpn().value()) + .nameAtManufacturer(asBuiltAspect.partTypeInformation().nameAtManufacturer()) + .manufacturerPartId(asBuiltAspect.partTypeInformation().manufacturerPartId()) + .parentRelations(parentRelations) + .childRelations(childRelations) + .owner(Owner.OWN) + .activeAlert(false) + .inInvestigation(false) + .classification(asBuiltAspect.partTypeInformation().classification()) + .qualityType(QualityType.OK) + .semanticDataModel(semanticDataModel.get()) + .van(van()) + .importState(ImportState.TRANSIENT) + .importNote(ImportNote.TRANSIENT_CREATED) + .build(); } + public static DetailAspectModel extractDetailAspectModelsAsBuilt(AsBuiltMainAspectV2.ManufacturingInformation manufacturingInformation, + AsBuiltMainAspectV2.PartTypeInformation partTypeInformation) { + + DetailAspectDataAsBuilt detailAspectDataAsBuilt = DetailAspectDataAsBuilt.builder() + .customerPartId(partTypeInformation.customerPartId()) + .manufacturingCountry(manufacturingInformation.country()) + .manufacturingDate(OffsetDateTime.parse(manufacturingInformation.date())) + .nameAtCustomer(partTypeInformation.nameAtCustomer()) + .partId(partTypeInformation.manufacturerPartId()) + .build(); + return DetailAspectModel.builder().data(detailAspectDataAsBuilt).type(DetailAspectType.AS_BUILT).build(); + } } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsPlannedMainAspectStrategy.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsPlannedMainAspectStrategy.java index 93f971206a..cd2b973347 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsPlannedMainAspectStrategy.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsPlannedMainAspectStrategy.java @@ -18,23 +18,111 @@ ********************************************************************************/ package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; +import org.eclipse.tractusx.traceability.assets.domain.asplanned.model.aspect.DetailAspectDataPartSiteInformationAsPlanned; import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; +import org.eclipse.tractusx.traceability.assets.domain.base.model.Descriptions; +import org.eclipse.tractusx.traceability.assets.domain.base.model.ImportNote; +import org.eclipse.tractusx.traceability.assets.domain.base.model.ImportState; +import org.eclipse.tractusx.traceability.assets.domain.base.model.Owner; +import org.eclipse.tractusx.traceability.assets.domain.base.model.QualityType; +import org.eclipse.tractusx.traceability.assets.domain.base.model.aspect.DetailAspectModel; +import org.eclipse.tractusx.traceability.assets.domain.base.model.aspect.DetailAspectType; import org.eclipse.tractusx.traceability.assets.domain.importpoc.ImportRequestV2; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.PartSiteInformationAsPlannedRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.SingleLevelBomAsPlannedRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.SingleLevelUsageAsPlannedRequest; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; +import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties; +import java.time.OffsetDateTime; +import java.util.ArrayList; import java.util.List; +import static org.apache.commons.collections4.ListUtils.emptyIfNull; import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isAsPlannedMainAspect; +import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isDownwardRelationshipAsPlanned; +import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isPartSiteInformationAsPlanned; +import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isUpwardRelationshipAsPlanned; + public class AsPlannedMainAspectStrategy implements MappingStrategy { + @Override - public AssetBase map(ImportRequestV2.AssetImportRequestV2 assetImportRequestV2) { + public AssetBase mapToAssetBase(ImportRequestV2.AssetImportRequestV2 assetImportRequestV2, TraceabilityProperties traceabilityProperties) { + List submodels = assetImportRequestV2.submodels(); + + PartAsPlannedV2 partAsPlannedV2 = submodels.stream() + .filter(genericSubmodel -> isAsPlannedMainAspect(genericSubmodel.getAspectType())) + .map(GenericSubmodel::getPayload) + .filter(PartAsPlannedV2.class::isInstance) + .map(PartAsPlannedV2.class::cast) + .findFirst() + .orElse(null); + + PartSiteInformationAsPlannedRequest partSiteInformationAsPlannedRequest = submodels.stream() + .filter(genericSubmodel -> isPartSiteInformationAsPlanned(genericSubmodel.getAspectType())) + .map(GenericSubmodel::getPayload) + .filter(PartSiteInformationAsPlannedRequest.class::isInstance) + .map(PartSiteInformationAsPlannedRequest.class::cast) + .findFirst() + .orElse(null); + + List parentRelations = submodels.stream() + .filter(genericSubmodel -> isUpwardRelationshipAsPlanned(genericSubmodel.getAspectType())) + .map(GenericSubmodel::getPayload) + .filter(SingleLevelUsageAsPlannedRequest.class::isInstance) + .map(SingleLevelUsageAsPlannedRequest.class::cast) + .map(singleLevelUsageAsPlannedRequest -> new Descriptions(singleLevelUsageAsPlannedRequest.catenaXId(), null)) + .toList(); + - GenericSubmodel mainAspectSubmodel = assetImportRequestV2.submodels().stream().filter(genericSubmodel -> isAsPlannedMainAspect(genericSubmodel.getAspectType())).findFirst().get(); + List childRelations = submodels.stream() + .filter(genericSubmodel -> isDownwardRelationshipAsPlanned(genericSubmodel.getAspectType())) + .map(GenericSubmodel::getPayload) + .filter(SingleLevelBomAsPlannedRequest.class::isInstance) + .map(SingleLevelBomAsPlannedRequest.class::cast) + .map(singleLevelBomAsPlannedRequest -> new Descriptions(singleLevelBomAsPlannedRequest.catenaXId(), null)) + .toList(); + + List detailAspectModels = new ArrayList<>(extractDetailAspectModelsPartSiteInformationAsPlanned(emptyIfNull(partSiteInformationAsPlannedRequest.sites()))); + + AssetBase.AssetBaseBuilder assetBaseBuilder = AssetBase.builder(); + if (partAsPlannedV2 != null) { + assetBaseBuilder + .id(assetImportRequestV2.assetMetaInfoRequest().catenaXId()) + .manufacturerId(traceabilityProperties.getBpn().value()) + .nameAtManufacturer(partAsPlannedV2.partTypeInformation().nameAtManufacturer()) + .manufacturerPartId(partAsPlannedV2.partTypeInformation().manufacturerPartId()) + .parentRelations(parentRelations) + .detailAspectModels(detailAspectModels) + .childRelations(childRelations) + .owner(Owner.OWN) + .activeAlert(false) + .classification(partAsPlannedV2.partTypeInformation().classification()) + .inInvestigation(false) + .qualityType(QualityType.OK) + .semanticDataModel(org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.PARTASPLANNED) + .importState(ImportState.TRANSIENT) + .importNote(ImportNote.TRANSIENT_CREATED); + } + + return assetBaseBuilder.build(); + + } - List otherAspectTypes = assetImportRequestV2.submodels().stream().filter(genericSubmodel -> !(genericSubmodel.getPayload() instanceof AsBuiltMainAspectV2)).toList(); + public static List extractDetailAspectModelsPartSiteInformationAsPlanned(List sites) { + List detailAspectModels = new ArrayList<>(); + emptyIfNull(sites).forEach(site -> { + DetailAspectDataPartSiteInformationAsPlanned detailAspectDataPartSiteInformationAsPlanned = DetailAspectDataPartSiteInformationAsPlanned.builder() + .catenaXSiteId(site.catenaXSiteId()) + .functionValidFrom(OffsetDateTime.parse(site.functionValidFrom())) + .function(site.function()) + .functionValidUntil(OffsetDateTime.parse(site.functionValidUntil())) + .build(); + detailAspectModels.add(DetailAspectModel.builder().data(detailAspectDataPartSiteInformationAsPlanned).type(DetailAspectType.PART_SITE_INFORMATION_AS_PLANNED).build()); + }); - return AssetBase.builder().build(); + return detailAspectModels; } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/BatchV2.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/BatchV2.java deleted file mode 100644 index 18f39271cf..0000000000 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/BatchV2.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; - -import lombok.Getter; - -import java.util.List; - -public record BatchV2(List localIdentifiers, - ManufacturingInformation manufacturingInformation, - String catenaXId, - PartTypeInformation partTypeInformation) { - - public record LocalIdentifier(String value, String key) { - } - - public record ManufacturingInformation(String date, String country) { - } - - public record PartTypeInformation(String manufacturerPartId, String classification, String nameAtManufacturer) { - } - -} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/JustInSequenceV2.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/JustInSequenceV2.java deleted file mode 100644 index 3240fa09eb..0000000000 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/JustInSequenceV2.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; - -import java.time.LocalDateTime; -import java.util.List; - -public record JustInSequenceV2(String catenaXId, List localIdentifiers, - SerialPartV2.PartTypeInformation partTypeInformation, - SerialPartV2.ManufacturingInformation manufacturingInformation) { - - public record LocalIdentifier(String value, String key) { - } - - public record ManufacturingInformation(LocalDateTime date, String country) { - } - - public record PartTypeInformation(String manufacturerPartId, String classification, String nameAtManufacturer, String customerPartId, String nameAtCustomer) { - } - -} - - - - - - - diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/MappingStrategy.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/MappingStrategy.java index bab4fd34bc..079850e790 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/MappingStrategy.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/MappingStrategy.java @@ -2,7 +2,8 @@ import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; import org.eclipse.tractusx.traceability.assets.domain.importpoc.ImportRequestV2; +import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties; public interface MappingStrategy { - AssetBase map(ImportRequestV2.AssetImportRequestV2 assetImportRequestV2); + AssetBase mapToAssetBase(ImportRequestV2.AssetImportRequestV2 assetImportRequestV2, TraceabilityProperties traceabilityProperties); } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/StrategyFactory.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/MappingStrategyFactory.java similarity index 76% rename from tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/StrategyFactory.java rename to tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/MappingStrategyFactory.java index cfc8f2d89f..bd0eca52af 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/StrategyFactory.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/MappingStrategyFactory.java @@ -18,9 +18,11 @@ ********************************************************************************/ package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; +import lombok.RequiredArgsConstructor; import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; import org.eclipse.tractusx.traceability.assets.domain.importpoc.ImportRequestV2; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; +import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties; import org.springframework.stereotype.Component; import java.util.Optional; @@ -30,24 +32,24 @@ import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isMainAspect; @Component -public class StrategyFactory { +@RequiredArgsConstructor +public class MappingStrategyFactory { + private TraceabilityProperties traceabilityProperties; - //use getShape method to get object of type shape - public AssetBase map(ImportRequestV2.AssetImportRequestV2 importRequestV2) { + public Optional mapToAssetBase(ImportRequestV2.AssetImportRequestV2 importRequestV2) { Optional isMainAspectSubmodel = importRequestV2.submodels().stream().filter(genericSubmodel -> isMainAspect(genericSubmodel.getAspectType())).map(GenericSubmodel::getAspectType).findFirst(); if (isMainAspectSubmodel.isEmpty()) { - return null; + return Optional.empty(); } if (isAsPlannedMainAspect(isMainAspectSubmodel.get())) { - return new AsPlannedMainAspectStrategy().map(importRequestV2); + return Optional.of(new AsPlannedMainAspectStrategy().mapToAssetBase(importRequestV2, traceabilityProperties)); } if (isAsBuiltMainAspect(isMainAspectSubmodel.get())) { - return new AsBuiltMainAspectStrategy().map(importRequestV2); + return Optional.of(new AsBuiltMainAspectStrategy().mapToAssetBase(importRequestV2, traceabilityProperties)); } - - return null; + return Optional.empty(); } } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/PartBase.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/PartBase.java deleted file mode 100644 index 674924a9a7..0000000000 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/PartBase.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; - -import lombok.AllArgsConstructor; - -@AllArgsConstructor -public class PartBase { - private String catenaXId; - private SerialPartV2.PartTypeInformation partTypeInformation; - -} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SerialPartV2.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SerialPartV2.java deleted file mode 100644 index 5194627861..0000000000 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SerialPartV2.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; - -import java.time.LocalDateTime; -import java.util.List; - -public record SerialPartV2(String catenaXId, List localIdentifiers, - PartTypeInformation partTypeInformation, - ManufacturingInformation manufacturingInformation) { - - public record LocalIdentifier(String value, String key) { - } - - public record ManufacturingInformation(LocalDateTime date, String country) { - } - - public record PartTypeInformation(String manufacturerPartId, String classification, String nameAtManufacturer, String customerPartId, String nameAtCustomer) { - } - -} - - - - - - diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java index 432757e9fd..9cd6528240 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java @@ -31,12 +31,8 @@ import org.eclipse.tractusx.traceability.assets.domain.importpoc.SingleLevelBomAsPlannedRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.SingleLevelUsageAsPlannedRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.AsBuiltMainAspectV2; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.BatchV2; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.JustInSequenceV2; import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.PartAsPlannedV2; import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.PartSiteInformationAsPlannedV2; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.SerialPartV2; -import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.semanticdatamodel.SemanticDataModel; @Slf4j public class GenericSubmodel { diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/relationship/Aspect.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/relationship/Aspect.java index 71be945a2d..4db6455fb5 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/relationship/Aspect.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/relationship/Aspect.java @@ -30,6 +30,7 @@ public enum Aspect { SINGLE_LEVEL_BOM_AS_BUILT("SingleLevelBomAsBuilt"), SINGLE_LEVEL_USAGE_AS_BUILT("SingleLevelUsageAsBuilt"), SINGLE_LEVEL_BOM_AS_PLANNED("SingleLevelBomAsPlanned"), + SINGLE_LEVEL_USAGE_AS_PLANNED("SingleLevelUsageAsPlanned"), PART_SITE_INFORMATION_AS_PLANNED("PartSiteInformationAsPlanned"), PART_AS_PLANNED("PartAsPlanned"), JUST_IN_SEQUENCE_PART("JustInSequencePart"), @@ -77,6 +78,29 @@ public static boolean isAsBuiltMainAspect(String aspect) { public static boolean isAsPlannedMainAspect(String aspect) { return aspect.contains(Aspect.PART_AS_PLANNED.getAspectName()); + } + + public static boolean isPartSiteInformationAsPlanned(String aspect){ + return aspect.contains(Aspect.PART_SITE_INFORMATION_AS_PLANNED.getAspectName()); + } + + public static boolean isTractionBatteryCode(String aspect){ + return aspect.contains(Aspect.TRACTION_BATTERY_CODE.getAspectName()); + } + + public static boolean isUpwardRelationshipAsBuilt(String aspect){ + return aspect.contains(Aspect.SINGLE_LEVEL_BOM_AS_BUILT.getAspectName()); + } + + public static boolean isDownwardRelationshipAsBuilt(String aspect){ + return aspect.contains(Aspect.SINGLE_LEVEL_USAGE_AS_BUILT.getAspectName()); + } + + public static boolean isUpwardRelationshipAsPlanned(String aspect){ + return aspect.contains(Aspect.SINGLE_LEVEL_BOM_AS_PLANNED.getAspectName()); + } + public static boolean isDownwardRelationshipAsPlanned(String aspect){ + return aspect.contains(Aspect.SINGLE_LEVEL_USAGE_AS_PLANNED.getAspectName()); } } diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java index f0124fb9fd..f1b1ac6517 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java @@ -6,10 +6,8 @@ import org.eclipse.tractusx.traceability.assets.domain.asplanned.repository.AssetAsPlannedRepository; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.StrategyFactory; -import org.eclipse.tractusx.traceability.common.model.BPN; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.MappingStrategyFactory; import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -21,8 +19,6 @@ import java.io.IOException; import java.io.InputStream; -import static org.mockito.Mockito.when; - @ExtendWith(MockitoExtension.class) class ImportServiceImplTest { @@ -35,7 +31,7 @@ class ImportServiceImplTest { private AssetAsBuiltRepository assetAsBuiltRepository; @Mock - private StrategyFactory strategyFactory; + private MappingStrategyFactory strategyFactory; @Mock private TraceabilityProperties traceabilityProperties; From a296935bd488aa7f96e932a09989fec8b820b346 Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Mon, 8 Jan 2024 16:43:18 +0100 Subject: [PATCH 15/49] feat(mapping): TRACEFOSS-2741 alternative approach --- .../application/importpoc/ImportService.java | 2 - .../domain/importpoc/AssetWrapperRequest.java | 74 -------- .../domain/importpoc/ImportRequest.java | 175 ------------------ .../domain/importpoc/ImportRequestV2.java | 16 -- .../{ => model}/AssetMetaInfoRequest.java | 2 +- .../domain/importpoc/model/ImportRequest.java | 14 ++ .../MainAspectAsBuiltRequest.java} | 10 +- .../MainAspectAsPlannedRequest.java} | 7 +- .../PartSiteInformationAsPlannedRequest.java | 2 +- .../SingelLevelUsageAsBuiltRequest.java | 2 +- .../SingleLevelBomAsBuiltRequest.java | 2 +- .../SingleLevelBomAsPlannedRequest.java | 2 +- .../SingleLevelUsageAsPlannedRequest.java | 2 +- .../importpoc/service/ImportServiceImpl.java | 36 +--- .../MainAspectAsBuiltStrategy.java} | 62 +++++-- .../MainAspectAsPlannedStrategy.java} | 27 +-- .../{v2 => service}/MappingStrategy.java | 6 +- .../MappingStrategyFactory.java | 14 +- .../v2/PartSiteInformationAsPlannedV2.java | 32 ---- .../v2/SingelLevelUsageAsBuiltV2.java | 34 ---- .../importpoc/v2/SingleLevelBomAsBuiltV2.java | 38 ---- .../v2/SingleLevelBomAsPlannedV2.java | 48 ----- .../v2/SingleLevelUsageAsPlannedV2.java | 50 ----- .../irs/model/response/GenericSubmodel.java | 34 ++-- .../domain/importpoc/ImportRequestTest.java | 3 +- .../service/ImportServiceImplTest.java | 13 +- 26 files changed, 127 insertions(+), 580 deletions(-) delete mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java delete mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java delete mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequestV2.java rename tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/{ => model}/AssetMetaInfoRequest.java (99%) create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/ImportRequest.java rename tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/{v2/AsBuiltMainAspectV2.java => model/MainAspectAsBuiltRequest.java} (56%) rename tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/{v2/PartAsPlannedV2.java => model/MainAspectAsPlannedRequest.java} (64%) rename tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/{ => model}/PartSiteInformationAsPlannedRequest.java (99%) rename tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/{ => model}/SingelLevelUsageAsBuiltRequest.java (99%) rename tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/{ => model}/SingleLevelBomAsBuiltRequest.java (99%) rename tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/{ => model}/SingleLevelBomAsPlannedRequest.java (99%) rename tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/{ => model}/SingleLevelUsageAsPlannedRequest.java (99%) rename tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/{v2/AsBuiltMainAspectStrategy.java => service/MainAspectAsBuiltStrategy.java} (67%) rename tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/{v2/AsPlannedMainAspectStrategy.java => service/MainAspectAsPlannedStrategy.java} (88%) rename tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/{v2 => service}/MappingStrategy.java (66%) rename tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/{v2 => service}/MappingStrategyFactory.java (83%) delete mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/PartSiteInformationAsPlannedV2.java delete mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingelLevelUsageAsBuiltV2.java delete mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingleLevelBomAsBuiltV2.java delete mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingleLevelBomAsPlannedV2.java delete mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingleLevelUsageAsPlannedV2.java diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/importpoc/ImportService.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/importpoc/ImportService.java index 277c45f0fb..876df7a2ea 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/importpoc/ImportService.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/importpoc/ImportService.java @@ -24,6 +24,4 @@ public interface ImportService { void importAssets(MultipartFile file); - - void importAssetV2(MultipartFile file); } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java deleted file mode 100644 index 8e613fe156..0000000000 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetWrapperRequest.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ -package org.eclipse.tractusx.traceability.assets.domain.importpoc; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.request.BomLifecycle; -import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; -import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.semanticdatamodel.SemanticDataModel; - -import java.util.ArrayList; -import java.util.List; - -public record AssetWrapperRequest(AssetMetaInfoRequest assetMetaInfoRequest, - List mainAspectModels, - List upwardRelationship, - List downwardRelationship, - BomLifecycle bomLifecycle -) { - - @JsonCreator - static AssetWrapperRequest of( - @JsonProperty("assetMetaInfo") AssetMetaInfoRequest assetMetaInfoRequest, - @JsonProperty("submodels") List submodels - ) { - List upwardSubmodels = submodels.stream().filter(submodel -> isUpwardRelationship(submodel.getAspectType())).toList(); - List downwardSubmodels = submodels.stream().filter(submodel -> isDownwardRelationship(submodel.getAspectType())).toList(); - List mainAspectSubmodels = submodels.stream().filter(submodel -> isMainAspect(submodel.getAspectType())).toList(); - List mainAspectSemanticDataModel = transformMainAspectModel(mainAspectSubmodels); - BomLifecycle bom = mainAspectSubmodels.stream().findAny() - .map(submodel -> submodel.getAspectType().contains("AsPlanned") ? BomLifecycle.AS_PLANNED : BomLifecycle.AS_BUILT).orElseThrow(); - - return new AssetWrapperRequest(assetMetaInfoRequest, mainAspectSemanticDataModel, upwardSubmodels, downwardSubmodels, bom); - } - - private static List transformMainAspectModel(List submodels) { - List semanticDataModels = new ArrayList<>(); - for (GenericSubmodel submodel : submodels) { - SemanticDataModel payload = (SemanticDataModel) submodel.getPayload(); - payload.setAspectType(submodel.getAspectType()); - semanticDataModels.add(payload); - } - return semanticDataModels; - } - - - private static boolean isUpwardRelationship(final String aspectType) { - return aspectType.contains("Usage"); - } - - private static boolean isDownwardRelationship(final String aspectType) { - return aspectType.contains("Bom"); - } - - private static boolean isMainAspect(final String aspectType) { - return !isDownwardRelationship(aspectType) && !isUpwardRelationship(aspectType); - } -} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java deleted file mode 100644 index 318ba83e56..0000000000 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequest.java +++ /dev/null @@ -1,175 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ -package org.eclipse.tractusx.traceability.assets.domain.importpoc; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.extern.slf4j.Slf4j; -import org.eclipse.tractusx.traceability.assets.domain.asbuilt.model.aspect.DetailAspectDataTractionBatteryCode; -import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; -import org.eclipse.tractusx.traceability.assets.domain.base.model.Descriptions; -import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.request.BomLifecycle; -import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; -import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect; -import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.semanticdatamodel.SemanticDataModel; - -import java.util.ArrayList; -import java.util.EnumMap; -import java.util.List; -import java.util.Map; - -import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.JobDetailResponse.addPartSiteInformationAsPlannedToOwnPartsAsPlanned; - -@Slf4j -public record ImportRequest( - Map> bomLifecycleToAssetWrapperRequestList -) { - - @JsonCreator - static ImportRequest of( - @JsonProperty("assets") List assetRawRequestList - ) { - List assetAsBuiltWrapperRequest = new ArrayList<>(); - List assetAsPlannedWrapperRequest = new ArrayList<>(); - - for (AssetWrapperRequest assetWrapperRequest : assetRawRequestList) { - AssetMetaInfoRequest assetMetaInfoRequest = assetWrapperRequest.assetMetaInfoRequest(); - - if (BomLifecycle.AS_BUILT.equals(assetWrapperRequest.bomLifecycle())) { - List mainAspectsAsBuilt = assetWrapperRequest.mainAspectModels(); - - - List upwardAspectsAsBuilt = assetWrapperRequest.upwardRelationship(); - - List downwardAspectsAsBuilt = assetWrapperRequest.downwardRelationship(); - assetAsBuiltWrapperRequest.add(new AssetWrapperRequest(assetMetaInfoRequest, mainAspectsAsBuilt, upwardAspectsAsBuilt, downwardAspectsAsBuilt, BomLifecycle.AS_BUILT)); - } - - if (BomLifecycle.AS_PLANNED.equals(assetWrapperRequest.bomLifecycle())) { - List mainAspectsAsPlanned = assetWrapperRequest.mainAspectModels(); - List upwardAspectsAsPlanned = assetWrapperRequest.upwardRelationship(); - - List downwardAspectsAsPlanned = assetWrapperRequest.downwardRelationship(); - assetAsPlannedWrapperRequest.add(new AssetWrapperRequest(assetMetaInfoRequest, mainAspectsAsPlanned, upwardAspectsAsPlanned, downwardAspectsAsPlanned, BomLifecycle.AS_PLANNED)); - - } - - } - Map> bomLifecycleToAssetWrapperList = new EnumMap<>(BomLifecycle.class); - - bomLifecycleToAssetWrapperList.put(BomLifecycle.AS_BUILT, assetAsBuiltWrapperRequest); - bomLifecycleToAssetWrapperList.put(BomLifecycle.AS_PLANNED, assetAsPlannedWrapperRequest); - return new ImportRequest(bomLifecycleToAssetWrapperList); - } - - public List convertAssetsAsBuilt() { - return new ArrayList<>(mapToOwnPartsAsBuilt()); - } - - public List convertAssetsAsPlanned(final String bpn) { - return new ArrayList<>(mapToOwnPartsAsPlanned(bpn)); - } - - private List mapToOwnPartsAsBuilt() { - - List assetWrapperRequests = bomLifecycleToAssetWrapperRequestList.get(BomLifecycle.AS_BUILT); - List list = new ArrayList<>(); - for (AssetWrapperRequest assetWrapperRequest : assetWrapperRequests) { - - List mainAspectModels = assetWrapperRequest.mainAspectModels().stream().filter(semanticDataModel -> !semanticDataModel.aspectType().contains("traction_battery_code")).toList(); - - List detailAspectDataTractionBatteryCodes = assetWrapperRequest - .mainAspectModels() - .stream() - .filter(semanticDataModel -> semanticDataModel.aspectType().contains("traction_battery_code")) - .map(DetailAspectDataTractionBatteryCode.class::cast).toList(); - - List downwardModels = assetWrapperRequest.downwardRelationship(); - List upwardModels = assetWrapperRequest.upwardRelationship(); - - - List parentRelations = upwardModels.stream() - .map(genericSubmodel -> { - SingelLevelUsageAsBuiltRequest payload = (SingelLevelUsageAsBuiltRequest) genericSubmodel.getPayload(); - return payload.customers().stream() - .flatMap(customer -> customer.parentItems().stream()) - .map(parentItem -> new Descriptions(parentItem.catenaXId(), null)).toList(); - }) - .flatMap(List::stream).toList(); - - - List childRelations = downwardModels.stream() - .map(genericSubmodel -> { - SingleLevelBomAsBuiltRequest payload = (SingleLevelBomAsBuiltRequest) genericSubmodel.getPayload(); - return payload.childItems().stream() - .map(childItem -> new Descriptions(childItem.catenaXId(), null)).toList(); - }) - .flatMap(List::stream).toList(); - - - list.addAll(mainAspectModels.stream().map(semanticDataModel -> semanticDataModel.toDomainAsBuiltLight(parentRelations, childRelations, detailAspectDataTractionBatteryCodes)).toList()); - - } - - return list; - } - - private List mapToOwnPartsAsPlanned(final String bpn) { - List assetWrapperRequests = bomLifecycleToAssetWrapperRequestList.get(BomLifecycle.AS_PLANNED); - List list = new ArrayList<>(); - for (AssetWrapperRequest assetWrapperRequest : assetWrapperRequests) { - - List mainAspectModels = assetWrapperRequest.mainAspectModels().stream().filter(semanticDataModel -> !semanticDataModel.aspectType().contains(Aspect.PART_SITE_INFORMATION_AS_PLANNED.getAspectName())).toList(); - List partSiteInfoAsPlanned = - mainAspectModels.stream() - .filter(semanticDataModel -> semanticDataModel.aspectType().contains(Aspect.PART_SITE_INFORMATION_AS_PLANNED.getAspectName())).toList(); - - addPartSiteInformationAsPlannedToOwnPartsAsPlanned(mainAspectModels, partSiteInfoAsPlanned); - - List downwardModels = assetWrapperRequest.downwardRelationship(); - List upwardModels = assetWrapperRequest.upwardRelationship(); - - - List parentRelations = upwardModels.stream() - .map(genericSubmodel -> { - SingleLevelUsageAsPlannedRequest payload = (SingleLevelUsageAsPlannedRequest) genericSubmodel.getPayload(); - return payload.parentParts().stream() - .map(parentPart -> new Descriptions(parentPart.parentCatenaXId(), null)).toList(); - }) - .flatMap(List::stream).toList(); - - - List childRelations = downwardModels.stream() - .map(genericSubmodel -> { - SingleLevelBomAsPlannedRequest payload = (SingleLevelBomAsPlannedRequest) genericSubmodel.getPayload(); - return payload.childItems().stream() - .map(childItem -> new Descriptions(childItem.catenaXId(), null)).toList(); - }) - .flatMap(List::stream).toList(); - - list.addAll(mainAspectModels.stream().map(semanticDataModel -> semanticDataModel.toDomainAsPlannedLight(parentRelations, childRelations, bpn)).toList()); - - } - - return list; - } - -} - - diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequestV2.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequestV2.java deleted file mode 100644 index 7ad0861b5f..0000000000 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequestV2.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.eclipse.tractusx.traceability.assets.domain.importpoc; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.ToString; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.AssetMetaInfoRequest; -import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; - -import java.util.List; - -public record ImportRequestV2(@JsonProperty("assets") List assets) { - public record AssetImportRequestV2(@JsonProperty("assetMetaInfo") AssetMetaInfoRequest assetMetaInfoRequest, - @JsonProperty("submodels") List submodels) { - } - - -} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetMetaInfoRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/AssetMetaInfoRequest.java similarity index 99% rename from tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetMetaInfoRequest.java rename to tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/AssetMetaInfoRequest.java index 2a9e9c7344..1d4eba3c98 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/AssetMetaInfoRequest.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/AssetMetaInfoRequest.java @@ -16,7 +16,7 @@ * * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -package org.eclipse.tractusx.traceability.assets.domain.importpoc; +package org.eclipse.tractusx.traceability.assets.domain.importpoc.model; public record AssetMetaInfoRequest(String catenaXId) { } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/ImportRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/ImportRequest.java new file mode 100644 index 0000000000..869a9a8a7e --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/ImportRequest.java @@ -0,0 +1,14 @@ +package org.eclipse.tractusx.traceability.assets.domain.importpoc.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; + +import java.util.List; + +public record ImportRequest(@JsonProperty("assets") List assets) { + public record AssetImportRequest(@JsonProperty("assetMetaInfo") AssetMetaInfoRequest assetMetaInfoRequest, + @JsonProperty("submodels") List submodels) { + } + + +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsBuiltMainAspectV2.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/MainAspectAsBuiltRequest.java similarity index 56% rename from tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsBuiltMainAspectV2.java rename to tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/MainAspectAsBuiltRequest.java index 3a92f9ea70..6d7348030d 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsBuiltMainAspectV2.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/MainAspectAsBuiltRequest.java @@ -1,11 +1,11 @@ -package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; +package org.eclipse.tractusx.traceability.assets.domain.importpoc.model; import java.util.List; -public record AsBuiltMainAspectV2(List localIdentifiers, - ManufacturingInformation manufacturingInformation, - String catenaXId, - PartTypeInformation partTypeInformation) { +public record MainAspectAsBuiltRequest(List localIdentifiers, + ManufacturingInformation manufacturingInformation, + String catenaXId, + PartTypeInformation partTypeInformation) { public record LocalIdentifier(String value, String key) { } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/PartAsPlannedV2.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/MainAspectAsPlannedRequest.java similarity index 64% rename from tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/PartAsPlannedV2.java rename to tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/MainAspectAsPlannedRequest.java index e37991f5d0..a14743e4d0 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/PartAsPlannedV2.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/MainAspectAsPlannedRequest.java @@ -1,10 +1,9 @@ -package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; +package org.eclipse.tractusx.traceability.assets.domain.importpoc.model; import java.time.LocalDateTime; -import java.util.List; -public record PartAsPlannedV2(String catenaXId, ValidityPeriod validityPeriod, - PartTypeInformation partTypeInformation +public record MainAspectAsPlannedRequest(String catenaXId, ValidityPeriod validityPeriod, + PartTypeInformation partTypeInformation ) { public record ValidityPeriod(LocalDateTime validFrom, LocalDateTime validTo) { diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/PartSiteInformationAsPlannedRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/PartSiteInformationAsPlannedRequest.java similarity index 99% rename from tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/PartSiteInformationAsPlannedRequest.java rename to tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/PartSiteInformationAsPlannedRequest.java index def46ac69c..7ea2621a5d 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/PartSiteInformationAsPlannedRequest.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/PartSiteInformationAsPlannedRequest.java @@ -16,7 +16,7 @@ * * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -package org.eclipse.tractusx.traceability.assets.domain.importpoc; +package org.eclipse.tractusx.traceability.assets.domain.importpoc.model; import java.util.List; diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingelLevelUsageAsBuiltRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/SingelLevelUsageAsBuiltRequest.java similarity index 99% rename from tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingelLevelUsageAsBuiltRequest.java rename to tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/SingelLevelUsageAsBuiltRequest.java index dc2b1d94be..cec413dcbc 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingelLevelUsageAsBuiltRequest.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/SingelLevelUsageAsBuiltRequest.java @@ -16,7 +16,7 @@ * * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -package org.eclipse.tractusx.traceability.assets.domain.importpoc; +package org.eclipse.tractusx.traceability.assets.domain.importpoc.model; import java.util.List; diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingleLevelBomAsBuiltRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/SingleLevelBomAsBuiltRequest.java similarity index 99% rename from tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingleLevelBomAsBuiltRequest.java rename to tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/SingleLevelBomAsBuiltRequest.java index 5f679b504f..c07cad5801 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingleLevelBomAsBuiltRequest.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/SingleLevelBomAsBuiltRequest.java @@ -16,7 +16,7 @@ * * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -package org.eclipse.tractusx.traceability.assets.domain.importpoc; +package org.eclipse.tractusx.traceability.assets.domain.importpoc.model; import java.util.List; diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingleLevelBomAsPlannedRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/SingleLevelBomAsPlannedRequest.java similarity index 99% rename from tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingleLevelBomAsPlannedRequest.java rename to tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/SingleLevelBomAsPlannedRequest.java index be2efe2ed0..086d5a8557 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingleLevelBomAsPlannedRequest.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/SingleLevelBomAsPlannedRequest.java @@ -16,7 +16,7 @@ * * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -package org.eclipse.tractusx.traceability.assets.domain.importpoc; +package org.eclipse.tractusx.traceability.assets.domain.importpoc.model; import java.time.OffsetDateTime; import java.util.List; diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingleLevelUsageAsPlannedRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/SingleLevelUsageAsPlannedRequest.java similarity index 99% rename from tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingleLevelUsageAsPlannedRequest.java rename to tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/SingleLevelUsageAsPlannedRequest.java index 9e5fadca2c..44bd07ffb7 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/SingleLevelUsageAsPlannedRequest.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/SingleLevelUsageAsPlannedRequest.java @@ -16,7 +16,7 @@ * * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -package org.eclipse.tractusx.traceability.assets.domain.importpoc; +package org.eclipse.tractusx.traceability.assets.domain.importpoc.model; import java.time.OffsetDateTime; import java.util.List; diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java index 798192b34c..0b4369632d 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java @@ -26,15 +26,12 @@ import org.eclipse.tractusx.traceability.assets.domain.asbuilt.repository.AssetAsBuiltRepository; import org.eclipse.tractusx.traceability.assets.domain.asplanned.repository.AssetAsPlannedRepository; import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.ImportRequest; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.ImportRequestV2; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.ImportRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.exception.ImportException; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.MappingStrategyFactory; import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; -import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Map; import java.util.Optional; @@ -55,40 +52,15 @@ public class ImportServiceImpl implements ImportService { @Override public void importAssets(MultipartFile file) { try { - String fileContent = new String(file.getBytes(), StandardCharsets.UTF_8); - log.info("Imported file: " + fileContent); - - ImportRequest importRequest = objectMapper.readValue(fileContent, ImportRequest.class); - - List persistedAsBuilts = this.assetAsBuiltRepository.saveAll(importRequest.convertAssetsAsBuilt()); - try { - log.info("persistedAsBuilts as JSON {}", objectMapper.writeValueAsString(persistedAsBuilts)); - } catch (Exception e) { - log.error("exception", e); - } - final String bpn = traceabilityProperties.getBpn().toString(); - List persistedAsPlanned = this.assetAsPlannedRepository.saveAll(importRequest.convertAssetsAsPlanned(bpn)); - try { - log.info("persistedAsPlanned as JSON {}", objectMapper.writeValueAsString(persistedAsPlanned)); - } catch (Exception e) { - log.error("exception", e); - } - } catch (Exception e) { - throw new ImportException(e.getMessage()); - } - } - - @Override - public void importAssetV2(MultipartFile file) { - try { - ImportRequestV2 importRequest = objectMapper.readValue(file.getBytes(), ImportRequestV2.class); + ImportRequest importRequest = objectMapper.readValue(file.getBytes(), ImportRequest.class); Map> map = importRequest.assets() .stream() - .map(strategyFactory::mapToAssetBase) + .map(importRequestV2 -> strategyFactory.mapToAssetBase(importRequestV2, traceabilityProperties)) .filter(Optional::isPresent) .map(Optional::get) .collect(Collectors.groupingBy(assetBase -> { + // TODO the name does not match the enum. if (isAsBuiltMainAspect(assetBase.getSemanticDataModel().name())) { return BomLifecycle.AS_BUILT; } else { diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsBuiltMainAspectStrategy.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java similarity index 67% rename from tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsBuiltMainAspectStrategy.java rename to tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java index f2b1d1c2a1..702db272fb 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsBuiltMainAspectStrategy.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java @@ -16,7 +16,7 @@ * * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; +package org.eclipse.tractusx.traceability.assets.domain.importpoc.service; import org.eclipse.tractusx.traceability.assets.domain.asbuilt.model.aspect.DetailAspectDataAsBuilt; import org.eclipse.tractusx.traceability.assets.domain.asbuilt.model.aspect.DetailAspectDataTractionBatteryCode; @@ -28,31 +28,34 @@ import org.eclipse.tractusx.traceability.assets.domain.base.model.QualityType; import org.eclipse.tractusx.traceability.assets.domain.base.model.aspect.DetailAspectModel; import org.eclipse.tractusx.traceability.assets.domain.base.model.aspect.DetailAspectType; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.ImportRequestV2; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.SingleLevelBomAsBuiltRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.ImportRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingelLevelUsageAsBuiltRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelBomAsBuiltRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.MainAspectAsBuiltRequest; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; - import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties; import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.atomic.AtomicReference; +import static org.eclipse.tractusx.traceability.assets.domain.base.model.aspect.DetailAspectModel.extractDetailAspectModelTractionBatteryCode; import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isAsBuiltMainAspect; import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isDownwardRelationshipAsBuilt; import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isTractionBatteryCode; import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isUpwardRelationshipAsBuilt; -public class AsBuiltMainAspectStrategy implements MappingStrategy { +public class MainAspectAsBuiltStrategy implements MappingStrategy { @Override - public AssetBase mapToAssetBase(ImportRequestV2.AssetImportRequestV2 assetImportRequestV2, TraceabilityProperties traceabilityProperties) { + public AssetBase mapToAssetBase(ImportRequest.AssetImportRequest assetImportRequestV2, TraceabilityProperties traceabilityProperties) { List submodels = assetImportRequestV2.submodels(); - AsBuiltMainAspectV2 asBuiltAspect = submodels.stream() + MainAspectAsBuiltRequest asBuiltAspect = submodels.stream() .filter(genericSubmodel -> isAsBuiltMainAspect(genericSubmodel.getAspectType())) .map(GenericSubmodel::getPayload) - .filter(AsBuiltMainAspectV2.class::isInstance) - .map(AsBuiltMainAspectV2.class::cast) + .filter(MainAspectAsBuiltRequest.class::isInstance) + .map(MainAspectAsBuiltRequest.class::cast) .findFirst() .orElse(null); @@ -66,8 +69,8 @@ public AssetBase mapToAssetBase(ImportRequestV2.AssetImportRequestV2 assetImport List parentRelations = submodels.stream() .filter(genericSubmodel -> isUpwardRelationshipAsBuilt(genericSubmodel.getAspectType())) .map(GenericSubmodel::getPayload) - .filter(SingelLevelUsageAsBuiltV2.class::isInstance) - .map(SingelLevelUsageAsBuiltV2.class::cast) + .filter(SingelLevelUsageAsBuiltRequest.class::isInstance) + .map(SingelLevelUsageAsBuiltRequest.class::cast) .map(singelLevelUsageAsBuiltV2 -> new Descriptions(singelLevelUsageAsBuiltV2.catenaXId(), null)) .toList(); @@ -81,13 +84,36 @@ public AssetBase mapToAssetBase(ImportRequestV2.AssetImportRequestV2 assetImport .toList(); - String semanticModelId = null; - List detailAspectModels = new ArrayList<>(); + final AtomicReference semanticModelId = new AtomicReference<>(); + final AtomicReference semanticDataModel = new AtomicReference<>(); + ArrayList detailAspectModels = new ArrayList<>(); + + asBuiltAspect.localIdentifiers().stream().filter(localIdentifier -> localIdentifier.key().equals("partInstanceId")).findFirst().ifPresent(s -> { + semanticModelId.set(s.value()); + semanticDataModel.set(org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.SERIALPART); + detailAspectDataTractionBatteryCodes.forEach(detailAspectDataTractionBatteryCode -> { + detailAspectModels.add(extractDetailAspectModelTractionBatteryCode(detailAspectDataTractionBatteryCode)); + }); + }); + + asBuiltAspect.localIdentifiers().stream().filter(localId -> localId.key().equals("batchId")).findFirst().ifPresent(s -> { + semanticModelId.set(s.value()); + semanticDataModel.set(org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.BATCH); + }); + + asBuiltAspect.localIdentifiers().stream().filter(localId -> localId.key().equals("jisNumber")).findFirst().ifPresent(s -> { + semanticModelId.set(s.value()); + semanticDataModel.set(org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.JUSTINSEQUENCE); + }); + + if (semanticDataModel.get() == null) { + semanticDataModel.set(org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.UNKNOWN); + } + - extractDetailAspectModelsAsBuilt(asBuiltAspect.manufacturingInformation(), asBuiltAspect.partTypeInformation()) return AssetBase.builder() .id(assetImportRequestV2.assetMetaInfoRequest().catenaXId()) - .semanticModelId(semanticModelId) + .semanticModelId(semanticModelId.get()) .detailAspectModels(detailAspectModels) .manufacturerId(traceabilityProperties.getBpn().value()) .nameAtManufacturer(asBuiltAspect.partTypeInformation().nameAtManufacturer()) @@ -100,14 +126,13 @@ public AssetBase mapToAssetBase(ImportRequestV2.AssetImportRequestV2 assetImport .classification(asBuiltAspect.partTypeInformation().classification()) .qualityType(QualityType.OK) .semanticDataModel(semanticDataModel.get()) - .van(van()) .importState(ImportState.TRANSIENT) .importNote(ImportNote.TRANSIENT_CREATED) .build(); } - public static DetailAspectModel extractDetailAspectModelsAsBuilt(AsBuiltMainAspectV2.ManufacturingInformation manufacturingInformation, - AsBuiltMainAspectV2.PartTypeInformation partTypeInformation) { + public static DetailAspectModel extractDetailAspectModelsAsBuilt(MainAspectAsBuiltRequest.ManufacturingInformation manufacturingInformation, + MainAspectAsBuiltRequest.PartTypeInformation partTypeInformation) { DetailAspectDataAsBuilt detailAspectDataAsBuilt = DetailAspectDataAsBuilt.builder() .customerPartId(partTypeInformation.customerPartId()) @@ -118,5 +143,4 @@ public static DetailAspectModel extractDetailAspectModelsAsBuilt(AsBuiltMainAspe .build(); return DetailAspectModel.builder().data(detailAspectDataAsBuilt).type(DetailAspectType.AS_BUILT).build(); } - } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsPlannedMainAspectStrategy.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsPlannedStrategy.java similarity index 88% rename from tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsPlannedMainAspectStrategy.java rename to tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsPlannedStrategy.java index cd2b973347..9b8f9320bd 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/AsPlannedMainAspectStrategy.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsPlannedStrategy.java @@ -16,7 +16,7 @@ * * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; +package org.eclipse.tractusx.traceability.assets.domain.importpoc.service; import org.eclipse.tractusx.traceability.assets.domain.asplanned.model.aspect.DetailAspectDataPartSiteInformationAsPlanned; import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; @@ -27,10 +27,11 @@ import org.eclipse.tractusx.traceability.assets.domain.base.model.QualityType; import org.eclipse.tractusx.traceability.assets.domain.base.model.aspect.DetailAspectModel; import org.eclipse.tractusx.traceability.assets.domain.base.model.aspect.DetailAspectType; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.ImportRequestV2; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.PartSiteInformationAsPlannedRequest; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.SingleLevelBomAsPlannedRequest; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.SingleLevelUsageAsPlannedRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.ImportRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.PartSiteInformationAsPlannedRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelBomAsPlannedRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelUsageAsPlannedRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.MainAspectAsPlannedRequest; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties; @@ -45,17 +46,17 @@ import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isUpwardRelationshipAsPlanned; -public class AsPlannedMainAspectStrategy implements MappingStrategy { +public class MainAspectAsPlannedStrategy implements MappingStrategy { @Override - public AssetBase mapToAssetBase(ImportRequestV2.AssetImportRequestV2 assetImportRequestV2, TraceabilityProperties traceabilityProperties) { + public AssetBase mapToAssetBase(ImportRequest.AssetImportRequest assetImportRequestV2, TraceabilityProperties traceabilityProperties) { List submodels = assetImportRequestV2.submodels(); - PartAsPlannedV2 partAsPlannedV2 = submodels.stream() + MainAspectAsPlannedRequest partAsPlannedV2 = submodels.stream() .filter(genericSubmodel -> isAsPlannedMainAspect(genericSubmodel.getAspectType())) .map(GenericSubmodel::getPayload) - .filter(PartAsPlannedV2.class::isInstance) - .map(PartAsPlannedV2.class::cast) + .filter(MainAspectAsPlannedRequest.class::isInstance) + .map(MainAspectAsPlannedRequest.class::cast) .findFirst() .orElse(null); @@ -84,7 +85,11 @@ public AssetBase mapToAssetBase(ImportRequestV2.AssetImportRequestV2 assetImport .map(singleLevelBomAsPlannedRequest -> new Descriptions(singleLevelBomAsPlannedRequest.catenaXId(), null)) .toList(); - List detailAspectModels = new ArrayList<>(extractDetailAspectModelsPartSiteInformationAsPlanned(emptyIfNull(partSiteInformationAsPlannedRequest.sites()))); + List detailAspectModels = new ArrayList<>(); + if (partSiteInformationAsPlannedRequest != null){ + detailAspectModels.addAll(extractDetailAspectModelsPartSiteInformationAsPlanned(emptyIfNull(partSiteInformationAsPlannedRequest.sites()))); + } + AssetBase.AssetBaseBuilder assetBaseBuilder = AssetBase.builder(); if (partAsPlannedV2 != null) { diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/MappingStrategy.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MappingStrategy.java similarity index 66% rename from tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/MappingStrategy.java rename to tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MappingStrategy.java index 079850e790..ed989f7087 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/MappingStrategy.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MappingStrategy.java @@ -1,9 +1,9 @@ -package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; +package org.eclipse.tractusx.traceability.assets.domain.importpoc.service; import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.ImportRequestV2; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.ImportRequest; import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties; public interface MappingStrategy { - AssetBase mapToAssetBase(ImportRequestV2.AssetImportRequestV2 assetImportRequestV2, TraceabilityProperties traceabilityProperties); + AssetBase mapToAssetBase(ImportRequest.AssetImportRequest assetImportRequestV2, TraceabilityProperties traceabilityProperties); } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/MappingStrategyFactory.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MappingStrategyFactory.java similarity index 83% rename from tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/MappingStrategyFactory.java rename to tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MappingStrategyFactory.java index bd0eca52af..deee15dbc2 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/MappingStrategyFactory.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MappingStrategyFactory.java @@ -16,11 +16,13 @@ * * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; +package org.eclipse.tractusx.traceability.assets.domain.importpoc.service; import lombok.RequiredArgsConstructor; import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.ImportRequestV2; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.ImportRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.service.MainAspectAsBuiltStrategy; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.service.MainAspectAsPlannedStrategy; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties; import org.springframework.stereotype.Component; @@ -34,9 +36,9 @@ @Component @RequiredArgsConstructor public class MappingStrategyFactory { - private TraceabilityProperties traceabilityProperties; - public Optional mapToAssetBase(ImportRequestV2.AssetImportRequestV2 importRequestV2) { + + public Optional mapToAssetBase(ImportRequest.AssetImportRequest importRequestV2, TraceabilityProperties traceabilityProperties) { Optional isMainAspectSubmodel = importRequestV2.submodels().stream().filter(genericSubmodel -> isMainAspect(genericSubmodel.getAspectType())).map(GenericSubmodel::getAspectType).findFirst(); @@ -44,10 +46,10 @@ public Optional mapToAssetBase(ImportRequestV2.AssetImportRequestV2 i return Optional.empty(); } if (isAsPlannedMainAspect(isMainAspectSubmodel.get())) { - return Optional.of(new AsPlannedMainAspectStrategy().mapToAssetBase(importRequestV2, traceabilityProperties)); + return Optional.of(new MainAspectAsPlannedStrategy().mapToAssetBase(importRequestV2, traceabilityProperties)); } if (isAsBuiltMainAspect(isMainAspectSubmodel.get())) { - return Optional.of(new AsBuiltMainAspectStrategy().mapToAssetBase(importRequestV2, traceabilityProperties)); + return Optional.of(new MainAspectAsBuiltStrategy().mapToAssetBase(importRequestV2, traceabilityProperties)); } return Optional.empty(); } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/PartSiteInformationAsPlannedV2.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/PartSiteInformationAsPlannedV2.java deleted file mode 100644 index 038f4728c5..0000000000 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/PartSiteInformationAsPlannedV2.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ -package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; - -import java.util.List; - -public record PartSiteInformationAsPlannedV2(String catenaXId, List sites) { - - public record Site( - String functionValidUntil, - String function, - String functionValidFrom, - String catenaXSiteId - ) { - } -} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingelLevelUsageAsBuiltV2.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingelLevelUsageAsBuiltV2.java deleted file mode 100644 index a24cc53700..0000000000 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingelLevelUsageAsBuiltV2.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ -package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; - -import java.util.List; - -public record SingelLevelUsageAsBuiltV2(String catenaXId, List customers) { - - public record Customer(List parentItems, String businessPartner, String createdOn, String lastModifiedOn) { - } - - public record ParentItem(Quantity quantity, String catenaXId, String createdOn, String lastModifiedOn) { - } - - public record Quantity(int quantityNumber, String measurementUnit) { - } - -} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingleLevelBomAsBuiltV2.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingleLevelBomAsBuiltV2.java deleted file mode 100644 index 76c6875e80..0000000000 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingleLevelBomAsBuiltV2.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ -package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; - -import java.util.List; - -public record SingleLevelBomAsBuiltV2(String catenaXId, List childItems) { - - public record ChildItem( - Quantity quantity, - boolean hasAlternatives, - String createdOn, - String lastModifiedOn, - String catenaXId, - String businessPartner - ) { - } - - public record Quantity(int quantityNumber, String measurementUnit) { - } -} - diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingleLevelBomAsPlannedV2.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingleLevelBomAsPlannedV2.java deleted file mode 100644 index b242f8b797..0000000000 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingleLevelBomAsPlannedV2.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ -package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; - -import java.time.OffsetDateTime; -import java.util.List; - -public record SingleLevelBomAsPlannedV2(String catenaXId, List childItems) { - - public record ChildItem( - ValidityPeriod validityPeriod, - String catenaXId, - Quantity quantity, - String businessPartner, - String createdOn, - String lastModifiedOn - ) { - } - - public record ValidityPeriod( - OffsetDateTime validFrom, - OffsetDateTime validTo - ) { - } - - public record Quantity( - double quantityNumber, - String measurementUnit - ) { - } -} - diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingleLevelUsageAsPlannedV2.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingleLevelUsageAsPlannedV2.java deleted file mode 100644 index 11b85cc35b..0000000000 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/v2/SingleLevelUsageAsPlannedV2.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ -package org.eclipse.tractusx.traceability.assets.domain.importpoc.v2; - -import java.time.OffsetDateTime; -import java.util.List; - -public record SingleLevelUsageAsPlannedV2( - List parentParts, - String businessPartner, - String catenaXId -) { - - public record ParentPart( - ValidityPeriod validityPeriod, - String parentCatenaXId, - Quantity quantity, - String createdOn, - String lastModifiedOn - ) { - } - - public record ValidityPeriod( - OffsetDateTime validFrom, - OffsetDateTime validTo - ) { - } - - public record Quantity( - double quantityNumber, - String measurementUnit - ) { - } -} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java index 9cd6528240..2d2020f0d5 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java @@ -26,13 +26,14 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import lombok.extern.slf4j.Slf4j; import org.eclipse.tractusx.traceability.assets.domain.asbuilt.model.aspect.DetailAspectDataTractionBatteryCode; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.SingelLevelUsageAsBuiltRequest; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.SingleLevelBomAsBuiltRequest; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.SingleLevelBomAsPlannedRequest; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.SingleLevelUsageAsPlannedRequest; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.AsBuiltMainAspectV2; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.PartAsPlannedV2; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.PartSiteInformationAsPlannedV2; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.PartSiteInformationAsPlannedRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingelLevelUsageAsBuiltRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelBomAsBuiltRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelBomAsPlannedRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelUsageAsPlannedRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.MainAspectAsBuiltRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.MainAspectAsPlannedRequest; + @Slf4j public class GenericSubmodel { @@ -42,29 +43,26 @@ public class GenericSubmodel { defaultImpl = Void.class, property = "aspectType") @JsonSubTypes({ - @Type(value = AsBuiltMainAspectV2.class, names = { + @Type(value = MainAspectAsBuiltRequest.class, names = { "urn:samm:io.catenax.serial_part:1.0.0#SerialPart", "urn:bamm:io.catenax.serial_part:1.0.0#SerialPart", "urn:bamm:io.catenax.serial_part:1.1.0#SerialPart", - "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart" - - }), - @Type(value = AsBuiltMainAspectV2.class, names = { + "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", "urn:bamm:com.catenax.batch:1.0.0#Batch", "urn:bamm:io.catenax.batch:1.0.0#Batch", "urn:bamm:io.catenax.batch:1.0.2#Batch", - "urn:samm:io.catenax.batch:2.0.0#Batch" + "urn:samm:io.catenax.batch:2.0.0#Batch", + "urn:bamm:io.catenax.just_in_sequence_part:1.0.0#JustInSequencePart" }), - @Type(value = PartAsPlannedV2.class, names = { + + @Type(value = MainAspectAsPlannedRequest.class, names = { "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", "urn:bamm:io.catenax.part_as_planned:1.0.0#PartAsPlanned" }), - @Type(value = PartSiteInformationAsPlannedV2.class, names = { + @Type(value = PartSiteInformationAsPlannedRequest.class, names = { "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned" }), - @Type(value = AsBuiltMainAspectV2.class, names = { - "urn:bamm:io.catenax.just_in_sequence_part:1.0.0#JustInSequencePart" - }), + @Type(value = DetailAspectDataTractionBatteryCode.class, names = { "urn:bamm:io.catenax.traction_battery_code:1.0.0#TractionBatteryCode" }), diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequestTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequestTest.java index d54ae407f4..5a233c9eec 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequestTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/ImportRequestTest.java @@ -20,6 +20,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.ImportRequest; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -30,7 +31,7 @@ import java.nio.file.Path; @ExtendWith(MockitoExtension.class) -class ImportRequestTest { +class ImportRequestV2Test { @Test void testMapper() throws IOException { diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java index f1b1ac6517..78c26ce659 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java @@ -6,7 +6,7 @@ import org.eclipse.tractusx.traceability.assets.domain.asplanned.repository.AssetAsPlannedRepository; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.v2.MappingStrategyFactory; +import org.eclipse.tractusx.traceability.common.model.BPN; import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -19,6 +19,8 @@ import java.io.IOException; import java.io.InputStream; +import static org.mockito.Mockito.when; + @ExtendWith(MockitoExtension.class) class ImportServiceImplTest { @@ -30,7 +32,6 @@ class ImportServiceImplTest { @Mock private AssetAsBuiltRepository assetAsBuiltRepository; - @Mock private MappingStrategyFactory strategyFactory; @Mock private TraceabilityProperties traceabilityProperties; @@ -39,8 +40,8 @@ class ImportServiceImplTest { public void testSetup(){ ObjectMapper objectMapper = new ObjectMapper(); objectMapper.registerModule(new JavaTimeModule()); - //when(traceabilityProperties.getBpn()).thenReturn(BPN.of("ABC")); - importService = new ImportServiceImpl(objectMapper, assetAsPlannedRepository, assetAsBuiltRepository, traceabilityProperties, strategyFactory); + + importService = new ImportServiceImpl(objectMapper, assetAsPlannedRepository, assetAsBuiltRepository, traceabilityProperties, new MappingStrategyFactory()); } @Test @@ -56,8 +57,8 @@ void testService() throws IOException { ); //importService.importAssets(multipartFile); - - importService.importAssetV2(multipartFile); + when(traceabilityProperties.getBpn()).thenReturn(BPN.of("ABC")); + importService.importAssets(multipartFile); } From 8619dac874166f13faaacec7fec650d38c5a2053 Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Tue, 9 Jan 2024 08:37:26 +0100 Subject: [PATCH 16/49] feat(mapping): TRACEFOSS-2741 alternative approach --- .../domain/base/model/SemanticDataModel.java | 8 ++++++- .../importpoc/service/ImportServiceImpl.java | 7 +++--- .../service/MainAspectAsBuiltStrategy.java | 12 +++++----- .../service/MainAspectAsPlannedStrategy.java | 16 +++++++------- .../semanticdatamodel/SemanticDataModel.java | 22 +++++++++++++------ 5 files changed, 39 insertions(+), 26 deletions(-) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/model/SemanticDataModel.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/model/SemanticDataModel.java index 92e25f48cf..3123d9d50b 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/model/SemanticDataModel.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/model/SemanticDataModel.java @@ -20,5 +20,11 @@ package org.eclipse.tractusx.traceability.assets.domain.base.model; public enum SemanticDataModel { - BATCH, SERIALPART, UNKNOWN, PARTASPLANNED, JUSTINSEQUENCE + BATCH("Batch"), SERIALPART("SerialPart"), UNKNOWN(""), PARTASPLANNED("PartAsPlanned"), JUSTINSEQUENCE("JustInSequence"); + + private String name; + + SemanticDataModel(String name) { + this.name = name; + } } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java index 0b4369632d..a5be71e0ee 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java @@ -26,8 +26,8 @@ import org.eclipse.tractusx.traceability.assets.domain.asbuilt.repository.AssetAsBuiltRepository; import org.eclipse.tractusx.traceability.assets.domain.asplanned.repository.AssetAsPlannedRepository; import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.ImportRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.exception.ImportException; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.ImportRequest; import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; @@ -37,7 +37,7 @@ import java.util.Optional; import java.util.stream.Collectors; -import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isAsBuiltMainAspect; +import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.semanticdatamodel.SemanticDataModel.isAsBuiltMainSemanticModel; @Slf4j @RequiredArgsConstructor @@ -60,8 +60,7 @@ public void importAssets(MultipartFile file) { .filter(Optional::isPresent) .map(Optional::get) .collect(Collectors.groupingBy(assetBase -> { - // TODO the name does not match the enum. - if (isAsBuiltMainAspect(assetBase.getSemanticDataModel().name())) { + if (isAsBuiltMainSemanticModel(assetBase.getSemanticDataModel())) { return BomLifecycle.AS_BUILT; } else { return BomLifecycle.AS_PLANNED; diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java index 702db272fb..f764f9048c 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java @@ -69,18 +69,18 @@ public AssetBase mapToAssetBase(ImportRequest.AssetImportRequest assetImportRequ List parentRelations = submodels.stream() .filter(genericSubmodel -> isUpwardRelationshipAsBuilt(genericSubmodel.getAspectType())) .map(GenericSubmodel::getPayload) - .filter(SingelLevelUsageAsBuiltRequest.class::isInstance) - .map(SingelLevelUsageAsBuiltRequest.class::cast) - .map(singelLevelUsageAsBuiltV2 -> new Descriptions(singelLevelUsageAsBuiltV2.catenaXId(), null)) + .filter(SingleLevelBomAsBuiltRequest.class::isInstance) + .map(SingleLevelBomAsBuiltRequest.class::cast) + .map(singleLevelBomAsBuiltRequest -> new Descriptions(singleLevelBomAsBuiltRequest.catenaXId(), null)) .toList(); List childRelations = submodels.stream() .filter(genericSubmodel -> isDownwardRelationshipAsBuilt(genericSubmodel.getAspectType())) .map(GenericSubmodel::getPayload) - .filter(SingleLevelBomAsBuiltRequest.class::isInstance) - .map(SingleLevelBomAsBuiltRequest.class::cast) - .map(singleLevelBomAsBuiltRequest -> new Descriptions(singleLevelBomAsBuiltRequest.catenaXId(), null)) + .filter(SingelLevelUsageAsBuiltRequest.class::isInstance) + .map(SingelLevelUsageAsBuiltRequest.class::cast) + .map(singleLevelUsageAsBuiltRequest -> new Descriptions(singleLevelUsageAsBuiltRequest.catenaXId(), null)) .toList(); diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsPlannedStrategy.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsPlannedStrategy.java index 9b8f9320bd..f17770c569 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsPlannedStrategy.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsPlannedStrategy.java @@ -28,10 +28,10 @@ import org.eclipse.tractusx.traceability.assets.domain.base.model.aspect.DetailAspectModel; import org.eclipse.tractusx.traceability.assets.domain.base.model.aspect.DetailAspectType; import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.ImportRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.MainAspectAsPlannedRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.PartSiteInformationAsPlannedRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelBomAsPlannedRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelUsageAsPlannedRequest; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.MainAspectAsPlannedRequest; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties; @@ -71,22 +71,22 @@ public AssetBase mapToAssetBase(ImportRequest.AssetImportRequest assetImportRequ List parentRelations = submodels.stream() .filter(genericSubmodel -> isUpwardRelationshipAsPlanned(genericSubmodel.getAspectType())) .map(GenericSubmodel::getPayload) - .filter(SingleLevelUsageAsPlannedRequest.class::isInstance) - .map(SingleLevelUsageAsPlannedRequest.class::cast) - .map(singleLevelUsageAsPlannedRequest -> new Descriptions(singleLevelUsageAsPlannedRequest.catenaXId(), null)) + .filter(SingleLevelBomAsPlannedRequest.class::isInstance) + .map(SingleLevelBomAsPlannedRequest.class::cast) + .map(singleLevelBomAsPlannedRequest -> new Descriptions(singleLevelBomAsPlannedRequest.catenaXId(), null)) .toList(); List childRelations = submodels.stream() .filter(genericSubmodel -> isDownwardRelationshipAsPlanned(genericSubmodel.getAspectType())) .map(GenericSubmodel::getPayload) - .filter(SingleLevelBomAsPlannedRequest.class::isInstance) - .map(SingleLevelBomAsPlannedRequest.class::cast) - .map(singleLevelBomAsPlannedRequest -> new Descriptions(singleLevelBomAsPlannedRequest.catenaXId(), null)) + .filter(SingleLevelUsageAsPlannedRequest.class::isInstance) + .map(SingleLevelUsageAsPlannedRequest.class::cast) + .map(singleLevelUsageAsPlannedRequest -> new Descriptions(singleLevelUsageAsPlannedRequest.catenaXId(), null)) .toList(); List detailAspectModels = new ArrayList<>(); - if (partSiteInformationAsPlannedRequest != null){ + if (partSiteInformationAsPlannedRequest != null) { detailAspectModels.addAll(extractDetailAspectModelsPartSiteInformationAsPlanned(emptyIfNull(partSiteInformationAsPlannedRequest.sites()))); } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/semanticdatamodel/SemanticDataModel.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/semanticdatamodel/SemanticDataModel.java index 2dedf7c870..43e8ea3ed8 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/semanticdatamodel/SemanticDataModel.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/semanticdatamodel/SemanticDataModel.java @@ -44,6 +44,9 @@ import java.util.concurrent.atomic.AtomicReference; import static org.apache.commons.collections4.ListUtils.emptyIfNull; +import static org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.BATCH; +import static org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.JUSTINSEQUENCE; +import static org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.SERIALPART; import static org.eclipse.tractusx.traceability.assets.domain.base.model.aspect.DetailAspectModel.extractDetailAspectModelTractionBatteryCode; import static org.eclipse.tractusx.traceability.assets.domain.base.model.aspect.DetailAspectModel.extractDetailAspectModelsAsBuilt; import static org.eclipse.tractusx.traceability.assets.domain.base.model.aspect.DetailAspectModel.extractDetailAspectModelsAsPlanned; @@ -107,13 +110,13 @@ public AssetBase toDomainAsBuilt(List localIds, Map sho getLocalIdByInput(LocalIdKey.PART_INSTANCE_ID, localIds).ifPresent(s -> { semanticModelId.set(s); - semanticDataModel.set(org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.SERIALPART); + semanticDataModel.set(SERIALPART); tractionBatteryCodeOptional.ifPresent(tbc -> detailAspectModels.add(extractDetailAspectModelTractionBatteryCode(tbc))); }); getLocalIdByInput(LocalIdKey.BATCH_ID, localIds).ifPresent(s -> { semanticModelId.set(s); - semanticDataModel.set(org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.BATCH); + semanticDataModel.set(BATCH); }); getLocalIdByInput(LocalIdKey.JIS_NUMBER, localIds).ifPresent(s -> { @@ -160,7 +163,7 @@ public AssetBase toDomainAsBuiltLight(List parentRelations, List localId.key().equals(LocalIdKey.PART_INSTANCE_ID)).findFirst().ifPresent(s -> { semanticModelId.set(s.value()); - semanticDataModel.set(org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.SERIALPART); + semanticDataModel.set(SERIALPART); detailAspectDataTractionBatteryCodes.forEach(detailAspectDataTractionBatteryCode -> { detailAspectModels.add(extractDetailAspectModelTractionBatteryCode(detailAspectDataTractionBatteryCode)); }); @@ -168,7 +171,7 @@ public AssetBase toDomainAsBuiltLight(List parentRelations, List localId.key().equals(LocalIdKey.BATCH_ID)).findFirst().ifPresent(s -> { semanticModelId.set(s.value()); - semanticDataModel.set(org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.BATCH); + semanticDataModel.set(BATCH); }); localIdentifiers.stream().filter(localId -> localId.key().equals(LocalIdKey.JIS_NUMBER)).findFirst().ifPresent(s -> { @@ -211,7 +214,7 @@ public AssetBase toDomainAsPlannedLight( List parentRelations, List childRelations, String ownerBpn - ) { + ) { List partSiteInfoAsPlanned = extractDetailAspectModelsPartSiteInformationAsPlanned(sites()); @@ -222,9 +225,9 @@ public AssetBase toDomainAsPlannedLight( return AssetBase.builder() .id(catenaXId()) - // .idShort(defaultValue(shortIds.get(catenaXId()))) + // .idShort(defaultValue(shortIds.get(catenaXId()))) .manufacturerId(ownerBpn) - // .manufacturerName(defaultValue(manufacturerName)) + // .manufacturerName(defaultValue(manufacturerName)) .nameAtManufacturer(partTypeInformation.nameAtManufacturer()) .manufacturerPartId(partTypeInformation.manufacturerPartId()) .parentRelations(parentRelations) @@ -362,4 +365,9 @@ public boolean isAsBuilt() { return !aspectType.contains("AsPlanned"); } + + public static boolean isAsBuiltMainSemanticModel(org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel semanticDataModel) { + return semanticDataModel.equals(SERIALPART) || semanticDataModel.equals(BATCH) || semanticDataModel.equals(JUSTINSEQUENCE); + } + } From 858b6e17d965e4058f3e3db321f2032ccd71073d Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Tue, 9 Jan 2024 08:38:37 +0100 Subject: [PATCH 17/49] feat(mapping): TRACEFOSS-2741 alternative approach --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7715a7f2c7..5bdb6c7cd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [UNRELEASED - DD.MM.YYYY] ### Added +- Import Data Service for data provisioning ### Changed - Fixed security findings From d653b36f7e25ff7347826fa9b36b807b70a0296a Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Tue, 9 Jan 2024 08:54:12 +0100 Subject: [PATCH 18/49] feat(mapping): TRACEFOSS-2741 alternative approach --- ...va => SingleLevelUsageAsBuiltRequest.java} | 2 +- .../service/MainAspectAsBuiltStrategy.java | 6 +- .../irs/model/response/GenericSubmodel.java | 4 +- .../semanticdatamodel/SemanticDataModel.java | 92 ------------------- .../service/ImportServiceImplTest.java | 26 +++++- 5 files changed, 30 insertions(+), 100 deletions(-) rename tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/{SingelLevelUsageAsBuiltRequest.java => SingleLevelUsageAsBuiltRequest.java} (95%) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/SingelLevelUsageAsBuiltRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/SingleLevelUsageAsBuiltRequest.java similarity index 95% rename from tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/SingelLevelUsageAsBuiltRequest.java rename to tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/SingleLevelUsageAsBuiltRequest.java index cec413dcbc..e5c80e8738 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/SingelLevelUsageAsBuiltRequest.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/SingleLevelUsageAsBuiltRequest.java @@ -20,7 +20,7 @@ import java.util.List; -public record SingelLevelUsageAsBuiltRequest(String catenaXId, List customers) { +public record SingleLevelUsageAsBuiltRequest(String catenaXId, List customers) { public record Customer(List parentItems, String businessPartner, String createdOn, String lastModifiedOn) { } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java index f764f9048c..d50f1cde93 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java @@ -29,7 +29,7 @@ import org.eclipse.tractusx.traceability.assets.domain.base.model.aspect.DetailAspectModel; import org.eclipse.tractusx.traceability.assets.domain.base.model.aspect.DetailAspectType; import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.ImportRequest; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingelLevelUsageAsBuiltRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelUsageAsBuiltRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelBomAsBuiltRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.MainAspectAsBuiltRequest; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; @@ -78,8 +78,8 @@ public AssetBase mapToAssetBase(ImportRequest.AssetImportRequest assetImportRequ List childRelations = submodels.stream() .filter(genericSubmodel -> isDownwardRelationshipAsBuilt(genericSubmodel.getAspectType())) .map(GenericSubmodel::getPayload) - .filter(SingelLevelUsageAsBuiltRequest.class::isInstance) - .map(SingelLevelUsageAsBuiltRequest.class::cast) + .filter(SingleLevelUsageAsBuiltRequest.class::isInstance) + .map(SingleLevelUsageAsBuiltRequest.class::cast) .map(singleLevelUsageAsBuiltRequest -> new Descriptions(singleLevelUsageAsBuiltRequest.catenaXId(), null)) .toList(); diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java index 2d2020f0d5..03a3728489 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java @@ -27,7 +27,7 @@ import lombok.extern.slf4j.Slf4j; import org.eclipse.tractusx.traceability.assets.domain.asbuilt.model.aspect.DetailAspectDataTractionBatteryCode; import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.PartSiteInformationAsPlannedRequest; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingelLevelUsageAsBuiltRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelUsageAsBuiltRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelBomAsBuiltRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelBomAsPlannedRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelUsageAsPlannedRequest; @@ -69,7 +69,7 @@ public class GenericSubmodel { @Type(value = SingleLevelBomAsBuiltRequest.class, names = { "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt" }), - @Type(value = SingelLevelUsageAsBuiltRequest.class, names = { + @Type(value = SingleLevelUsageAsBuiltRequest.class, names = { "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt" }), @Type(value = SingleLevelUsageAsPlannedRequest.class, names = { diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/semanticdatamodel/SemanticDataModel.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/semanticdatamodel/SemanticDataModel.java index 43e8ea3ed8..50faa07aef 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/semanticdatamodel/SemanticDataModel.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/semanticdatamodel/SemanticDataModel.java @@ -153,98 +153,6 @@ public AssetBase toDomainAsBuilt(List localIds, Map sho .build(); } - public AssetBase toDomainAsBuiltLight(List parentRelations, List childRelations, - List detailAspectDataTractionBatteryCodes) { - - ArrayList detailAspectModels = new ArrayList<>(); - - final AtomicReference semanticModelId = new AtomicReference<>(); - final AtomicReference semanticDataModel = new AtomicReference<>(); - - localIdentifiers.stream().filter(localId -> localId.key().equals(LocalIdKey.PART_INSTANCE_ID)).findFirst().ifPresent(s -> { - semanticModelId.set(s.value()); - semanticDataModel.set(SERIALPART); - detailAspectDataTractionBatteryCodes.forEach(detailAspectDataTractionBatteryCode -> { - detailAspectModels.add(extractDetailAspectModelTractionBatteryCode(detailAspectDataTractionBatteryCode)); - }); - }); - - localIdentifiers.stream().filter(localId -> localId.key().equals(LocalIdKey.BATCH_ID)).findFirst().ifPresent(s -> { - semanticModelId.set(s.value()); - semanticDataModel.set(BATCH); - }); - - localIdentifiers.stream().filter(localId -> localId.key().equals(LocalIdKey.JIS_NUMBER)).findFirst().ifPresent(s -> { - semanticModelId.set(s.value()); - semanticDataModel.set(org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.JUSTINSEQUENCE); - }); - - if (semanticDataModel.get() == null) { - semanticDataModel.set(org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.UNKNOWN); - } - - detailAspectModels.add(extractDetailAspectModelsAsBuilt(manufacturingInformation, partTypeInformation)); - - return AssetBase.builder() - .id(catenaXId()) - // only in shell object existing basically just a trim of the nameAtManufacturer - // .idShort(defaultValue(shortIds.get(catenaXId()))) - .semanticModelId(semanticModelId.get()) - .detailAspectModels(detailAspectModels) - .manufacturerId(manufacturerId()) - // we dont have the manufacturername - //.manufacturerName(defaultValue(manufacturerName)) - .nameAtManufacturer(partTypeInformation.nameAtManufacturer()) - .manufacturerPartId(partTypeInformation.manufacturerPartId()) - .parentRelations(parentRelations) - .childRelations(childRelations) - .owner(Owner.OWN) - .activeAlert(false) - .inInvestigation(false) - .classification(partTypeInformation.classification()) - .qualityType(QualityType.OK) - .semanticDataModel(semanticDataModel.get()) - .van(van()) - .importState(ImportState.TRANSIENT) - .importNote(ImportNote.TRANSIENT_CREATED) - .build(); - } - - public AssetBase toDomainAsPlannedLight( - List parentRelations, - List childRelations, - String ownerBpn - ) { - - - List partSiteInfoAsPlanned = extractDetailAspectModelsPartSiteInformationAsPlanned(sites()); - DetailAspectModel asPlanned = extractDetailAspectModelsAsPlanned(validityPeriod); - - final List aspectModels = new ArrayList<>(partSiteInfoAsPlanned); - aspectModels.add(asPlanned); - - return AssetBase.builder() - .id(catenaXId()) - // .idShort(defaultValue(shortIds.get(catenaXId()))) - .manufacturerId(ownerBpn) - // .manufacturerName(defaultValue(manufacturerName)) - .nameAtManufacturer(partTypeInformation.nameAtManufacturer()) - .manufacturerPartId(partTypeInformation.manufacturerPartId()) - .parentRelations(parentRelations) - .detailAspectModels(aspectModels) - .childRelations(childRelations) - .owner(Owner.OWN) - .activeAlert(false) - .classification(partTypeInformation.classification()) - .inInvestigation(false) - .qualityType(QualityType.OK) - .semanticDataModel(org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.PARTASPLANNED) - .van(van()) - .importState(ImportState.TRANSIENT) - .importNote(ImportNote.TRANSIENT_CREATED) - .build(); - } - public AssetBase toDomainAsPlanned( Map shortIds, Owner owner, diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java index 78c26ce659..f6e221ba0f 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java @@ -1,3 +1,21 @@ +/******************************************************************************** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ package org.eclipse.tractusx.traceability.assets.domain.importpoc.service; import com.fasterxml.jackson.databind.ObjectMapper; @@ -19,6 +37,9 @@ import java.io.IOException; import java.io.InputStream; +import static org.mockito.ArgumentMatchers.anyList; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) @@ -45,7 +66,7 @@ public void testSetup(){ } @Test - void testService() throws IOException { + void testImportRequestSuccessful() throws IOException { InputStream file = ImportServiceImplTest.class.getResourceAsStream("/testdata/import-request.json"); // Convert the file to a MockMultipartFile @@ -56,9 +77,10 @@ void testService() throws IOException { file ); - //importService.importAssets(multipartFile); when(traceabilityProperties.getBpn()).thenReturn(BPN.of("ABC")); importService.importAssets(multipartFile); + verify(assetAsBuiltRepository, times(1)).saveAll(anyList()); + verify(assetAsPlannedRepository, times(1)).saveAll(anyList()); } From 58fc1208e409abd08bcae7008d57deef34748022 Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Tue, 9 Jan 2024 09:00:19 +0100 Subject: [PATCH 19/49] feat(mapping): TRACEFOSS-2741 alternative approach --- .../importpoc/service/MainAspectAsBuiltStrategy.java | 8 +++----- .../domain/importpoc/service/MappingStrategyFactory.java | 2 -- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java index d50f1cde93..ebbacfcd86 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java @@ -29,9 +29,9 @@ import org.eclipse.tractusx.traceability.assets.domain.base.model.aspect.DetailAspectModel; import org.eclipse.tractusx.traceability.assets.domain.base.model.aspect.DetailAspectType; import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.ImportRequest; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelUsageAsBuiltRequest; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelBomAsBuiltRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.MainAspectAsBuiltRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelBomAsBuiltRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelUsageAsBuiltRequest; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties; @@ -91,9 +91,7 @@ public AssetBase mapToAssetBase(ImportRequest.AssetImportRequest assetImportRequ asBuiltAspect.localIdentifiers().stream().filter(localIdentifier -> localIdentifier.key().equals("partInstanceId")).findFirst().ifPresent(s -> { semanticModelId.set(s.value()); semanticDataModel.set(org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.SERIALPART); - detailAspectDataTractionBatteryCodes.forEach(detailAspectDataTractionBatteryCode -> { - detailAspectModels.add(extractDetailAspectModelTractionBatteryCode(detailAspectDataTractionBatteryCode)); - }); + detailAspectDataTractionBatteryCodes.forEach(detailAspectDataTractionBatteryCode -> detailAspectModels.add(extractDetailAspectModelTractionBatteryCode(detailAspectDataTractionBatteryCode))); }); asBuiltAspect.localIdentifiers().stream().filter(localId -> localId.key().equals("batchId")).findFirst().ifPresent(s -> { diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MappingStrategyFactory.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MappingStrategyFactory.java index deee15dbc2..d30e2af3fc 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MappingStrategyFactory.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MappingStrategyFactory.java @@ -21,8 +21,6 @@ import lombok.RequiredArgsConstructor; import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.ImportRequest; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.service.MainAspectAsBuiltStrategy; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.service.MainAspectAsPlannedStrategy; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties; import org.springframework.stereotype.Component; From af2cc3bc6dc5f8841129aa03fe6fa7cf1a0b9590 Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Tue, 9 Jan 2024 11:02:56 +0100 Subject: [PATCH 20/49] feat(mapping): TRACEFOSS-2741 alternative approach --- .../assets/application/ImportController.java | 29 +++++++++++---- .../asbuilt/rest/AssetAsBuiltController.java | 2 +- .../rest/AssetAsPlannedController.java | 2 +- .../dashboard/rest/DashboardController.java | 2 +- .../application/importpoc/ImportService.java | 5 ++- .../assets/domain/base/AssetRepository.java | 2 ++ .../importpoc/service/ImportServiceImpl.java | 10 +++--- .../AssetAsBuiltRepositoryImpl.java | 35 +++++++++++++++++++ .../AssetAsPlannedRepositoryImpl.java | 9 +++++ .../rest/BpnMappingController.java | 2 +- .../common/config/ErrorHandlingConfig.java | 2 +- .../alert/rest/AlertController.java | 2 +- .../EdcNotificationContractController.java | 2 +- .../rest/InvestigationsController.java | 2 +- .../infrastructure/edc/EdcController.java | 2 +- .../application/RegistryController.java | 2 +- .../ShellDescriptorController.java | 2 +- .../application/rest/SubmodelController.java | 2 +- .../config/ErrorHandlingConfigTest.java | 2 +- .../java/assets/importpoc}/ErrorResponse.java | 2 +- .../java/assets/importpoc/ImportResponse.java | 26 ++++++++++++++ .../assets/importpoc/ImportStateMessage.java | 24 +++++++++++++ .../assets/importpoc/ImportStateResponse.java | 24 +++++++++++++ .../assets/importpoc}/ValidationResponse.java | 2 +- 24 files changed, 167 insertions(+), 27 deletions(-) rename {tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/response => tx-models/src/main/java/assets/importpoc}/ErrorResponse.java (95%) create mode 100644 tx-models/src/main/java/assets/importpoc/ImportResponse.java create mode 100644 tx-models/src/main/java/assets/importpoc/ImportStateMessage.java create mode 100644 tx-models/src/main/java/assets/importpoc/ImportStateResponse.java rename {tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/response => tx-models/src/main/java/assets/importpoc}/ValidationResponse.java (94%) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java index 0e2c69e2e2..003fb66f88 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java @@ -20,6 +20,11 @@ package org.eclipse.tractusx.traceability.assets.application; +import assets.importpoc.ErrorResponse; +import assets.importpoc.ImportResponse; +import assets.importpoc.ImportStateMessage; +import assets.importpoc.ImportStateResponse; +import assets.importpoc.ValidationResponse; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; @@ -31,8 +36,7 @@ import lombok.extern.slf4j.Slf4j; import org.eclipse.tractusx.traceability.assets.application.importpoc.ImportService; import org.eclipse.tractusx.traceability.assets.application.importpoc.validation.JsonFileValidator; -import org.eclipse.tractusx.traceability.common.response.ErrorResponse; -import org.eclipse.tractusx.traceability.common.response.ValidationResponse; +import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; @@ -44,6 +48,7 @@ import org.springframework.web.multipart.MultipartFile; import java.util.List; +import java.util.Map; @Slf4j @RequiredArgsConstructor @@ -116,14 +121,24 @@ public class ImportController { schema = @Schema(implementation = ErrorResponse.class)))}) @PostMapping(value = "/import", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity importJson(@RequestPart("file") MultipartFile file) { + public ResponseEntity importJson(@RequestPart("file") MultipartFile file) { List validationResult = jsonFileValidator.isValid(file); + ValidationResponse validationResponse = new ValidationResponse(validationResult); + if (!validationResult.isEmpty()) { - return ResponseEntity.status(HttpStatus.BAD_REQUEST) - .body(new ValidationResponse(validationResult)); + return ResponseEntity + .status(HttpStatus.BAD_REQUEST) + .body(new ImportResponse(List.of(new ImportStateMessage(null, null, false, validationResponse)))); } - importService.importAssets(file); - return ResponseEntity.noContent().build(); + Map resultMap = importService.importAssets(file); + + List importStateMessages = resultMap.entrySet().stream().map(assetBaseSet -> new ImportStateMessage(assetBaseSet.getKey().getId(), ImportStateResponse.valueOf(assetBaseSet.getKey().getImportState().name()), assetBaseSet.getValue(), validationResponse)).toList(); + + ImportResponse importResponse = new ImportResponse(importStateMessages); + + return ResponseEntity.ok(importResponse); } } + + diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asbuilt/rest/AssetAsBuiltController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asbuilt/rest/AssetAsBuiltController.java index 77a8b74bb6..c22266edbe 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asbuilt/rest/AssetAsBuiltController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asbuilt/rest/AssetAsBuiltController.java @@ -43,7 +43,7 @@ import org.eclipse.tractusx.traceability.common.model.PageResult; import org.eclipse.tractusx.traceability.common.request.OwnPageable; import org.eclipse.tractusx.traceability.common.request.SearchCriteriaRequestParam; -import org.eclipse.tractusx.traceability.common.response.ErrorResponse; +import assets.importpoc.ErrorResponse; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asplanned/rest/AssetAsPlannedController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asplanned/rest/AssetAsPlannedController.java index 79e18f82ce..b89f7b8731 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asplanned/rest/AssetAsPlannedController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/asplanned/rest/AssetAsPlannedController.java @@ -41,7 +41,7 @@ import org.eclipse.tractusx.traceability.common.model.PageResult; import org.eclipse.tractusx.traceability.common.request.OwnPageable; import org.eclipse.tractusx.traceability.common.request.SearchCriteriaRequestParam; -import org.eclipse.tractusx.traceability.common.response.ErrorResponse; +import assets.importpoc.ErrorResponse; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/dashboard/rest/DashboardController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/dashboard/rest/DashboardController.java index 9537c5e225..0bf7077edc 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/dashboard/rest/DashboardController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/dashboard/rest/DashboardController.java @@ -32,7 +32,7 @@ import lombok.RequiredArgsConstructor; import org.eclipse.tractusx.traceability.assets.application.dashboard.mapper.DashboardResponseMapper; import org.eclipse.tractusx.traceability.assets.application.dashboard.service.DashboardService; -import org.eclipse.tractusx.traceability.common.response.ErrorResponse; +import assets.importpoc.ErrorResponse; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/importpoc/ImportService.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/importpoc/ImportService.java index 876df7a2ea..b814435327 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/importpoc/ImportService.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/importpoc/ImportService.java @@ -18,10 +18,13 @@ ********************************************************************************/ package org.eclipse.tractusx.traceability.assets.application.importpoc; +import assets.response.base.ImportStateResponse; +import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; +import java.util.Map; public interface ImportService { - void importAssets(MultipartFile file); + Map importAssets(MultipartFile file); } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/AssetRepository.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/AssetRepository.java index df0f3b61d7..26b841f693 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/AssetRepository.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/AssetRepository.java @@ -39,6 +39,8 @@ public interface AssetRepository { List saveAll(List assets); + List saveAllIfNotInIRSSyncAndUpdateImportStateAndNote(List assets); + long countAssets(); void updateParentDescriptionsAndOwner(final AssetBase asset); diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java index a5be71e0ee..7e1f311d9f 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java @@ -32,6 +32,7 @@ import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; @@ -50,7 +51,7 @@ public class ImportServiceImpl implements ImportService { private final MappingStrategyFactory strategyFactory; @Override - public void importAssets(MultipartFile file) { + public Map importAssets(MultipartFile file) { try { ImportRequest importRequest = objectMapper.readValue(file.getBytes(), ImportRequest.class); Map> map = @@ -66,9 +67,10 @@ public void importAssets(MultipartFile file) { return BomLifecycle.AS_PLANNED; } })); - this.assetAsBuiltRepository.saveAll(map.get(BomLifecycle.AS_BUILT)); - this.assetAsPlannedRepository.saveAll(map.get(BomLifecycle.AS_PLANNED)); - + this.assetAsBuiltRepository.saveAllIfNotInIRSSyncAndUpdateImportStateAndNote(map.get(BomLifecycle.AS_BUILT)); + this.assetAsPlannedRepository.saveAllIfNotInIRSSyncAndUpdateImportStateAndNote(map.get(BomLifecycle.AS_PLANNED)); + Map resultMap = new HashMap<>(); + // TODO construct result } catch (Exception e) { throw new ImportException(e.getMessage()); } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/repository/AssetAsBuiltRepositoryImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/repository/AssetAsBuiltRepositoryImpl.java index ab724dbdb1..a45c3f1220 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/repository/AssetAsBuiltRepositoryImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/repository/AssetAsBuiltRepositoryImpl.java @@ -28,12 +28,16 @@ import org.eclipse.tractusx.traceability.assets.domain.asbuilt.exception.AssetNotFoundException; import org.eclipse.tractusx.traceability.assets.domain.asbuilt.repository.AssetAsBuiltRepository; import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; +import org.eclipse.tractusx.traceability.assets.domain.base.model.ImportNote; +import org.eclipse.tractusx.traceability.assets.domain.base.model.ImportState; import org.eclipse.tractusx.traceability.assets.domain.base.model.Owner; import org.eclipse.tractusx.traceability.assets.infrastructure.asbuilt.model.AssetAsBuiltEntity; import org.eclipse.tractusx.traceability.common.repository.CriteriaUtility; import org.springframework.stereotype.Component; +import java.util.ArrayList; import java.util.List; +import java.util.Optional; @RequiredArgsConstructor @Component @@ -97,6 +101,37 @@ public List saveAll(List assets) { .toList(); } + // TODO make sure this will update based on the import strategy and updated import note and state based on it + @Override + @Transactional + public List saveAllIfNotInIRSSyncAndUpdateImportStateAndNote(List assets) { + List savedEntities = new ArrayList<>(); + + for (AssetBase asset : assets) { + String assetId = asset.getId(); // Assuming getId() returns the ID of the entity + + // Check if the entity with the given ID already exists + Optional existingEntityOptional = jpaAssetAsBuiltRepository.findById(assetId); + + if (existingEntityOptional.isPresent()) { + // If it exists, update the single attribute + AssetAsBuiltEntity existingEntity = existingEntityOptional.get(); + ImportNote importNote = existingEntity.getImportState().equals(ImportState.PERSISTENT) + savedEntities.add(existingEntity); + } else { + // If it doesn't exist, save the new entity + AssetAsBuiltEntity newEntity = AssetAsBuiltEntity.fromDomain(asset); + savedEntities.add(newEntity); + } + } + + return jpaAssetAsBuiltRepository.saveAll(savedEntities).stream() + .map(AssetAsBuiltEntity::toDomain) + .toList(); + } + + // TODO check if it exists + @Transactional @Override diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/repository/AssetAsPlannedRepositoryImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/repository/AssetAsPlannedRepositoryImpl.java index 20f34c577e..931a97f44a 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/repository/AssetAsPlannedRepositoryImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/repository/AssetAsPlannedRepositoryImpl.java @@ -35,6 +35,7 @@ import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; +import java.util.Collections; import java.util.List; import static org.apache.commons.collections4.ListUtils.emptyIfNull; @@ -97,6 +98,14 @@ public List saveAll(List assets) { return AssetAsPlannedEntity.toDomainList(jpaAssetAsPlannedRepository.saveAll(AssetAsPlannedEntity.fromList(assets))); } + // TODO make sure this will update based on the import strategy and updated import note and state based on it + + @Override + @Transactional + public List saveAllIfNotInIRSSyncAndUpdateImportStateAndNote(List assets) { + return Collections.emptyList(); + } + @Transactional @Override public void updateParentDescriptionsAndOwner(final AssetBase asset) { diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/bpn/application/rest/BpnMappingController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/bpn/application/rest/BpnMappingController.java index cd4b496bdb..cf7e15f291 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/bpn/application/rest/BpnMappingController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/bpn/application/rest/BpnMappingController.java @@ -35,7 +35,7 @@ import lombok.extern.slf4j.Slf4j; import org.eclipse.tractusx.traceability.bpn.application.mapper.BpnMapper; import org.eclipse.tractusx.traceability.bpn.domain.service.BpnServiceImpl; -import org.eclipse.tractusx.traceability.common.response.ErrorResponse; +import assets.importpoc.ErrorResponse; import org.springframework.http.HttpStatus; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/config/ErrorHandlingConfig.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/config/ErrorHandlingConfig.java index e3e0519667..5da63ca59e 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/config/ErrorHandlingConfig.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/config/ErrorHandlingConfig.java @@ -35,7 +35,7 @@ import org.eclipse.tractusx.traceability.common.model.UnsupportedSearchCriteriaFieldException; import org.eclipse.tractusx.traceability.common.request.InvalidFilterException; import org.eclipse.tractusx.traceability.common.request.InvalidSortException; -import org.eclipse.tractusx.traceability.common.response.ErrorResponse; +import assets.importpoc.ErrorResponse; import org.eclipse.tractusx.traceability.common.security.TechnicalUserAuthorizationException; import org.eclipse.tractusx.traceability.qualitynotification.application.contract.model.CreateNotificationContractException; import org.eclipse.tractusx.traceability.qualitynotification.application.validation.UpdateQualityNotificationValidationException; diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/rest/AlertController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/rest/AlertController.java index c5e3631a9f..7b1f8f98b5 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/rest/AlertController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/alert/rest/AlertController.java @@ -35,7 +35,7 @@ import org.eclipse.tractusx.traceability.common.model.PageResult; import org.eclipse.tractusx.traceability.common.request.OwnPageable; import org.eclipse.tractusx.traceability.common.request.SearchCriteriaRequestParam; -import org.eclipse.tractusx.traceability.common.response.ErrorResponse; +import assets.importpoc.ErrorResponse; import org.eclipse.tractusx.traceability.qualitynotification.application.alert.mapper.AlertResponseMapper; import org.eclipse.tractusx.traceability.qualitynotification.application.base.mapper.QualityNotificationFieldMapper; import org.eclipse.tractusx.traceability.qualitynotification.application.base.service.QualityNotificationService; diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/contract/EdcNotificationContractController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/contract/EdcNotificationContractController.java index ae104f3bee..35f0f06386 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/contract/EdcNotificationContractController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/contract/EdcNotificationContractController.java @@ -28,7 +28,7 @@ import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; -import org.eclipse.tractusx.traceability.common.response.ErrorResponse; +import assets.importpoc.ErrorResponse; import org.eclipse.tractusx.traceability.qualitynotification.application.contract.model.CreateNotificationContractRequest; import org.eclipse.tractusx.traceability.qualitynotification.application.contract.model.CreateNotificationContractResponse; import org.eclipse.tractusx.traceability.qualitynotification.domain.contract.EdcNotificationContractService; diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/investigation/rest/InvestigationsController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/investigation/rest/InvestigationsController.java index c569c7f66f..be4e39e20b 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/investigation/rest/InvestigationsController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/application/investigation/rest/InvestigationsController.java @@ -37,7 +37,7 @@ import org.eclipse.tractusx.traceability.common.model.PageResult; import org.eclipse.tractusx.traceability.common.request.OwnPageable; import org.eclipse.tractusx.traceability.common.request.SearchCriteriaRequestParam; -import org.eclipse.tractusx.traceability.common.response.ErrorResponse; +import assets.importpoc.ErrorResponse; import org.eclipse.tractusx.traceability.qualitynotification.application.base.mapper.QualityNotificationFieldMapper; import org.eclipse.tractusx.traceability.qualitynotification.application.base.service.QualityNotificationService; import org.eclipse.tractusx.traceability.qualitynotification.application.investigation.mapper.InvestigationResponseMapper; diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/edc/EdcController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/edc/EdcController.java index b40a1cbb5e..07df312162 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/edc/EdcController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/qualitynotification/infrastructure/edc/EdcController.java @@ -30,7 +30,7 @@ import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.eclipse.tractusx.traceability.common.response.ErrorResponse; +import assets.importpoc.ErrorResponse; import org.eclipse.tractusx.traceability.qualitynotification.domain.alert.service.AlertsReceiverService; import org.eclipse.tractusx.traceability.qualitynotification.domain.investigation.model.exception.InvestigationIllegalUpdate; import org.eclipse.tractusx.traceability.qualitynotification.domain.investigation.service.InvestigationsReceiverService; diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/shelldescriptor/application/RegistryController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/shelldescriptor/application/RegistryController.java index 1b98bb2b66..9e8776e398 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/shelldescriptor/application/RegistryController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/shelldescriptor/application/RegistryController.java @@ -29,7 +29,7 @@ import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; -import org.eclipse.tractusx.traceability.common.response.ErrorResponse; +import assets.importpoc.ErrorResponse; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/shelldescriptor/application/ShellDescriptorController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/shelldescriptor/application/ShellDescriptorController.java index d65c04fbf5..ddd4f5e06d 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/shelldescriptor/application/ShellDescriptorController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/shelldescriptor/application/ShellDescriptorController.java @@ -26,7 +26,7 @@ import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; -import org.eclipse.tractusx.traceability.common.response.ErrorResponse; +import assets.importpoc.ErrorResponse; import org.eclipse.tractusx.traceability.shelldescriptor.application.mapper.ShellDescriptorResponseMapper; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.DeleteMapping; diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/application/rest/SubmodelController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/application/rest/SubmodelController.java index 4ca022fa25..4526633a66 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/application/rest/SubmodelController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/application/rest/SubmodelController.java @@ -27,7 +27,7 @@ import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; -import org.eclipse.tractusx.traceability.common.response.ErrorResponse; +import assets.importpoc.ErrorResponse; import org.eclipse.tractusx.traceability.submodel.application.service.SubmodelService; import org.eclipse.tractusx.traceability.submodel.domain.model.Submodel; import org.springframework.http.HttpStatus; diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/common/config/ErrorHandlingConfigTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/common/config/ErrorHandlingConfigTest.java index cfa2851e40..93eecad1c3 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/common/config/ErrorHandlingConfigTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/common/config/ErrorHandlingConfigTest.java @@ -27,7 +27,7 @@ import jakarta.validation.ValidationException; import org.eclipse.tractusx.traceability.assets.domain.asbuilt.exception.AssetNotFoundException; import org.eclipse.tractusx.traceability.bpn.domain.model.BpnNotFoundException; -import org.eclipse.tractusx.traceability.common.response.ErrorResponse; +import assets.importpoc.ErrorResponse; import org.eclipse.tractusx.traceability.common.security.TechnicalUserAuthorizationException; import org.eclipse.tractusx.traceability.qualitynotification.application.contract.model.CreateNotificationContractException; import org.eclipse.tractusx.traceability.qualitynotification.application.validation.UpdateQualityNotificationValidationException; diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/response/ErrorResponse.java b/tx-models/src/main/java/assets/importpoc/ErrorResponse.java similarity index 95% rename from tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/response/ErrorResponse.java rename to tx-models/src/main/java/assets/importpoc/ErrorResponse.java index 7015e0277b..33eefc36c3 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/response/ErrorResponse.java +++ b/tx-models/src/main/java/assets/importpoc/ErrorResponse.java @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -package org.eclipse.tractusx.traceability.common.response; +package assets.importpoc; import io.swagger.annotations.ApiModelProperty; import jakarta.validation.constraints.Pattern; diff --git a/tx-models/src/main/java/assets/importpoc/ImportResponse.java b/tx-models/src/main/java/assets/importpoc/ImportResponse.java new file mode 100644 index 0000000000..ddebbb44b8 --- /dev/null +++ b/tx-models/src/main/java/assets/importpoc/ImportResponse.java @@ -0,0 +1,26 @@ +/******************************************************************************** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +package assets.importpoc; + +import java.util.List; + +public record ImportResponse(List importStateMessage) { + +} + diff --git a/tx-models/src/main/java/assets/importpoc/ImportStateMessage.java b/tx-models/src/main/java/assets/importpoc/ImportStateMessage.java new file mode 100644 index 0000000000..869b4267d3 --- /dev/null +++ b/tx-models/src/main/java/assets/importpoc/ImportStateMessage.java @@ -0,0 +1,24 @@ +/******************************************************************************** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +package assets.importpoc; + +public record ImportStateMessage(String catenaXId, ImportStateResponse importState, boolean importSuccessful, + ValidationResponse validationResponse) { + +} diff --git a/tx-models/src/main/java/assets/importpoc/ImportStateResponse.java b/tx-models/src/main/java/assets/importpoc/ImportStateResponse.java new file mode 100644 index 0000000000..d65094b285 --- /dev/null +++ b/tx-models/src/main/java/assets/importpoc/ImportStateResponse.java @@ -0,0 +1,24 @@ +/******************************************************************************** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +package assets.importpoc; + + +public enum ImportStateResponse { + TRANSIENT, PERSISTENT, ERROR, IN_SYNCHRONIZATION, UNSET; +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/response/ValidationResponse.java b/tx-models/src/main/java/assets/importpoc/ValidationResponse.java similarity index 94% rename from tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/response/ValidationResponse.java rename to tx-models/src/main/java/assets/importpoc/ValidationResponse.java index 5398f4c225..5331fa38e8 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/common/response/ValidationResponse.java +++ b/tx-models/src/main/java/assets/importpoc/ValidationResponse.java @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -package org.eclipse.tractusx.traceability.common.response; +package assets.importpoc; import java.util.List; From fe8c9d4b339e82f216a2e137c1294f61605a6d59 Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Tue, 9 Jan 2024 23:49:56 +0100 Subject: [PATCH 21/49] chore(tx-backend): TRACEFOSS-2741 cleanup methods --- .../assets/application/ImportController.java | 9 ++- .../application/importpoc/ImportService.java | 2 - .../assets/domain/base/model/AssetBase.java | 13 ++++ .../importpoc/service/ImportServiceImpl.java | 38 +++++----- .../AssetAsBuiltRepositoryImpl.java | 69 +++++++++++++------ .../AssetAsPlannedRepositoryImpl.java | 29 +++++++- .../service/ImportServiceImplTest.java | 4 +- .../java/assets/importpoc/ImportResponse.java | 11 ++- .../assets/importpoc/ImportStateMessage.java | 6 +- .../assets/importpoc/ValidationResponse.java | 3 + 10 files changed, 135 insertions(+), 49 deletions(-) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java index 003fb66f88..4a0a972f96 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java @@ -128,12 +128,17 @@ public ResponseEntity importJson(@RequestPart("file") MultipartF if (!validationResult.isEmpty()) { return ResponseEntity .status(HttpStatus.BAD_REQUEST) - .body(new ImportResponse(List.of(new ImportStateMessage(null, null, false, validationResponse)))); + .body(new ImportResponse(validationResponse)); } Map resultMap = importService.importAssets(file); - List importStateMessages = resultMap.entrySet().stream().map(assetBaseSet -> new ImportStateMessage(assetBaseSet.getKey().getId(), ImportStateResponse.valueOf(assetBaseSet.getKey().getImportState().name()), assetBaseSet.getValue(), validationResponse)).toList(); + List importStateMessages = resultMap.entrySet().stream() + .map(assetBaseSet -> new ImportStateMessage( + assetBaseSet.getKey().getId(), + ImportStateResponse.valueOf(assetBaseSet.getKey().getImportState().name()), + assetBaseSet.getValue()) + ).toList(); ImportResponse importResponse = new ImportResponse(importStateMessages); diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/importpoc/ImportService.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/importpoc/ImportService.java index b814435327..2455ee77a3 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/importpoc/ImportService.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/importpoc/ImportService.java @@ -18,11 +18,9 @@ ********************************************************************************/ package org.eclipse.tractusx.traceability.assets.application.importpoc; -import assets.response.base.ImportStateResponse; import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.Map; public interface ImportService { diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/model/AssetBase.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/model/AssetBase.java index 27096aa98d..e03de55608 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/model/AssetBase.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/model/AssetBase.java @@ -26,11 +26,16 @@ import lombok.Data; import lombok.Singular; import lombok.extern.slf4j.Slf4j; +import org.eclipse.tractusx.irs.component.enums.BomLifecycle; import org.eclipse.tractusx.traceability.assets.domain.base.model.aspect.DetailAspectModel; import org.eclipse.tractusx.traceability.qualitynotification.domain.base.model.QualityNotification; import java.util.List; +import static org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.BATCH; +import static org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.JUSTINSEQUENCE; +import static org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.SERIALPART; + @Slf4j @AllArgsConstructor @Data @@ -61,4 +66,12 @@ public class AssetBase { private List receivedQualityInvestigations; private ImportState importState; private String importNote; + + public BomLifecycle getBomLifecycle() { + if(semanticDataModel.equals(SERIALPART) || semanticDataModel.equals(BATCH) || semanticDataModel.equals(JUSTINSEQUENCE)){ + return BomLifecycle.AS_BUILT; + } else { + return BomLifecycle.AS_PLANNED; + } + } } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java index 7e1f311d9f..515b74346d 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java @@ -32,13 +32,13 @@ import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; -import java.util.HashMap; +import java.util.Collection; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.stream.Collectors; - -import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.semanticdatamodel.SemanticDataModel.isAsBuiltMainSemanticModel; +import java.util.stream.Stream; @Slf4j @RequiredArgsConstructor @@ -54,25 +54,31 @@ public class ImportServiceImpl implements ImportService { public Map importAssets(MultipartFile file) { try { ImportRequest importRequest = objectMapper.readValue(file.getBytes(), ImportRequest.class); - Map> map = + Map> assetToUploadByBomLifecycle = importRequest.assets() .stream() - .map(importRequestV2 -> strategyFactory.mapToAssetBase(importRequestV2, traceabilityProperties)) + .map(assetImportItem -> strategyFactory.mapToAssetBase(assetImportItem, traceabilityProperties)) .filter(Optional::isPresent) .map(Optional::get) - .collect(Collectors.groupingBy(assetBase -> { - if (isAsBuiltMainSemanticModel(assetBase.getSemanticDataModel())) { - return BomLifecycle.AS_BUILT; - } else { - return BomLifecycle.AS_PLANNED; - } - })); - this.assetAsBuiltRepository.saveAllIfNotInIRSSyncAndUpdateImportStateAndNote(map.get(BomLifecycle.AS_BUILT)); - this.assetAsPlannedRepository.saveAllIfNotInIRSSyncAndUpdateImportStateAndNote(map.get(BomLifecycle.AS_PLANNED)); - Map resultMap = new HashMap<>(); - // TODO construct result + .collect(Collectors.groupingBy(AssetBase::getBomLifecycle)); + + List persistedAsBuilt = assetAsBuiltRepository.saveAllIfNotInIRSSyncAndUpdateImportStateAndNote(assetToUploadByBomLifecycle.get(BomLifecycle.AS_BUILT)); + List persistedAsPlanned = assetAsPlannedRepository.saveAllIfNotInIRSSyncAndUpdateImportStateAndNote(assetToUploadByBomLifecycle.get(BomLifecycle.AS_PLANNED)); + + List expectedAssetsToBePersisted = assetToUploadByBomLifecycle.values().stream().flatMap(Collection::stream).toList(); + List persistedAssets = Stream.concat(persistedAsBuilt.stream(), persistedAsPlanned.stream()).toList(); + + return compareForUploadResult(expectedAssetsToBePersisted, persistedAssets); } catch (Exception e) { throw new ImportException(e.getMessage()); } } + + public static Map compareForUploadResult(List incoming, List persisted) { + return incoming.stream().map(asset -> { + Optional persistedAssetOptional = persisted.stream().filter(persistedAsset -> persistedAsset.getId().equals(asset.getId())).findFirst(); + return persistedAssetOptional.map(assetBase -> Map.entry(assetBase, true)).orElseGet(() -> Map.entry(asset, false)); + } + ).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (x, y) -> y, LinkedHashMap::new)); + } } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/repository/AssetAsBuiltRepositoryImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/repository/AssetAsBuiltRepositoryImpl.java index a45c3f1220..a0a27100f4 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/repository/AssetAsBuiltRepositoryImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/repository/AssetAsBuiltRepositoryImpl.java @@ -32,11 +32,17 @@ import org.eclipse.tractusx.traceability.assets.domain.base.model.ImportState; import org.eclipse.tractusx.traceability.assets.domain.base.model.Owner; import org.eclipse.tractusx.traceability.assets.infrastructure.asbuilt.model.AssetAsBuiltEntity; +import org.eclipse.tractusx.traceability.assets.infrastructure.base.model.AssetBaseEntity; import org.eclipse.tractusx.traceability.common.repository.CriteriaUtility; +import org.springframework.data.util.Pair; import org.springframework.stereotype.Component; +import java.util.AbstractMap; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.Objects; import java.util.Optional; @RequiredArgsConstructor @@ -105,29 +111,48 @@ public List saveAll(List assets) { @Override @Transactional public List saveAllIfNotInIRSSyncAndUpdateImportStateAndNote(List assets) { - List savedEntities = new ArrayList<>(); - - for (AssetBase asset : assets) { - String assetId = asset.getId(); // Assuming getId() returns the ID of the entity - - // Check if the entity with the given ID already exists - Optional existingEntityOptional = jpaAssetAsBuiltRepository.findById(assetId); - - if (existingEntityOptional.isPresent()) { - // If it exists, update the single attribute - AssetAsBuiltEntity existingEntity = existingEntityOptional.get(); - ImportNote importNote = existingEntity.getImportState().equals(ImportState.PERSISTENT) - savedEntities.add(existingEntity); - } else { - // If it doesn't exist, save the new entity - AssetAsBuiltEntity newEntity = AssetAsBuiltEntity.fromDomain(asset); - savedEntities.add(newEntity); - } - } - return jpaAssetAsBuiltRepository.saveAll(savedEntities).stream() - .map(AssetAsBuiltEntity::toDomain) - .toList(); + List toPersist = assets.stream().map(assetToPersist -> new AbstractMap.SimpleEntry(assetToPersist, jpaAssetAsBuiltRepository.findById(assetToPersist.getId()).orElse(null))) + .filter(this::entityIsTransientOrNotExistent) + .map(entry -> { + if(entry.getValue() != null) { + entry.getKey().setImportNote(ImportNote.TRANSIENT_UPDATED); + } + return entry.getKey(); + }) + .map(AssetAsBuiltEntity::from).toList(); + + return jpaAssetAsBuiltRepository.saveAll(toPersist).stream().map(AssetAsBuiltEntity::toDomain).toList(); + +// +// for (AssetBase asset : assets) { +// String assetId = asset.getId(); // Assuming getId() returns the ID of the entity +// +// // Check if the entity with the given ID already exists +// Optional existingEntityOptional = jpaAssetAsBuiltRepository.findById(assetId); +// +// if (existingEntityOptional.isPresent() && existingEntityOptional.get().getImportState() == ImportState.TRANSIENT) { +// // If it exists, update the single attribute +// jpaAssetAsBuiltRepository.save(AssetAsBuiltEntity.from(asset)); +// savedEntities.add(existingEntity); +// } else if(existingEntityOptional.isEmpty()){ +// // If it doesn't exist, save the new entity +// AssetAsBuiltEntity newEntity = AssetAsBuiltEntity.from(asset); +// jpaAssetAsBuiltRepository.save(newEntity); +// savedEntities.add(newEntity); +// } +// } +// +// return jpaAssetAsBuiltRepository.saveAll(savedEntities).stream() +// .map(AssetAsBuiltEntity::toDomain) +// .toList(); + } + + private boolean entityIsTransientOrNotExistent(AbstractMap.SimpleEntry assetBaseAssetBaseEntitySimpleEntry) { + if(Objects.isNull(assetBaseAssetBaseEntitySimpleEntry.getValue())) { + return true; + } + return assetBaseAssetBaseEntitySimpleEntry.getValue().getImportState() == ImportState.TRANSIENT; } // TODO check if it exists diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/repository/AssetAsPlannedRepositoryImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/repository/AssetAsPlannedRepositoryImpl.java index 931a97f44a..19d725d6fc 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/repository/AssetAsPlannedRepositoryImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/repository/AssetAsPlannedRepositoryImpl.java @@ -25,8 +25,11 @@ import org.eclipse.tractusx.traceability.assets.domain.asbuilt.exception.AssetNotFoundException; import org.eclipse.tractusx.traceability.assets.domain.asplanned.repository.AssetAsPlannedRepository; import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; +import org.eclipse.tractusx.traceability.assets.domain.base.model.ImportNote; +import org.eclipse.tractusx.traceability.assets.domain.base.model.ImportState; import org.eclipse.tractusx.traceability.assets.domain.base.model.Owner; import org.eclipse.tractusx.traceability.assets.infrastructure.asplanned.model.AssetAsPlannedEntity; +import org.eclipse.tractusx.traceability.assets.infrastructure.base.model.AssetBaseEntity; import org.eclipse.tractusx.traceability.common.model.PageResult; import org.eclipse.tractusx.traceability.common.model.SearchCriteria; import org.eclipse.tractusx.traceability.common.repository.CriteriaUtility; @@ -35,8 +38,9 @@ import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; -import java.util.Collections; +import java.util.AbstractMap; import java.util.List; +import java.util.Objects; import static org.apache.commons.collections4.ListUtils.emptyIfNull; @@ -103,7 +107,28 @@ public List saveAll(List assets) { @Override @Transactional public List saveAllIfNotInIRSSyncAndUpdateImportStateAndNote(List assets) { - return Collections.emptyList(); + List toPersist = assets.stream().map(assetToPersist -> + new AbstractMap.SimpleEntry( + assetToPersist, + jpaAssetAsPlannedRepository.findById(assetToPersist.getId()).orElse(null))) + .filter(this::entityIsTransientOrNotExistent) + .map(entry -> { + if (entry.getValue() != null) { + entry.getKey().setImportNote(ImportNote.TRANSIENT_UPDATED); + } + return entry.getKey(); + }) + .map(AssetAsPlannedEntity::from).toList(); + + return jpaAssetAsPlannedRepository.saveAll(toPersist).stream().map(AssetAsPlannedEntity::toDomain).toList(); + + } + + private boolean entityIsTransientOrNotExistent(AbstractMap.SimpleEntry assetBaseAssetBaseEntitySimpleEntry) { + if (Objects.isNull(assetBaseAssetBaseEntitySimpleEntry.getValue())) { + return true; + } + return assetBaseAssetBaseEntitySimpleEntry.getValue().getImportState() == ImportState.TRANSIENT; } @Transactional diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java index f6e221ba0f..c077b3e9f1 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java @@ -79,8 +79,8 @@ void testImportRequestSuccessful() throws IOException { when(traceabilityProperties.getBpn()).thenReturn(BPN.of("ABC")); importService.importAssets(multipartFile); - verify(assetAsBuiltRepository, times(1)).saveAll(anyList()); - verify(assetAsPlannedRepository, times(1)).saveAll(anyList()); + verify(assetAsBuiltRepository, times(1)).saveAllIfNotInIRSSyncAndUpdateImportStateAndNote(anyList()); + verify(assetAsPlannedRepository, times(1)).saveAllIfNotInIRSSyncAndUpdateImportStateAndNote(anyList()); } diff --git a/tx-models/src/main/java/assets/importpoc/ImportResponse.java b/tx-models/src/main/java/assets/importpoc/ImportResponse.java index ddebbb44b8..2abc4acfd3 100644 --- a/tx-models/src/main/java/assets/importpoc/ImportResponse.java +++ b/tx-models/src/main/java/assets/importpoc/ImportResponse.java @@ -20,7 +20,16 @@ import java.util.List; -public record ImportResponse(List importStateMessage) { +public record ImportResponse( + List importStateMessage, + ValidationResponse validationResult) { + public ImportResponse(List importStateMessages) { + this(importStateMessages, ValidationResponse.emptyValidationResult()); + } + + public ImportResponse(ValidationResponse importStateMessages) { + this(List.of(), importStateMessages); + } } diff --git a/tx-models/src/main/java/assets/importpoc/ImportStateMessage.java b/tx-models/src/main/java/assets/importpoc/ImportStateMessage.java index 869b4267d3..1cd83cf86b 100644 --- a/tx-models/src/main/java/assets/importpoc/ImportStateMessage.java +++ b/tx-models/src/main/java/assets/importpoc/ImportStateMessage.java @@ -18,7 +18,9 @@ ********************************************************************************/ package assets.importpoc; -public record ImportStateMessage(String catenaXId, ImportStateResponse importState, boolean importSuccessful, - ValidationResponse validationResponse) { +public record ImportStateMessage( + String catenaXId, + ImportStateResponse importState, + boolean importSuccessful) { } diff --git a/tx-models/src/main/java/assets/importpoc/ValidationResponse.java b/tx-models/src/main/java/assets/importpoc/ValidationResponse.java index 5331fa38e8..c32c40c404 100644 --- a/tx-models/src/main/java/assets/importpoc/ValidationResponse.java +++ b/tx-models/src/main/java/assets/importpoc/ValidationResponse.java @@ -23,4 +23,7 @@ public record ValidationResponse(List validationErrors) { + public static ValidationResponse emptyValidationResult() { + return new ValidationResponse(List.of()); + } } From 6fb59865422e41983fbe320403b8ef1386a56b58 Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Wed, 10 Jan 2024 00:42:27 +0100 Subject: [PATCH 22/49] chore(tx-backend): TRACEFOSS-2741 fix tests --- .../importdata/ImportControllerIT.java | 37 ++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/importdata/ImportControllerIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/importdata/ImportControllerIT.java index 74939061bd..0bdc8762a2 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/importdata/ImportControllerIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/importdata/ImportControllerIT.java @@ -19,6 +19,9 @@ package org.eclipse.tractusx.traceability.integration.importdata; +import assets.importpoc.ImportResponse; +import assets.importpoc.ImportStateMessage; +import assets.importpoc.ImportStateResponse; import org.eclipse.tractusx.traceability.common.security.JwtRole; import org.eclipse.tractusx.traceability.integration.IntegrationTestSpecification; import org.hamcrest.Matchers; @@ -29,6 +32,7 @@ import java.util.List; import static io.restassured.RestAssured.given; +import static org.assertj.core.api.Assertions.assertThat; class ImportControllerIT extends IntegrationTestSpecification { @@ -39,13 +43,36 @@ void givenValidFile_whenImportData_thenValidationShouldPass() throws JoseExcepti File file = new File(path); // when/then - given() + ImportResponse result = given() .header(oAuth2Support.jwtAuthorization(JwtRole.ADMIN)) .when() .multiPart(file) .post("/api/assets/import") .then() - .statusCode(204); + .statusCode(200) + .extract().as(ImportResponse.class); + + assertThat(result.validationResult().validationErrors()).isEmpty(); + assertThat(result.importStateMessage()).containsExactlyInAnyOrder( + new ImportStateMessage("urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4eb01", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:c7a2b803-f8fe-4b79-b6fc-967ce847c9a1", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef128c", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:07cb071f-8716-45fe-89f1-f2f77a1ce93b", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:e8c48a8e-d2d7-43d9-a867-65c70c85f5b8", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb01", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb02", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb03", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:580d3adf-1981-44a0-a214-13d6ceed6841", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:b0acf3e1-3fbe-46c0-aa0b-0724caae7772", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f", ImportStateResponse.TRANSIENT, true) + ); } @Test @@ -62,7 +89,7 @@ void givenInvalidFile_whenImportData_thenValidationShouldNotPass() throws JoseEx .post("/api/assets/import") .then() .statusCode(400) - .body("validationErrors", Matchers.contains( + .body("validationResult.validationErrors", Matchers.contains( List.of( "Did not match pattern: ^urn:uuid:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$", "Missing property aspectType", @@ -87,7 +114,7 @@ void givenInvalidFileExtension_whenImportData_thenValidationShouldPass() throws .post("/api/assets/import") .then() .statusCode(400) - .body("validationErrors", Matchers.contains( + .body("validationResult.validationErrors", Matchers.contains( List.of( "Supported file is *.json" ).toArray())); @@ -107,7 +134,7 @@ void givenInvalidAspect_whenImportData_thenValidationShouldPass() throws JoseExc .post("/api/assets/import") .then() .statusCode(400) - .body("validationErrors", Matchers.contains( + .body("validationResult.validationErrors", Matchers.contains( List.of( "'urn:bamm:io.catenax.serial_part:1.1.1#NOT_SUPPORTED_NAME' is not supported" ).toArray())); From b25c812a06964d7bdef4f83528349466a995ae70 Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Wed, 10 Jan 2024 00:54:27 +0100 Subject: [PATCH 23/49] chore(tx-backend): TRACEFOSS-2741 add test --- .../importdata/ImportControllerIT.java | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/importdata/ImportControllerIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/importdata/ImportControllerIT.java index 0bdc8762a2..c3a2241f57 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/importdata/ImportControllerIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/importdata/ImportControllerIT.java @@ -22,11 +22,17 @@ import assets.importpoc.ImportResponse; import assets.importpoc.ImportStateMessage; import assets.importpoc.ImportStateResponse; +import org.eclipse.tractusx.traceability.assets.domain.asbuilt.repository.AssetAsBuiltRepository; +import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; +import org.eclipse.tractusx.traceability.assets.domain.base.model.ImportState; +import org.eclipse.tractusx.traceability.assets.domain.base.model.Owner; +import org.eclipse.tractusx.traceability.assets.domain.base.model.QualityType; import org.eclipse.tractusx.traceability.common.security.JwtRole; import org.eclipse.tractusx.traceability.integration.IntegrationTestSpecification; import org.hamcrest.Matchers; import org.jose4j.lang.JoseException; import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; import java.io.File; import java.util.List; @@ -36,6 +42,9 @@ class ImportControllerIT extends IntegrationTestSpecification { + @Autowired + AssetAsBuiltRepository assetAsBuiltRepository; + @Test void givenValidFile_whenImportData_thenValidationShouldPass() throws JoseException { // given @@ -75,6 +84,112 @@ void givenValidFile_whenImportData_thenValidationShouldPass() throws JoseExcepti ); } + @Test + void givenValidFile_whenImportDataButAssetExistInPersistentImportState_thenValidationShouldPassAndExpectedResponse() throws JoseException { + // given + String path = getClass().getResource("/testdata/importfiles/validImportFile.json").getFile(); + File file = new File(path); + AssetBase asset = AssetBase.builder() + .id("urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd") + .semanticModelId("NO-313869652971440618042264") + .manufacturerId("BPNL00000003AXS3") + .nameAtManufacturer("Door f-l") + .manufacturerPartId("") + .detailAspectModels(List.of()) + .owner(Owner.OWN) + .activeAlert(false) + .inInvestigation(false) + .qualityType(QualityType.OK) + .classification("component") + .importState(ImportState.PERSISTENT) + .build(); + assetAsBuiltRepository.save(asset); + // when/then + ImportResponse result = given() + .header(oAuth2Support.jwtAuthorization(JwtRole.ADMIN)) + .when() + .multiPart(file) + .post("/api/assets/import") + .then() + .statusCode(200) + .extract().as(ImportResponse.class); + + assertThat(result.validationResult().validationErrors()).isEmpty(); + assertThat(result.importStateMessage()).containsExactlyInAnyOrder( + new ImportStateMessage("urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4eb01", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:c7a2b803-f8fe-4b79-b6fc-967ce847c9a1", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef128c", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:07cb071f-8716-45fe-89f1-f2f77a1ce93b", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:e8c48a8e-d2d7-43d9-a867-65c70c85f5b8", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd", ImportStateResponse.TRANSIENT, false), + new ImportStateMessage("urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb01", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb02", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb03", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:580d3adf-1981-44a0-a214-13d6ceed6841", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:b0acf3e1-3fbe-46c0-aa0b-0724caae7772", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f", ImportStateResponse.TRANSIENT, true) + ); + } + + @Test + void givenValidFile_whenImportDataButAssetExistInTransientImportState_thenValidationShouldPassAndExpectedResponse() throws JoseException { + // given + String path = getClass().getResource("/testdata/importfiles/validImportFile.json").getFile(); + File file = new File(path); + AssetBase asset = AssetBase.builder() + .id("urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd") + .semanticModelId("NO-313869652971440618042264") + .manufacturerId("BPNL00000003AXS3") + .nameAtManufacturer("Door f-l") + .manufacturerPartId("") + .detailAspectModels(List.of()) + .owner(Owner.OWN) + .activeAlert(false) + .inInvestigation(false) + .qualityType(QualityType.OK) + .classification("component") + .importState(ImportState.TRANSIENT) + .build(); + assetAsBuiltRepository.save(asset); + // when/then + ImportResponse result = given() + .header(oAuth2Support.jwtAuthorization(JwtRole.ADMIN)) + .when() + .multiPart(file) + .post("/api/assets/import") + .then() + .statusCode(200) + .extract().as(ImportResponse.class); + + assertThat(result.validationResult().validationErrors()).isEmpty(); + assertThat(result.importStateMessage()).containsExactlyInAnyOrder( + new ImportStateMessage("urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4eb01", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:c7a2b803-f8fe-4b79-b6fc-967ce847c9a1", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef128c", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:07cb071f-8716-45fe-89f1-f2f77a1ce93b", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:e8c48a8e-d2d7-43d9-a867-65c70c85f5b8", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb01", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb02", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb03", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:580d3adf-1981-44a0-a214-13d6ceed6841", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:b0acf3e1-3fbe-46c0-aa0b-0724caae7772", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d", ImportStateResponse.TRANSIENT, true), + new ImportStateMessage("urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f", ImportStateResponse.TRANSIENT, true) + ); + } + @Test void givenInvalidFile_whenImportData_thenValidationShouldNotPass() throws JoseException { // given From 7a52cade29d24f6767b773ca707964d3088a835f Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Wed, 10 Jan 2024 00:58:36 +0100 Subject: [PATCH 24/49] chore(tx-backend): TRACEFOSS-2741 add test --- .../integration/importdata/ImportControllerIT.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/importdata/ImportControllerIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/importdata/ImportControllerIT.java index c3a2241f57..2d080e3a9d 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/importdata/ImportControllerIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/importdata/ImportControllerIT.java @@ -146,7 +146,7 @@ void givenValidFile_whenImportDataButAssetExistInTransientImportState_thenValida .id("urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd") .semanticModelId("NO-313869652971440618042264") .manufacturerId("BPNL00000003AXS3") - .nameAtManufacturer("Door f-l") + .nameAtManufacturer("Door to be updated") .manufacturerPartId("") .detailAspectModels(List.of()) .owner(Owner.OWN) @@ -188,6 +188,9 @@ void givenValidFile_whenImportDataButAssetExistInTransientImportState_thenValida new ImportStateMessage("urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d", ImportStateResponse.TRANSIENT, true), new ImportStateMessage("urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f", ImportStateResponse.TRANSIENT, true) ); + AssetBase updatedAsset = assetAsBuiltRepository.getAssetById("urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd"); + assertThat(updatedAsset.getImportNote()).isEqualTo("Asset updated successfully in transient state."); + assertThat(updatedAsset.getNameAtManufacturer()).isEqualTo("Door f-l"); } @Test From 71c958b2b5e6cd22b717f2bca8122a23a248eb95 Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Wed, 10 Jan 2024 09:03:05 +0100 Subject: [PATCH 25/49] chore(tx-backend): TRACEFOSS-2741 remove ImportStateStatus from response --- .../assets/application/ImportController.java | 2 - .../AssetAsBuiltRepositoryImpl.java | 23 ---- .../importdata/ImportControllerIT.java | 109 +++++++++--------- .../assets/importpoc/ImportStateMessage.java | 1 - 4 files changed, 54 insertions(+), 81 deletions(-) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java index 4a0a972f96..d7ebef8d2a 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java @@ -23,7 +23,6 @@ import assets.importpoc.ErrorResponse; import assets.importpoc.ImportResponse; import assets.importpoc.ImportStateMessage; -import assets.importpoc.ImportStateResponse; import assets.importpoc.ValidationResponse; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; @@ -136,7 +135,6 @@ public ResponseEntity importJson(@RequestPart("file") MultipartF List importStateMessages = resultMap.entrySet().stream() .map(assetBaseSet -> new ImportStateMessage( assetBaseSet.getKey().getId(), - ImportStateResponse.valueOf(assetBaseSet.getKey().getImportState().name()), assetBaseSet.getValue()) ).toList(); diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/repository/AssetAsBuiltRepositoryImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/repository/AssetAsBuiltRepositoryImpl.java index a0a27100f4..696f59962c 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/repository/AssetAsBuiltRepositoryImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/repository/AssetAsBuiltRepositoryImpl.java @@ -123,29 +123,6 @@ public List saveAllIfNotInIRSSyncAndUpdateImportStateAndNote(List existingEntityOptional = jpaAssetAsBuiltRepository.findById(assetId); -// -// if (existingEntityOptional.isPresent() && existingEntityOptional.get().getImportState() == ImportState.TRANSIENT) { -// // If it exists, update the single attribute -// jpaAssetAsBuiltRepository.save(AssetAsBuiltEntity.from(asset)); -// savedEntities.add(existingEntity); -// } else if(existingEntityOptional.isEmpty()){ -// // If it doesn't exist, save the new entity -// AssetAsBuiltEntity newEntity = AssetAsBuiltEntity.from(asset); -// jpaAssetAsBuiltRepository.save(newEntity); -// savedEntities.add(newEntity); -// } -// } -// -// return jpaAssetAsBuiltRepository.saveAll(savedEntities).stream() -// .map(AssetAsBuiltEntity::toDomain) -// .toList(); } private boolean entityIsTransientOrNotExistent(AbstractMap.SimpleEntry assetBaseAssetBaseEntitySimpleEntry) { diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/importdata/ImportControllerIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/importdata/ImportControllerIT.java index 2d080e3a9d..1ef46837bb 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/importdata/ImportControllerIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/importdata/ImportControllerIT.java @@ -21,7 +21,6 @@ import assets.importpoc.ImportResponse; import assets.importpoc.ImportStateMessage; -import assets.importpoc.ImportStateResponse; import org.eclipse.tractusx.traceability.assets.domain.asbuilt.repository.AssetAsBuiltRepository; import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; import org.eclipse.tractusx.traceability.assets.domain.base.model.ImportState; @@ -63,24 +62,24 @@ void givenValidFile_whenImportData_thenValidationShouldPass() throws JoseExcepti assertThat(result.validationResult().validationErrors()).isEmpty(); assertThat(result.importStateMessage()).containsExactlyInAnyOrder( - new ImportStateMessage("urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4eb01", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:c7a2b803-f8fe-4b79-b6fc-967ce847c9a1", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef128c", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:07cb071f-8716-45fe-89f1-f2f77a1ce93b", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:e8c48a8e-d2d7-43d9-a867-65c70c85f5b8", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb01", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb02", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb03", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:580d3adf-1981-44a0-a214-13d6ceed6841", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:b0acf3e1-3fbe-46c0-aa0b-0724caae7772", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f", ImportStateResponse.TRANSIENT, true) + new ImportStateMessage("urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4eb01", true), + new ImportStateMessage("urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e", true), + new ImportStateMessage("urn:uuid:c7a2b803-f8fe-4b79-b6fc-967ce847c9a1", true), + new ImportStateMessage("urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef128c", true), + new ImportStateMessage("urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7", true), + new ImportStateMessage("urn:uuid:07cb071f-8716-45fe-89f1-f2f77a1ce93b", true), + new ImportStateMessage("urn:uuid:e8c48a8e-d2d7-43d9-a867-65c70c85f5b8", true), + new ImportStateMessage("urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd", true), + new ImportStateMessage("urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a", true), + new ImportStateMessage("urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd", true), + new ImportStateMessage("urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d", true), + new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb01", true), + new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb02", true), + new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb03", true), + new ImportStateMessage("urn:uuid:580d3adf-1981-44a0-a214-13d6ceed6841", true), + new ImportStateMessage("urn:uuid:b0acf3e1-3fbe-46c0-aa0b-0724caae7772", true), + new ImportStateMessage("urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d", true), + new ImportStateMessage("urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f", true) ); } @@ -116,24 +115,24 @@ void givenValidFile_whenImportDataButAssetExistInPersistentImportState_thenValid assertThat(result.validationResult().validationErrors()).isEmpty(); assertThat(result.importStateMessage()).containsExactlyInAnyOrder( - new ImportStateMessage("urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4eb01", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:c7a2b803-f8fe-4b79-b6fc-967ce847c9a1", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef128c", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:07cb071f-8716-45fe-89f1-f2f77a1ce93b", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:e8c48a8e-d2d7-43d9-a867-65c70c85f5b8", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd", ImportStateResponse.TRANSIENT, false), - new ImportStateMessage("urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb01", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb02", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb03", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:580d3adf-1981-44a0-a214-13d6ceed6841", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:b0acf3e1-3fbe-46c0-aa0b-0724caae7772", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f", ImportStateResponse.TRANSIENT, true) + new ImportStateMessage("urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4eb01", true), + new ImportStateMessage("urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e", true), + new ImportStateMessage("urn:uuid:c7a2b803-f8fe-4b79-b6fc-967ce847c9a1", true), + new ImportStateMessage("urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef128c", true), + new ImportStateMessage("urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7", true), + new ImportStateMessage("urn:uuid:07cb071f-8716-45fe-89f1-f2f77a1ce93b", true), + new ImportStateMessage("urn:uuid:e8c48a8e-d2d7-43d9-a867-65c70c85f5b8", true), + new ImportStateMessage("urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd", false), + new ImportStateMessage("urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a", true), + new ImportStateMessage("urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd", true), + new ImportStateMessage("urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d", true), + new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb01", true), + new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb02", true), + new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb03", true), + new ImportStateMessage("urn:uuid:580d3adf-1981-44a0-a214-13d6ceed6841", true), + new ImportStateMessage("urn:uuid:b0acf3e1-3fbe-46c0-aa0b-0724caae7772", true), + new ImportStateMessage("urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d", true), + new ImportStateMessage("urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f", true) ); } @@ -169,24 +168,24 @@ void givenValidFile_whenImportDataButAssetExistInTransientImportState_thenValida assertThat(result.validationResult().validationErrors()).isEmpty(); assertThat(result.importStateMessage()).containsExactlyInAnyOrder( - new ImportStateMessage("urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4eb01", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:c7a2b803-f8fe-4b79-b6fc-967ce847c9a1", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef128c", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:07cb071f-8716-45fe-89f1-f2f77a1ce93b", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:e8c48a8e-d2d7-43d9-a867-65c70c85f5b8", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb01", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb02", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb03", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:580d3adf-1981-44a0-a214-13d6ceed6841", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:b0acf3e1-3fbe-46c0-aa0b-0724caae7772", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d", ImportStateResponse.TRANSIENT, true), - new ImportStateMessage("urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f", ImportStateResponse.TRANSIENT, true) + new ImportStateMessage("urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4eb01", true), + new ImportStateMessage("urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e", true), + new ImportStateMessage("urn:uuid:c7a2b803-f8fe-4b79-b6fc-967ce847c9a1", true), + new ImportStateMessage("urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef128c", true), + new ImportStateMessage("urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7", true), + new ImportStateMessage("urn:uuid:07cb071f-8716-45fe-89f1-f2f77a1ce93b", true), + new ImportStateMessage("urn:uuid:e8c48a8e-d2d7-43d9-a867-65c70c85f5b8", true), + new ImportStateMessage("urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd", true), + new ImportStateMessage("urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a", true), + new ImportStateMessage("urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd", true), + new ImportStateMessage("urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d", true), + new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb01", true), + new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb02", true), + new ImportStateMessage("urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb03", true), + new ImportStateMessage("urn:uuid:580d3adf-1981-44a0-a214-13d6ceed6841", true), + new ImportStateMessage("urn:uuid:b0acf3e1-3fbe-46c0-aa0b-0724caae7772", true), + new ImportStateMessage("urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d", true), + new ImportStateMessage("urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f", true) ); AssetBase updatedAsset = assetAsBuiltRepository.getAssetById("urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd"); assertThat(updatedAsset.getImportNote()).isEqualTo("Asset updated successfully in transient state."); diff --git a/tx-models/src/main/java/assets/importpoc/ImportStateMessage.java b/tx-models/src/main/java/assets/importpoc/ImportStateMessage.java index 1cd83cf86b..6267c27bbb 100644 --- a/tx-models/src/main/java/assets/importpoc/ImportStateMessage.java +++ b/tx-models/src/main/java/assets/importpoc/ImportStateMessage.java @@ -20,7 +20,6 @@ public record ImportStateMessage( String catenaXId, - ImportStateResponse importState, boolean importSuccessful) { } From b83acb12dc67956d71629bc520fe973d5273c2e7 Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Wed, 10 Jan 2024 09:06:05 +0100 Subject: [PATCH 26/49] chore(tx-backend): TRACEFOSS-2741 renamed boolean in file upload response to reflect actual action --- .../src/main/java/assets/importpoc/ImportStateMessage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tx-models/src/main/java/assets/importpoc/ImportStateMessage.java b/tx-models/src/main/java/assets/importpoc/ImportStateMessage.java index 6267c27bbb..4c10ecc712 100644 --- a/tx-models/src/main/java/assets/importpoc/ImportStateMessage.java +++ b/tx-models/src/main/java/assets/importpoc/ImportStateMessage.java @@ -20,6 +20,6 @@ public record ImportStateMessage( String catenaXId, - boolean importSuccessful) { + boolean persistedOrUpdated) { } From 11caaea4ad3f16386dccb7e4a66735fe0fa0a74e Mon Sep 17 00:00:00 2001 From: Martin Maul Date: Wed, 10 Jan 2024 10:13:00 +0100 Subject: [PATCH 27/49] chore(fileupload): TRACEFOSS-XXX- added dummy import status response --- .../modules/page/admin/core/admin.service.ts | 76 +++++++++++++------ .../import-json/import-json.component.html | 72 ++++++++++++------ .../import-json/import-json.component.scss | 21 +++++ .../import-json/import-json.component.ts | 12 +++ frontend/src/assets/locales/de/common.json | 1 + .../src/assets/locales/de/page.admin.json | 3 + frontend/src/assets/locales/en/common.json | 1 + .../src/assets/locales/en/page.admin.json | 3 + 8 files changed, 140 insertions(+), 49 deletions(-) diff --git a/frontend/src/app/modules/page/admin/core/admin.service.ts b/frontend/src/app/modules/page/admin/core/admin.service.ts index 53b16b00a8..72e08b1298 100644 --- a/frontend/src/app/modules/page/admin/core/admin.service.ts +++ b/frontend/src/app/modules/page/admin/core/admin.service.ts @@ -23,39 +23,67 @@ import { Injectable } from '@angular/core'; import { ApiService } from '@core/api/api.service'; import { environment } from '@env'; import { AdminAssembler } from '@page/admin/core/admin.assembler'; -import { BpnConfig, BpnConfigResponse} from '@page/admin/core/admin.model'; -import { Observable } from 'rxjs'; +import { BpnConfig, BpnConfigResponse } from '@page/admin/core/admin.model'; +import { Observable, of } from 'rxjs'; import { map } from 'rxjs/operators'; @Injectable() export class AdminService { - private readonly url = environment.apiUrl; + private readonly url = environment.apiUrl; + private readonly STATIC_IMPORT_RESPONSE_SUCCESS = [ + { + "catenaXId": "123", + "importState": "TRANSIENT", + "importSuccessful": true + }, + { + "catenaXId": "2345", + "importState": "PERSISTENT", + "importSuccessful": false + }, + { + "catenaXId": "333", + "importState": "PERSISTENT", + "importSuccessful": true + }, + ] - constructor(private readonly apiService: ApiService) { - } + private readonly STATIC_IMPORT_RESPONSE_VALIDATION_ERROR = [ + { + "validationResponse": [ + "failure reason 1", "failure reason 2" + ] + } + ] - public createBpnFallbackConfig(bpnConfig: BpnConfig[]): Observable { - return this.apiService.post(`${ this.url }/bpn-config`, bpnConfig); - } - public readBpnFallbackConfig(): Observable { - return this.apiService - .get(`${ this.url }/bpn-config`) - .pipe(map(data => AdminAssembler.assembleBpnConfig(data))); - } + constructor(private readonly apiService: ApiService) { + } - public updateBpnFallbackConfig(bpnConfig: BpnConfig[]): Observable { - return this.apiService.put(`${ this.url }/bpn-config`, bpnConfig); - } - public deleteBpnFallbackConfig(bpn: string): Observable { - return this.apiService.delete(`${ this.url }/bpn-config/${ bpn }`); - } + public createBpnFallbackConfig(bpnConfig: BpnConfig[]): Observable { + return this.apiService.post(`${this.url}/bpn-config`, bpnConfig); + } + + public readBpnFallbackConfig(): Observable { + return this.apiService + .get(`${this.url}/bpn-config`) + .pipe(map(data => AdminAssembler.assembleBpnConfig(data))); + } + + public updateBpnFallbackConfig(bpnConfig: BpnConfig[]): Observable { + return this.apiService.put(`${this.url}/bpn-config`, bpnConfig); + } + + public deleteBpnFallbackConfig(bpn: string): Observable { + return this.apiService.delete(`${this.url}/bpn-config/${bpn}`); + } + + public postJsonFile(file: File): Observable { + const formData = new FormData(); + formData.append('file', file); + return of(this.STATIC_IMPORT_RESPONSE_SUCCESS)// this.apiService.postFile(`${this.url}/assets/import`, formData); + } - public postJsonFile(file: File): Observable{ - const formData = new FormData(); - formData.append('file', file); - return this.apiService.postFile(`${ this.url }/assets/import`, formData); - } } diff --git a/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.html b/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.html index 8a00d84a8e..1e474f3c8c 100644 --- a/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.html +++ b/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.html @@ -18,30 +18,52 @@ --> - -

{{ 'pageAdmin.importJson.title' | i18n }}

-
- -
-
- upload - -

{{ 'pageAdmin.importJson.Drag_and_Drop' | i18n }}

-

{{ 'pageAdmin.importJson.or' | i18n }}

-
-

{{ 'pageAdmin.importJson.browseFiles' | i18n }}

-
-

{{ 'pageAdmin.importJson.error' | i18n }}

-
+ +

{{ 'pageAdmin.importJson.title' | i18n }}

+
+ +
+ +
+
+ upload + +

{{ 'pageAdmin.importJson.Drag_and_Drop' | i18n }}

+

{{ 'pageAdmin.importJson.or' | i18n }}

+
+

{{ 'pageAdmin.importJson.browseFiles' | i18n }}

+
+

{{ 'pageAdmin.importJson.error' | i18n }}

+
-
- upload_file -

{{file.name}}

- {{ 'pageAdmin.importJson.clear_file' | i18n }} - {{ 'pageAdmin.importJson.upload_file' | i18n }} -
-
- +
+ upload_file +

{{file.name}}

+ {{ 'pageAdmin.importJson.clear_file' | i18n }} + {{ 'pageAdmin.importJson.upload_file' | i18n }} +
+
+ + +
+

{{ 'pageAdmin.importStatus.importStatus' | i18n }}:

+
+ +
+ {{Object.keys(item)}} +
+
+ {{Object.values(item)}} +
+
+
+
+
+
+
+ diff --git a/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.scss b/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.scss index 4ab9dbd114..d809effa68 100644 --- a/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.scss +++ b/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.scss @@ -17,6 +17,27 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ +.import-container { + display: flex; + gap: 16px; +} + +.status-content { + display: flex; + flex-direction: column; + justify-content: space-evenly; +} + +.status-label-container { + display: flex; + justify-content: space-evenly; +} + +.status-values { + display: flex; + justify-content: space-evenly; +} + .import-json { .file-container_drag_and_drop { width: 300px; diff --git a/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.ts b/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.ts index b9216c3871..fa48992178 100644 --- a/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.ts +++ b/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.ts @@ -20,6 +20,7 @@ import { Component, Input } from '@angular/core'; import { AdminFacade } from '@page/admin/core/admin.facade'; import { ToastService } from '@shared/components/toasts/toast.service'; +import { BehaviorSubject } from 'rxjs'; @Component({ selector: 'app-import-json', @@ -30,7 +31,14 @@ export class ImportJsonComponent { @Input() showError = false; @Input() file: File; + importResponse = new BehaviorSubject([]); + displayUploader: boolean = true; + + + + constructor(private readonly adminFacade: AdminFacade, private readonly toastService: ToastService) { + this.importResponse.subscribe(next => console.log(next)) } public getFile(event: any) { @@ -44,7 +52,10 @@ export class ImportJsonComponent { } public uploadFile(file: File) { this.adminFacade.postJsonImport(file).subscribe(response => { + console.log(response); + this.importResponse.next(response); this.toastService.success('pageAdmin.importJson.success'); + this.displayUploader = false; }); } @@ -65,4 +76,5 @@ export class ImportJsonComponent { return null; } + protected readonly Object = Object; } diff --git a/frontend/src/assets/locales/de/common.json b/frontend/src/assets/locales/de/common.json index fc9da9e732..db5c2e86dd 100644 --- a/frontend/src/assets/locales/de/common.json +++ b/frontend/src/assets/locales/de/common.json @@ -12,6 +12,7 @@ "alerts": "Qualitätswarnung", "adminRegistry": "Registry-Abfragen", "adminBpn": "BPN - EDC Konfiguration", + "adminImport": "Daten importieren", "unauthorized": "Die Funktion ist aufgrund einer fehlenden Rolle deaktiviert. Bitten Sie Ihren Administrator, die erforderliche Rolle für die Funktion bereitzustellen." }, "pageTitle": { diff --git a/frontend/src/assets/locales/de/page.admin.json b/frontend/src/assets/locales/de/page.admin.json index 4a1c4ecc21..4c3a274a99 100644 --- a/frontend/src/assets/locales/de/page.admin.json +++ b/frontend/src/assets/locales/de/page.admin.json @@ -27,6 +27,9 @@ "or": "oder", "browseFiles": "Dateien durchsuchen", "success": "Erfolgreich hochgeladen." + }, + "importStatus": { + "importStatus": "Import Status" } } } diff --git a/frontend/src/assets/locales/en/common.json b/frontend/src/assets/locales/en/common.json index 2ff7168b63..f480afbf92 100644 --- a/frontend/src/assets/locales/en/common.json +++ b/frontend/src/assets/locales/en/common.json @@ -12,6 +12,7 @@ "alerts": "Quality alerts", "adminRegistry": "Registry lookups", "adminBpn": "BPN - EDC configuration", + "adminImport": "Asset import", "unauthorized": "Functionality is disabled because of missing role. Ask your administrator to provide the required role for the functionality." }, "pageTitle": { diff --git a/frontend/src/assets/locales/en/page.admin.json b/frontend/src/assets/locales/en/page.admin.json index 89f28e1fc0..fe9b58b8da 100644 --- a/frontend/src/assets/locales/en/page.admin.json +++ b/frontend/src/assets/locales/en/page.admin.json @@ -27,6 +27,9 @@ "or": "or", "browseFiles": "Browse files", "success": "Successfully uploaded." + }, + "importStatus": { + "importStatus": "Import status" } } } From 78442fef734ef8e850e0a59b7062c35be1f04a4d Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Wed, 10 Jan 2024 13:43:38 +0100 Subject: [PATCH 28/49] feat(mapping): TRACEFOSS-2741 fixed bad structure import validation. Added bpn validation for assets to be imported matching app bpn. --- .../assets/application/ImportController.java | 23 +- .../validation/JsonFileValidator.java | 6 +- .../assets/domain/base/model/AssetBase.java | 3 + .../importpoc/service/ImportServiceImpl.java | 10 +- .../service/MainAspectAsBuiltStrategy.java | 8 +- .../importdata/ImportControllerIT.java | 40 + .../invalidImportFileBadStructure.json | 1079 +++++++++++++++++ .../testdata/importfiles/validImportFile.json | 26 +- .../validImportFileButWrongBPN.json | 1072 ++++++++++++++++ 9 files changed, 2244 insertions(+), 23 deletions(-) create mode 100644 tx-backend/src/test/resources/testdata/importfiles/invalidImportFileBadStructure.json create mode 100644 tx-backend/src/test/resources/testdata/importfiles/validImportFileButWrongBPN.json diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java index d7ebef8d2a..63ec6181ff 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java @@ -36,6 +36,7 @@ import org.eclipse.tractusx.traceability.assets.application.importpoc.ImportService; import org.eclipse.tractusx.traceability.assets.application.importpoc.validation.JsonFileValidator; import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.exception.ImportException; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; @@ -46,6 +47,7 @@ import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -121,16 +123,27 @@ public class ImportController { @PostMapping(value = "/import", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity importJson(@RequestPart("file") MultipartFile file) { - List validationResult = jsonFileValidator.isValid(file); - ValidationResponse validationResponse = new ValidationResponse(validationResult); + List jsonSchemaErrors = jsonFileValidator.isValid(file); + ValidationResponse validationResponse = new ValidationResponse(jsonSchemaErrors); - if (!validationResult.isEmpty()) { + if (!jsonSchemaErrors.isEmpty()) { return ResponseEntity - .status(HttpStatus.BAD_REQUEST) + .badRequest() .body(new ImportResponse(validationResponse)); + } + Map resultMap = null; + try { + resultMap = importService.importAssets(file); + } catch (ImportException e) { + log.info("Could not import data", e); + List validationErrors = new ArrayList<>(); + validationErrors.add(e.getMessage()); + ValidationResponse importErrorResponse = new ValidationResponse(validationErrors); + return ResponseEntity + .badRequest() + .body(new ImportResponse(importErrorResponse)); } - Map resultMap = importService.importAssets(file); List importStateMessages = resultMap.entrySet().stream() .map(assetBaseSet -> new ImportStateMessage( diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/importpoc/validation/JsonFileValidator.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/importpoc/validation/JsonFileValidator.java index d9dde47efe..6aded8da33 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/importpoc/validation/JsonFileValidator.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/importpoc/validation/JsonFileValidator.java @@ -62,7 +62,7 @@ public List isValid(MultipartFile file) { return List.of(); } String fileName = file.getOriginalFilename(); - if (isNull(fileName)){ + if (isNull(fileName)) { throw new IllegalStateException(); } String[] fileNameSplit = fileName.split("\\."); @@ -94,6 +94,10 @@ private List validateAspectPayload(MultipartFile file, Validator validat } JsonNode assetsNode = rootNode.get("assets"); + if (isNull(assetsNode)) { + errors.add("Could not find assets"); + return errors; + } for (JsonNode asset : assetsNode) { JsonNode submodels = asset.get("submodels"); for (JsonNode submodel : submodels) { diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/model/AssetBase.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/model/AssetBase.java index e03de55608..19b49c343a 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/model/AssetBase.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/base/model/AssetBase.java @@ -74,4 +74,7 @@ public BomLifecycle getBomLifecycle() { return BomLifecycle.AS_PLANNED; } } + public boolean isOwnAsset(final String bpn){ + return bpn.equals(manufacturerId); + } } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java index 515b74346d..95ad5be8d1 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java @@ -57,8 +57,14 @@ public Map importAssets(MultipartFile file) { Map> assetToUploadByBomLifecycle = importRequest.assets() .stream() - .map(assetImportItem -> strategyFactory.mapToAssetBase(assetImportItem, traceabilityProperties)) - .filter(Optional::isPresent) + .map(assetImportItem -> { + Optional assetBase = strategyFactory.mapToAssetBase(assetImportItem, traceabilityProperties); + if (assetBase.isPresent() && assetBase.get().isOwnAsset(traceabilityProperties.getBpn().toString())) { + return assetBase; + } else { + throw new ImportException("At least one asset does not match the application bpn " + traceabilityProperties.getBpn().value()); + } + }) .map(Optional::get) .collect(Collectors.groupingBy(AssetBase::getBomLifecycle)); diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java index ebbacfcd86..f180046323 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java @@ -87,7 +87,7 @@ public AssetBase mapToAssetBase(ImportRequest.AssetImportRequest assetImportRequ final AtomicReference semanticModelId = new AtomicReference<>(); final AtomicReference semanticDataModel = new AtomicReference<>(); ArrayList detailAspectModels = new ArrayList<>(); - + final AtomicReference manufacturerId = new AtomicReference<>(); asBuiltAspect.localIdentifiers().stream().filter(localIdentifier -> localIdentifier.key().equals("partInstanceId")).findFirst().ifPresent(s -> { semanticModelId.set(s.value()); semanticDataModel.set(org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.SERIALPART); @@ -104,6 +104,10 @@ public AssetBase mapToAssetBase(ImportRequest.AssetImportRequest assetImportRequ semanticDataModel.set(org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.JUSTINSEQUENCE); }); + asBuiltAspect.localIdentifiers().stream().filter(localId -> localId.key().equals("manufacturerId")).findFirst().ifPresent(s -> { + manufacturerId.set(s.value()); + }); + if (semanticDataModel.get() == null) { semanticDataModel.set(org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.UNKNOWN); } @@ -113,7 +117,7 @@ public AssetBase mapToAssetBase(ImportRequest.AssetImportRequest assetImportRequ .id(assetImportRequestV2.assetMetaInfoRequest().catenaXId()) .semanticModelId(semanticModelId.get()) .detailAspectModels(detailAspectModels) - .manufacturerId(traceabilityProperties.getBpn().value()) + .manufacturerId(manufacturerId.get()) .nameAtManufacturer(asBuiltAspect.partTypeInformation().nameAtManufacturer()) .manufacturerPartId(asBuiltAspect.partTypeInformation().manufacturerPartId()) .parentRelations(parentRelations) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/importdata/ImportControllerIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/importdata/ImportControllerIT.java index 1ef46837bb..7db69be780 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/importdata/ImportControllerIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/importdata/ImportControllerIT.java @@ -217,6 +217,46 @@ void givenInvalidFile_whenImportData_thenValidationShouldNotPass() throws JoseEx ).toArray())); } + @Test + void givenInvalidFile_whenImportDataWithBadStructure_thenValidationShouldNotPass() throws JoseException { + // given + String path = getClass().getResource("/testdata/importfiles/invalidImportFileBadStructure.json").getFile(); + File file = new File(path); + + // when/then + given() + .header(oAuth2Support.jwtAuthorization(JwtRole.ADMIN)) + .when() + .multiPart(file) + .post("/api/assets/import") + .then() + .statusCode(400) + .body("validationResult.validationErrors", Matchers.contains( + List.of( + "Missing property assets", "Could not find assets" + ).toArray())); + } + + @Test + void givenValidFile_whenImportDataWithWrongBPN_thenValidationShouldNotPass() throws JoseException { + // given + String path = getClass().getResource("/testdata/importfiles/validImportFileButWrongBPN.json").getFile(); + File file = new File(path); + + // when/then + given() + .header(oAuth2Support.jwtAuthorization(JwtRole.ADMIN)) + .when() + .multiPart(file) + .post("/api/assets/import") + .then() + .statusCode(400) + .body("validationResult.validationErrors", Matchers.contains( + List.of( + "At least one asset does not match the application bpn BPNL00000003AXS3" + ).toArray())); + } + @Test void givenInvalidFileExtension_whenImportData_thenValidationShouldPass() throws JoseException { // given diff --git a/tx-backend/src/test/resources/testdata/importfiles/invalidImportFileBadStructure.json b/tx-backend/src/test/resources/testdata/importfiles/invalidImportFileBadStructure.json new file mode 100644 index 0000000000..48a907f198 --- /dev/null +++ b/tx-backend/src/test/resources/testdata/importfiles/invalidImportFileBadStructure.json @@ -0,0 +1,1079 @@ +{ + "fasdasdfsfda" : [ + { + "adsfsfd" : { + "catenaXId" : "invalidUUID" + }, + "afd" : [ + { + "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", + "payload" : { + "invalidlocalIdentifiers" : [ + { + "value" : "BPNL00000003CNKC", + "key" : "manufacturerId" + }, + { + "value" : "22782277-50", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-313869652971440618042264", + "key" : "partInstanceId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd", + "partTypeInformation" : { + "manufacturerPartId" : "22782277-50", + "customerPartId" : "22782277-50", + "classification" : "component", + "nameAtManufacturer" : "Door f-l", + "nameAtCustomer" : "b/test Door front-left" + } + } + }, + { + "invalidaspectType" : "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd", + "childItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "hasAlternatives" : true, + "createdOn" : "2023-02-20T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z", + "catenaXId" : "urn:uuid:1d2d8480-90a5-4a17-9ecb-2ff039d35fec", + "businessPartner" : "BPNL00000003CSGV" + } + ] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd", + "customers" : [ + { + "parentItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "catenaXId" : "urn:uuid:6b2296cc-26c0-4f38-8a22-092338c36e22", + "createdOn" : "2023-05-29T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ], + "businessPartner" : "BPNL00000003CML1", + "createdOn" : "2023-02-03T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003CNKC", + "key" : "manufacturerId" + }, + { + "value" : "3880383-57", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-989134870198932317923938", + "key" : "partInstanceId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a", + "partTypeInformation" : { + "manufacturerPartId" : "3880383-57", + "customerPartId" : "3880383-57", + "classification" : "component", + "nameAtManufacturer" : "b/test Door f-l", + "nameAtCustomer" : "Door front-left" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt", + "payload" : { + "catenaX1Id" : "urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a", + "invalidchildItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "hasAlternatives" : true, + "createdOn" : "2020-05-02T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z", + "catenaXId" : "urn:uuid:4e390dab-707f-446e-bfbe-653f6f5b1f37", + "businessPartner" : "BPNL00000003CML1" + } + ] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a", + "customers" : [ + { + "parentItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "catenaXId" : "urn:uuid:d8030bbf-a874-49fb-b2e1-7610f0ccad12", + "createdOn" : "2023-07-15T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ], + "businessPartner" : "BPNL00000003CML1", + "createdOn" : "2023-02-03T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003CNKC", + "key" : "manufacturerId" + }, + { + "value" : "9069675-60", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-004314332935115065980115", + "key" : "partInstanceId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd", + "partTypeInformation" : { + "manufacturerPartId" : "9069675-60", + "customerPartId" : "9069675-60", + "classification" : "component", + "nameAtManufacturer" : "b/test Door f-l", + "nameAtCustomer" : "Door front-left" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd", + "childItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "hasAlternatives" : true, + "createdOn" : "2018-09-17T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z", + "catenaXId" : "urn:uuid:4a5e9ff6-2d5c-4510-a90e-d55af3ba502f", + "businessPartner" : "BPNL00000003CML1" + } + ] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd", + "customers" : [ + { + "parentItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "catenaXId" : "urn:uuid:7c7d5aec-b15d-491c-8fbd-c61c6c02c69a", + "createdOn" : "2023-02-16T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ], + "businessPartner" : "BPNL00000003CML1", + "createdOn" : "2023-02-03T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003CNKC", + "key" : "manufacturerId" + }, + { + "value" : "9879317-51", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-477013846751358222215326", + "key" : "partInstanceId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d", + "partTypeInformation" : { + "manufacturerPartId" : "9879317-51", + "customerPartId" : "9879317-51", + "classification" : "component", + "nameAtManufacturer" : "b/test Door f-l", + "nameAtCustomer" : "Door front-left" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d", + "childItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "hasAlternatives" : true, + "createdOn" : "2022-06-28T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z", + "catenaXId" : "urn:uuid:6ec3f1db-2798-454b-a73f-0d21a8966c74", + "businessPartner" : "BPNL00000003CML1" + } + ] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d", + "customers" : [ + { + "parentItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "catenaXId" : "urn:uuid:4d33bfa6-0f1f-43a5-ad63-c3fe07a2d076", + "createdOn" : "2023-03-03T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ], + "businessPartner" : "BPNL00000003CSGV", + "createdOn" : "2023-02-03T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb01" + }, + "submodels" : [ + { + "aspectType" : "urn:samm:io.catenax.batch:2.0.0#Batch", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003CNKC", + "key" : "manufacturerId" + }, + { + "value" : "5894914-94", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-341449848714937445621543", + "key" : "batchId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb01", + "partTypeInformation" : { + "manufacturerPartId" : "5894914-94", + "classification" : "component", + "nameAtManufacturer" : "b/test Door Key" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb01", + "customers" : [ + { + "parentItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa02", + "createdOn" : "2023-08-08T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ], + "businessPartner" : "BPNL00000003CML1", + "createdOn" : "2023-02-03T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb02" + }, + "submodels" : [ + { + "aspectType" : "urn:samm:io.catenax.batch:2.0.0#Batch", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003CNKC", + "key" : "manufacturerId" + }, + { + "value" : "6245773-32", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-341449848714937445621543", + "key" : "batchId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb02", + "partTypeInformation" : { + "manufacturerPartId" : "6245773-32", + "classification" : "component", + "nameAtManufacturer" : "b/test Door Key" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb02", + "childItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "hasAlternatives" : true, + "createdOn" : "2019-08-15T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z", + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa03", + "businessPartner" : "BPNL00000003CML1" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb03" + }, + "submodels" : [ + { + "aspectType" : "urn:samm:io.catenax.batch:2.0.0#Batch", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003CNKC", + "key" : "manufacturerId" + }, + { + "value" : "9770171-23", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-341449848714937445621543", + "key" : "batchId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb03", + "partTypeInformation" : { + "manufacturerPartId" : "9770171-23", + "classification" : "component", + "nameAtManufacturer" : "b/test Door Key" + } + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4eb01" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", + "payload" : { + "validityPeriod" : { + "validFrom" : "2019-04-04T03:19:03.000Z", + "validTo" : "2024-12-29T10:25:12.000Z" + }, + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4eb01", + "partTypeInformation" : { + "manufacturerPartId" : "7805659-25", + "classification" : "product", + "nameAtManufacturer" : "b/test Vehicle Model B" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4eb01", + "childItems" : [ + { + "validityPeriod" : { + "validFrom" : "2023-03-21T08:17:29.187+01:00", + "validTo" : "2024-07-01T16:10:00.000+01:00" + }, + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "createdOn" : "2022-09-03T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z", + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4da01", + "businessPartner" : "BPNL00000003CML1" + } + ] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4eb01", + "sites" : [ + { + "functionValidUntil" : "2025-02-08T04:30:48.000Z", + "function" : "production", + "functionValidFrom" : "2019-08-21T02:10:36.000Z", + "catenaXSiteId" : "BPNS000004711DMY" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:580d3adf-1981-44a0-a214-13d6ceed6841" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.just_in_sequence_part:1.0.0#JustInSequencePart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003CNKC", + "key" : "manufacturerId" + }, + { + "value" : "12345678ABC", + "key" : "jisNumber" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "HUN" + }, + "catenaXId" : "urn:uuid:580d3adf-1981-44a0-a214-13d6ceed6841", + "partTypeInformation" : { + "manufacturerPartId" : "3578115-43", + "customerPartId" : "PRT-12345", + "classification" : "product", + "nameAtManufacturer" : "Mirror left", + "nameAtCustomer" : "b/test side element A" + } + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", + "payload" : { + "validityPeriod" : { + "validFrom" : "2017-01-03T07:45:04.000Z", + "validTo" : "2029-11-15T11:57:45.000Z" + }, + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e", + "partTypeInformation" : { + "manufacturerPartId" : "2586427-48", + "classification" : "product", + "nameAtManufacturer" : "b/test Vehicle Model A" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e", + "childItems" : [ + { + "validityPeriod" : { + "validFrom" : "2023-03-21T08:17:29.187+01:00", + "validTo" : "2024-07-01T16:10:00.000+01:00" + }, + "catenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef127c", + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:litre" + }, + "businessPartner" : "BPNL00000003AYRE", + "createdOn" : "2022-12-03T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z" + } + ] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e", + "sites" : [ + { + "validUntil" : "2025-04-04T04:14:11.000Z", + "catenaXsiteId" : "BPNS000004711DMY", + "function" : "production", + "functionValidFrom" : "2018-03-24T13:38:32.000Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:c7a2b803-f8fe-4b79-b6fc-967ce847c9a1" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", + "payload" : { + "validityPeriod" : { + "validFrom" : "2016-04-28T20:00:55.000Z", + "validTo" : "2027-04-27T00:59:41.000Z" + }, + "catenaXId" : "urn:uuid:c7a2b803-f8fe-4b79-b6fc-967ce847c9a1", + "partTypeInformation" : { + "manufacturerPartId" : "8840374-09", + "classification" : "product", + "nameAtManufacturer" : "b/test ZB ZELLE" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:c7a2b803-f8fe-4b79-b6fc-967ce847c9a1", + "sites" : [ + { + "functionValidUntil" : "2028-04-27T13:34:20.000Z", + "catenaXsiteId" : "BPNS000004711DMY", + "function" : "production", + "functionValidFrom" : "2017-05-03T09:10:04.000Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef128c" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", + "payload" : { + "validityPeriod" : { + "validFrom" : "2015-05-18T23:10:44.000Z", + "validTo" : "2025-10-23T14:46:01.000Z" + }, + "catenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef128c", + "partTypeInformation" : { + "manufacturerPartId" : "6288246-67", + "classification" : "product", + "nameAtManufacturer" : "b/test OEM A High Voltage Battery" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef128c", + "childItems" : [ + { + "validityPeriod" : { + "validFrom" : "2023-03-21T08:17:29.187+01:00", + "validTo" : "2024-07-01T16:10:00.000+01:00" + }, + "catenaXId" : "urn:uuid:e5c96ab5-896a-482c-8761-efd74777ca98", + "quantity" : { + "quantityNumber" : 6, + "measurementUnit" : "unit:litre" + }, + "businessPartner" : "BPNL00000003CML1", + "createdOn" : "2022-02-08T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z" + } + ] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef128c", + "sites" : [ + { + "functionValidUntil" : "2027-05-23T09:16:30.000Z", + "catenaXsiteId" : "BPNS000004711DMY", + "function" : "production", + "functionValidFrom" : "2013-11-17T23:59:54.000Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", + "payload" : { + "validityPeriod" : { + "validFrom" : "2017-07-03T05:23:01.000Z", + "validTo" : "2032-09-25T10:26:27.000Z" + }, + "catenaXId" : "urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7", + "partTypeInformation" : { + "manufacturerPartId" : "32494586-73", + "classification" : "product", + "nameAtManufacturer" : "b/test Tier A Gearbox" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7", + "childItems" : [ + { + "validityPeriod" : { + "validFrom" : "2023-03-21T08:17:29.187+01:00", + "validTo" : "2024-07-01T16:10:00.000+01:00" + }, + "catenaXId" : "urn:uuid:bee5614f-9e46-4c98-9209-61a6f2b2a7fc", + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:litre" + }, + "businessPartner" : "BPNL00000003CML1", + "createdOn" : "2022-02-09T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z" + }, + { + "validityPeriod" : { + "validFrom" : "2023-03-21T08:17:29.187+01:00", + "validTo" : "2024-07-01T16:10:00.000+01:00" + }, + "catenaXId" : "urn:uuid:4518c080-14fb-4252-b8de-4362d615868d", + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:litre" + }, + "businessPartner" : "BPNL00000003CML1", + "createdOn" : "2022-02-10T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z" + } + ] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7", + "sites" : [ + { + "functionValidUntil" : "2031-10-27T21:24:04.000Z", + "catenaXsiteId" : "BPNS00000003B2OM", + "function" : "production", + "functionValidFrom" : "2016-01-29T21:44:37.000Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:07cb071f-8716-45fe-89f1-f2f77a1ce93b" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", + "payload" : { + "validityPeriod" : { + "validFrom" : "2016-04-24T08:26:56.000Z", + "validTo" : "2031-12-17T23:55:04.000Z" + }, + "catenaXId" : "urn:uuid:07cb071f-8716-45fe-89f1-f2f77a1ce93b", + "partTypeInformation" : { + "manufacturerPartId" : "8583898-48", + "classification" : "product", + "nameAtManufacturer" : "b/test Tier B ECU1" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:07cb071f-8716-45fe-89f1-f2f77a1ce93b", + "childItems" : [ + { + "validityPeriod" : { + "validFrom" : "2023-03-21T08:17:29.187+01:00", + "validTo" : "2024-07-01T16:10:00.000+01:00" + }, + "catenaXId" : "urn:uuid:3cdd2826-5df0-4c7b-b540-9eeccecb2301", + "quantity" : { + "quantityNumber" : 0.3301, + "measurementUnit" : "unit:kilogram" + }, + "businessPartner" : "BPNL00000003CML1", + "createdOn" : "2022-02-13T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z" + } + ] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:07cb071f-8716-45fe-89f1-f2f77a1ce93b", + "sites" : [ + { + "functionValidUntil" : "2028-09-29T13:56:09.000Z", + "catenaXsiteId" : "BPNS00000003B5MJ", + "function" : "production", + "functionValidFrom" : "2017-01-30T12:55:30.000Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:e8c48a8e-d2d7-43d9-a867-65c70c85f5b8" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", + "payload" : { + "validityPeriod" : { + "validFrom" : "2019-11-02T11:14:15.000Z", + "validTo" : "2024-07-17T02:07:07.000Z" + }, + "catenaXId" : "urn:uuid:e8c48a8e-d2d7-43d9-a867-65c70c85f5b8", + "partTypeInformation" : { + "manufacturerPartId" : "1987361-42", + "classification" : "product", + "nameAtManufacturer" : "b/test Tire Model A" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:e8c48a8e-d2d7-43d9-a867-65c70c85f5b8", + "sites" : [ + { + "functionValidUntil" : "2028-02-14T21:42:45.000Z", + "catenaXsiteId" : "BPNS00000003B2OM", + "function" : "production", + "functionValidFrom" : "2015-07-21T06:33:16.000Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:b0acf3e1-3fbe-46c0-aa0b-0724caae7772" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003CNKC", + "key" : "manufacturerId" + }, + { + "value" : "8840374-09", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-917923082133064161014067", + "key" : "partInstanceId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:b0acf3e1-3fbe-46c0-aa0b-0724caae7772", + "partTypeInformation" : { + "manufacturerPartId" : "8840374-09", + "customerPartId" : "8840374-09", + "classification" : "component", + "nameAtManufacturer" : "b/test ZB ZELLE", + "nameAtCustomer" : "ZB ZELLE" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.traction_battery_code:1.0.0#TractionBatteryCode", + "payload" : { + "tractionBatteryCode" : "X12MCPM27KLPCLX2M2382320", + "subcomponents" : [ + { + "tractionBatteryCode" : "X12MCPM27KLPCLX2M2382320", + "productType" : "cell" + } + ], + "productType" : "cell" + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003CNKC", + "key" : "manufacturerId" + }, + { + "value" : "1142469-27", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-655858074471261486971940", + "key" : "partInstanceId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d", + "partTypeInformation" : { + "manufacturerPartId" : "1142469-27", + "customerPartId" : "1142469-27", + "classification" : "component", + "nameAtManufacturer" : "b/test Door Key", + "nameAtCustomer" : "Door Key" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.just_in_sequence_part:1.0.0#JustInSequencePart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "92879626SFC", + "key" : "jisNumber" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "HUN" + }, + "catenaXId" : "urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d", + "partTypeInformation" : { + "manufacturerPartId" : "1417058-05", + "customerPartId" : "PRT-12345", + "classification" : "product", + "nameAtManufacturer" : "b/test Door Key", + "nameAtCustomer" : "Door Key" + } + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003CNKC", + "key" : "manufacturerId" + }, + { + "value" : "8840837-48", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-570196089623842018037372", + "key" : "partInstanceId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f", + "partTypeInformation" : { + "manufacturerPartId" : "8840838-04", + "customerPartId" : "8840838-04", + "classification" : "component", + "nameAtManufacturer" : "HV MODUL", + "nameAtCustomer" : "HV MODUL" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f", + "childItems" : [ + { + "catenaXId" : "urn:uuid:e3b2f5e2-5be5-4ea6-98f0-6876de0fcb5f", + "quantity" : { + "quantityNumber" : 2.5, + "measurementUnit" : "unit:litre" + }, + "hasAlternatives" : true, + "businessPartner" : "BPNL00000003CNKC", + "createdOn" : "2022-02-03T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z" + } + ] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f", + "customers" : [ + { + "businessPartner" : "BPNL00000003CNKC", + "parentItems" : [], + "createdOn" : "2022-02-03T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:e3b2f5e2-5be5-4ea6-98f0-6876de0fcb5f" + }, + "submodels" : [ + ] + } + ] +} diff --git a/tx-backend/src/test/resources/testdata/importfiles/validImportFile.json b/tx-backend/src/test/resources/testdata/importfiles/validImportFile.json index 462f8f7572..be3abf619a 100644 --- a/tx-backend/src/test/resources/testdata/importfiles/validImportFile.json +++ b/tx-backend/src/test/resources/testdata/importfiles/validImportFile.json @@ -10,7 +10,7 @@ "payload" : { "localIdentifiers" : [ { - "value" : "BPNL00000003CNKC", + "value" : "BPNL00000003AXS3", "key" : "manufacturerId" }, { @@ -91,7 +91,7 @@ "payload" : { "localIdentifiers" : [ { - "value" : "BPNL00000003CNKC", + "value" : "BPNL00000003AXS3", "key" : "manufacturerId" }, { @@ -172,7 +172,7 @@ "payload" : { "localIdentifiers" : [ { - "value" : "BPNL00000003CNKC", + "value" : "BPNL00000003AXS3", "key" : "manufacturerId" }, { @@ -253,7 +253,7 @@ "payload" : { "localIdentifiers" : [ { - "value" : "BPNL00000003CNKC", + "value" : "BPNL00000003AXS3", "key" : "manufacturerId" }, { @@ -334,7 +334,7 @@ "payload" : { "localIdentifiers" : [ { - "value" : "BPNL00000003CNKC", + "value" : "BPNL00000003AXS3", "key" : "manufacturerId" }, { @@ -394,7 +394,7 @@ "payload" : { "localIdentifiers" : [ { - "value" : "BPNL00000003CNKC", + "value" : "BPNL00000003AXS3", "key" : "manufacturerId" }, { @@ -449,7 +449,7 @@ "payload" : { "localIdentifiers" : [ { - "value" : "BPNL00000003CNKC", + "value" : "BPNL00000003AXS3", "key" : "manufacturerId" }, { @@ -543,7 +543,7 @@ "payload" : { "localIdentifiers" : [ { - "value" : "BPNL00000003CNKC", + "value" : "BPNL00000003AXS3", "key" : "manufacturerId" }, { @@ -895,7 +895,7 @@ "payload" : { "localIdentifiers" : [ { - "value" : "BPNL00000003CNKC", + "value" : "BPNL00000003AXS3", "key" : "manufacturerId" }, { @@ -946,7 +946,7 @@ "payload" : { "localIdentifiers" : [ { - "value" : "BPNL00000003CNKC", + "value" : "BPNL00000003AXS3", "key" : "manufacturerId" }, { @@ -1007,7 +1007,7 @@ "payload" : { "localIdentifiers" : [ { - "value" : "BPNL00000003CNKC", + "value" : "BPNL00000003AXS3", "key" : "manufacturerId" }, { @@ -1045,7 +1045,7 @@ "measurementUnit" : "unit:litre" }, "hasAlternatives" : true, - "businessPartner" : "BPNL00000003CNKC", + "businessPartner" : "BPNL00000003AXS3", "createdOn" : "2022-02-03T14:48:54.709Z", "lastModifiedOn" : "2022-02-03T14:48:54.709Z" } @@ -1058,7 +1058,7 @@ "catenaXId" : "urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f", "customers" : [ { - "businessPartner" : "BPNL00000003CNKC", + "businessPartner" : "BPNL00000003AXS3", "parentItems" : [], "createdOn" : "2022-02-03T14:48:54.709Z", "lastModifiedOn" : "2022-02-03T14:48:54.709Z" diff --git a/tx-backend/src/test/resources/testdata/importfiles/validImportFileButWrongBPN.json b/tx-backend/src/test/resources/testdata/importfiles/validImportFileButWrongBPN.json new file mode 100644 index 0000000000..554a6b21d7 --- /dev/null +++ b/tx-backend/src/test/resources/testdata/importfiles/validImportFileButWrongBPN.json @@ -0,0 +1,1072 @@ +{ + "assets" : [ + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003XXX1", + "key" : "manufacturerId" + }, + { + "value" : "22782277-50", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-313869652971440618042264", + "key" : "partInstanceId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd", + "partTypeInformation" : { + "manufacturerPartId" : "22782277-50", + "customerPartId" : "22782277-50", + "classification" : "component", + "nameAtManufacturer" : "Door f-l", + "nameAtCustomer" : "b/test Door front-left" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd", + "childItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "hasAlternatives" : true, + "createdOn" : "2023-02-20T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z", + "catenaXId" : "urn:uuid:1d2d8480-90a5-4a17-9ecb-2ff039d35fec", + "businessPartner" : "BPNL00000003CSGV" + } + ] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd", + "customers" : [ + { + "parentItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "catenaXId" : "urn:uuid:6b2296cc-26c0-4f38-8a22-092338c36e22", + "createdOn" : "2023-05-29T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ], + "businessPartner" : "BPNL00000003CML1", + "createdOn" : "2023-02-03T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003AXS3", + "key" : "manufacturerId" + }, + { + "value" : "3880383-57", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-989134870198932317923938", + "key" : "partInstanceId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a", + "partTypeInformation" : { + "manufacturerPartId" : "3880383-57", + "customerPartId" : "3880383-57", + "classification" : "component", + "nameAtManufacturer" : "b/test Door f-l", + "nameAtCustomer" : "Door front-left" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a", + "childItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "hasAlternatives" : true, + "createdOn" : "2020-05-02T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z", + "catenaXId" : "urn:uuid:4e390dab-707f-446e-bfbe-653f6f5b1f37", + "businessPartner" : "BPNL00000003CML1" + } + ] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a", + "customers" : [ + { + "parentItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "catenaXId" : "urn:uuid:d8030bbf-a874-49fb-b2e1-7610f0ccad12", + "createdOn" : "2023-07-15T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ], + "businessPartner" : "BPNL00000003CML1", + "createdOn" : "2023-02-03T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003AXS3", + "key" : "manufacturerId" + }, + { + "value" : "9069675-60", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-004314332935115065980115", + "key" : "partInstanceId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd", + "partTypeInformation" : { + "manufacturerPartId" : "9069675-60", + "customerPartId" : "9069675-60", + "classification" : "component", + "nameAtManufacturer" : "b/test Door f-l", + "nameAtCustomer" : "Door front-left" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd", + "childItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "hasAlternatives" : true, + "createdOn" : "2018-09-17T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z", + "catenaXId" : "urn:uuid:4a5e9ff6-2d5c-4510-a90e-d55af3ba502f", + "businessPartner" : "BPNL00000003CML1" + } + ] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd", + "customers" : [ + { + "parentItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "catenaXId" : "urn:uuid:7c7d5aec-b15d-491c-8fbd-c61c6c02c69a", + "createdOn" : "2023-02-16T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ], + "businessPartner" : "BPNL00000003CML1", + "createdOn" : "2023-02-03T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003AXS3", + "key" : "manufacturerId" + }, + { + "value" : "9879317-51", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-477013846751358222215326", + "key" : "partInstanceId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d", + "partTypeInformation" : { + "manufacturerPartId" : "9879317-51", + "customerPartId" : "9879317-51", + "classification" : "component", + "nameAtManufacturer" : "b/test Door f-l", + "nameAtCustomer" : "Door front-left" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d", + "childItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "hasAlternatives" : true, + "createdOn" : "2022-06-28T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z", + "catenaXId" : "urn:uuid:6ec3f1db-2798-454b-a73f-0d21a8966c74", + "businessPartner" : "BPNL00000003CML1" + } + ] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d", + "customers" : [ + { + "parentItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "catenaXId" : "urn:uuid:4d33bfa6-0f1f-43a5-ad63-c3fe07a2d076", + "createdOn" : "2023-03-03T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ], + "businessPartner" : "BPNL00000003CSGV", + "createdOn" : "2023-02-03T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb01" + }, + "submodels" : [ + { + "aspectType" : "urn:samm:io.catenax.batch:2.0.0#Batch", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003AXS3", + "key" : "manufacturerId" + }, + { + "value" : "5894914-94", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-341449848714937445621543", + "key" : "batchId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb01", + "partTypeInformation" : { + "manufacturerPartId" : "5894914-94", + "classification" : "component", + "nameAtManufacturer" : "b/test Door Key" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb01", + "customers" : [ + { + "parentItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa02", + "createdOn" : "2023-08-08T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ], + "businessPartner" : "BPNL00000003CML1", + "createdOn" : "2023-02-03T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb02" + }, + "submodels" : [ + { + "aspectType" : "urn:samm:io.catenax.batch:2.0.0#Batch", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003AXS3", + "key" : "manufacturerId" + }, + { + "value" : "6245773-32", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-341449848714937445621543", + "key" : "batchId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb02", + "partTypeInformation" : { + "manufacturerPartId" : "6245773-32", + "classification" : "component", + "nameAtManufacturer" : "b/test Door Key" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb02", + "childItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "hasAlternatives" : true, + "createdOn" : "2019-08-15T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z", + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa03", + "businessPartner" : "BPNL00000003CML1" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb03" + }, + "submodels" : [ + { + "aspectType" : "urn:samm:io.catenax.batch:2.0.0#Batch", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003AXS3", + "key" : "manufacturerId" + }, + { + "value" : "9770171-23", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-341449848714937445621543", + "key" : "batchId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb03", + "partTypeInformation" : { + "manufacturerPartId" : "9770171-23", + "classification" : "component", + "nameAtManufacturer" : "b/test Door Key" + } + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4eb01" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", + "payload" : { + "validityPeriod" : { + "validFrom" : "2019-04-04T03:19:03.000Z", + "validTo" : "2024-12-29T10:25:12.000Z" + }, + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4eb01", + "partTypeInformation" : { + "manufacturerPartId" : "7805659-25", + "classification" : "product", + "nameAtManufacturer" : "b/test Vehicle Model B" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4eb01", + "childItems" : [ + { + "validityPeriod" : { + "validFrom" : "2023-03-21T08:17:29.187+01:00", + "validTo" : "2024-07-01T16:10:00.000+01:00" + }, + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "createdOn" : "2022-09-03T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z", + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4da01", + "businessPartner" : "BPNL00000003CML1" + } + ] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4eb01", + "sites" : [ + { + "functionValidUntil" : "2025-02-08T04:30:48.000Z", + "function" : "production", + "functionValidFrom" : "2019-08-21T02:10:36.000Z", + "catenaXSiteId" : "BPNS000004711DMY" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:580d3adf-1981-44a0-a214-13d6ceed6841" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.just_in_sequence_part:1.0.0#JustInSequencePart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003AXS3", + "key" : "manufacturerId" + }, + { + "value" : "12345678ABC", + "key" : "jisNumber" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "HUN" + }, + "catenaXId" : "urn:uuid:580d3adf-1981-44a0-a214-13d6ceed6841", + "partTypeInformation" : { + "manufacturerPartId" : "3578115-43", + "customerPartId" : "PRT-12345", + "classification" : "product", + "nameAtManufacturer" : "Mirror left", + "nameAtCustomer" : "b/test side element A" + } + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", + "payload" : { + "validityPeriod" : { + "validFrom" : "2017-01-03T07:45:04.000Z", + "validTo" : "2029-11-15T11:57:45.000Z" + }, + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e", + "partTypeInformation" : { + "manufacturerPartId" : "2586427-48", + "classification" : "product", + "nameAtManufacturer" : "b/test Vehicle Model A" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e", + "childItems" : [ + { + "validityPeriod" : { + "validFrom" : "2023-03-21T08:17:29.187+01:00", + "validTo" : "2024-07-01T16:10:00.000+01:00" + }, + "catenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef127c", + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:litre" + }, + "businessPartner" : "BPNL00000003AYRE", + "createdOn" : "2022-12-03T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z" + } + ] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e", + "sites" : [ + { + "functionValidUntil" : "2025-04-04T04:14:11.000Z", + "catenaXsiteId" : "BPNS000004711DMY", + "function" : "production", + "functionValidFrom" : "2018-03-24T13:38:32.000Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:c7a2b803-f8fe-4b79-b6fc-967ce847c9a1" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", + "payload" : { + "validityPeriod" : { + "validFrom" : "2016-04-28T20:00:55.000Z", + "validTo" : "2027-04-27T00:59:41.000Z" + }, + "catenaXId" : "urn:uuid:c7a2b803-f8fe-4b79-b6fc-967ce847c9a1", + "partTypeInformation" : { + "manufacturerPartId" : "8840374-09", + "classification" : "product", + "nameAtManufacturer" : "b/test ZB ZELLE" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:c7a2b803-f8fe-4b79-b6fc-967ce847c9a1", + "sites" : [ + { + "functionValidUntil" : "2028-04-27T13:34:20.000Z", + "catenaXsiteId" : "BPNS000004711DMY", + "function" : "production", + "functionValidFrom" : "2017-05-03T09:10:04.000Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef128c" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", + "payload" : { + "validityPeriod" : { + "validFrom" : "2015-05-18T23:10:44.000Z", + "validTo" : "2025-10-23T14:46:01.000Z" + }, + "catenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef128c", + "partTypeInformation" : { + "manufacturerPartId" : "6288246-67", + "classification" : "product", + "nameAtManufacturer" : "b/test OEM A High Voltage Battery" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef128c", + "childItems" : [ + { + "validityPeriod" : { + "validFrom" : "2023-03-21T08:17:29.187+01:00", + "validTo" : "2024-07-01T16:10:00.000+01:00" + }, + "catenaXId" : "urn:uuid:e5c96ab5-896a-482c-8761-efd74777ca98", + "quantity" : { + "quantityNumber" : 6, + "measurementUnit" : "unit:litre" + }, + "businessPartner" : "BPNL00000003CML1", + "createdOn" : "2022-02-08T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z" + } + ] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef128c", + "sites" : [ + { + "functionValidUntil" : "2027-05-23T09:16:30.000Z", + "catenaXsiteId" : "BPNS000004711DMY", + "function" : "production", + "functionValidFrom" : "2013-11-17T23:59:54.000Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", + "payload" : { + "validityPeriod" : { + "validFrom" : "2017-07-03T05:23:01.000Z", + "validTo" : "2032-09-25T10:26:27.000Z" + }, + "catenaXId" : "urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7", + "partTypeInformation" : { + "manufacturerPartId" : "32494586-73", + "classification" : "product", + "nameAtManufacturer" : "b/test Tier A Gearbox" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7", + "childItems" : [ + { + "validityPeriod" : { + "validFrom" : "2023-03-21T08:17:29.187+01:00", + "validTo" : "2024-07-01T16:10:00.000+01:00" + }, + "catenaXId" : "urn:uuid:bee5614f-9e46-4c98-9209-61a6f2b2a7fc", + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:litre" + }, + "businessPartner" : "BPNL00000003CML1", + "createdOn" : "2022-02-09T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z" + }, + { + "validityPeriod" : { + "validFrom" : "2023-03-21T08:17:29.187+01:00", + "validTo" : "2024-07-01T16:10:00.000+01:00" + }, + "catenaXId" : "urn:uuid:4518c080-14fb-4252-b8de-4362d615868d", + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:litre" + }, + "businessPartner" : "BPNL00000003CML1", + "createdOn" : "2022-02-10T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z" + } + ] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7", + "sites" : [ + { + "functionValidUntil" : "2031-10-27T21:24:04.000Z", + "catenaXsiteId" : "BPNS00000003B2OM", + "function" : "production", + "functionValidFrom" : "2016-01-29T21:44:37.000Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:07cb071f-8716-45fe-89f1-f2f77a1ce93b" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", + "payload" : { + "validityPeriod" : { + "validFrom" : "2016-04-24T08:26:56.000Z", + "validTo" : "2031-12-17T23:55:04.000Z" + }, + "catenaXId" : "urn:uuid:07cb071f-8716-45fe-89f1-f2f77a1ce93b", + "partTypeInformation" : { + "manufacturerPartId" : "8583898-48", + "classification" : "product", + "nameAtManufacturer" : "b/test Tier B ECU1" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:07cb071f-8716-45fe-89f1-f2f77a1ce93b", + "childItems" : [ + { + "validityPeriod" : { + "validFrom" : "2023-03-21T08:17:29.187+01:00", + "validTo" : "2024-07-01T16:10:00.000+01:00" + }, + "catenaXId" : "urn:uuid:3cdd2826-5df0-4c7b-b540-9eeccecb2301", + "quantity" : { + "quantityNumber" : 0.3301, + "measurementUnit" : "unit:kilogram" + }, + "businessPartner" : "BPNL00000003CML1", + "createdOn" : "2022-02-13T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z" + } + ] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:07cb071f-8716-45fe-89f1-f2f77a1ce93b", + "sites" : [ + { + "functionValidUntil" : "2028-09-29T13:56:09.000Z", + "catenaXsiteId" : "BPNS00000003B5MJ", + "function" : "production", + "functionValidFrom" : "2017-01-30T12:55:30.000Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:e8c48a8e-d2d7-43d9-a867-65c70c85f5b8" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", + "payload" : { + "validityPeriod" : { + "validFrom" : "2019-11-02T11:14:15.000Z", + "validTo" : "2024-07-17T02:07:07.000Z" + }, + "catenaXId" : "urn:uuid:e8c48a8e-d2d7-43d9-a867-65c70c85f5b8", + "partTypeInformation" : { + "manufacturerPartId" : "1987361-42", + "classification" : "product", + "nameAtManufacturer" : "b/test Tire Model A" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", + "payload" : { + "catenaXId" : "urn:uuid:e8c48a8e-d2d7-43d9-a867-65c70c85f5b8", + "sites" : [ + { + "functionValidUntil" : "2028-02-14T21:42:45.000Z", + "catenaXsiteId" : "BPNS00000003B2OM", + "function" : "production", + "functionValidFrom" : "2015-07-21T06:33:16.000Z" + } + ] + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:b0acf3e1-3fbe-46c0-aa0b-0724caae7772" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003AXS3", + "key" : "manufacturerId" + }, + { + "value" : "8840374-09", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-917923082133064161014067", + "key" : "partInstanceId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:b0acf3e1-3fbe-46c0-aa0b-0724caae7772", + "partTypeInformation" : { + "manufacturerPartId" : "8840374-09", + "customerPartId" : "8840374-09", + "classification" : "component", + "nameAtManufacturer" : "b/test ZB ZELLE", + "nameAtCustomer" : "ZB ZELLE" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.traction_battery_code:1.0.0#TractionBatteryCode", + "payload" : { + "tractionBatteryCode" : "X12MCPM27KLPCLX2M2382320", + "subcomponents" : [ + { + "tractionBatteryCode" : "X12MCPM27KLPCLX2M2382320", + "productType" : "cell" + } + ], + "productType" : "cell" + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003AXS3", + "key" : "manufacturerId" + }, + { + "value" : "1142469-27", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-655858074471261486971940", + "key" : "partInstanceId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d", + "partTypeInformation" : { + "manufacturerPartId" : "1142469-27", + "customerPartId" : "1142469-27", + "classification" : "component", + "nameAtManufacturer" : "b/test Door Key", + "nameAtCustomer" : "Door Key" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.just_in_sequence_part:1.0.0#JustInSequencePart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "92879626SFC", + "key" : "jisNumber" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "HUN" + }, + "catenaXId" : "urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d", + "partTypeInformation" : { + "manufacturerPartId" : "1417058-05", + "customerPartId" : "PRT-12345", + "classification" : "product", + "nameAtManufacturer" : "b/test Door Key", + "nameAtCustomer" : "Door Key" + } + } + } + ] + }, + { + "assetMetaInfo" : { + "catenaXId" : "urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f" + }, + "submodels" : [ + { + "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", + "payload" : { + "localIdentifiers" : [ + { + "value" : "BPNL00000003AXS3", + "key" : "manufacturerId" + }, + { + "value" : "8840837-48", + "key" : "manufacturerPartId" + }, + { + "value" : "NO-570196089623842018037372", + "key" : "partInstanceId" + } + ], + "manufacturingInformation" : { + "date" : "2022-02-04T14:48:54", + "country" : "DEU" + }, + "catenaXId" : "urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f", + "partTypeInformation" : { + "manufacturerPartId" : "8840838-04", + "customerPartId" : "8840838-04", + "classification" : "component", + "nameAtManufacturer" : "HV MODUL", + "nameAtCustomer" : "HV MODUL" + } + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f", + "childItems" : [ + { + "catenaXId" : "urn:uuid:e3b2f5e2-5be5-4ea6-98f0-6876de0fcb5f", + "quantity" : { + "quantityNumber" : 2.5, + "measurementUnit" : "unit:litre" + }, + "hasAlternatives" : true, + "businessPartner" : "BPNL00000003AXS3", + "createdOn" : "2022-02-03T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z" + } + ] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f", + "customers" : [ + { + "businessPartner" : "BPNL00000003AXS3", + "parentItems" : [], + "createdOn" : "2022-02-03T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z" + } + ] + } + } + ] + } + ] +} From d7b8dcc15d1b63baff898559331170065acfe69e Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Wed, 10 Jan 2024 13:49:34 +0100 Subject: [PATCH 29/49] feat(mapping): TRACEFOSS-2741 fixed bad structure import validation. Added bpn validation for assets to be imported matching app bpn. --- .../assets/domain/importpoc/service/ImportServiceImplTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java index c077b3e9f1..1f13e8043b 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java @@ -77,7 +77,7 @@ void testImportRequestSuccessful() throws IOException { file ); - when(traceabilityProperties.getBpn()).thenReturn(BPN.of("ABC")); + when(traceabilityProperties.getBpn()).thenReturn(BPN.of("BPNL00000003CML1")); importService.importAssets(multipartFile); verify(assetAsBuiltRepository, times(1)).saveAllIfNotInIRSSyncAndUpdateImportStateAndNote(anyList()); verify(assetAsPlannedRepository, times(1)).saveAllIfNotInIRSSyncAndUpdateImportStateAndNote(anyList()); From 3585643ba55181c041d9120801b113b443b557dd Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Wed, 10 Jan 2024 15:05:13 +0100 Subject: [PATCH 30/49] feat(mapping): TRACEFOSS-2741 fixed bad structure import validation. Added bpn validation for assets to be imported matching app bpn. --- .../openapi/traceability-foss-backend.json | 1600 ++++++++--------- .../service/MainAspectAsBuiltStrategy.java | 6 +- .../service/ImportServiceImplTest.java | 1 - .../resources/testdata/import-request.json | 851 +++------ .../testdata/importfiles/validImportFile.json | 24 +- .../validImportFileButWrongBPN.json | 24 +- 6 files changed, 1123 insertions(+), 1383 deletions(-) diff --git a/tx-backend/openapi/traceability-foss-backend.json b/tx-backend/openapi/traceability-foss-backend.json index 0df66e26a2..726d57aff6 100644 --- a/tx-backend/openapi/traceability-foss-backend.json +++ b/tx-backend/openapi/traceability-foss-backend.json @@ -41,8 +41,8 @@ "description" : "The endpoint returns a result of BPN EDC URL mappings.", "operationId" : "getBpnEdcs", "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -51,8 +51,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -61,8 +61,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -71,18 +71,20 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "200" : { + "description" : "Returns the paged result found", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" } } } }, - "404" : { - "description" : "Not found.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -91,20 +93,18 @@ } } }, - "200" : { - "description" : "Returns the paged result found", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -113,8 +113,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -155,8 +155,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -165,8 +165,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -175,8 +175,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -185,18 +185,20 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "200" : { + "description" : "Returns the paged result found for BpnEdcMapping", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" } } } }, - "404" : { - "description" : "Not found.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -205,20 +207,18 @@ } } }, - "200" : { - "description" : "Returns the paged result found for BpnEdcMapping", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -227,8 +227,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -269,8 +269,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -279,8 +279,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -289,8 +289,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -299,18 +299,20 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "200" : { + "description" : "Returns the paged result found for BpnEdcMapping", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" } } } }, - "404" : { - "description" : "Not found.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -319,20 +321,18 @@ } } }, - "200" : { - "description" : "Returns the paged result found for BpnEdcMapping", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -341,8 +341,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -380,8 +380,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -390,8 +390,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -400,8 +400,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -410,6 +410,12 @@ } } }, + "200" : { + "description" : "Returns the paged result found", + "content" : { + "application/json" : {} + } + }, "415" : { "description" : "Unsupported media type", "content" : { @@ -420,8 +426,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -430,14 +436,8 @@ } } }, - "200" : { - "description" : "Returns the paged result found", - "content" : { - "application/json" : {} - } - }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -446,8 +446,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -493,8 +493,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -503,8 +503,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -513,8 +513,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -523,6 +523,9 @@ } } }, + "200" : { + "description" : "Ok." + }, "415" : { "description" : "Unsupported media type", "content" : { @@ -533,8 +536,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -543,14 +546,11 @@ } } }, - "200" : { - "description" : "Ok." - }, "204" : { "description" : "No Content." }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -559,8 +559,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -606,8 +606,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -616,8 +616,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -626,8 +626,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -646,8 +646,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -668,8 +668,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -678,8 +678,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -715,8 +715,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -725,8 +725,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -735,8 +735,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -755,8 +755,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -775,8 +775,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -785,8 +785,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -835,8 +835,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -845,8 +845,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -855,8 +855,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -865,6 +865,9 @@ } } }, + "200" : { + "description" : "Ok." + }, "415" : { "description" : "Unsupported media type", "content" : { @@ -875,8 +878,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -885,11 +888,11 @@ } } }, - "200" : { - "description" : "Ok." + "204" : { + "description" : "No content." }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -898,11 +901,8 @@ } } }, - "204" : { - "description" : "No content." - }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -951,8 +951,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -961,8 +961,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -971,8 +971,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -981,6 +981,9 @@ } } }, + "200" : { + "description" : "Ok." + }, "415" : { "description" : "Unsupported media type", "content" : { @@ -991,8 +994,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1001,11 +1004,11 @@ } } }, - "200" : { - "description" : "Ok." + "204" : { + "description" : "No content." }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1014,11 +1017,8 @@ } } }, - "204" : { - "description" : "No content." - }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1057,8 +1057,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1067,8 +1067,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1077,8 +1077,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1087,6 +1087,12 @@ } } }, + "200" : { + "description" : "Ok." + }, + "204" : { + "description" : "No content." + }, "415" : { "description" : "Unsupported media type", "content" : { @@ -1097,8 +1103,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1107,14 +1113,8 @@ } } }, - "200" : { - "description" : "Ok." - }, - "204" : { - "description" : "No content." - }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1123,8 +1123,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1163,8 +1163,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1173,8 +1173,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1183,8 +1183,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1193,6 +1193,12 @@ } } }, + "200" : { + "description" : "Ok." + }, + "204" : { + "description" : "No content." + }, "415" : { "description" : "Unsupported media type", "content" : { @@ -1203,8 +1209,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1213,14 +1219,8 @@ } } }, - "200" : { - "description" : "Ok." - }, - "204" : { - "description" : "No content." - }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1229,8 +1229,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1268,8 +1268,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1278,8 +1278,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1288,8 +1288,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1308,8 +1308,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1328,8 +1328,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1338,8 +1338,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1385,8 +1385,8 @@ } }, "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1395,8 +1395,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1405,8 +1405,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1425,14 +1425,8 @@ } } }, - "200" : { - "description" : "OK.", - "content" : { - "application/json" : {} - } - }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1444,8 +1438,14 @@ "204" : { "description" : "No Content." }, - "429" : { - "description" : "Too many requests.", + "200" : { + "description" : "OK.", + "content" : { + "application/json" : {} + } + }, + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1454,8 +1454,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1493,8 +1493,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1503,8 +1503,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1513,8 +1513,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1533,8 +1533,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1546,8 +1546,8 @@ "201" : { "description" : "Created." }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1556,8 +1556,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1595,8 +1595,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1605,8 +1605,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1615,8 +1615,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1625,18 +1625,20 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "200" : { + "description" : "Returns the paged result found for Asset", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" } } } }, - "404" : { - "description" : "Not found.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1645,20 +1647,18 @@ } } }, - "200" : { - "description" : "Returns the paged result found for Asset", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1667,8 +1667,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1706,8 +1706,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1716,8 +1716,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1726,8 +1726,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1746,8 +1746,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1759,8 +1759,8 @@ "201" : { "description" : "Created." }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1769,8 +1769,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1808,20 +1808,18 @@ "required" : true }, "responses" : { - "200" : { - "description" : "Returns the paged result found for Asset", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "403" : { - "description" : "Forbidden.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1830,8 +1828,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1840,12 +1838,14 @@ } } }, - "400" : { - "description" : "Bad request.", + "200" : { + "description" : "Returns the paged result found for Asset", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" } } } @@ -1860,8 +1860,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -1870,8 +1870,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1880,8 +1880,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -1927,8 +1927,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -1937,8 +1937,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -1947,8 +1947,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -1957,18 +1957,19 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "200" : { + "description" : "Returns the paged result found for Asset", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "type" : "array" } } } }, - "404" : { - "description" : "Not found.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -1977,19 +1978,18 @@ } } }, - "200" : { - "description" : "Returns the paged result found for Asset", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -1998,8 +1998,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -2035,8 +2035,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -2045,8 +2045,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -2055,8 +2055,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -2075,8 +2075,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -2095,8 +2095,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -2105,8 +2105,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -2155,8 +2155,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -2165,8 +2165,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -2175,8 +2175,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -2195,8 +2195,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -2205,8 +2205,11 @@ } } }, - "429" : { - "description" : "Too many requests.", + "204" : { + "description" : "No content." + }, + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -2215,11 +2218,8 @@ } } }, - "204" : { - "description" : "No content." - }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -2268,8 +2268,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -2278,8 +2278,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -2288,8 +2288,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -2298,6 +2298,9 @@ } } }, + "200" : { + "description" : "Ok." + }, "415" : { "description" : "Unsupported media type", "content" : { @@ -2308,8 +2311,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -2318,11 +2321,11 @@ } } }, - "200" : { - "description" : "Ok." + "204" : { + "description" : "No content." }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -2331,11 +2334,8 @@ } } }, - "204" : { - "description" : "No content." - }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -2374,8 +2374,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -2384,8 +2384,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -2394,8 +2394,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -2404,6 +2404,12 @@ } } }, + "200" : { + "description" : "Ok." + }, + "204" : { + "description" : "No content." + }, "415" : { "description" : "Unsupported media type", "content" : { @@ -2414,8 +2420,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -2424,14 +2430,8 @@ } } }, - "200" : { - "description" : "Ok." - }, - "204" : { - "description" : "No content." - }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -2440,8 +2440,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -2480,8 +2480,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -2490,8 +2490,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -2500,8 +2500,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -2510,6 +2510,12 @@ } } }, + "200" : { + "description" : "Ok." + }, + "204" : { + "description" : "No content." + }, "415" : { "description" : "Unsupported media type", "content" : { @@ -2520,8 +2526,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -2530,14 +2536,8 @@ } } }, - "200" : { - "description" : "Ok." - }, - "204" : { - "description" : "No content." - }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -2546,8 +2546,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -2585,6 +2585,16 @@ } ], "responses" : { + "404" : { + "description" : "Not found.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "200" : { "description" : "Returns the assets found", "content" : { @@ -2745,18 +2755,8 @@ } } }, - "403" : { - "description" : "Forbidden.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -2765,8 +2765,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -2785,8 +2785,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -2795,8 +2795,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -2805,8 +2805,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -2852,18 +2852,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "500" : { - "description" : "Internal server error.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -2882,18 +2872,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "404" : { - "description" : "Not found.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -3062,8 +3042,18 @@ } } }, - "429" : { - "description" : "Too many requests.", + "415" : { + "description" : "Unsupported media type", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -3081,6 +3071,16 @@ } } } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } } }, "security" : [ @@ -3111,18 +3111,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "500" : { - "description" : "Internal server error.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -3301,8 +3291,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -3311,8 +3301,8 @@ } } }, - "404" : { - "description" : "Not found.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -3321,8 +3311,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -3340,6 +3330,16 @@ } } } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } } }, "security" : [ @@ -3378,18 +3378,8 @@ "required" : true }, "responses" : { - "403" : { - "description" : "Forbidden.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "500" : { - "description" : "Internal server error.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -3408,26 +3398,6 @@ } } }, - "415" : { - "description" : "Unsupported media type", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "404" : { - "description" : "Not found.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, "429" : { "description" : "Too many requests.", "content" : { @@ -3598,6 +3568,26 @@ } } }, + "415" : { + "description" : "Unsupported media type", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, "401" : { "description" : "Authorization failed.", "content" : { @@ -3607,6 +3597,16 @@ } } } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } } }, "security" : [ @@ -3627,8 +3627,8 @@ "description" : "The endpoint returns all shell descriptors.", "operationId" : "findAll", "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -3637,8 +3637,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -3647,8 +3647,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -3657,18 +3657,21 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "200" : { + "description" : "ShellDescriptors found.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ShellDescriptorResponse" + } } } } }, - "404" : { - "description" : "Not found.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -3677,21 +3680,18 @@ } } }, - "200" : { - "description" : "ShellDescriptors found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/ShellDescriptorResponse" - } + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -3700,8 +3700,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -3728,8 +3728,8 @@ "description" : "The endpoint deletes all shell descriptors.", "operationId" : "deleteAll", "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -3738,8 +3738,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -3748,8 +3748,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -3758,6 +3758,9 @@ } } }, + "204" : { + "description" : "Deleted." + }, "415" : { "description" : "Unsupported media type", "content" : { @@ -3768,8 +3771,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -3778,11 +3781,8 @@ } } }, - "204" : { - "description" : "Deleted." - }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -3791,8 +3791,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -3820,8 +3820,8 @@ "description" : "The endpoint Triggers reload of shell descriptors.", "operationId" : "reload", "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -3830,8 +3830,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -3840,8 +3840,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -3850,6 +3850,9 @@ } } }, + "202" : { + "description" : "Created registry reload job." + }, "415" : { "description" : "Unsupported media type", "content" : { @@ -3860,8 +3863,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -3870,11 +3873,8 @@ } } }, - "202" : { - "description" : "Created registry reload job." - }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -3883,8 +3883,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -3923,18 +3923,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "500" : { - "description" : "Internal server error.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -3953,18 +3943,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "404" : { - "description" : "Not found.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -3989,8 +3969,18 @@ } } }, - "429" : { - "description" : "Too many requests.", + "415" : { + "description" : "Unsupported media type", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -4008,6 +3998,16 @@ } } } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } } }, "security" : [ @@ -4068,8 +4068,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -4078,8 +4078,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -4088,8 +4088,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -4098,18 +4098,20 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "200" : { + "description" : "Returns a distinct filter values for given fieldName.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" } } } }, - "404" : { - "description" : "Not found.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -4118,20 +4120,18 @@ } } }, - "200" : { - "description" : "Returns a distinct filter values for given fieldName.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -4140,8 +4140,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -4169,18 +4169,18 @@ "description" : "The endpoint can return limited data based on the user role", "operationId" : "dashboard", "responses" : { - "403" : { - "description" : "Forbidden.", + "200" : { + "description" : "Returns dashboard data", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "$ref" : "#/components/schemas/DashboardResponse" } } } }, - "500" : { - "description" : "Internal server error.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -4199,8 +4199,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -4209,8 +4209,8 @@ } } }, - "404" : { - "description" : "Not found.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -4219,18 +4219,18 @@ } } }, - "200" : { - "description" : "Returns dashboard data", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/DashboardResponse" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -4239,8 +4239,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -4286,8 +4286,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -4296,8 +4296,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -4306,8 +4306,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -4326,8 +4326,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -4501,8 +4501,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -4511,8 +4511,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -4558,18 +4558,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "500" : { - "description" : "Internal server error.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -4588,18 +4578,8 @@ } } }, - "415" : { - "description" : "Unsupported media type", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "404" : { - "description" : "Not found.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -4768,8 +4748,18 @@ } } }, - "429" : { - "description" : "Too many requests.", + "415" : { + "description" : "Unsupported media type", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -4787,6 +4777,16 @@ } } } + }, + "403" : { + "description" : "Forbidden.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } } }, "security" : [ @@ -4849,8 +4849,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -4859,8 +4859,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -4869,8 +4869,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -4879,18 +4879,20 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "200" : { + "description" : "Returns a distinct filter values for given fieldName.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" } } } }, - "404" : { - "description" : "Not found.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -4899,20 +4901,18 @@ } } }, - "200" : { - "description" : "Returns a distinct filter values for given fieldName.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -4921,8 +4921,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -4968,8 +4968,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -4978,8 +4978,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -4988,8 +4988,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -5008,8 +5008,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -5183,8 +5183,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -5193,8 +5193,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -5240,8 +5240,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -5250,8 +5250,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -5260,8 +5260,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -5280,8 +5280,28 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "401" : { + "description" : "Authorization failed.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" + } + } + } + }, + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -5449,26 +5469,6 @@ } } } - }, - "429" : { - "description" : "Too many requests.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "401" : { - "description" : "Authorization failed.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } } }, "security" : [ @@ -5531,8 +5531,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -5541,8 +5541,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -5551,8 +5551,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -5561,18 +5561,20 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "200" : { + "description" : "Returns a distinct filter values for given fieldName.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" } } } }, - "404" : { - "description" : "Not found.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -5581,20 +5583,18 @@ } } }, - "200" : { - "description" : "Returns a distinct filter values for given fieldName.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -5603,8 +5603,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -5632,8 +5632,8 @@ "description" : "The endpoint returns a map for assets consumed by the map.", "operationId" : "assetsCountryMap", "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -5642,8 +5642,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -5652,8 +5652,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -5662,18 +5662,22 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "200" : { + "description" : "Returns the assets found", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "type" : "object", + "additionalProperties" : { + "type" : "integer", + "format" : "int64" + } } } } }, - "404" : { - "description" : "Not found.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -5682,22 +5686,18 @@ } } }, - "200" : { - "description" : "Returns the assets found", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { - "type" : "object", - "additionalProperties" : { - "type" : "integer", - "format" : "int64" - } + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -5706,8 +5706,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -5746,8 +5746,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -5756,8 +5756,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -5766,8 +5766,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -5776,18 +5776,23 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "200" : { + "description" : "OK.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "type" : "array", + "description" : "Alerts", + "items" : { + "$ref" : "#/components/schemas/AlertResponse" + } } } } }, - "404" : { - "description" : "Not found.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -5796,23 +5801,18 @@ } } }, - "200" : { - "description" : "OK.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "type" : "array", - "description" : "Alerts", - "items" : { - "$ref" : "#/components/schemas/AlertResponse" - } + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -5821,8 +5821,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -5890,8 +5890,8 @@ } ], "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -5900,8 +5900,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -5910,8 +5910,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -5920,18 +5920,20 @@ } } }, - "415" : { - "description" : "Unsupported media type", + "200" : { + "description" : "Returns a distinct filter values for given fieldName.", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "maxItems" : 2147483647, + "minItems" : 0, + "type" : "array" } } } }, - "404" : { - "description" : "Not found.", + "415" : { + "description" : "Unsupported media type", "content" : { "application/json" : { "schema" : { @@ -5940,20 +5942,18 @@ } } }, - "200" : { - "description" : "Returns a distinct filter values for given fieldName.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { - "maxItems" : 2147483647, - "minItems" : 0, - "type" : "array" + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -5962,8 +5962,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -5991,8 +5991,8 @@ "description" : "Deletes all submodels from the system.", "operationId" : "deleteSubmodels", "responses" : { - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -6001,8 +6001,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -6011,8 +6011,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -6021,6 +6021,9 @@ } } }, + "200" : { + "description" : "Ok." + }, "415" : { "description" : "Unsupported media type", "content" : { @@ -6031,8 +6034,8 @@ } } }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -6041,14 +6044,11 @@ } } }, - "200" : { - "description" : "Ok." - }, "204" : { "description" : "No Content." }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -6057,8 +6057,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { @@ -6099,8 +6099,8 @@ "200" : { "description" : "Okay" }, - "403" : { - "description" : "Forbidden.", + "404" : { + "description" : "Not found.", "content" : { "application/json" : { "schema" : { @@ -6109,8 +6109,8 @@ } } }, - "500" : { - "description" : "Internal server error.", + "400" : { + "description" : "Bad request.", "content" : { "application/json" : { "schema" : { @@ -6119,8 +6119,8 @@ } } }, - "400" : { - "description" : "Bad request.", + "429" : { + "description" : "Too many requests.", "content" : { "application/json" : { "schema" : { @@ -6129,6 +6129,9 @@ } } }, + "204" : { + "description" : "Deleted." + }, "415" : { "description" : "Unsupported media type", "content" : { @@ -6139,11 +6142,8 @@ } } }, - "204" : { - "description" : "Deleted." - }, - "404" : { - "description" : "Not found.", + "500" : { + "description" : "Internal server error.", "content" : { "application/json" : { "schema" : { @@ -6152,8 +6152,8 @@ } } }, - "429" : { - "description" : "Too many requests.", + "401" : { + "description" : "Authorization failed.", "content" : { "application/json" : { "schema" : { @@ -6162,8 +6162,8 @@ } } }, - "401" : { - "description" : "Authorization failed.", + "403" : { + "description" : "Forbidden.", "content" : { "application/json" : { "schema" : { diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java index f180046323..72d98ed6f5 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java @@ -86,8 +86,12 @@ public AssetBase mapToAssetBase(ImportRequest.AssetImportRequest assetImportRequ final AtomicReference semanticModelId = new AtomicReference<>(); final AtomicReference semanticDataModel = new AtomicReference<>(); - ArrayList detailAspectModels = new ArrayList<>(); final AtomicReference manufacturerId = new AtomicReference<>(); + + List detailAspectModels = new ArrayList<>(); + DetailAspectModel asBuiltDetailAspect = extractDetailAspectModelsAsBuilt(asBuiltAspect.manufacturingInformation(), asBuiltAspect.partTypeInformation()); + detailAspectModels.add(asBuiltDetailAspect); + asBuiltAspect.localIdentifiers().stream().filter(localIdentifier -> localIdentifier.key().equals("partInstanceId")).findFirst().ifPresent(s -> { semanticModelId.set(s.value()); semanticDataModel.set(org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.SERIALPART); diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java index 1f13e8043b..91407425d4 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java @@ -61,7 +61,6 @@ class ImportServiceImplTest { public void testSetup(){ ObjectMapper objectMapper = new ObjectMapper(); objectMapper.registerModule(new JavaTimeModule()); - importService = new ImportServiceImpl(objectMapper, assetAsPlannedRepository, assetAsBuiltRepository, traceabilityProperties, new MappingStrategyFactory()); } diff --git a/tx-backend/src/test/resources/testdata/import-request.json b/tx-backend/src/test/resources/testdata/import-request.json index 63cdcb6f89..579f9a98f3 100644 --- a/tx-backend/src/test/resources/testdata/import-request.json +++ b/tx-backend/src/test/resources/testdata/import-request.json @@ -2,7 +2,7 @@ "assets" : [ { "assetMetaInfo" : { - "catenaXId" : "urn:uuid:6b2296cc-26c0-4f38-8a22-092338c36e22" + "catenaXId" : "urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd" }, "submodels" : [ { @@ -14,34 +14,32 @@ "key" : "manufacturerId" }, { - "value" : "3500076-05", + "value" : "22782277-50", "key" : "manufacturerPartId" }, { - "value" : "OMAOYGBDTSRCMYSCX", + "value" : "NO-313869652971440618042264", "key" : "partInstanceId" - }, - { - "value" : "OMAOYGBDTSRCMYSCX", - "key" : "van" } ], "manufacturingInformation" : { "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, - "catenaXId" : "urn:uuid:6b2296cc-26c0-4f38-8a22-092338c36e22", + "catenaXId" : "urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd", "partTypeInformation" : { - "manufacturerPartId" : "3500076-05", - "classification" : "product", - "nameAtManufacturer" : "a/dev Vehicle Hybrid" + "manufacturerPartId" : "22782277-50", + "customerPartId" : "22782277-50", + "classification" : "component", + "nameAtManufacturer" : "Door f-l", + "nameAtCustomer" : "b/test Door front-left" } } }, { "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt", "payload" : { - "catenaXId" : "urn:uuid:6b2296cc-26c0-4f38-8a22-092338c36e22", + "catenaXId" : "urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd", "childItems" : [ { "quantity" : { @@ -49,10 +47,34 @@ "measurementUnit" : "unit:piece" }, "hasAlternatives" : true, - "createdOn" : "2022-02-03T14:48:54.709Z", + "createdOn" : "2023-02-20T14:48:54.709Z", "lastModifiedOn" : "2022-02-03T14:48:54.709Z", - "catenaXId" : "urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd", - "businessPartner" : "BPNL00000003CNKC" + "catenaXId" : "urn:uuid:1d2d8480-90a5-4a17-9ecb-2ff039d35fec", + "businessPartner" : "BPNL00000003CSGV" + } + ] + } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd", + "customers" : [ + { + "parentItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "catenaXId" : "urn:uuid:6b2296cc-26c0-4f38-8a22-092338c36e22", + "createdOn" : "2023-05-29T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ], + "businessPartner" : "BPNL00000003CML1", + "createdOn" : "2023-02-03T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" } ] } @@ -61,7 +83,7 @@ }, { "assetMetaInfo" : { - "catenaXId" : "urn:uuid:d8030bbf-a874-49fb-b2e1-7610f0ccad12" + "catenaXId" : "urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a" }, "submodels" : [ { @@ -73,34 +95,32 @@ "key" : "manufacturerId" }, { - "value" : "4922009-56", + "value" : "3880383-57", "key" : "manufacturerPartId" }, { - "value" : "OMAYSKEITUGNVHKKX", + "value" : "NO-989134870198932317923938", "key" : "partInstanceId" - }, - { - "value" : "OMAYSKEITUGNVHKKX", - "key" : "van" } ], "manufacturingInformation" : { - "date" : "2015-03-07T19:38:12.000Z", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, - "catenaXId" : "urn:uuid:d8030bbf-a874-49fb-b2e1-7610f0ccad12", + "catenaXId" : "urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a", "partTypeInformation" : { - "manufacturerPartId" : "4922009-56", - "classification" : "product", - "nameAtManufacturer" : "a/dev Vehicle Hybrid" + "manufacturerPartId" : "3880383-57", + "customerPartId" : "3880383-57", + "classification" : "component", + "nameAtManufacturer" : "b/test Door f-l", + "nameAtCustomer" : "Door front-left" } } }, { "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt", "payload" : { - "catenaXId" : "urn:uuid:d8030bbf-a874-49fb-b2e1-7610f0ccad12", + "catenaXId" : "urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a", "childItems" : [ { "quantity" : { @@ -108,56 +128,18 @@ "measurementUnit" : "unit:piece" }, "hasAlternatives" : true, - "createdOn" : "2021-01-15T14:48:54.709Z", + "createdOn" : "2020-05-02T14:48:54.709Z", "lastModifiedOn" : "2022-02-03T14:48:54.709Z", - "catenaXId" : "urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a", - "businessPartner" : "BPNL00000003CNKC" + "catenaXId" : "urn:uuid:4e390dab-707f-446e-bfbe-653f6f5b1f37", + "businessPartner" : "BPNL00000003CML1" } ] } - } - ] - }, - { - "assetMetaInfo" : { - "catenaXId" : "urn:uuid:4e390dab-707f-446e-bfbe-653f6f5b1f37" - }, - "submodels" : [ - { - "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", - "payload" : { - "localIdentifiers" : [ - { - "value" : "BPNL00000003CML1", - "key" : "manufacturerId" - }, - { - "value" : "6683834-82", - "key" : "manufacturerPartId" - }, - { - "value" : "NO-493575190274381019348907", - "key" : "partInstanceId" - } - ], - "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", - "country" : "DEU" - }, - "catenaXId" : "urn:uuid:4e390dab-707f-446e-bfbe-653f6f5b1f37", - "partTypeInformation" : { - "manufacturerPartId" : "6683834-82", - "customerPartId" : "6683834-82", - "classification" : "component", - "nameAtManufacturer" : "Door Key", - "nameAtCustomer" : "Door Key" - } - } }, { "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt", "payload" : { - "catenaXId" : "urn:uuid:4e390dab-707f-446e-bfbe-653f6f5b1f37", + "catenaXId" : "urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a", "customers" : [ { "parentItems" : [ @@ -166,12 +148,12 @@ "quantityNumber" : 1, "measurementUnit" : "unit:piece" }, - "catenaXId" : "urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a", - "createdOn" : "2023-12-05T14:48:54.709Z", + "catenaXId" : "urn:uuid:d8030bbf-a874-49fb-b2e1-7610f0ccad12", + "createdOn" : "2023-07-15T14:48:54.709Z", "lastModifiedOn" : "2023-02-03T14:48:54.709Z" } ], - "businessPartner" : "BPNL00000003CNKC", + "businessPartner" : "BPNL00000003CML1", "createdOn" : "2023-02-03T14:48:54.709Z", "lastModifiedOn" : "2023-02-03T14:48:54.709Z" } @@ -182,7 +164,7 @@ }, { "assetMetaInfo" : { - "catenaXId" : "urn:uuid:7c7d5aec-b15d-491c-8fbd-c61c6c02c69a" + "catenaXId" : "urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd" }, "submodels" : [ { @@ -194,34 +176,32 @@ "key" : "manufacturerId" }, { - "value" : "5519583-63", + "value" : "9069675-60", "key" : "manufacturerPartId" }, { - "value" : "OMAZRXWWMSPTQUEKI", + "value" : "NO-004314332935115065980115", "key" : "partInstanceId" - }, - { - "value" : "OMAZRXWWMSPTQUEKI", - "key" : "van" } ], "manufacturingInformation" : { - "date" : "2015-07-04T14:30:31.000Z", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, - "catenaXId" : "urn:uuid:7c7d5aec-b15d-491c-8fbd-c61c6c02c69a", + "catenaXId" : "urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd", "partTypeInformation" : { - "manufacturerPartId" : "5519583-63", - "classification" : "product", - "nameAtManufacturer" : "Vehicle Hybrid" + "manufacturerPartId" : "9069675-60", + "customerPartId" : "9069675-60", + "classification" : "component", + "nameAtManufacturer" : "b/test Door f-l", + "nameAtCustomer" : "Door front-left" } } }, { "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt", "payload" : { - "catenaXId" : "urn:uuid:7c7d5aec-b15d-491c-8fbd-c61c6c02c69a", + "catenaXId" : "urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd", "childItems" : [ { "quantity" : { @@ -229,56 +209,18 @@ "measurementUnit" : "unit:piece" }, "hasAlternatives" : true, - "createdOn" : "2022-11-22T14:48:54.709Z", + "createdOn" : "2018-09-17T14:48:54.709Z", "lastModifiedOn" : "2022-02-03T14:48:54.709Z", - "catenaXId" : "urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd", - "businessPartner" : "BPNL00000003CNKC" + "catenaXId" : "urn:uuid:4a5e9ff6-2d5c-4510-a90e-d55af3ba502f", + "businessPartner" : "BPNL00000003CML1" } ] } - } - ] - }, - { - "assetMetaInfo" : { - "catenaXId" : "urn:uuid:4a5e9ff6-2d5c-4510-a90e-d55af3ba502f" - }, - "submodels" : [ - { - "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", - "payload" : { - "localIdentifiers" : [ - { - "value" : "BPNL00000003CML1", - "key" : "manufacturerId" - }, - { - "value" : "8770123-80", - "key" : "manufacturerPartId" - }, - { - "value" : "NO-246880451848384868750731", - "key" : "partInstanceId" - } - ], - "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", - "country" : "DEU" - }, - "catenaXId" : "urn:uuid:4a5e9ff6-2d5c-4510-a90e-d55af3ba502f", - "partTypeInformation" : { - "manufacturerPartId" : "8770123-80", - "customerPartId" : "8770123-80", - "classification" : "component", - "nameAtManufacturer" : "a/dev Door Key", - "nameAtCustomer" : "Door Key" - } - } }, { "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt", "payload" : { - "catenaXId" : "urn:uuid:4a5e9ff6-2d5c-4510-a90e-d55af3ba502f", + "catenaXId" : "urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd", "customers" : [ { "parentItems" : [ @@ -287,12 +229,12 @@ "quantityNumber" : 1, "measurementUnit" : "unit:piece" }, - "catenaXId" : "urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd", - "createdOn" : "2023-04-13T14:48:54.709Z", + "catenaXId" : "urn:uuid:7c7d5aec-b15d-491c-8fbd-c61c6c02c69a", + "createdOn" : "2023-02-16T14:48:54.709Z", "lastModifiedOn" : "2023-02-03T14:48:54.709Z" } ], - "businessPartner" : "BPNL00000003CNKC", + "businessPartner" : "BPNL00000003CML1", "createdOn" : "2023-02-03T14:48:54.709Z", "lastModifiedOn" : "2023-02-03T14:48:54.709Z" } @@ -303,7 +245,7 @@ }, { "assetMetaInfo" : { - "catenaXId" : "urn:uuid:6ec3f1db-2798-454b-a73f-0d21a8966c74" + "catenaXId" : "urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d" }, "submodels" : [ { @@ -315,32 +257,51 @@ "key" : "manufacturerId" }, { - "value" : "5756987-94", + "value" : "9879317-51", "key" : "manufacturerPartId" }, { - "value" : "NO-613963493493659233961306", + "value" : "NO-477013846751358222215326", "key" : "partInstanceId" } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, - "catenaXId" : "urn:uuid:6ec3f1db-2798-454b-a73f-0d21a8966c74", + "catenaXId" : "urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d", "partTypeInformation" : { - "manufacturerPartId" : "5756987-94", - "customerPartId" : "5756987-94", + "manufacturerPartId" : "9879317-51", + "customerPartId" : "9879317-51", "classification" : "component", - "nameAtManufacturer" : "a/dev Door Key", - "nameAtCustomer" : "Door Key" + "nameAtManufacturer" : "b/test Door f-l", + "nameAtCustomer" : "Door front-left" } } }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d", + "childItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "hasAlternatives" : true, + "createdOn" : "2022-06-28T14:48:54.709Z", + "lastModifiedOn" : "2022-02-03T14:48:54.709Z", + "catenaXId" : "urn:uuid:6ec3f1db-2798-454b-a73f-0d21a8966c74", + "businessPartner" : "BPNL00000003CML1" + } + ] + } + }, { "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt", "payload" : { - "catenaXId" : "urn:uuid:6ec3f1db-2798-454b-a73f-0d21a8966c74", + "catenaXId" : "urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d", "customers" : [ { "parentItems" : [ @@ -349,12 +310,12 @@ "quantityNumber" : 1, "measurementUnit" : "unit:piece" }, - "catenaXId" : "urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d", - "createdOn" : "2023-08-21T14:48:54.709Z", + "catenaXId" : "urn:uuid:4d33bfa6-0f1f-43a5-ad63-c3fe07a2d076", + "createdOn" : "2023-03-03T14:48:54.709Z", "lastModifiedOn" : "2023-02-03T14:48:54.709Z" } ], - "businessPartner" : "BPNL00000003CNKC", + "businessPartner" : "BPNL00000003CSGV", "createdOn" : "2023-02-03T14:48:54.709Z", "lastModifiedOn" : "2023-02-03T14:48:54.709Z" } @@ -365,7 +326,7 @@ }, { "assetMetaInfo" : { - "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa01" + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb01" }, "submodels" : [ { @@ -377,7 +338,7 @@ "key" : "manufacturerId" }, { - "value" : "9858559-85", + "value" : "5894914-94", "key" : "manufacturerPartId" }, { @@ -386,22 +347,46 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, - "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa01", + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb01", "partTypeInformation" : { - "manufacturerPartId" : "9858559-85", + "manufacturerPartId" : "5894914-94", "classification" : "component", - "nameAtManufacturer" : "a/dev Door Key" + "nameAtManufacturer" : "b/test Door Key" } } + }, + { + "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt", + "payload" : { + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb01", + "customers" : [ + { + "parentItems" : [ + { + "quantity" : { + "quantityNumber" : 1, + "measurementUnit" : "unit:piece" + }, + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa02", + "createdOn" : "2023-08-08T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ], + "businessPartner" : "BPNL00000003CML1", + "createdOn" : "2023-02-03T14:48:54.709Z", + "lastModifiedOn" : "2023-02-03T14:48:54.709Z" + } + ] + } } ] }, { "assetMetaInfo" : { - "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa02" + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb02" }, "submodels" : [ { @@ -413,7 +398,7 @@ "key" : "manufacturerId" }, { - "value" : "9623673-66", + "value" : "6245773-32", "key" : "manufacturerPartId" }, { @@ -422,21 +407,21 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, - "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa02", + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb02", "partTypeInformation" : { - "manufacturerPartId" : "9623673-66", + "manufacturerPartId" : "6245773-32", "classification" : "component", - "nameAtManufacturer" : "a/dev Door Key" + "nameAtManufacturer" : "b/test Door Key" } } }, { "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt", "payload" : { - "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa02", + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb02", "childItems" : [ { "quantity" : { @@ -444,10 +429,10 @@ "measurementUnit" : "unit:piece" }, "hasAlternatives" : true, - "createdOn" : "2016-01-20T14:48:54.709Z", + "createdOn" : "2019-08-15T14:48:54.709Z", "lastModifiedOn" : "2022-02-03T14:48:54.709Z", - "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb01", - "businessPartner" : "BPNL00000003CNKC" + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa03", + "businessPartner" : "BPNL00000003CML1" } ] } @@ -456,7 +441,7 @@ }, { "assetMetaInfo" : { - "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa03" + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb03" }, "submodels" : [ { @@ -468,7 +453,7 @@ "key" : "manufacturerId" }, { - "value" : "4902203-92", + "value" : "9770171-23", "key" : "manufacturerPartId" }, { @@ -477,46 +462,22 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, - "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa03", + "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb03", "partTypeInformation" : { - "manufacturerPartId" : "4902203-92", + "manufacturerPartId" : "9770171-23", "classification" : "component", - "nameAtManufacturer" : "a/dev Door Key" + "nameAtManufacturer" : "b/test Door Key" } } - }, - { - "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt", - "payload" : { - "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa03", - "customers" : [ - { - "parentItems" : [ - { - "quantity" : { - "quantityNumber" : 1, - "measurementUnit" : "unit:piece" - }, - "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb02", - "createdOn" : "2022-07-03T14:48:54.709Z", - "lastModifiedOn" : "2023-02-03T14:48:54.709Z" - } - ], - "businessPartner" : "BPNL00000003CNKC", - "createdOn" : "2023-02-03T14:48:54.709Z", - "lastModifiedOn" : "2023-02-03T14:48:54.709Z" - } - ] - } } ] }, { "assetMetaInfo" : { - "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4da01" + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4eb01" }, "submodels" : [ { @@ -526,18 +487,18 @@ "validFrom" : "2019-04-04T03:19:03.000Z", "validTo" : "2024-12-29T10:25:12.000Z" }, - "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4da01", + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4eb01", "partTypeInformation" : { - "manufacturerPartId" : "9649571-63", + "manufacturerPartId" : "7805659-25", "classification" : "product", - "nameAtManufacturer" : "a/dev Vehicle Model A" + "nameAtManufacturer" : "b/test Vehicle Model B" } } }, { "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned", "payload" : { - "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4da01", + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4eb01", "childItems" : [ { "validityPeriod" : { @@ -548,10 +509,10 @@ "quantityNumber" : 1, "measurementUnit" : "unit:piece" }, - "createdOn" : "2022-08-03T14:48:54.709Z", + "createdOn" : "2022-09-03T14:48:54.709Z", "lastModifiedOn" : "2022-02-03T14:48:54.709Z", - "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4eb01", - "businessPartner" : "BPNL00000003CNKC" + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4da01", + "businessPartner" : "BPNL00000003CML1" } ] } @@ -559,7 +520,7 @@ { "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", "payload" : { - "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4da01", + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4eb01", "sites" : [ { "functionValidUntil" : "2025-02-08T04:30:48.000Z", @@ -574,7 +535,7 @@ }, { "assetMetaInfo" : { - "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e43842" + "catenaXId" : "urn:uuid:580d3adf-1981-44a0-a214-13d6ceed6841" }, "submodels" : [ { @@ -591,16 +552,16 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "HUN" }, - "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e43842", + "catenaXId" : "urn:uuid:580d3adf-1981-44a0-a214-13d6ceed6841", "partTypeInformation" : { - "manufacturerPartId" : "8397292-13", + "manufacturerPartId" : "3578115-43", "customerPartId" : "PRT-12345", "classification" : "product", "nameAtManufacturer" : "Mirror left", - "nameAtCustomer" : "a/dev side element A" + "nameAtCustomer" : "b/test side element A" } } } @@ -608,78 +569,56 @@ }, { "assetMetaInfo" : { - "catenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef127c" + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e" }, "submodels" : [ { "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", "payload" : { "validityPeriod" : { - "validFrom" : "2015-05-18T23:10:44.000Z", - "validTo" : "2025-10-23T14:46:01.000Z" + "validFrom" : "2017-01-03T07:45:04.000Z", + "validTo" : "2029-11-15T11:57:45.000Z" }, - "catenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef127c", + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e", "partTypeInformation" : { - "manufacturerPartId" : "38049661-08", + "manufacturerPartId" : "2586427-48", "classification" : "product", - "nameAtManufacturer" : "a/dev OEM A High Voltage Battery" + "nameAtManufacturer" : "b/test Vehicle Model A" } } }, { "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned", "payload" : { - "catenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef127c", + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e", "childItems" : [ { "validityPeriod" : { "validFrom" : "2023-03-21T08:17:29.187+01:00", "validTo" : "2024-07-01T16:10:00.000+01:00" }, - "catenaXId" : "urn:uuid:e5c96ab5-896a-482c-8761-efd74777ca97", + "catenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef127c", "quantity" : { - "quantityNumber" : 6, + "quantityNumber" : 1, "measurementUnit" : "unit:litre" }, - "businessPartner" : "BPNL00000003CML1", - "createdOn" : "2022-10-03T14:48:54.709Z", + "businessPartner" : "BPNL00000003AYRE", + "createdOn" : "2022-12-03T14:48:54.709Z", "lastModifiedOn" : "2022-02-03T14:48:54.709Z" } ] } }, - { - "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_planned:1.1.0#SingleLevelUsageAsPlanned", - "payload" : { - "parentParts" : [ - { - "validityPeriod" : { - "validFrom" : "2023-03-21T08:47:14.438+01:00", - "validTo" : "2024-08-02T09:00:00.000+01:00" - }, - "parentCatenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e", - "quantity" : { - "quantityNumber" : 2.5, - "measurementUnit" : "unit:litre" - }, - "createdOn" : "2022-11-03T14:48:54.709Z", - "lastModifiedOn" : "2022-02-03T14:48:54.709Z" - } - ], - "businessPartner" : "BPNL00000003CNKC", - "catenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef127c" - } - }, { "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", "payload" : { - "catenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef127c", + "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e", "sites" : [ { - "functionValidUntil" : "2027-05-23T09:16:30.000Z", + "functionValidUntil" : "2025-04-04T04:14:11.000Z", "catenaXSiteId" : "BPNS000004711DMY", "function" : "production", - "functionValidFrom" : "2013-11-17T23:59:54.000Z" + "functionValidFrom" : "2018-03-24T13:38:32.000Z" } ] } @@ -688,78 +627,34 @@ }, { "assetMetaInfo" : { - "catenaXId" : "urn:uuid:e5c96ab5-896a-482c-8761-efd74777ca98" + "catenaXId" : "urn:uuid:c7a2b803-f8fe-4b79-b6fc-967ce847c9a1" }, "submodels" : [ { "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", "payload" : { "validityPeriod" : { - "validFrom" : "2018-01-25T08:42:58.000Z", - "validTo" : "2029-02-10T03:24:30.000Z" + "validFrom" : "2016-04-28T20:00:55.000Z", + "validTo" : "2027-04-27T00:59:41.000Z" }, - "catenaXId" : "urn:uuid:e5c96ab5-896a-482c-8761-efd74777ca98", + "catenaXId" : "urn:uuid:c7a2b803-f8fe-4b79-b6fc-967ce847c9a1", "partTypeInformation" : { - "manufacturerPartId" : "8840838-04", + "manufacturerPartId" : "8840374-09", "classification" : "product", - "nameAtManufacturer" : "a/dev HV Modul" + "nameAtManufacturer" : "b/test ZB ZELLE" } } }, - { - "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned", - "payload" : { - "catenaXId" : "urn:uuid:e5c96ab5-896a-482c-8761-efd74777ca98", - "childItems" : [ - { - "validityPeriod" : { - "validFrom" : "2023-03-21T08:17:29.187+01:00", - "validTo" : "2024-07-01T16:10:00.000+01:00" - }, - "catenaXId" : "urn:uuid:c7a2b803-f8fe-4b79-b6fc-967ce847c9a1", - "quantity" : { - "quantityNumber" : 10, - "measurementUnit" : "unit:litre" - }, - "businessPartner" : "BPNL00000003CNKC", - "createdOn" : "2022-01-03T14:48:54.709Z", - "lastModifiedOn" : "2022-02-03T14:48:54.709Z" - } - ] - } - }, - { - "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_planned:1.1.0#SingleLevelUsageAsPlanned", - "payload" : { - "parentParts" : [ - { - "validityPeriod" : { - "validFrom" : "2023-03-21T08:47:14.438+01:00", - "validTo" : "2024-08-02T09:00:00.000+01:00" - }, - "parentCatenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef128c", - "quantity" : { - "quantityNumber" : 2.5, - "measurementUnit" : "unit:litre" - }, - "createdOn" : "2022-02-06T14:48:54.709Z", - "lastModifiedOn" : "2022-02-03T14:48:54.709Z" - } - ], - "businessPartner" : "BPNL00000003CNKC", - "catenaXId" : "urn:uuid:e5c96ab5-896a-482c-8761-efd74777ca98" - } - }, { "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", "payload" : { - "catenaXId" : "urn:uuid:e5c96ab5-896a-482c-8761-efd74777ca98", + "catenaXId" : "urn:uuid:c7a2b803-f8fe-4b79-b6fc-967ce847c9a1", "sites" : [ { - "functionValidUntil" : "2031-11-21T03:24:27.000Z", + "functionValidUntil" : "2028-04-27T13:34:20.000Z", "catenaXSiteId" : "BPNS000004711DMY", "function" : "production", - "functionValidFrom" : "2020-06-07T07:30:47.000Z" + "functionValidFrom" : "2017-05-03T09:10:04.000Z" } ] } @@ -768,92 +663,56 @@ }, { "assetMetaInfo" : { - "catenaXId" : "urn:uuid:4f7b1cf2-a598-4027-bc78-63f6d8e55699" + "catenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef128c" }, "submodels" : [ { "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", "payload" : { "validityPeriod" : { - "validFrom" : "2013-11-24T00:27:33.000Z", - "validTo" : "2025-08-16T09:18:35.000Z" - }, - "catenaXId" : "urn:uuid:4f7b1cf2-a598-4027-bc78-63f6d8e55699", - "partTypeInformation" : { - "manufacturerPartId" : "7A047C7-01", - "classification" : "product", - "nameAtManufacturer" : "a/dev N Tier A CathodeMaterial" - } - } - }, - { - "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", - "payload" : { - "catenaXId" : "urn:uuid:4f7b1cf2-a598-4027-bc78-63f6d8e55699", - "sites" : [ - { - "functionValidUntil" : "2025-03-05T00:33:55.000Z", - "catenaXSiteId" : "BPNS00000003B0Q0", - "function" : "production", - "functionValidFrom" : "2019-09-10T14:41:50.000Z" - } - ] - } - } - ] - }, - { - "assetMetaInfo" : { - "catenaXId" : "urn:uuid:bee5614f-9e46-4c98-9209-61a6f2b2a7fc" - }, - "submodels" : [ - { - "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", - "payload" : { - "validityPeriod" : { - "validFrom" : "2013-06-18T03:47:22.000Z", - "validTo" : "2030-12-31T23:33:25.000Z" + "validFrom" : "2015-05-18T23:10:44.000Z", + "validTo" : "2025-10-23T14:46:01.000Z" }, - "catenaXId" : "urn:uuid:bee5614f-9e46-4c98-9209-61a6f2b2a7fc", + "catenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef128c", "partTypeInformation" : { - "manufacturerPartId" : "6740244-02", + "manufacturerPartId" : "6288246-67", "classification" : "product", - "nameAtManufacturer" : "a/dev Sub Tier A Sensor" + "nameAtManufacturer" : "b/test OEM A High Voltage Battery" } } }, { - "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_planned:1.1.0#SingleLevelUsageAsPlanned", + "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned", "payload" : { - "parentParts" : [ + "catenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef128c", + "childItems" : [ { "validityPeriod" : { - "validFrom" : "2023-03-21T08:47:14.438+01:00", - "validTo" : "2024-08-02T09:00:00.000+01:00" + "validFrom" : "2023-03-21T08:17:29.187+01:00", + "validTo" : "2024-07-01T16:10:00.000+01:00" }, - "parentCatenaXId" : "urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7", + "catenaXId" : "urn:uuid:e5c96ab5-896a-482c-8761-efd74777ca98", "quantity" : { - "quantityNumber" : 2.5, + "quantityNumber" : 6, "measurementUnit" : "unit:litre" }, - "createdOn" : "2022-02-11T14:48:54.709Z", + "businessPartner" : "BPNL00000003CML1", + "createdOn" : "2022-02-08T14:48:54.709Z", "lastModifiedOn" : "2022-02-03T14:48:54.709Z" } - ], - "businessPartner" : "BPNL00000003CNKC", - "catenaXId" : "urn:uuid:bee5614f-9e46-4c98-9209-61a6f2b2a7fc" + ] } }, { "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", "payload" : { - "catenaXId" : "urn:uuid:bee5614f-9e46-4c98-9209-61a6f2b2a7fc", + "catenaXId" : "urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef128c", "sites" : [ { - "functionValidUntil" : "2031-04-16T11:07:09.000Z", - "catenaXSiteId" : "BPNS00000003B3NX", + "functionValidUntil" : "2027-05-23T09:16:30.000Z", + "catenaXSiteId" : "BPNS000004711DMY", "function" : "production", - "functionValidFrom" : "2013-12-07T09:33:50.000Z" + "functionValidFrom" : "2013-11-17T23:59:54.000Z" } ] } @@ -862,121 +721,70 @@ }, { "assetMetaInfo" : { - "catenaXId" : "urn:uuid:4518c080-14fb-4252-b8de-4362d615868d" + "catenaXId" : "urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7" }, "submodels" : [ { "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", "payload" : { "validityPeriod" : { - "validFrom" : "2015-01-23T16:24:59.000Z", - "validTo" : "2031-05-04T12:01:38.000Z" + "validFrom" : "2017-07-03T05:23:01.000Z", + "validTo" : "2032-09-25T10:26:27.000Z" }, - "catenaXId" : "urn:uuid:4518c080-14fb-4252-b8de-4362d615868d", + "catenaXId" : "urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7", "partTypeInformation" : { - "manufacturerPartId" : "7A987KK-04", + "manufacturerPartId" : "32494586-73", "classification" : "product", - "nameAtManufacturer" : "a/dev N Tier A Plastics" + "nameAtManufacturer" : "b/test Tier A Gearbox" } } }, { "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned", "payload" : { - "catenaXId" : "urn:uuid:4518c080-14fb-4252-b8de-4362d615868d", - "childItems" : [] - } - }, - { - "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_planned:1.1.0#SingleLevelUsageAsPlanned", - "payload" : { - "parentParts" : [ + "catenaXId" : "urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7", + "childItems" : [ { "validityPeriod" : { - "validFrom" : "2023-03-21T08:47:14.438+01:00", - "validTo" : "2024-08-02T09:00:00.000+01:00" + "validFrom" : "2023-03-21T08:17:29.187+01:00", + "validTo" : "2024-07-01T16:10:00.000+01:00" }, - "parentCatenaXId" : "urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7", + "catenaXId" : "urn:uuid:bee5614f-9e46-4c98-9209-61a6f2b2a7fc", "quantity" : { - "quantityNumber" : 2.5, + "quantityNumber" : 1, "measurementUnit" : "unit:litre" }, - "createdOn" : "2022-02-12T14:48:54.709Z", + "businessPartner" : "BPNL00000003CML1", + "createdOn" : "2022-02-09T14:48:54.709Z", "lastModifiedOn" : "2022-02-03T14:48:54.709Z" - } - ], - "businessPartner" : "BPNL00000003CNKC", - "catenaXId" : "urn:uuid:4518c080-14fb-4252-b8de-4362d615868d" - } - }, - { - "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", - "payload" : { - "catenaXId" : "urn:uuid:4518c080-14fb-4252-b8de-4362d615868d", - "sites" : [ - { - "functionValidUntil" : "2030-01-29T19:43:54.000Z", - "catenaXSiteId" : "BPNS00000003B0Q0", - "function" : "production", - "functionValidFrom" : "2015-11-17T18:35:23.000Z" - } - ] - } - } - ] - }, - { - "assetMetaInfo" : { - "catenaXId" : "urn:uuid:3cdd2826-5df0-4c7b-b540-9eeccecb2301" - }, - "submodels" : [ - { - "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", - "payload" : { - "validityPeriod" : { - "validFrom" : "2019-08-17T14:14:30.000Z", - "validTo" : "2032-08-30T04:32:28.000Z" - }, - "catenaXId" : "urn:uuid:3cdd2826-5df0-4c7b-b540-9eeccecb2301", - "partTypeInformation" : { - "manufacturerPartId" : "6775244-06", - "classification" : "product", - "nameAtManufacturer" : "a/dev Sub Tier B Glue" - } - } - }, - { - "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_planned:1.1.0#SingleLevelUsageAsPlanned", - "payload" : { - "parentParts" : [ + }, { "validityPeriod" : { - "validFrom" : "2023-03-21T08:47:14.438+01:00", - "validTo" : "2024-08-02T09:00:00.000+01:00" + "validFrom" : "2023-03-21T08:17:29.187+01:00", + "validTo" : "2024-07-01T16:10:00.000+01:00" }, - "parentCatenaXId" : "urn:uuid:07cb071f-8716-45fe-89f1-f2f77a1ce93b", + "catenaXId" : "urn:uuid:4518c080-14fb-4252-b8de-4362d615868d", "quantity" : { - "quantityNumber" : 2.5, + "quantityNumber" : 1, "measurementUnit" : "unit:litre" }, - "createdOn" : "2022-02-15T14:48:54.709Z", + "businessPartner" : "BPNL00000003CML1", + "createdOn" : "2022-02-10T14:48:54.709Z", "lastModifiedOn" : "2022-02-03T14:48:54.709Z" } - ], - "businessPartner" : "BPNL00000003CML1", - "catenaXId" : "urn:uuid:3cdd2826-5df0-4c7b-b540-9eeccecb2301" + ] } }, { "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", "payload" : { - "catenaXId" : "urn:uuid:3cdd2826-5df0-4c7b-b540-9eeccecb2301", + "catenaXId" : "urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7", "sites" : [ { - "functionValidUntil" : "2032-01-21T11:22:57.000Z", - "catenaXSiteId" : "BPNS00000003AXS3", + "functionValidUntil" : "2031-10-27T21:24:04.000Z", + "catenaXSiteId" : "BPNS00000003B2OM", "function" : "production", - "functionValidFrom" : "2017-05-27T13:54:13.000Z" + "functionValidFrom" : "2016-01-29T21:44:37.000Z" } ] } @@ -985,41 +793,41 @@ }, { "assetMetaInfo" : { - "catenaXId" : "urn:uuid:68904173-ad59-4a77-8412-3e73fcafbd8b" + "catenaXId" : "urn:uuid:07cb071f-8716-45fe-89f1-f2f77a1ce93b" }, "submodels" : [ { "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", "payload" : { "validityPeriod" : { - "validFrom" : "2016-04-09T20:41:14.000Z", - "validTo" : "2023-12-09T04:46:33.000Z" + "validFrom" : "2016-04-24T08:26:56.000Z", + "validTo" : "2031-12-17T23:55:04.000Z" }, - "catenaXId" : "urn:uuid:68904173-ad59-4a77-8412-3e73fcafbd8b", + "catenaXId" : "urn:uuid:07cb071f-8716-45fe-89f1-f2f77a1ce93b", "partTypeInformation" : { - "manufacturerPartId" : "6004474-20", + "manufacturerPartId" : "8583898-48", "classification" : "product", - "nameAtManufacturer" : "a/dev Vehicle Model B" + "nameAtManufacturer" : "b/test Tier B ECU1" } } }, { "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned", "payload" : { - "catenaXId" : "urn:uuid:68904173-ad59-4a77-8412-3e73fcafbd8b", + "catenaXId" : "urn:uuid:07cb071f-8716-45fe-89f1-f2f77a1ce93b", "childItems" : [ { "validityPeriod" : { "validFrom" : "2023-03-21T08:17:29.187+01:00", "validTo" : "2024-07-01T16:10:00.000+01:00" }, - "catenaXId" : "urn:uuid:07cb071f-8716-45fe-89f1-f2f77a1ce93b", + "catenaXId" : "urn:uuid:3cdd2826-5df0-4c7b-b540-9eeccecb2301", "quantity" : { - "quantityNumber" : 1, - "measurementUnit" : "unit:litre" + "quantityNumber" : 0.3301, + "measurementUnit" : "unit:kilogram" }, - "businessPartner" : "BPNL00000003CNKC", - "createdOn" : "2022-02-16T14:48:54.709Z", + "businessPartner" : "BPNL00000003CML1", + "createdOn" : "2022-02-13T14:48:54.709Z", "lastModifiedOn" : "2022-02-03T14:48:54.709Z" } ] @@ -1028,13 +836,13 @@ { "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", "payload" : { - "catenaXId" : "urn:uuid:68904173-ad59-4a77-8412-3e73fcafbd8b", + "catenaXId" : "urn:uuid:07cb071f-8716-45fe-89f1-f2f77a1ce93b", "sites" : [ { - "functionValidUntil" : "2030-05-16T19:21:46.000Z", - "catenaXSiteId" : "BPNS000000815DMY", + "functionValidUntil" : "2028-09-29T13:56:09.000Z", + "catenaXSiteId" : "BPNS00000003B5MJ", "function" : "production", - "functionValidFrom" : "2019-10-17T03:16:09.000Z" + "functionValidFrom" : "2017-01-30T12:55:30.000Z" } ] } @@ -1043,82 +851,43 @@ }, { "assetMetaInfo" : { - "catenaXId" : "urn:uuid:44347dec-21d1-47aa-b2a7-f959bf9d424b" + "catenaXId" : "urn:uuid:e8c48a8e-d2d7-43d9-a867-65c70c85f5b8" }, "submodels" : [ { - "aspectType" : "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", + "aspectType" : "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned", "payload" : { - "localIdentifiers" : [ - { - "value" : "BPNL00000003CML1", - "key" : "manufacturerId" - }, - { - "value" : "8840837-48", - "key" : "manufacturerPartId" - }, - { - "value" : "NO-282209222605524629600815", - "key" : "partInstanceId" - } - ], - "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", - "country" : "DEU" + "validityPeriod" : { + "validFrom" : "2019-11-02T11:14:15.000Z", + "validTo" : "2024-07-17T02:07:07.000Z" }, - "catenaXId" : "urn:uuid:44347dec-21d1-47aa-b2a7-f959bf9d424b", + "catenaXId" : "urn:uuid:e8c48a8e-d2d7-43d9-a867-65c70c85f5b8", "partTypeInformation" : { - "manufacturerPartId" : "8840837-48", - "customerPartId" : "9560617-12", - "classification" : "component", - "nameAtManufacturer" : "a/dev HV MODUL", - "nameAtCustomer" : "HV MODUL" + "manufacturerPartId" : "1987361-42", + "classification" : "product", + "nameAtManufacturer" : "b/test Tire Model A" } } }, { - "aspectType" : "urn:bamm:io.catenax.traction_battery_code:1.0.0#TractionBatteryCode", + "aspectType" : "urn:bamm:io.catenax.part_site_information_as_planned:1.0.0#PartSiteInformationAsPlanned", "payload" : { - "tractionBatteryCode" : "X12MCPM27KLPCLX2M2382320", - "subcomponents" : [ - { - "tractionBatteryCode" : "X12MCPM27KLPCLX2M2382320", - "productType" : "module" - }, - { - "tractionBatteryCode" : "X12MCPM27KLPCLX2M2382321", - "productType" : "module" - }, - { - "tractionBatteryCode" : "X12MCPM27KLPCLX2M2382322", - "productType" : "module" - }, - { - "tractionBatteryCode" : "X12MCPM27KLPCLX2M2382323", - "productType" : "module" - }, - { - "tractionBatteryCode" : "X12MCPM27KLPCLX2M2382324", - "productType" : "module" - }, - { - "tractionBatteryCode" : "X12MCPM27KLPCLX2M2382325", - "productType" : "module" - }, + "catenaXId" : "urn:uuid:e8c48a8e-d2d7-43d9-a867-65c70c85f5b8", + "sites" : [ { - "tractionBatteryCode" : "X12MCPM27KLPCLX2M2382326", - "productType" : "module" + "functionValidUntil" : "2028-02-14T21:42:45.000Z", + "catenaXSiteId" : "BPNS00000003B2OM", + "function" : "production", + "functionValidFrom" : "2015-07-21T06:33:16.000Z" } - ], - "productType" : "module" + ] } } ] }, { "assetMetaInfo" : { - "catenaXId" : "urn:uuid:1233b405-5ac8-4867-93f8-6fdf37733737" + "catenaXId" : "urn:uuid:b0acf3e1-3fbe-46c0-aa0b-0724caae7772" }, "submodels" : [ { @@ -1130,24 +899,24 @@ "key" : "manufacturerId" }, { - "value" : "4683655-00", + "value" : "8840374-09", "key" : "manufacturerPartId" }, { - "value" : "NO-135342108157438763234738", + "value" : "NO-917923082133064161014067", "key" : "partInstanceId" } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, - "catenaXId" : "urn:uuid:1233b405-5ac8-4867-93f8-6fdf37733737", + "catenaXId" : "urn:uuid:b0acf3e1-3fbe-46c0-aa0b-0724caae7772", "partTypeInformation" : { - "manufacturerPartId" : "4683655-00", - "customerPartId" : "4683655-00", + "manufacturerPartId" : "8840374-09", + "customerPartId" : "8840374-09", "classification" : "component", - "nameAtManufacturer" : "a/dev ZB ZELLE", + "nameAtManufacturer" : "b/test ZB ZELLE", "nameAtCustomer" : "ZB ZELLE" } } @@ -1169,7 +938,7 @@ }, { "assetMetaInfo" : { - "catenaXId" : "urn:uuid:bcfae197-40fa-4be0-821d-5c1873a1b7c2" + "catenaXId" : "urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d" }, "submodels" : [ { @@ -1181,24 +950,24 @@ "key" : "manufacturerId" }, { - "value" : "1261027-41", + "value" : "1142469-27", "key" : "manufacturerPartId" }, { - "value" : "NO-200738629800530338038454", + "value" : "NO-655858074471261486971940", "key" : "partInstanceId" } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, - "catenaXId" : "urn:uuid:bcfae197-40fa-4be0-821d-5c1873a1b7c2", + "catenaXId" : "urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d", "partTypeInformation" : { - "manufacturerPartId" : "1261027-41", - "customerPartId" : "1261027-41", + "manufacturerPartId" : "1142469-27", + "customerPartId" : "1142469-27", "classification" : "component", - "nameAtManufacturer" : "a/dev Door Key", + "nameAtManufacturer" : "b/test Door Key", "nameAtCustomer" : "Door Key" } } @@ -1208,20 +977,20 @@ "payload" : { "localIdentifiers" : [ { - "value" : "85851549CBX", + "value" : "92879626SFC", "key" : "jisNumber" } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "HUN" }, - "catenaXId" : "urn:uuid:bcfae197-40fa-4be0-821d-5c1873a1b7c2", + "catenaXId" : "urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d", "partTypeInformation" : { - "manufacturerPartId" : "5464168-83", + "manufacturerPartId" : "1417058-05", "customerPartId" : "PRT-12345", "classification" : "product", - "nameAtManufacturer" : "a/dev Door Key", + "nameAtManufacturer" : "b/test Door Key", "nameAtCustomer" : "Door Key" } } @@ -1230,7 +999,7 @@ }, { "assetMetaInfo" : { - "catenaXId" : "urn:uuid:254604ab-2153-45fb-8cad-54ef09f4070e" + "catenaXId" : "urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f" }, "submodels" : [ { @@ -1251,10 +1020,10 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, - "catenaXId" : "urn:uuid:254604ab-2153-45fb-8cad-54ef09f4070e", + "catenaXId" : "urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f", "partTypeInformation" : { "manufacturerPartId" : "8840838-04", "customerPartId" : "8840838-04", @@ -1267,10 +1036,10 @@ { "aspectType" : "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt", "payload" : { - "catenaXId" : "urn:uuid:254604ab-2153-45fb-8cad-54ef09f4070e", + "catenaXId" : "urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f", "childItems" : [ { - "catenaXId" : "urn:uuid:e3b2f5e2-5be5-4ea6-98f0-6876de0fca4f", + "catenaXId" : "urn:uuid:e3b2f5e2-5be5-4ea6-98f0-6876de0fcb5f", "quantity" : { "quantityNumber" : 2.5, "measurementUnit" : "unit:litre" @@ -1286,7 +1055,7 @@ { "aspectType" : "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt", "payload" : { - "catenaXId" : "urn:uuid:254604ab-2153-45fb-8cad-54ef09f4070e", + "catenaXId" : "urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f", "customers" : [ { "businessPartner" : "BPNL00000003CML1", @@ -1298,38 +1067,6 @@ } } ] - }, - { - "assetMetaInfo" : { - "catenaXId" : "urn:uuid:e3b2f5e2-5be5-4ea6-98f0-6876de0fca4f" - }, - "submodels" : [ - { - "aspectType" : "urn:samm:io.catenax.batch:2.0.0#Batch", - "payload" : { - "localIdentifiers" : [ - { - "value" : "BPNL00000003CML1", - "key" : "manufacturerId" - }, - { - "value" : "BID12345678", - "key" : "batchId" - } - ], - "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", - "country" : "HUN" - }, - "catenaXId" : "urn:uuid:e3b2f5e2-5be5-4ea6-98f0-6876de0fca4f", - "partTypeInformation" : { - "manufacturerPartId" : "123-0.740-3434-A", - "classification" : "product", - "nameAtManufacturer" : "Sealant" - } - } - } - ] } ] } diff --git a/tx-backend/src/test/resources/testdata/importfiles/validImportFile.json b/tx-backend/src/test/resources/testdata/importfiles/validImportFile.json index be3abf619a..9bcce83e57 100644 --- a/tx-backend/src/test/resources/testdata/importfiles/validImportFile.json +++ b/tx-backend/src/test/resources/testdata/importfiles/validImportFile.json @@ -23,7 +23,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd", @@ -104,7 +104,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a", @@ -185,7 +185,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd", @@ -266,7 +266,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d", @@ -347,7 +347,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb01", @@ -407,7 +407,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb02", @@ -462,7 +462,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb03", @@ -552,7 +552,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "HUN" }, "catenaXId" : "urn:uuid:580d3adf-1981-44a0-a214-13d6ceed6841", @@ -908,7 +908,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:b0acf3e1-3fbe-46c0-aa0b-0724caae7772", @@ -959,7 +959,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d", @@ -982,7 +982,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "HUN" }, "catenaXId" : "urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d", @@ -1020,7 +1020,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f", diff --git a/tx-backend/src/test/resources/testdata/importfiles/validImportFileButWrongBPN.json b/tx-backend/src/test/resources/testdata/importfiles/validImportFileButWrongBPN.json index 554a6b21d7..a0c27c7058 100644 --- a/tx-backend/src/test/resources/testdata/importfiles/validImportFileButWrongBPN.json +++ b/tx-backend/src/test/resources/testdata/importfiles/validImportFileButWrongBPN.json @@ -23,7 +23,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd", @@ -104,7 +104,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a", @@ -185,7 +185,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd", @@ -266,7 +266,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d", @@ -347,7 +347,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb01", @@ -407,7 +407,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb02", @@ -462,7 +462,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb03", @@ -552,7 +552,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "HUN" }, "catenaXId" : "urn:uuid:580d3adf-1981-44a0-a214-13d6ceed6841", @@ -908,7 +908,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:b0acf3e1-3fbe-46c0-aa0b-0724caae7772", @@ -959,7 +959,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d", @@ -982,7 +982,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "HUN" }, "catenaXId" : "urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d", @@ -1020,7 +1020,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2018-09-28T04:15:57.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f", From 98a0b9aa16f56cfba450f867c23c7f0b983dfa42 Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Wed, 10 Jan 2024 15:11:04 +0100 Subject: [PATCH 31/49] feat(mapping): TRACEFOSS-2741 fixed bad structure import validation. Added bpn validation for assets to be imported matching app bpn. --- .../model/MainAspectAsPlannedRequest.java | 3 ++- .../service/MainAspectAsPlannedStrategy.java | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/MainAspectAsPlannedRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/MainAspectAsPlannedRequest.java index a14743e4d0..cf4c6a776b 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/MainAspectAsPlannedRequest.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/MainAspectAsPlannedRequest.java @@ -1,12 +1,13 @@ package org.eclipse.tractusx.traceability.assets.domain.importpoc.model; import java.time.LocalDateTime; +import java.time.OffsetDateTime; public record MainAspectAsPlannedRequest(String catenaXId, ValidityPeriod validityPeriod, PartTypeInformation partTypeInformation ) { - public record ValidityPeriod(LocalDateTime validFrom, LocalDateTime validTo) { + public record ValidityPeriod(OffsetDateTime validFrom, OffsetDateTime validTo) { } public record PartTypeInformation(String manufacturerPartId, String classification, String nameAtManufacturer) { diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsPlannedStrategy.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsPlannedStrategy.java index f17770c569..18edf2410e 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsPlannedStrategy.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsPlannedStrategy.java @@ -18,6 +18,7 @@ ********************************************************************************/ package org.eclipse.tractusx.traceability.assets.domain.importpoc.service; +import org.eclipse.tractusx.traceability.assets.domain.asplanned.model.aspect.DetailAspectDataAsPlanned; import org.eclipse.tractusx.traceability.assets.domain.asplanned.model.aspect.DetailAspectDataPartSiteInformationAsPlanned; import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; import org.eclipse.tractusx.traceability.assets.domain.base.model.Descriptions; @@ -33,6 +34,7 @@ import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelBomAsPlannedRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelUsageAsPlannedRequest; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; + import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties; import java.time.OffsetDateTime; @@ -40,6 +42,7 @@ import java.util.List; import static org.apache.commons.collections4.ListUtils.emptyIfNull; +import static org.eclipse.tractusx.traceability.assets.domain.base.model.aspect.DetailAspectModel.extractDetailAspectModelsAsPlanned; import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isAsPlannedMainAspect; import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isDownwardRelationshipAsPlanned; import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isPartSiteInformationAsPlanned; @@ -90,6 +93,9 @@ public AssetBase mapToAssetBase(ImportRequest.AssetImportRequest assetImportRequ detailAspectModels.addAll(extractDetailAspectModelsPartSiteInformationAsPlanned(emptyIfNull(partSiteInformationAsPlannedRequest.sites()))); } + DetailAspectModel asPlannedDetailAspect = extractDetailAspectModelsAsPlanned(partAsPlannedV2.validityPeriod()); + detailAspectModels.add(asPlannedDetailAspect); + AssetBase.AssetBaseBuilder assetBaseBuilder = AssetBase.builder(); if (partAsPlannedV2 != null) { @@ -130,5 +136,13 @@ public static List extractDetailAspectModelsPartSiteInformati return detailAspectModels; } + public static DetailAspectModel extractDetailAspectModelsAsPlanned(MainAspectAsPlannedRequest.ValidityPeriod validityPeriod) { + DetailAspectDataAsPlanned detailAspectDataAsPlanned = DetailAspectDataAsPlanned.builder() + .validityPeriodFrom(validityPeriod.validFrom()) + .validityPeriodTo(validityPeriod.validTo()) + .build(); + return DetailAspectModel.builder().data(detailAspectDataAsPlanned).type(DetailAspectType.AS_PLANNED).build(); + } + } From 7b1fbd1ed2173ddf312a8a846b722f29b452e0ae Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Wed, 10 Jan 2024 15:16:52 +0100 Subject: [PATCH 32/49] chore(tx-backend): TRACEFOSS-2741 raw data of submodel persisted to database --- .../model/MainAspectAsPlannedRequest.java | 6 +- .../SingleLevelUsageAsPlannedRequest.java | 5 +- .../repository/SubmodelPayloadRepository.java | 30 ++++++++++ .../importpoc/service/ImportServiceImpl.java | 25 +++++++++ .../asbuilt/model/AssetAsBuiltEntity.java | 6 ++ .../asplanned/model/AssetAsPlannedEntity.java | 6 ++ .../irs/model/response/GenericSubmodel.java | 22 +++++++- .../model/SubmodelPayloadEntity.java | 48 ++++++++++------ .../JpaSubmodelPayloadRepository.java | 27 +++++++++ .../SubmodelPayloadRepositoryImpl.java | 55 +++++++++++++++++++ .../migration/V8__change_submodelPayload.sql | 21 +++++++ .../service/ImportServiceImplTest.java | 11 ++-- .../common/support/DatabaseSupport.java | 1 + .../importdata/ImportControllerIT.java | 10 ++++ 14 files changed, 243 insertions(+), 30 deletions(-) create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/repository/SubmodelPayloadRepository.java create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/infrastructure/reposotory/JpaSubmodelPayloadRepository.java create mode 100644 tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/infrastructure/reposotory/SubmodelPayloadRepositoryImpl.java create mode 100644 tx-backend/src/main/resources/db/migration/V8__change_submodelPayload.sql diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/MainAspectAsPlannedRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/MainAspectAsPlannedRequest.java index a14743e4d0..03dd60b447 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/MainAspectAsPlannedRequest.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/MainAspectAsPlannedRequest.java @@ -1,12 +1,12 @@ package org.eclipse.tractusx.traceability.assets.domain.importpoc.model; -import java.time.LocalDateTime; - public record MainAspectAsPlannedRequest(String catenaXId, ValidityPeriod validityPeriod, PartTypeInformation partTypeInformation ) { - public record ValidityPeriod(LocalDateTime validFrom, LocalDateTime validTo) { + public record ValidityPeriod( + String validFrom, + String validTo) { } public record PartTypeInformation(String manufacturerPartId, String classification, String nameAtManufacturer) { diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/SingleLevelUsageAsPlannedRequest.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/SingleLevelUsageAsPlannedRequest.java index 44bd07ffb7..458dfe9c87 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/SingleLevelUsageAsPlannedRequest.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/model/SingleLevelUsageAsPlannedRequest.java @@ -18,7 +18,6 @@ ********************************************************************************/ package org.eclipse.tractusx.traceability.assets.domain.importpoc.model; -import java.time.OffsetDateTime; import java.util.List; public record SingleLevelUsageAsPlannedRequest( @@ -37,8 +36,8 @@ public record ParentPart( } public record ValidityPeriod( - OffsetDateTime validFrom, - OffsetDateTime validTo + String validFrom, + String validTo ) { } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/repository/SubmodelPayloadRepository.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/repository/SubmodelPayloadRepository.java new file mode 100644 index 0000000000..521f81660c --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/repository/SubmodelPayloadRepository.java @@ -0,0 +1,30 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +package org.eclipse.tractusx.traceability.assets.domain.importpoc.repository; + +import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; + +import java.util.List; + +public interface SubmodelPayloadRepository { + void savePayloadForAssetAsBuilt(String assetId, List submodels); + + void savePayloadForAssetAsPlanned(String assetId, List submodels); +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java index 515b74346d..d227e9ff4a 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java @@ -28,6 +28,7 @@ import org.eclipse.tractusx.traceability.assets.domain.base.model.AssetBase; import org.eclipse.tractusx.traceability.assets.domain.importpoc.exception.ImportException; import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.ImportRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.repository.SubmodelPayloadRepository; import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; @@ -49,11 +50,14 @@ public class ImportServiceImpl implements ImportService { private final AssetAsBuiltRepository assetAsBuiltRepository; private final TraceabilityProperties traceabilityProperties; private final MappingStrategyFactory strategyFactory; + private final SubmodelPayloadRepository submodelPayloadRepository; @Override public Map importAssets(MultipartFile file) { try { ImportRequest importRequest = objectMapper.readValue(file.getBytes(), ImportRequest.class); + + Map> assetToUploadByBomLifecycle = importRequest.assets() .stream() @@ -68,12 +72,33 @@ public Map importAssets(MultipartFile file) { List expectedAssetsToBePersisted = assetToUploadByBomLifecycle.values().stream().flatMap(Collection::stream).toList(); List persistedAssets = Stream.concat(persistedAsBuilt.stream(), persistedAsPlanned.stream()).toList(); + saveRawDataForPersistedAssets(persistedAssets, importRequest); + return compareForUploadResult(expectedAssetsToBePersisted, persistedAssets); } catch (Exception e) { throw new ImportException(e.getMessage()); } } + private void saveRawDataForPersistedAssets(List persistedAssets, ImportRequest importRequest) { + List persistedAssetsIds = persistedAssets.stream().map(AssetBase::getId).toList(); + importRequest.assets().stream().filter(asset -> persistedAssetsIds.contains(asset.assetMetaInfoRequest().catenaXId())) + .map(assetImportRequest -> Map.entry( + getAssetById(assetImportRequest.assetMetaInfoRequest().catenaXId(), persistedAssets), + assetImportRequest.submodels())) + .forEach(entry -> { + if (entry.getKey().getBomLifecycle() == BomLifecycle.AS_BUILT) { + submodelPayloadRepository.savePayloadForAssetAsBuilt(entry.getKey().getId(), entry.getValue()); + } else if (entry.getKey().getBomLifecycle() == BomLifecycle.AS_PLANNED) { + submodelPayloadRepository.savePayloadForAssetAsPlanned(entry.getKey().getId(), entry.getValue()); + } + }); + } + + private AssetBase getAssetById(String assetId, List assets) { + return assets.stream().filter(asset -> asset.getId().equals(assetId)).findFirst().orElseThrow(() -> new ImportException("Failed when trying to persist raw payload to persisted Assets")); + } + public static Map compareForUploadResult(List incoming, List persisted) { return incoming.stream().map(asset -> { Optional persistedAssetOptional = persisted.stream().filter(persistedAsset -> persistedAsset.getId().equals(asset.getId())).findFirst(); diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/model/AssetAsBuiltEntity.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/model/AssetAsBuiltEntity.java index ab5c5beab5..752ef3c18f 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/model/AssetAsBuiltEntity.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/model/AssetAsBuiltEntity.java @@ -25,8 +25,10 @@ import jakarta.persistence.ElementCollection; import jakarta.persistence.Embeddable; import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; import jakarta.persistence.JoinColumn; import jakarta.persistence.ManyToMany; +import jakarta.persistence.OneToMany; import jakarta.persistence.Table; import lombok.AllArgsConstructor; import lombok.Builder; @@ -43,6 +45,7 @@ import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.alert.model.AlertEntity; import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.investigation.model.InvestigationEntity; import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.model.NotificationSideBaseEntity; +import org.eclipse.tractusx.traceability.submodel.infrastructure.model.SubmodelPayloadEntity; import java.time.Instant; import java.util.ArrayList; @@ -85,6 +88,9 @@ public class AssetAsBuiltEntity extends AssetBaseEntity { @ManyToMany(mappedBy = "assets") private List alerts = new ArrayList<>(); + @OneToMany(mappedBy = "assetAsBuilt", fetch = FetchType.EAGER) + private List submodels; + public static AssetAsBuiltEntity from(AssetBase asset) { ManufacturingInfo manufacturingInfo = ManufacturingInfo.from(asset.getDetailAspectModels()); TractionBatteryCode tractionBatteryCodeObj = TractionBatteryCode.from(asset.getDetailAspectModels()); diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/model/AssetAsPlannedEntity.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/model/AssetAsPlannedEntity.java index 07333cafc6..79b8f8be06 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/model/AssetAsPlannedEntity.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/model/AssetAsPlannedEntity.java @@ -22,8 +22,10 @@ import jakarta.persistence.ElementCollection; import jakarta.persistence.Embeddable; import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; import jakarta.persistence.JoinColumn; import jakarta.persistence.ManyToMany; +import jakarta.persistence.OneToMany; import jakarta.persistence.Table; import lombok.AllArgsConstructor; import lombok.Builder; @@ -39,6 +41,7 @@ import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.alert.model.AlertEntity; import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.investigation.model.InvestigationEntity; import org.eclipse.tractusx.traceability.qualitynotification.infrastructure.model.NotificationSideBaseEntity; +import org.eclipse.tractusx.traceability.submodel.infrastructure.model.SubmodelPayloadEntity; import java.time.Instant; import java.util.ArrayList; @@ -72,6 +75,9 @@ public class AssetAsPlannedEntity extends AssetBaseEntity { @ManyToMany(mappedBy = "assetsAsPlanned") private List alerts = new ArrayList<>(); + @OneToMany(mappedBy = "assetAsPlanned", fetch = FetchType.EAGER) + private List submodels; + @Builder @NoArgsConstructor @AllArgsConstructor diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java index 03a3728489..b1a84c17a9 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/base/irs/model/response/GenericSubmodel.java @@ -24,15 +24,18 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonSubTypes.Type; import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import lombok.extern.slf4j.Slf4j; import org.eclipse.tractusx.traceability.assets.domain.asbuilt.model.aspect.DetailAspectDataTractionBatteryCode; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.MainAspectAsBuiltRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.MainAspectAsPlannedRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.PartSiteInformationAsPlannedRequest; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelUsageAsBuiltRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelBomAsBuiltRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelBomAsPlannedRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelUsageAsBuiltRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelUsageAsPlannedRequest; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.MainAspectAsBuiltRequest; -import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.MainAspectAsPlannedRequest; @Slf4j @@ -81,6 +84,8 @@ public class GenericSubmodel { }) private Object payload; + private String payloadRaw; + @JsonProperty("aspectType") private String aspectType; @@ -88,6 +93,13 @@ public class GenericSubmodel { public GenericSubmodel(@JsonProperty("aspectType") String aspectType, @JsonProperty("payload") Object payload) { this.aspectType = aspectType; this.payload = payload; + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.registerModule(new JavaTimeModule()); + try { + this.payloadRaw = objectMapper.writeValueAsString(payload); + } catch (JsonProcessingException exception) { + this.payloadRaw = exception.getMessage(); + } } public Object getPayload() { @@ -98,6 +110,10 @@ public String getAspectType() { return aspectType; } + public String getPayloadRaw() { + return payloadRaw; + } + } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/infrastructure/model/SubmodelPayloadEntity.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/infrastructure/model/SubmodelPayloadEntity.java index b83f119370..3c6a73d0c0 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/infrastructure/model/SubmodelPayloadEntity.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/infrastructure/model/SubmodelPayloadEntity.java @@ -20,10 +20,12 @@ import jakarta.persistence.CascadeType; import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; import jakarta.persistence.Id; import jakarta.persistence.JoinColumn; -import jakarta.persistence.JoinTable; -import jakarta.persistence.ManyToMany; +import jakarta.persistence.ManyToOne; import jakarta.persistence.Table; import lombok.AllArgsConstructor; import lombok.Builder; @@ -31,6 +33,7 @@ import lombok.NoArgsConstructor; import org.eclipse.tractusx.traceability.assets.infrastructure.asbuilt.model.AssetAsBuiltEntity; import org.eclipse.tractusx.traceability.assets.infrastructure.asplanned.model.AssetAsPlannedEntity; +import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; import java.util.List; @@ -42,24 +45,37 @@ @Builder public class SubmodelPayloadEntity { @Id + @GeneratedValue(strategy = GenerationType.UUID) private String id; + private String aspectType; + private String json; - @ManyToMany(cascade = CascadeType.ALL) - @JoinTable( - name = "assets_as_built_submodel_payload", - joinColumns = @JoinColumn(name = "submodel_payload_id"), - inverseJoinColumns = @JoinColumn(name = "asset_id") - ) - public List assets; + @ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL) + @JoinColumn(name = "asset_as_built_id") + public AssetAsBuiltEntity assetAsBuilt; + + @ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL) + @JoinColumn(name = "asset_as_planned_id") + private AssetAsPlannedEntity assetAsPlanned; + + public static List from(AssetAsBuiltEntity asset, List submodels) { + return submodels.stream().map(submodel -> SubmodelPayloadEntity.builder() + .aspectType(submodel.getAspectType()) + .json(submodel.getPayloadRaw()) + .assetAsBuilt(asset) + .build()) + .toList(); + } - @ManyToMany(cascade = CascadeType.ALL) - @JoinTable( - name = "assets_as_planned_submodel_payload", - joinColumns = @JoinColumn(name = "submodel_payload_id"), - inverseJoinColumns = @JoinColumn(name = "asset_id") - ) - private List assetsAsPlanned; + public static List from(AssetAsPlannedEntity asset, List submodels) { + return submodels.stream().map(submodel -> SubmodelPayloadEntity.builder() + .aspectType(submodel.getAspectType()) + .json(submodel.getPayloadRaw()) + .assetAsPlanned(asset) + .build()) + .toList(); + } } diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/infrastructure/reposotory/JpaSubmodelPayloadRepository.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/infrastructure/reposotory/JpaSubmodelPayloadRepository.java new file mode 100644 index 0000000000..49eab371bc --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/infrastructure/reposotory/JpaSubmodelPayloadRepository.java @@ -0,0 +1,27 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +package org.eclipse.tractusx.traceability.submodel.infrastructure.reposotory; + +import org.eclipse.tractusx.traceability.submodel.infrastructure.model.SubmodelPayloadEntity; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface JpaSubmodelPayloadRepository extends JpaRepository { + +} diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/infrastructure/reposotory/SubmodelPayloadRepositoryImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/infrastructure/reposotory/SubmodelPayloadRepositoryImpl.java new file mode 100644 index 0000000000..ab1c7056a0 --- /dev/null +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/submodel/infrastructure/reposotory/SubmodelPayloadRepositoryImpl.java @@ -0,0 +1,55 @@ +/******************************************************************************** + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +package org.eclipse.tractusx.traceability.submodel.infrastructure.reposotory; + +import lombok.RequiredArgsConstructor; +import org.eclipse.tractusx.traceability.assets.domain.asbuilt.exception.AssetNotFoundException; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.repository.SubmodelPayloadRepository; +import org.eclipse.tractusx.traceability.assets.infrastructure.asbuilt.model.AssetAsBuiltEntity; +import org.eclipse.tractusx.traceability.assets.infrastructure.asbuilt.repository.JpaAssetAsBuiltRepository; +import org.eclipse.tractusx.traceability.assets.infrastructure.asplanned.model.AssetAsPlannedEntity; +import org.eclipse.tractusx.traceability.assets.infrastructure.asplanned.repository.JpaAssetAsPlannedRepository; +import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; +import org.eclipse.tractusx.traceability.submodel.infrastructure.model.SubmodelPayloadEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +@RequiredArgsConstructor +public class SubmodelPayloadRepositoryImpl implements SubmodelPayloadRepository { + private final JpaSubmodelPayloadRepository jpaSubmodelPayloadRepository; + private final JpaAssetAsBuiltRepository jpaAssetAsBuiltRepository; + private final JpaAssetAsPlannedRepository jpaAssetAsPlannedRepository; + + private static final String ASSET_NOT_FOUND_EXCEPTION_TEMPLATE = "Asset with id: '%s' not found while saving submodels"; + + @Override + public void savePayloadForAssetAsBuilt(String assetId, List submodels) { + AssetAsBuiltEntity asset = jpaAssetAsBuiltRepository.findById(assetId).orElseThrow(() -> new AssetNotFoundException(ASSET_NOT_FOUND_EXCEPTION_TEMPLATE.formatted(assetId))); + jpaSubmodelPayloadRepository.saveAll(SubmodelPayloadEntity.from(asset, submodels)); + } + + @Override + public void savePayloadForAssetAsPlanned(String assetId, List submodels) { + AssetAsPlannedEntity asset = jpaAssetAsPlannedRepository.findById(assetId).orElseThrow(() -> new AssetNotFoundException(ASSET_NOT_FOUND_EXCEPTION_TEMPLATE.formatted(assetId))); + jpaSubmodelPayloadRepository.saveAll(SubmodelPayloadEntity.from(asset, submodels)); + } +} diff --git a/tx-backend/src/main/resources/db/migration/V8__change_submodelPayload.sql b/tx-backend/src/main/resources/db/migration/V8__change_submodelPayload.sql new file mode 100644 index 0000000000..a5320fc8d5 --- /dev/null +++ b/tx-backend/src/main/resources/db/migration/V8__change_submodelPayload.sql @@ -0,0 +1,21 @@ +DROP TABLE public.assets_as_built_submodel_payload; +DROP TABLE public.assets_as_planned_submodel_payload; +Drop TABLE public.submodel_payload; + +-- public.submodel_payload definition + +-- Drop table + +-- Drop TABLE public.submodel_payload + +CREATE TABLE public.submodel_payload +( + id VARCHAR(255) NOT NULL, + json VARCHAR NULL, + aspect_type VARCHAR(255), + asset_as_built_id VARCHAR(255) NULL, + asset_as_planned_id VARCHAR(255) NULL, + CONSTRAINT submodel_payload_pkey PRIMARY KEY (id), + CONSTRAINT fk_asset_as_built FOREIGN KEY (asset_as_built_id) REFERENCES public.assets_as_built (id), + CONSTRAINT fk_asset_as_planned FOREIGN KEY (asset_as_planned_id) REFERENCES public.assets_as_planned (id) +); diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java index c077b3e9f1..6a9cfb7901 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImplTest.java @@ -22,8 +22,7 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import org.eclipse.tractusx.traceability.assets.domain.asbuilt.repository.AssetAsBuiltRepository; import org.eclipse.tractusx.traceability.assets.domain.asplanned.repository.AssetAsPlannedRepository; - - +import org.eclipse.tractusx.traceability.assets.domain.importpoc.repository.SubmodelPayloadRepository; import org.eclipse.tractusx.traceability.common.model.BPN; import org.eclipse.tractusx.traceability.common.properties.TraceabilityProperties; import org.junit.jupiter.api.BeforeEach; @@ -52,19 +51,22 @@ class ImportServiceImplTest { private AssetAsPlannedRepository assetAsPlannedRepository; @Mock private AssetAsBuiltRepository assetAsBuiltRepository; + @Mock + private SubmodelPayloadRepository submodelPayloadRepository; private MappingStrategyFactory strategyFactory; @Mock private TraceabilityProperties traceabilityProperties; @BeforeEach - public void testSetup(){ + public void testSetup() { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.registerModule(new JavaTimeModule()); - importService = new ImportServiceImpl(objectMapper, assetAsPlannedRepository, assetAsBuiltRepository, traceabilityProperties, new MappingStrategyFactory()); + importService = new ImportServiceImpl(objectMapper, assetAsPlannedRepository, assetAsBuiltRepository, traceabilityProperties, new MappingStrategyFactory(), submodelPayloadRepository); } + @Test void testImportRequestSuccessful() throws IOException { @@ -84,5 +86,4 @@ void testImportRequestSuccessful() throws IOException { } - } diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/DatabaseSupport.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/DatabaseSupport.java index 5a58641cd7..4d3d7e31cc 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/DatabaseSupport.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/common/support/DatabaseSupport.java @@ -28,6 +28,7 @@ @Component public class DatabaseSupport { private static final List TABLES = List.of(new String[]{ + "submodel_payload", "assets_as_built_childs", "assets_as_built_parents", "assets_as_built_notifications", diff --git a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/importdata/ImportControllerIT.java b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/importdata/ImportControllerIT.java index 1ef46837bb..0bdc83490d 100644 --- a/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/importdata/ImportControllerIT.java +++ b/tx-backend/src/test/java/org/eclipse/tractusx/traceability/integration/importdata/ImportControllerIT.java @@ -26,6 +26,8 @@ import org.eclipse.tractusx.traceability.assets.domain.base.model.ImportState; import org.eclipse.tractusx.traceability.assets.domain.base.model.Owner; import org.eclipse.tractusx.traceability.assets.domain.base.model.QualityType; +import org.eclipse.tractusx.traceability.assets.infrastructure.asbuilt.model.AssetAsBuiltEntity; +import org.eclipse.tractusx.traceability.assets.infrastructure.asbuilt.repository.JpaAssetAsBuiltRepository; import org.eclipse.tractusx.traceability.common.security.JwtRole; import org.eclipse.tractusx.traceability.integration.IntegrationTestSpecification; import org.hamcrest.Matchers; @@ -44,6 +46,9 @@ class ImportControllerIT extends IntegrationTestSpecification { @Autowired AssetAsBuiltRepository assetAsBuiltRepository; + @Autowired + JpaAssetAsBuiltRepository jpaAssetAsBuiltRepository; + @Test void givenValidFile_whenImportData_thenValidationShouldPass() throws JoseException { // given @@ -81,6 +86,9 @@ void givenValidFile_whenImportData_thenValidationShouldPass() throws JoseExcepti new ImportStateMessage("urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d", true), new ImportStateMessage("urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f", true) ); + + AssetAsBuiltEntity entity = jpaAssetAsBuiltRepository.findById("urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f").get(); + assertThat(entity.getSubmodels()).isNotEmpty(); } @Test @@ -134,6 +142,8 @@ void givenValidFile_whenImportDataButAssetExistInPersistentImportState_thenValid new ImportStateMessage("urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d", true), new ImportStateMessage("urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f", true) ); + + } @Test From 1212188fe237866e79f9c7aae3cdc2e1096db485 Mon Sep 17 00:00:00 2001 From: Martin Maul Date: Wed, 10 Jan 2024 15:20:50 +0100 Subject: [PATCH 33/49] chore(fileupload): TRACEFOSS-XXX- added import status / validation report --- .../modules/page/admin/core/admin.service.ts | 43 ++------ .../import-json/import-json.component.html | 101 +++++++++++++----- .../import-json/import-json.component.scss | 10 ++ .../import-json/import-json.component.ts | 43 ++++++-- 4 files changed, 122 insertions(+), 75 deletions(-) diff --git a/frontend/src/app/modules/page/admin/core/admin.service.ts b/frontend/src/app/modules/page/admin/core/admin.service.ts index 72e08b1298..f756fbc26d 100644 --- a/frontend/src/app/modules/page/admin/core/admin.service.ts +++ b/frontend/src/app/modules/page/admin/core/admin.service.ts @@ -19,44 +19,17 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -import { Injectable } from '@angular/core'; -import { ApiService } from '@core/api/api.service'; -import { environment } from '@env'; -import { AdminAssembler } from '@page/admin/core/admin.assembler'; -import { BpnConfig, BpnConfigResponse } from '@page/admin/core/admin.model'; -import { Observable, of } from 'rxjs'; -import { map } from 'rxjs/operators'; +import {Injectable} from '@angular/core'; +import {ApiService} from '@core/api/api.service'; +import {environment} from '@env'; +import {AdminAssembler} from '@page/admin/core/admin.assembler'; +import {BpnConfig, BpnConfigResponse} from '@page/admin/core/admin.model'; +import {Observable} from 'rxjs'; +import {map} from 'rxjs/operators'; @Injectable() export class AdminService { private readonly url = environment.apiUrl; - private readonly STATIC_IMPORT_RESPONSE_SUCCESS = [ - { - "catenaXId": "123", - "importState": "TRANSIENT", - "importSuccessful": true - }, - { - "catenaXId": "2345", - "importState": "PERSISTENT", - "importSuccessful": false - }, - { - "catenaXId": "333", - "importState": "PERSISTENT", - "importSuccessful": true - }, - ] - - private readonly STATIC_IMPORT_RESPONSE_VALIDATION_ERROR = [ - - { - "validationResponse": [ - "failure reason 1", "failure reason 2" - ] - } - ] - constructor(private readonly apiService: ApiService) { } @@ -83,7 +56,7 @@ export class AdminService { public postJsonFile(file: File): Observable { const formData = new FormData(); formData.append('file', file); - return of(this.STATIC_IMPORT_RESPONSE_SUCCESS)// this.apiService.postFile(`${this.url}/assets/import`, formData); + return this.apiService.postFile(`${this.url}/assets/import`, formData); } } diff --git a/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.html b/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.html index 1e474f3c8c..ee2a0a37b5 100644 --- a/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.html +++ b/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.html @@ -26,42 +26,85 @@
-
-
- upload - -

{{ 'pageAdmin.importJson.Drag_and_Drop' | i18n }}

-

{{ 'pageAdmin.importJson.or' | i18n }}

-
-

{{ 'pageAdmin.importJson.browseFiles' | i18n }}

+
+
+ upload + +

{{ 'pageAdmin.importJson.Drag_and_Drop' | i18n }}

+

{{ 'pageAdmin.importJson.or' | i18n }}

+
+

{{ 'pageAdmin.importJson.browseFiles' | i18n }}

+
+

{{ 'pageAdmin.importJson.error' | i18n }}

-

{{ 'pageAdmin.importJson.error' | i18n }}

-
-
- upload_file -

{{file.name}}

- {{ 'pageAdmin.importJson.clear_file' | i18n }} - {{ 'pageAdmin.importJson.upload_file' | i18n }} +
+ upload_file +

{{file.name}}

+ {{ 'pageAdmin.importJson.clear_file' | i18n }} + {{ 'pageAdmin.importJson.upload_file' | i18n }} +
-
- +
-

{{ 'pageAdmin.importStatus.importStatus' | i18n }}:

-
- -
- {{Object.keys(item)}} -
-
- {{Object.values(item)}} -
-
+ Upload more +
+

{{ 'pageAdmin.importStatus.importStatus' | i18n }}:

+
+
+ + + + + + + + + + + +
catena x id{{entry.catenaXId}} status{{entry.persistedOrUpdated ? 'imported' : 'skipped'}}
+
+
+
+ + +
+

{{ 'Validation Report' | i18n }}:

+ +
+ Import State Message: + {{errorImportStateMessage.length ? errorImportStateMessage : 'No Message was returned by the server.'}} +
+ +
+ + + + + + + + + + + +
Errors{{i+1}}Description{{errorDescription}}
+
diff --git a/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.scss b/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.scss index d809effa68..6f1941e678 100644 --- a/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.scss +++ b/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.scss @@ -22,12 +22,22 @@ gap: 16px; } +.status-container { + display: flex; + flex-direction: column; +} + .status-content { display: flex; flex-direction: column; justify-content: space-evenly; } +.import-report-content-container { + max-height: 600px; + overflow-y: auto; +} + .status-label-container { display: flex; justify-content: space-evenly; diff --git a/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.ts b/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.ts index fa48992178..63fa3fde10 100644 --- a/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.ts +++ b/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.ts @@ -17,10 +17,9 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -import { Component, Input } from '@angular/core'; -import { AdminFacade } from '@page/admin/core/admin.facade'; -import { ToastService } from '@shared/components/toasts/toast.service'; -import { BehaviorSubject } from 'rxjs'; +import {Component, Input} from '@angular/core'; +import {AdminFacade} from '@page/admin/core/admin.facade'; +import {ToastService} from '@shared/components/toasts/toast.service'; @Component({ selector: 'app-import-json', @@ -31,14 +30,21 @@ export class ImportJsonComponent { @Input() showError = false; @Input() file: File; - importResponse = new BehaviorSubject([]); + assetResponse = []; + errorResponse = []; + errorImportStateMessage = []; + errorValidationResult = {}; + errorValidationErrors = []; displayUploader: boolean = true; + public readonly importedAssetsDisplayedColumns: string[]; + public readonly validationErrorsDisplayedColumns: string[]; constructor(private readonly adminFacade: AdminFacade, private readonly toastService: ToastService) { - this.importResponse.subscribe(next => console.log(next)) + this.importedAssetsDisplayedColumns = ['catenaXId', 'import-status']; + this.validationErrorsDisplayedColumns = ['position', 'description']; } public getFile(event: any) { @@ -51,17 +57,32 @@ export class ImportJsonComponent { this.showError = false; } public uploadFile(file: File) { - this.adminFacade.postJsonImport(file).subscribe(response => { - console.log(response); - this.importResponse.next(response); - this.toastService.success('pageAdmin.importJson.success'); - this.displayUploader = false; + + this.adminFacade.postJsonImport(file).subscribe({ + next: (response) => { + this.assetResponse = response['importStateMessage']; + this.toastService.success('pageAdmin.importJson.success'); + this.displayUploader = false; + }, + + error: (error) => { + this.errorResponse = error.error; + this.errorImportStateMessage = this.errorResponse['importStateMessage']; + this.errorValidationResult = this.errorResponse['validationResult']; + this.errorValidationErrors = this.errorValidationResult['validationErrors']; + } }); } public clearFile(): void { this.file = undefined; this.showError = false; + this.assetResponse = []; + this.errorResponse = []; + this.errorImportStateMessage = []; + this.errorValidationResult = null; + this.errorValidationErrors = []; + } public shouldShowFileContainer_upload_file(file: File): boolean { From 9614a29d98af93a01b149178355ac0878181e89a Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Wed, 10 Jan 2024 15:21:34 +0100 Subject: [PATCH 34/49] chore(tx-backend): TRACEFOSS-2741 fix mapping --- .../domain/importpoc/service/MainAspectAsPlannedStrategy.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsPlannedStrategy.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsPlannedStrategy.java index 18edf2410e..657eafc1d6 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsPlannedStrategy.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsPlannedStrategy.java @@ -138,8 +138,8 @@ public static List extractDetailAspectModelsPartSiteInformati public static DetailAspectModel extractDetailAspectModelsAsPlanned(MainAspectAsPlannedRequest.ValidityPeriod validityPeriod) { DetailAspectDataAsPlanned detailAspectDataAsPlanned = DetailAspectDataAsPlanned.builder() - .validityPeriodFrom(validityPeriod.validFrom()) - .validityPeriodTo(validityPeriod.validTo()) + .validityPeriodFrom(OffsetDateTime.parse(validityPeriod.validFrom())) + .validityPeriodTo(OffsetDateTime.parse(validityPeriod.validTo())) .build(); return DetailAspectModel.builder().data(detailAspectDataAsPlanned).type(DetailAspectType.AS_PLANNED).build(); } From edad20b428a41b42b2158d9dc6ee32d13e347382 Mon Sep 17 00:00:00 2001 From: Martin Maul Date: Wed, 10 Jan 2024 16:04:38 +0100 Subject: [PATCH 35/49] chore(fileupload): TRACEFOSS-XXX- added import status / validation report --- .../import-json/import-json.component.html | 18 +++++++++--------- frontend/src/assets/locales/de/page.admin.json | 12 +++++++++++- frontend/src/assets/locales/en/page.admin.json | 12 +++++++++++- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.html b/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.html index ee2a0a37b5..c8ca1a72db 100644 --- a/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.html +++ b/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.html @@ -51,7 +51,7 @@

{{ 'pageAdmin.importJson.Drag_and_Drop' | i18n }}

Upload more + (click)="displayUploader = true; clearFile()">{{'pageAdmin.importStatus.uploadMore' | i18n}}

{{ 'pageAdmin.importStatus.importStatus' | i18n }}:

@@ -61,13 +61,13 @@

{{ 'pageAdmin.importStatus.importStatus' | i18n }}:

aria-describedby="importResponseTable" > - catena x id + {{'pageAdmin.importStatus.catenaXId' | i18n}} {{entry.catenaXId}} - status + {{'pageAdmin.importStatus.status' | i18n}} {{entry.persistedOrUpdated ? 'imported' : 'skipped'}} + *matCellDef="let entry">{{entry.persistedOrUpdated ? ('pageAdmin.importStatus.imported' | i18n) : ('pageAdmin.importStatus.skipped' | i18n)}} @@ -79,11 +79,11 @@

{{ 'pageAdmin.importStatus.importStatus' | i18n }}:

-

{{ 'Validation Report' | i18n }}:

+

{{'pageAdmin.importStatus.validationReport' | i18n}}:

- Import State Message: - {{errorImportStateMessage.length ? errorImportStateMessage : 'No Message was returned by the server.'}} + {{'pageAdmin.importStatus.importStateMessage' | i18n}} +
{{errorImportStateMessage.length ? errorImportStateMessage : ('pageAdmin.importStatus.noImportStateMessage' | i18n)}}
@@ -92,11 +92,11 @@

{{ 'Validation Report' | i18n }}:

aria-describedby="importValidationErrorsTable" > - Errors + {{'pageAdmin.importStatus.errors' | i18n}} {{i+1}} - Description + {{'pageAdmin.importStatus.description' | i18n}} {{errorDescription}} diff --git a/frontend/src/assets/locales/de/page.admin.json b/frontend/src/assets/locales/de/page.admin.json index 4c3a274a99..5471ae4aea 100644 --- a/frontend/src/assets/locales/de/page.admin.json +++ b/frontend/src/assets/locales/de/page.admin.json @@ -29,7 +29,17 @@ "success": "Erfolgreich hochgeladen." }, "importStatus": { - "importStatus": "Import Status" + "importStatus": "Import Status", + "catenaXId": "Catena-X ID", + "status": "Status", + "imported": "Importiert", + "skipped": "Übersprungen", + "validationReport": "Validierungsreport", + "importStateMessage": "Import Statusnachricht", + "errors": "Fehler", + "description": "Beschreibung", + "uploadMore": "Mehr Hochladen", + "noImportStateMessage": "Der Server hat keine weitere Information zurückgegeben." } } } diff --git a/frontend/src/assets/locales/en/page.admin.json b/frontend/src/assets/locales/en/page.admin.json index fe9b58b8da..bd89723eb4 100644 --- a/frontend/src/assets/locales/en/page.admin.json +++ b/frontend/src/assets/locales/en/page.admin.json @@ -29,7 +29,17 @@ "success": "Successfully uploaded." }, "importStatus": { - "importStatus": "Import status" + "importStatus": "Import Status", + "catenaXId": "Catena-X ID", + "status": "State", + "imported": "Imported", + "skipped": "Skipped", + "validationReport": "Validation report", + "importStateMessage": "Import state message", + "errors": "Error", + "description": "Description", + "uploadMore": "Upload more", + "noImportStateMessage": "No additional information was returned by the server." } } } From cac877e7a5ab6c01cf386ec2d4b1b78358ef50bc Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Wed, 10 Jan 2024 16:09:45 +0100 Subject: [PATCH 36/49] feat(mapping): TRACEFOSS-2741 fixed bad structure import validation. Added bpn validation for assets to be imported matching app bpn. --- .../infrastructure/asbuilt/model/AssetAsBuiltViewEntity.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/model/AssetAsBuiltViewEntity.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/model/AssetAsBuiltViewEntity.java index 0b2843e6dd..1b5d235053 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/model/AssetAsBuiltViewEntity.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/model/AssetAsBuiltViewEntity.java @@ -119,6 +119,8 @@ public AssetBase toDomain() { .qualityType(this.getQualityType()) .van(this.getVan()) .classification(this.getClassification()) + .importNote(this.getImportNote()) + .importState(this.getImportState()) .detailAspectModels(DetailAspectModel.from(this)) .sentQualityAlerts(emptyIfNull(this.alerts).stream().filter(alert -> NotificationSideBaseEntity.SENDER.equals(alert.getSide())).map(AlertEntity::toDomain).toList()) .receivedQualityAlerts(emptyIfNull(this.alerts).stream().filter(alert -> NotificationSideBaseEntity.RECEIVER.equals(alert.getSide())).map(AlertEntity::toDomain).toList()) From c30a75e791ffc33055b6be1060766fcdc6bad223 Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Wed, 10 Jan 2024 16:15:31 +0100 Subject: [PATCH 37/49] feat(mapping): TRACEFOSS-2741 fixed bad structure import validation. Added bpn validation for assets to be imported matching app bpn. --- .../importpoc/service/MainAspectAsBuiltStrategy.java | 4 +--- .../repository/AssetAsBuiltRepositoryImpl.java | 12 +++--------- .../repository/AssetAsPlannedRepositoryImpl.java | 2 -- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java index 72d98ed6f5..695398db8d 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java @@ -108,9 +108,7 @@ public AssetBase mapToAssetBase(ImportRequest.AssetImportRequest assetImportRequ semanticDataModel.set(org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.JUSTINSEQUENCE); }); - asBuiltAspect.localIdentifiers().stream().filter(localId -> localId.key().equals("manufacturerId")).findFirst().ifPresent(s -> { - manufacturerId.set(s.value()); - }); + asBuiltAspect.localIdentifiers().stream().filter(localId -> localId.key().equals("manufacturerId")).findFirst().ifPresent(s -> manufacturerId.set(s.value())); if (semanticDataModel.get() == null) { semanticDataModel.set(org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.UNKNOWN); diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/repository/AssetAsBuiltRepositoryImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/repository/AssetAsBuiltRepositoryImpl.java index 696f59962c..de2255b524 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/repository/AssetAsBuiltRepositoryImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asbuilt/repository/AssetAsBuiltRepositoryImpl.java @@ -34,16 +34,11 @@ import org.eclipse.tractusx.traceability.assets.infrastructure.asbuilt.model.AssetAsBuiltEntity; import org.eclipse.tractusx.traceability.assets.infrastructure.base.model.AssetBaseEntity; import org.eclipse.tractusx.traceability.common.repository.CriteriaUtility; -import org.springframework.data.util.Pair; import org.springframework.stereotype.Component; import java.util.AbstractMap; -import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.Objects; -import java.util.Optional; @RequiredArgsConstructor @Component @@ -107,15 +102,14 @@ public List saveAll(List assets) { .toList(); } - // TODO make sure this will update based on the import strategy and updated import note and state based on it @Override @Transactional public List saveAllIfNotInIRSSyncAndUpdateImportStateAndNote(List assets) { - List toPersist = assets.stream().map(assetToPersist -> new AbstractMap.SimpleEntry(assetToPersist, jpaAssetAsBuiltRepository.findById(assetToPersist.getId()).orElse(null))) + List toPersist = assets.stream().map(assetToPersist -> new AbstractMap.SimpleEntry(assetToPersist, jpaAssetAsBuiltRepository.findById(assetToPersist.getId()).orElse(null))) .filter(this::entityIsTransientOrNotExistent) .map(entry -> { - if(entry.getValue() != null) { + if (entry.getValue() != null) { entry.getKey().setImportNote(ImportNote.TRANSIENT_UPDATED); } return entry.getKey(); @@ -126,7 +120,7 @@ public List saveAllIfNotInIRSSyncAndUpdateImportStateAndNote(List assetBaseAssetBaseEntitySimpleEntry) { - if(Objects.isNull(assetBaseAssetBaseEntitySimpleEntry.getValue())) { + if (Objects.isNull(assetBaseAssetBaseEntitySimpleEntry.getValue())) { return true; } return assetBaseAssetBaseEntitySimpleEntry.getValue().getImportState() == ImportState.TRANSIENT; diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/repository/AssetAsPlannedRepositoryImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/repository/AssetAsPlannedRepositoryImpl.java index 19d725d6fc..af221d928f 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/repository/AssetAsPlannedRepositoryImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/infrastructure/asplanned/repository/AssetAsPlannedRepositoryImpl.java @@ -102,8 +102,6 @@ public List saveAll(List assets) { return AssetAsPlannedEntity.toDomainList(jpaAssetAsPlannedRepository.saveAll(AssetAsPlannedEntity.fromList(assets))); } - // TODO make sure this will update based on the import strategy and updated import note and state based on it - @Override @Transactional public List saveAllIfNotInIRSSyncAndUpdateImportStateAndNote(List assets) { From 55911ab86563d97392e1590bc548c7ec3b964da8 Mon Sep 17 00:00:00 2001 From: ashanmugavel Date: Wed, 10 Jan 2024 16:40:49 +0100 Subject: [PATCH 38/49] chore:[TRACEFOSS-428] fixed sorting bug --- .../src/app/modules/page/parts/presentation/parts.component.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/app/modules/page/parts/presentation/parts.component.ts b/frontend/src/app/modules/page/parts/presentation/parts.component.ts index 9f29488264..9585ea51be 100644 --- a/frontend/src/app/modules/page/parts/presentation/parts.component.ts +++ b/frontend/src/app/modules/page/parts/presentation/parts.component.ts @@ -159,6 +159,7 @@ export class PartsComponent implements OnInit, OnDestroy, AfterViewInit { } public onAsPlannedTableConfigChange({ page, pageSize, sorting }: TableEventConfig): void { + this.setTableSortingList(sorting, MainAspectType.AS_PLANNED); let pageSizeValue = this.DEFAULT_PAGE_SIZE; if (pageSize !== 0) { From 710092b583502aea3425a38241a72c03de55258a Mon Sep 17 00:00:00 2001 From: ashanmugavel Date: Wed, 10 Jan 2024 16:55:55 +0100 Subject: [PATCH 39/49] chore:[TRACEFOSS-428] fixed sorting bug --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a71a998d3..a3d0e44d17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### Changed - Fixed security findings - Fixed deadline overlap issues for Q-investigations in update menu +- Fixed sorting of asPlanned parts ### Removed ## [10.1.0 - 22.12.2023] From 2f73aa91af08f692db06cfaff72ad2ac89cfce1a Mon Sep 17 00:00:00 2001 From: Martin Maul Date: Wed, 10 Jan 2024 17:33:18 +0100 Subject: [PATCH 40/49] chore(fileupload): TRACEFOSS-XXX- added import status / validation report --- .../import-json/import-json.component.spec.ts | 85 ++++++++++++++++--- .../import-json/import-json.component.ts | 28 +++--- 2 files changed, 87 insertions(+), 26 deletions(-) diff --git a/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.spec.ts b/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.spec.ts index 683f355ad0..6bca99cdc3 100644 --- a/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.spec.ts +++ b/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.spec.ts @@ -18,13 +18,13 @@ ********************************************************************************/ -import { AdminModule } from '@page/admin/admin.module'; -import { ImportJsonComponent } from '@page/admin/presentation/import-json/import-json.component'; -import { screen, waitFor } from '@testing-library/angular'; -import { renderComponent } from '@tests/test-render.utils'; +import {AdminModule} from '@page/admin/admin.module'; +import {ImportJsonComponent} from '@page/admin/presentation/import-json/import-json.component'; +import {screen, waitFor} from '@testing-library/angular'; +import {renderComponent} from '@tests/test-render.utils'; describe('ImportJsonComponent', () => { - const jsonFileContent = { + const dummyJsonFileContent = { key1: 'value1', key2: 'value2', key3: { @@ -33,14 +33,15 @@ describe('ImportJsonComponent', () => { }, }; - const jsonString = JSON.stringify(jsonFileContent, null, 2); + const dummyJsonString = JSON.stringify(dummyJsonFileContent, null, 2); - - const createJsonFile = (fileName: string, fileType: string) => { - const jsonBlob = new Blob([jsonString], { type: fileType }); - return new File([jsonBlob], fileName, { type: fileType }); + const createDummyJsonFile = (fileName: string, fileType: string) => { + const dummyJsonBlob = new Blob([dummyJsonString], { type: fileType }); + return new File([dummyJsonBlob], fileName, { type: fileType }); }; - const jsonFile = createJsonFile('example.json', 'application/json'); + + const jsonFile = createDummyJsonFile('example.json', 'application/json'); + const renderComponentWithJsonFile = async (jsonFile: File, showError: boolean = false) => { return renderComponent(ImportJsonComponent, { imports: [AdminModule], @@ -50,7 +51,7 @@ describe('ImportJsonComponent', () => { it('should get the json-file', async () => { - const jsonFile = createJsonFile('example.json', 'application/json'); + const jsonFile = createDummyJsonFile('example.json', 'application/json'); const { fixture } = await renderComponentWithJsonFile(jsonFile, false); const { componentInstance } = fixture; @@ -65,7 +66,7 @@ describe('ImportJsonComponent', () => { }); it('should show error Message', async () => { - const File = createJsonFile('example.pdf', 'application/pdf'); + const File = createDummyJsonFile('example.pdf', 'application/pdf'); const { fixture } = await renderComponentWithJsonFile(File, false); const { componentInstance } = fixture; @@ -114,4 +115,62 @@ describe('ImportJsonComponent', () => { expect(componentInstance.getFileExtension(jsonFile)).toEqual('json') }) + + it('should return null if file extension is null', async () => { + + const { fixture } = await renderComponentWithJsonFile(jsonFile, false); + + const { componentInstance } = fixture; + const extensionResult = componentInstance.getFileExtension(null); + expect(extensionResult).toEqual(null) + }) + + it('should set error variables correctly', async () => { + const { fixture } = await renderComponentWithJsonFile(jsonFile, false); + const { componentInstance } = fixture; + + const errorResponse = { + error: { + importStateMessage: ["test message"], + validationResult: { + validationErrors: ["error1", "error2"] + } + } + } + + componentInstance.setValidationReport(errorResponse); + + expect(componentInstance.errorImportStateMessage).toEqual(errorResponse.error.importStateMessage); + expect(componentInstance.errorValidationResult).toEqual(errorResponse.error.validationResult); + expect(componentInstance.errorValidationErrors).toEqual(errorResponse.error.validationResult.validationErrors); + + }) + + fit('should set asset variables correctly', async () => { + const { fixture } = await renderComponentWithJsonFile(jsonFile, false); + const { componentInstance } = fixture; + + const assetResponse = { + importStateMessage: [ + { catenaXId: 'id1', persistedOrUpdated: true }, + { catenaXId: 'id2', persistedOrUpdated: false }, + ], + }; + + componentInstance.setAssetReport(assetResponse); + + console.warn(componentInstance.assetResponse) + console.warn(componentInstance.assetResponse['importStateMessage']) + + expect(componentInstance.assetResponse).toEqual(assetResponse.importStateMessage); + expect(componentInstance.displayUploader).toBeFalsy(); + }); + + + + + + + + }); diff --git a/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.ts b/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.ts index 63fa3fde10..6c9410f345 100644 --- a/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.ts +++ b/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.ts @@ -57,23 +57,25 @@ export class ImportJsonComponent { this.showError = false; } public uploadFile(file: File) { - this.adminFacade.postJsonImport(file).subscribe({ - next: (response) => { - this.assetResponse = response['importStateMessage']; - this.toastService.success('pageAdmin.importJson.success'); - this.displayUploader = false; - }, - - error: (error) => { - this.errorResponse = error.error; - this.errorImportStateMessage = this.errorResponse['importStateMessage']; - this.errorValidationResult = this.errorResponse['validationResult']; - this.errorValidationErrors = this.errorValidationResult['validationErrors']; - } + next: (response) => this.setAssetReport(response), + error: (error) => this.setValidationReport(error) }); } + setAssetReport(assetResponse: any) { + this.assetResponse = assetResponse['importStateMessage']; + this.toastService.success('pageAdmin.importJson.success'); + this.displayUploader = false; + } + + setValidationReport(errorResponse: any) { + this.errorResponse = errorResponse.error; + this.errorImportStateMessage = this.errorResponse['importStateMessage']; + this.errorValidationResult = this.errorResponse['validationResult']; + this.errorValidationErrors = this.errorValidationResult['validationErrors']; + } + public clearFile(): void { this.file = undefined; this.showError = false; From 0f5d7efd7aa70d88fc5e18c81415138608d3d5df Mon Sep 17 00:00:00 2001 From: Martin Maul Date: Wed, 10 Jan 2024 17:33:52 +0100 Subject: [PATCH 41/49] chore(fileupload): TRACEFOSS-XXX- added import status / validation report --- .../presentation/import-json/import-json.component.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.spec.ts b/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.spec.ts index 6bca99cdc3..fb42520fe2 100644 --- a/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.spec.ts +++ b/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.spec.ts @@ -146,7 +146,7 @@ describe('ImportJsonComponent', () => { }) - fit('should set asset variables correctly', async () => { + it('should set asset variables correctly', async () => { const { fixture } = await renderComponentWithJsonFile(jsonFile, false); const { componentInstance } = fixture; From db31111844719d44c192d77d98fb199e03e666e5 Mon Sep 17 00:00:00 2001 From: Martin Maul Date: Wed, 10 Jan 2024 17:34:55 +0100 Subject: [PATCH 42/49] chore(fileupload): TRACEFOSS-XXX- added import status / validation report --- .../presentation/import-json/import-json.component.spec.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.spec.ts b/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.spec.ts index fb42520fe2..8d5c515b49 100644 --- a/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.spec.ts +++ b/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.spec.ts @@ -159,9 +159,6 @@ describe('ImportJsonComponent', () => { componentInstance.setAssetReport(assetResponse); - console.warn(componentInstance.assetResponse) - console.warn(componentInstance.assetResponse['importStateMessage']) - expect(componentInstance.assetResponse).toEqual(assetResponse.importStateMessage); expect(componentInstance.displayUploader).toBeFalsy(); }); From adfa32f937ca507999135a2ccd9a0eb88cf39ea0 Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Thu, 11 Jan 2024 08:53:11 +0100 Subject: [PATCH 43/49] feat(mapping): TRACEFOSS-2741 fixed bad structure import validation. Added bpn validation for assets to be imported matching app bpn. --- .../service/MainAspectAsBuiltStrategy.java | 15 ++++++++++++--- .../service/MainAspectAsPlannedStrategy.java | 16 ++++++++++++++-- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java index 695398db8d..b341713da7 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java @@ -37,6 +37,7 @@ import java.time.OffsetDateTime; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.concurrent.atomic.AtomicReference; @@ -71,7 +72,11 @@ public AssetBase mapToAssetBase(ImportRequest.AssetImportRequest assetImportRequ .map(GenericSubmodel::getPayload) .filter(SingleLevelBomAsBuiltRequest.class::isInstance) .map(SingleLevelBomAsBuiltRequest.class::cast) - .map(singleLevelBomAsBuiltRequest -> new Descriptions(singleLevelBomAsBuiltRequest.catenaXId(), null)) + .findFirst() + .map(SingleLevelBomAsBuiltRequest::childItems) + .orElse(Collections.emptyList()) + .stream() + .map(childItem -> new Descriptions(childItem.catenaXId(), null)) .toList(); @@ -80,8 +85,12 @@ public AssetBase mapToAssetBase(ImportRequest.AssetImportRequest assetImportRequ .map(GenericSubmodel::getPayload) .filter(SingleLevelUsageAsBuiltRequest.class::isInstance) .map(SingleLevelUsageAsBuiltRequest.class::cast) - .map(singleLevelUsageAsBuiltRequest -> new Descriptions(singleLevelUsageAsBuiltRequest.catenaXId(), null)) - .toList(); + .findFirst() + .map(SingleLevelUsageAsBuiltRequest::customers) + .orElse(Collections.emptyList()) + .stream() + .map(SingleLevelUsageAsBuiltRequest.Customer::parentItems) + .flatMap(parentItems -> parentItems.stream().map(parentItem -> new Descriptions(parentItem.catenaXId(), null))).toList(); final AtomicReference semanticModelId = new AtomicReference<>(); diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsPlannedStrategy.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsPlannedStrategy.java index 657eafc1d6..d69197155a 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsPlannedStrategy.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsPlannedStrategy.java @@ -31,6 +31,7 @@ import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.ImportRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.MainAspectAsPlannedRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.PartSiteInformationAsPlannedRequest; +import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelBomAsBuiltRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelBomAsPlannedRequest; import org.eclipse.tractusx.traceability.assets.domain.importpoc.model.SingleLevelUsageAsPlannedRequest; import org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.GenericSubmodel; @@ -39,6 +40,7 @@ import java.time.OffsetDateTime; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import static org.apache.commons.collections4.ListUtils.emptyIfNull; @@ -46,6 +48,7 @@ import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isAsPlannedMainAspect; import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isDownwardRelationshipAsPlanned; import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isPartSiteInformationAsPlanned; +import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isUpwardRelationshipAsBuilt; import static org.eclipse.tractusx.traceability.assets.infrastructure.base.irs.model.response.relationship.Aspect.isUpwardRelationshipAsPlanned; @@ -76,16 +79,25 @@ public AssetBase mapToAssetBase(ImportRequest.AssetImportRequest assetImportRequ .map(GenericSubmodel::getPayload) .filter(SingleLevelBomAsPlannedRequest.class::isInstance) .map(SingleLevelBomAsPlannedRequest.class::cast) - .map(singleLevelBomAsPlannedRequest -> new Descriptions(singleLevelBomAsPlannedRequest.catenaXId(), null)) + .findFirst() + .map(SingleLevelBomAsPlannedRequest::childItems) + .orElse(Collections.emptyList()) + .stream() + .map(childItem -> new Descriptions(childItem.catenaXId(), null)) .toList(); + List childRelations = submodels.stream() .filter(genericSubmodel -> isDownwardRelationshipAsPlanned(genericSubmodel.getAspectType())) .map(GenericSubmodel::getPayload) .filter(SingleLevelUsageAsPlannedRequest.class::isInstance) .map(SingleLevelUsageAsPlannedRequest.class::cast) - .map(singleLevelUsageAsPlannedRequest -> new Descriptions(singleLevelUsageAsPlannedRequest.catenaXId(), null)) + .findFirst() + .map(SingleLevelUsageAsPlannedRequest::parentParts) + .orElse(Collections.emptyList()) + .stream() + .map(parentPart -> new Descriptions(parentPart.parentCatenaXId(), null)) .toList(); List detailAspectModels = new ArrayList<>(); From 43a1081a733937b855c29ecaf4aa1e4ce00364b7 Mon Sep 17 00:00:00 2001 From: Martin Maul Date: Thu, 11 Jan 2024 10:23:53 +0100 Subject: [PATCH 44/49] chore(fileupload): TRACEFOSS-XXX- added import status / validation report --- .../presentation/import-json/import-json.component.html | 2 +- .../presentation/import-json/import-json.component.ts | 7 +++---- frontend/src/assets/locales/de/common.json | 2 +- frontend/src/assets/locales/de/page.admin.json | 2 +- frontend/src/assets/locales/en/common.json | 2 +- frontend/src/assets/locales/en/page.admin.json | 2 +- 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.html b/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.html index c8ca1a72db..59a400598d 100644 --- a/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.html +++ b/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.html @@ -29,7 +29,7 @@
upload - +

{{ 'pageAdmin.importJson.Drag_and_Drop' | i18n }}

{{ 'pageAdmin.importJson.or' | i18n }}

diff --git a/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.ts b/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.ts index 6c9410f345..364817b767 100644 --- a/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.ts +++ b/frontend/src/app/modules/page/admin/presentation/import-json/import-json.component.ts @@ -17,9 +17,9 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -import {Component, Input} from '@angular/core'; -import {AdminFacade} from '@page/admin/core/admin.facade'; -import {ToastService} from '@shared/components/toasts/toast.service'; +import { Component, Input } from '@angular/core'; +import { AdminFacade } from '@page/admin/core/admin.facade'; +import { ToastService } from '@shared/components/toasts/toast.service'; @Component({ selector: 'app-import-json', @@ -99,5 +99,4 @@ export class ImportJsonComponent { return null; } - protected readonly Object = Object; } diff --git a/frontend/src/assets/locales/de/common.json b/frontend/src/assets/locales/de/common.json index db5c2e86dd..47f8f9edcf 100644 --- a/frontend/src/assets/locales/de/common.json +++ b/frontend/src/assets/locales/de/common.json @@ -12,7 +12,7 @@ "alerts": "Qualitätswarnung", "adminRegistry": "Registry-Abfragen", "adminBpn": "BPN - EDC Konfiguration", - "adminImport": "Daten importieren", + "adminImport": "Datenbereitstellung", "unauthorized": "Die Funktion ist aufgrund einer fehlenden Rolle deaktiviert. Bitten Sie Ihren Administrator, die erforderliche Rolle für die Funktion bereitzustellen." }, "pageTitle": { diff --git a/frontend/src/assets/locales/de/page.admin.json b/frontend/src/assets/locales/de/page.admin.json index 5471ae4aea..404dc38f48 100644 --- a/frontend/src/assets/locales/de/page.admin.json +++ b/frontend/src/assets/locales/de/page.admin.json @@ -19,7 +19,7 @@ } }, "importJson": { - "title": "Importieren - Json Datei", + "title": "Trace-X Datenimport", "clear_file": "Datei löschen", "upload_file": "Datei hochladen", "error": "Warnung: Bitte benutzen Sie eine Json Datei", diff --git a/frontend/src/assets/locales/en/common.json b/frontend/src/assets/locales/en/common.json index f480afbf92..cbad15502a 100644 --- a/frontend/src/assets/locales/en/common.json +++ b/frontend/src/assets/locales/en/common.json @@ -12,7 +12,7 @@ "alerts": "Quality alerts", "adminRegistry": "Registry lookups", "adminBpn": "BPN - EDC configuration", - "adminImport": "Asset import", + "adminImport": "Data provisioning", "unauthorized": "Functionality is disabled because of missing role. Ask your administrator to provide the required role for the functionality." }, "pageTitle": { diff --git a/frontend/src/assets/locales/en/page.admin.json b/frontend/src/assets/locales/en/page.admin.json index bd89723eb4..6b156175b4 100644 --- a/frontend/src/assets/locales/en/page.admin.json +++ b/frontend/src/assets/locales/en/page.admin.json @@ -19,7 +19,7 @@ } }, "importJson": { - "title": "Import - Json File", + "title": "Trace-X Data import", "clear_file": "clear file", "upload_file": "upload file", "error": "Error: Please select a JSON file.", From 0f6f119e1cf51ac7c0427c3cbe8aa8bdeb447e8b Mon Sep 17 00:00:00 2001 From: ashanmugavel Date: Thu, 11 Jan 2024 10:43:42 +0100 Subject: [PATCH 45/49] chore:[TRACEFOSS-428] fixed sorting bug --- .../src/app/modules/page/parts/presentation/parts.component.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/app/modules/page/parts/presentation/parts.component.ts b/frontend/src/app/modules/page/parts/presentation/parts.component.ts index 3ff26baa75..1e857cc7d4 100644 --- a/frontend/src/app/modules/page/parts/presentation/parts.component.ts +++ b/frontend/src/app/modules/page/parts/presentation/parts.component.ts @@ -172,6 +172,7 @@ export class PartsComponent implements OnInit, OnDestroy, AfterViewInit { public onAsPlannedTableConfigChange({page, pageSize, sorting}: TableEventConfig): void { this.setTableSortingList(sorting, MainAspectType.AS_PLANNED); + let pageSizeValue = this.DEFAULT_PAGE_SIZE; if (pageSize !== 0) { pageSizeValue = pageSize; From c11f5f5b255dd2699a711c0b23bebd2bb3fb03c0 Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Thu, 11 Jan 2024 11:21:11 +0100 Subject: [PATCH 46/49] chore(tx-backend): TRACEFOSS-2741 adjust pipeline and test data date format --- .github/workflows/argo.yml | 30 ++++++++++++------- .../testdata/import-test-data-CML1.json | 26 ++++++++-------- .../testdata/import-test-data-CNKC.json | 24 +++++++-------- 3 files changed, 44 insertions(+), 36 deletions(-) diff --git a/.github/workflows/argo.yml b/.github/workflows/argo.yml index d191c579ef..3105563b77 100644 --- a/.github/workflows/argo.yml +++ b/.github/workflows/argo.yml @@ -54,6 +54,13 @@ on: options: - Yes - No + trigger_registry_reload: + type: choice + description: Do You want to trigger registry reload right away? + required: true + options: + - Yes + - No env: ARGO_TEST_REGISTRY: "https://argo.dev.demo.catena-x.net/api/v1/applications/tracex-dt-registry-test" @@ -385,7 +392,7 @@ jobs: elif [ "${{ github.event.inputs.testdata_upload }}" == "false" ]; then echo "Testdata upload skipped" fi - + registry_reload: needs: - upload_testdata @@ -393,14 +400,15 @@ jobs: steps: - name: reload the registry run: | - - if [ "${{ github.event.inputs.environment }}" == "Dev/Test" ]; then - curl -X GET "$ARGO_TEST_RegistryReload" - curl -X GET "$ARGO_DEV_RegistryReload" - elif [ "${{ github.event.inputs.environment }}" == "E2E-A/E2E-B" ]; then - curl -X GET "$ARGO_E2E_A_RegistryReload" - curl -X GET "$ARGO_E2E_B_RegistryReload" - elif [ "${{ github.event.inputs.environment }}" == "int-a/int-b" ]; then - curl -X GET "$ARGO_INT_A_RegistryReload" - curl -X GET "$ARGO_INT_B_RegistryReload" + if [ "${{ github.event.inputs.trigger_registry_reload }}" == "true" ]; then + if [ "${{ github.event.inputs.environment }}" == "Dev/Test" ]; then + curl -X GET "$ARGO_TEST_RegistryReload" + curl -X GET "$ARGO_DEV_RegistryReload" + elif [ "${{ github.event.inputs.environment }}" == "E2E-A/E2E-B" ]; then + curl -X GET "$ARGO_E2E_A_RegistryReload" + curl -X GET "$ARGO_E2E_B_RegistryReload" + elif [ "${{ github.event.inputs.environment }}" == "int-a/int-b" ]; then + curl -X GET "$ARGO_INT_A_RegistryReload" + curl -X GET "$ARGO_INT_B_RegistryReload" + fi fi diff --git a/tx-backend/testdata/import-test-data-CML1.json b/tx-backend/testdata/import-test-data-CML1.json index f8c0b81fcf..ecae9ebd24 100644 --- a/tx-backend/testdata/import-test-data-CML1.json +++ b/tx-backend/testdata/import-test-data-CML1.json @@ -141,7 +141,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2022-02-04T14:48:54.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:4e390dab-707f-446e-bfbe-653f6f5b1f37", @@ -262,7 +262,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2022-02-04T14:48:54.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:4a5e9ff6-2d5c-4510-a90e-d55af3ba502f", @@ -324,7 +324,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2022-02-04T14:48:54.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:6ec3f1db-2798-454b-a73f-0d21a8966c74", @@ -386,7 +386,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2022-02-04T14:48:54.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa01", @@ -422,7 +422,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2022-02-04T14:48:54.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa02", @@ -477,7 +477,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2022-02-04T14:48:54.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fa03", @@ -591,7 +591,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2022-02-04T14:48:54.000Z", "country" : "HUN" }, "catenaXId" : "urn:uuid:0733946c-59c6-41ae-9570-cb43a6e43842", @@ -954,7 +954,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2022-02-04T14:48:54.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:44347dec-21d1-47aa-b2a7-f959bf9d424b", @@ -1029,7 +1029,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2022-02-04T14:48:54.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:1233b405-5ac8-4867-93f8-6fdf37733737", @@ -1080,7 +1080,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2022-02-04T14:48:54.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:bcfae197-40fa-4be0-821d-5c1873a1b7c2", @@ -1103,7 +1103,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2022-02-04T14:48:54.000Z", "country" : "HUN" }, "catenaXId" : "urn:uuid:bcfae197-40fa-4be0-821d-5c1873a1b7c2", @@ -1141,7 +1141,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2022-02-04T14:48:54.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:254604ab-2153-45fb-8cad-54ef09f4070e", @@ -1208,7 +1208,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2022-02-04T14:48:54.000Z", "country" : "HUN" }, "catenaXId" : "urn:uuid:e3b2f5e2-5be5-4ea6-98f0-6876de0fca4f", diff --git a/tx-backend/testdata/import-test-data-CNKC.json b/tx-backend/testdata/import-test-data-CNKC.json index 1d8473b45f..377b0b6488 100644 --- a/tx-backend/testdata/import-test-data-CNKC.json +++ b/tx-backend/testdata/import-test-data-CNKC.json @@ -23,7 +23,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2022-02-04T14:48:54.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:7eeeac86-7b69-444d-81e6-655d0f1513bd", @@ -104,7 +104,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2022-02-04T14:48:54.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:5205f736-8fc2-4585-b869-6bf36842369a", @@ -185,7 +185,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2022-02-04T14:48:54.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:f11ddc62-3bd5-468f-b7b0-110fe13ed0cd", @@ -266,7 +266,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2022-02-04T14:48:54.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:c47b9f8b-48d0-4ef4-8f0b-e965a225cb8d", @@ -347,7 +347,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2022-02-04T14:48:54.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb01", @@ -407,7 +407,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2022-02-04T14:48:54.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb02", @@ -462,7 +462,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2022-02-04T14:48:54.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:1be6ec59-40fb-4993-9836-acb0e284fb03", @@ -552,7 +552,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2022-02-04T14:48:54.000Z", "country" : "HUN" }, "catenaXId" : "urn:uuid:580d3adf-1981-44a0-a214-13d6ceed6841", @@ -908,7 +908,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2022-02-04T14:48:54.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:b0acf3e1-3fbe-46c0-aa0b-0724caae7772", @@ -959,7 +959,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2022-02-04T14:48:54.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d", @@ -982,7 +982,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2022-02-04T14:48:54.000Z", "country" : "HUN" }, "catenaXId" : "urn:uuid:da978a30-4dde-4d76-808a-b7946763ff0d", @@ -1020,7 +1020,7 @@ } ], "manufacturingInformation" : { - "date" : "2022-02-04T14:48:54", + "date" : "2022-02-04T14:48:54.000Z", "country" : "DEU" }, "catenaXId" : "urn:uuid:254604ab-2153-45fb-8cad-54ef09f4080f", From 7897e2951fe8e9db818085467e4f36dc697243e8 Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Thu, 11 Jan 2024 11:48:02 +0100 Subject: [PATCH 47/49] chore(tx-backend): TRACEFOSS-2741 adjust pipeline and test data date format --- .../traceability/assets/application/ImportController.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java index 63ec6181ff..36906fea29 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/application/ImportController.java @@ -156,5 +156,3 @@ public ResponseEntity importJson(@RequestPart("file") MultipartF return ResponseEntity.ok(importResponse); } } - - From c6339f752beb5abbb9d1808373154dc3a3796105 Mon Sep 17 00:00:00 2001 From: ds-ext-sceronik Date: Thu, 11 Jan 2024 13:22:49 +0100 Subject: [PATCH 48/49] chore(tx-backend): TRACEFOSS-2741 adjustments in mapping --- .github/workflows/argo.yml | 4 ++++ .../importpoc/service/ImportServiceImpl.java | 18 ++++++++++-------- .../service/MainAspectAsBuiltStrategy.java | 6 ++++++ ...son => import-test-data-CML1_v0.0.12.json} | 14 +++++++------- ...son => import-test-data-CNKC_v0.0.12.json} | 19 ++++++------------- 5 files changed, 33 insertions(+), 28 deletions(-) rename tx-backend/testdata/{import-test-data-CML1.json => import-test-data-CML1_v0.0.12.json} (99%) rename tx-backend/testdata/{import-test-data-CNKC.json => import-test-data-CNKC_v0.0.12.json} (98%) diff --git a/.github/workflows/argo.yml b/.github/workflows/argo.yml index 3105563b77..30e073e949 100644 --- a/.github/workflows/argo.yml +++ b/.github/workflows/argo.yml @@ -145,6 +145,10 @@ jobs: run: | echo "### inputs" >> $GITHUB_STEP_SUMMARY echo "- environment: ${{ github.event.inputs.environment }}" >> $GITHUB_STEP_SUMMARY + echo "- test data version: ${{ github.event.inputs.testdata_version }}" >> $GITHUB_STEP_SUMMARY + echo "- do hard refresh: ${{ github.event.inputs.hard_refresh }}" >> $GITHUB_STEP_SUMMARY + echo "- upload test data: ${{ github.event.inputs.testdata_upload }}" >> $GITHUB_STEP_SUMMARY + echo "- reload registry: ${{ github.event.inputs.trigger_registry_reload }}" >> $GITHUB_STEP_SUMMARY hard_refresh_environment: diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java index b598a51b51..0d80741a1c 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/ImportServiceImpl.java @@ -61,17 +61,19 @@ public Map importAssets(MultipartFile file) { Map> assetToUploadByBomLifecycle = importRequest.assets() .stream() - .map(assetImportItem -> { - Optional assetBase = strategyFactory.mapToAssetBase(assetImportItem, traceabilityProperties); - if (assetBase.isPresent() && assetBase.get().isOwnAsset(traceabilityProperties.getBpn().toString())) { - return assetBase; - } else { - throw new ImportException("At least one asset does not match the application bpn " + traceabilityProperties.getBpn().value()); - } - }) + .map(assetImportItem -> strategyFactory.mapToAssetBase(assetImportItem, traceabilityProperties)) + .filter(Optional::isPresent) .map(Optional::get) .collect(Collectors.groupingBy(AssetBase::getBomLifecycle)); + assetToUploadByBomLifecycle.values().stream().flatMap(Collection::stream) + .forEach(mappedAsset -> { + if (!mappedAsset.isOwnAsset(traceabilityProperties.getBpn().toString())) { + throw new ImportException("At least one asset does not match the application bpn " + traceabilityProperties.getBpn().value()); + } + }); + + List persistedAsBuilt = assetAsBuiltRepository.saveAllIfNotInIRSSyncAndUpdateImportStateAndNote(assetToUploadByBomLifecycle.get(BomLifecycle.AS_BUILT)); List persistedAsPlanned = assetAsPlannedRepository.saveAllIfNotInIRSSyncAndUpdateImportStateAndNote(assetToUploadByBomLifecycle.get(BomLifecycle.AS_PLANNED)); diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java index b341713da7..8db1503ae1 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/assets/domain/importpoc/service/MainAspectAsBuiltStrategy.java @@ -96,6 +96,7 @@ public AssetBase mapToAssetBase(ImportRequest.AssetImportRequest assetImportRequ final AtomicReference semanticModelId = new AtomicReference<>(); final AtomicReference semanticDataModel = new AtomicReference<>(); final AtomicReference manufacturerId = new AtomicReference<>(); + final AtomicReference van = new AtomicReference<>(); List detailAspectModels = new ArrayList<>(); DetailAspectModel asBuiltDetailAspect = extractDetailAspectModelsAsBuilt(asBuiltAspect.manufacturingInformation(), asBuiltAspect.partTypeInformation()); @@ -117,6 +118,10 @@ public AssetBase mapToAssetBase(ImportRequest.AssetImportRequest assetImportRequ semanticDataModel.set(org.eclipse.tractusx.traceability.assets.domain.base.model.SemanticDataModel.JUSTINSEQUENCE); }); + asBuiltAspect.localIdentifiers().stream().filter(localId -> localId.key().equals("van")).findFirst().ifPresent(s -> { + van.set(s.value()); + }); + asBuiltAspect.localIdentifiers().stream().filter(localId -> localId.key().equals("manufacturerId")).findFirst().ifPresent(s -> manufacturerId.set(s.value())); if (semanticDataModel.get() == null) { @@ -141,6 +146,7 @@ public AssetBase mapToAssetBase(ImportRequest.AssetImportRequest assetImportRequ .semanticDataModel(semanticDataModel.get()) .importState(ImportState.TRANSIENT) .importNote(ImportNote.TRANSIENT_CREATED) + .van(van.get()) .build(); } diff --git a/tx-backend/testdata/import-test-data-CML1.json b/tx-backend/testdata/import-test-data-CML1_v0.0.12.json similarity index 99% rename from tx-backend/testdata/import-test-data-CML1.json rename to tx-backend/testdata/import-test-data-CML1_v0.0.12.json index ecae9ebd24..e7661e2c24 100644 --- a/tx-backend/testdata/import-test-data-CML1.json +++ b/tx-backend/testdata/import-test-data-CML1_v0.0.12.json @@ -655,7 +655,7 @@ "sites" : [ { "functionValidUntil" : "2027-05-23T09:16:30.000Z", - "catenaXsiteId" : "BPNS000004711DMY", + "catenaXSiteId" : "BPNS000004711DMY", "function" : "production", "functionValidFrom" : "2013-11-17T23:59:54.000Z" } @@ -713,7 +713,7 @@ "sites" : [ { "functionValidUntil" : "2031-11-21T03:24:27.000Z", - "catenaXsiteId" : "BPNS000004711DMY", + "catenaXSiteId" : "BPNS000004711DMY", "function" : "production", "functionValidFrom" : "2020-06-07T07:30:47.000Z" } @@ -749,7 +749,7 @@ "sites" : [ { "functionValidUntil" : "2025-03-05T00:33:55.000Z", - "catenaXsiteId" : "BPNS00000003B0Q0", + "catenaXSiteId" : "BPNS00000003B0Q0", "function" : "production", "functionValidFrom" : "2019-09-10T14:41:50.000Z" } @@ -785,7 +785,7 @@ "sites" : [ { "functionValidUntil" : "2031-04-16T11:07:09.000Z", - "catenaXsiteId" : "BPNS00000003B3NX", + "catenaXSiteId" : "BPNS00000003B3NX", "function" : "production", "functionValidFrom" : "2013-12-07T09:33:50.000Z" } @@ -828,7 +828,7 @@ "sites" : [ { "functionValidUntil" : "2030-01-29T19:43:54.000Z", - "catenaXsiteId" : "BPNS00000003B0Q0", + "catenaXSiteId" : "BPNS00000003B0Q0", "function" : "production", "functionValidFrom" : "2015-11-17T18:35:23.000Z" } @@ -864,7 +864,7 @@ "sites" : [ { "functionValidUntil" : "2032-01-21T11:22:57.000Z", - "catenaXsiteId" : "BPNS00000003AXS3", + "catenaXSiteId" : "BPNS00000003AXS3", "function" : "production", "functionValidFrom" : "2017-05-27T13:54:13.000Z" } @@ -922,7 +922,7 @@ "sites" : [ { "functionValidUntil" : "2030-05-16T19:21:46.000Z", - "catenaXsiteId" : "BPNS000000815DMY", + "catenaXSiteId" : "BPNS000000815DMY", "function" : "production", "functionValidFrom" : "2019-10-17T03:16:09.000Z" } diff --git a/tx-backend/testdata/import-test-data-CNKC.json b/tx-backend/testdata/import-test-data-CNKC_v0.0.12.json similarity index 98% rename from tx-backend/testdata/import-test-data-CNKC.json rename to tx-backend/testdata/import-test-data-CNKC_v0.0.12.json index 377b0b6488..fd2525b0e9 100644 --- a/tx-backend/testdata/import-test-data-CNKC.json +++ b/tx-backend/testdata/import-test-data-CNKC_v0.0.12.json @@ -616,7 +616,7 @@ "sites" : [ { "functionValidUntil" : "2025-04-04T04:14:11.000Z", - "catenaXsiteId" : "BPNS000004711DMY", + "catenaXSiteId" : "BPNS000004711DMY", "function" : "production", "functionValidFrom" : "2018-03-24T13:38:32.000Z" } @@ -652,7 +652,7 @@ "sites" : [ { "functionValidUntil" : "2028-04-27T13:34:20.000Z", - "catenaXsiteId" : "BPNS000004711DMY", + "catenaXSiteId" : "BPNS000004711DMY", "function" : "production", "functionValidFrom" : "2017-05-03T09:10:04.000Z" } @@ -710,7 +710,7 @@ "sites" : [ { "functionValidUntil" : "2027-05-23T09:16:30.000Z", - "catenaXsiteId" : "BPNS000004711DMY", + "catenaXSiteId" : "BPNS000004711DMY", "function" : "production", "functionValidFrom" : "2013-11-17T23:59:54.000Z" } @@ -782,7 +782,7 @@ "sites" : [ { "functionValidUntil" : "2031-10-27T21:24:04.000Z", - "catenaXsiteId" : "BPNS00000003B2OM", + "catenaXSiteId" : "BPNS00000003B2OM", "function" : "production", "functionValidFrom" : "2016-01-29T21:44:37.000Z" } @@ -840,7 +840,7 @@ "sites" : [ { "functionValidUntil" : "2028-09-29T13:56:09.000Z", - "catenaXsiteId" : "BPNS00000003B5MJ", + "catenaXSiteId" : "BPNS00000003B5MJ", "function" : "production", "functionValidFrom" : "2017-01-30T12:55:30.000Z" } @@ -876,7 +876,7 @@ "sites" : [ { "functionValidUntil" : "2028-02-14T21:42:45.000Z", - "catenaXsiteId" : "BPNS00000003B2OM", + "catenaXSiteId" : "BPNS00000003B2OM", "function" : "production", "functionValidFrom" : "2015-07-21T06:33:16.000Z" } @@ -1067,13 +1067,6 @@ } } ] - }, - { - "assetMetaInfo" : { - "catenaXId" : "urn:uuid:e3b2f5e2-5be5-4ea6-98f0-6876de0fcb5f" - }, - "submodels" : [ - ] } ] } From 45823f3cf08843a5da438eb67dee668b05e271ca Mon Sep 17 00:00:00 2001 From: ds-jleyh Date: Thu, 11 Jan 2024 13:23:03 +0100 Subject: [PATCH 49/49] chore(): [TRACEFOSS-XXX] added diagrams for tracex dataimport modul2 and modul3 --- .../data-import-interface.adoc | 26 +++++++++++++++ ...data-import-interface-modul2-sequence.puml | 15 +++++++++ ...data-import-interface-modul2-swimlane.puml | 29 ++++++++++++++++ ...data-import-interface-modul3-sequence.puml | 21 ++++++++++++ ...data-import-interface-modul3-swimlane.puml | 33 +++++++++++++++++++ 5 files changed, 124 insertions(+) create mode 100644 docs/src/docs/arc42/trace-x-data-import-interface/data-import-interface.adoc create mode 100644 docs/src/uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul2-sequence.puml create mode 100644 docs/src/uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul2-swimlane.puml create mode 100644 docs/src/uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul3-sequence.puml create mode 100644 docs/src/uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul3-swimlane.puml diff --git a/docs/src/docs/arc42/trace-x-data-import-interface/data-import-interface.adoc b/docs/src/docs/arc42/trace-x-data-import-interface/data-import-interface.adoc new file mode 100644 index 0000000000..d3afeb74e1 --- /dev/null +++ b/docs/src/docs/arc42/trace-x-data-import-interface/data-import-interface.adoc @@ -0,0 +1,26 @@ += Concept for Trace-X Data Import interface (Data Provider) + +Modul 1 + +Modul 2 +[plantuml, target=modul2-sequence, format=svg] +.... +include::../../../uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul2-sequence.puml[] +.... + +[plantuml, target=modul2-swimlane, format=svg] +.... +include::../../../uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul2-swimlane.puml[] +.... + +Modul 3 +[plantuml, target=modul3-sequence, format=svg] +.... +include::../../../uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul3-sequence.puml[] +.... + +[plantuml, target=modul3-swimlane, format=svg] +.... +include::../../../uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul3-swimlane.puml[] +.... + diff --git a/docs/src/uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul2-sequence.puml b/docs/src/uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul2-sequence.puml new file mode 100644 index 0000000000..9dcb7459b4 --- /dev/null +++ b/docs/src/uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul2-sequence.puml @@ -0,0 +1,15 @@ +@startuml +participant FE +participant BE + +FE -> BE: [001] request assets: GET/assetsAsxxx +BE --> FE: [002] return assets_as_built OR assets_as_planned +FE -> FE: [003] present assets +FE -> BE: [004] select assets to synchronize: GET/policies +BE --> FE: [005] return policies +FE -> FE: [006] open detailview & assign policy (via dropdown) +FE -> BE: [007] register assets for publishing: POST/assets/sync +BE --> FE: [008] update asset state to IN_SYNC +BE -> BE: [008] trigger 'publish AAS Workflow' (Job scheduler) +FE -> FE: [009] refresh of FE view +@enduml diff --git a/docs/src/uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul2-swimlane.puml b/docs/src/uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul2-swimlane.puml new file mode 100644 index 0000000000..d84cf77511 --- /dev/null +++ b/docs/src/uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul2-swimlane.puml @@ -0,0 +1,29 @@ +@startuml +|FE| +start +:request assets; +-> GET/assetsAsxxx; +|#Mistyrose|BE| +:return assets_as_built OR assets_as_planned; +-> response; +|FE| +:present assets; +:select assets to synchronize; +-> GET/policies; +|#Mistyrose|BE| +:return policies; +-> response; +|FE| +:open detailview & assign policy (via dropdown); +:register assets for publishing; +-> POST/assets/sync; +|#Mistyrose|BE| +:update asset state to IN_SYNC; +split +:trigger 'publish AAS Workflow' (Job scheduler); +stop +|FE| +split again +:refresh of FE view; +stop +@enduml diff --git a/docs/src/uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul3-sequence.puml b/docs/src/uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul3-sequence.puml new file mode 100644 index 0000000000..e3902ed4ed --- /dev/null +++ b/docs/src/uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul3-sequence.puml @@ -0,0 +1,21 @@ +@startuml +participant BE +participant EDC +participant Registry +participant Submodels + +BE ->> BE: [001] scheduler job +BE ->> BE: [002] receive list of IN_SYNC_assets +BE ->> EDC: [003] create asset in EDC: POST/create/asset +EDC -->> BE: [004] response +BE ->> EDC: [005] create policy in EDC: POST/create/policy +EDC -->> BE: [006] response +BE ->> EDC: [007] create contract in EDC: POST/create/contract +EDC -->> BE: [008] response +BE ->> Submodels: [009] create submodel: POST/submodel +Submodels -->> BE: [010] +BE ->> Registry: [011] register shell in registry: POST/semantics/registry +Registry -->> BE: [012] +BE ->> BE: [013] update asset state PUBLISHED_TO_CX +BE ->> BE: [014] trigger IRS sync +@enduml diff --git a/docs/src/uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul3-swimlane.puml b/docs/src/uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul3-swimlane.puml new file mode 100644 index 0000000000..e10fae3771 --- /dev/null +++ b/docs/src/uml-diagrams/arc42/trace-x-data-import-interface/trace-x-data-import-interface-modul3-swimlane.puml @@ -0,0 +1,33 @@ +@startuml +|BE| +start +:receive list of IN_SYNC_assets; +:create asset in EDC; +-> POST/create/asset; +|#AntiqueWhite|EDC| +:create EDC asset; +|BE| +:create policy in EDC; +-> POST/create/policy; +|#AntiqueWhite|EDC| +:create policy; +|BE| +:create contract in EDC; +-> POST/create/contract; +|#AntiqueWhite|EDC| +:create contract; +|BE| +:create submodel; +-> POST/submodel; +|#Lavender|Submodel| +:create submodel; +|BE| +:register shell in registry; +|#Mistyrose|Registry| +:register shell; +-> POST/semantic/registry; +|BE| +:update asset state PUBLISHED_TO_CX; +:trigger IRS sync; +stop +@enduml