diff --git a/CHANGELOG.md b/CHANGELOG.md
index efaf0a6f2..efe449765 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Support for pcf v6.0.0 submodel.
- Added controller interface api's for PCF Exchange.
- Added new classes for multiple submodel version support.
+- Added different usecase Handler for multi version support.
- Added refactor code changes for external services.
- Added different usecase Handler for multi version support.
- Added usecase handle implementation for multiple submodel support.
@@ -20,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Supported new single level bom as built submodel with multi version support.
- Removed maven modules serial-part-typization and assembly-part-relationship for update.
- New maven module for part type information submodel support.
+- Refactored/Updated batch maven module to support multi version.
## [2.3.6] - 2024-03-06
### Fixed
diff --git a/modules/sde-submodules/batch/batch.md b/modules/sde-submodules/batch/batch.md
index 42dd7530a..728999b45 100644
--- a/modules/sde-submodules/batch/batch.md
+++ b/modules/sde-submodules/batch/batch.md
@@ -8,33 +8,37 @@ This module use for Batch submodel specification and descriptors. It's contain t
#### Version: 2.0.0
#### Batch Aspect Model URN: urn:bamm:io.catenax.batch:2.0.0#Batch
#### Semantic Id: urn:samm:io.catenax.batch:2.0.0
+
+#### Version: 3.0.0
+#### Batch Aspect Model URN: urn:bamm:io.catenax.batch:3.0.0#Batch
+#### Semantic Id: urn:samm:io.catenax.batch:3.0.0
---
### Schema
Please find below links for schema details:
-- [schema](src/main/resources/batch.json)
+- [batch-v2.0.0 schema](src/main/resources/batch-v2.0.0.json)
+- [batch-v3.0.0 schema](src/main/resources/batch-v2.0.0.json)
### CSV file headers
| Headers Name | Mandatory | Position |
-|------------------------------- |----------------------------- |-------- |
+|------------------------------- ----|----------------------------- |-------- |
| uuid | No | 1 |
| batch_id | No | 2 |
-| part_instance_id | Yes | 3 |
-| manufacturing_date | Yes | 4 |
-| manufacturing_country | No | 5 |
+| part_instance_id | Yes | 3 |
+| manufacturing_date | Yes | 4 |
+| manufacturing_country | No | 5 |
| manufacturer_part_id | Yes | 6 |
-| classification | Yes | 7 |
+| classification | Yes | 7 |
| name_at_manufacturer | Yes | 8 |
#### [CSV Sample File Link]
#### Example for submodel Batch
-
### Work Flow
@@ -44,11 +48,12 @@ Please find below links for schema details:
- UUID generate v4
- DigitalTwins API's calls
- EDC API's calls
+ - BPNDiscovery API Call
- DB Store
### External Services Call
- DigitalTwins
- EDC Connectors
-
-[CSV Sample File Link]: src/main/resources/batch.csv
+ - BPN Discovery
+
diff --git a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/BatchExecutor.java b/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/BatchExecutor.java
deleted file mode 100644
index 922f93e05..000000000
--- a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/BatchExecutor.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2022, 2024 T-Systems International GmbH
- * Copyright (c) 2022, 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.sde.submodels.batch;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.lang3.StringUtils;
-import org.eclipse.tractusx.sde.bpndiscovery.handler.BPNDiscoveryUseCaseHandler;
-import org.eclipse.tractusx.sde.common.constants.CommonConstants;
-import org.eclipse.tractusx.sde.common.entities.PolicyModel;
-import org.eclipse.tractusx.sde.common.entities.csv.RowData;
-import org.eclipse.tractusx.sde.common.exception.CsvHandlerDigitalTwinUseCaseException;
-import org.eclipse.tractusx.sde.common.submodel.executor.SubmodelExecutor;
-import org.eclipse.tractusx.sde.common.submodel.executor.create.steps.impl.CsvParse;
-import org.eclipse.tractusx.sde.common.submodel.executor.create.steps.impl.GenerateUrnUUID;
-import org.eclipse.tractusx.sde.common.submodel.executor.create.steps.impl.JsonRecordFormating;
-import org.eclipse.tractusx.sde.common.submodel.executor.create.steps.impl.JsonRecordValidate;
-import org.eclipse.tractusx.sde.submodels.batch.mapper.BatchMapper;
-import org.eclipse.tractusx.sde.submodels.batch.model.Batch;
-import org.eclipse.tractusx.sde.submodels.batch.service.BatchService;
-import org.eclipse.tractusx.sde.submodels.batch.steps.DigitalTwinsBatchCsvHandlerUseCase;
-import org.eclipse.tractusx.sde.submodels.batch.steps.EDCBatchHandlerUseCase;
-import org.eclipse.tractusx.sde.submodels.batch.steps.StoreBatchCsvHandlerUseCase;
-import org.springframework.stereotype.Component;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.gson.JsonObject;
-
-import lombok.AllArgsConstructor;
-import lombok.SneakyThrows;
-
-@Component
-@AllArgsConstructor
-public class BatchExecutor extends SubmodelExecutor {
-
- private final CsvParse csvParseStep;
-
- private final JsonRecordFormating jsonRecordformater;
-
- private final JsonRecordValidate jsonRecordValidate;
-
- private final GenerateUrnUUID generateUrnUUID;
-
- private final DigitalTwinsBatchCsvHandlerUseCase digitalTwinsBatchCsvHandlerUseCase;
-
- private final EDCBatchHandlerUseCase eDCBatchHandlerUseCase;
-
- private final StoreBatchCsvHandlerUseCase storeBatchCsvHandlerUseCase;
-
- private final BatchMapper batchMapper;
-
- private final BatchService batchDeleteService;
-
- private final BPNDiscoveryUseCaseHandler bPNDiscoveryUseCaseHandler;
-
- @SneakyThrows
- public void executeCsvRecord(RowData rowData, ObjectNode jsonObject, String processId, PolicyModel policy) {
-
- csvParseStep.init(getSubmodelSchema());
- csvParseStep.run(rowData, jsonObject, processId);
-
- nextSteps(rowData.position(), jsonObject, processId, policy);
-
- }
-
- @SneakyThrows
- public void executeJsonRecord(Integer rowIndex, ObjectNode jsonObject, String processId, PolicyModel policy) {
-
- jsonRecordformater.init(getSubmodelSchema());
- jsonRecordformater.run(rowIndex, jsonObject, processId);
-
- nextSteps(rowIndex, jsonObject, processId, policy);
-
- }
-
- @SneakyThrows
- private void nextSteps(Integer rowIndex, ObjectNode jsonObject, String processId, PolicyModel policy)
- throws CsvHandlerDigitalTwinUseCaseException {
- generateUrnUUID.run(jsonObject, processId);
-
- jsonRecordValidate.init(getSubmodelSchema());
- jsonRecordValidate.run(rowIndex, jsonObject);
-
- Batch batch = batchMapper.mapFrom(jsonObject);
-
- digitalTwinsBatchCsvHandlerUseCase.init(getSubmodelSchema());
- digitalTwinsBatchCsvHandlerUseCase.run(batch, policy);
-
- eDCBatchHandlerUseCase.init(getSubmodelSchema());
- eDCBatchHandlerUseCase.run(getNameOfModel(), batch, processId, policy);
-
- if (StringUtils.isBlank(batch.getUpdated())) {
- Map bpnKeyMap = new HashMap<>();
- bpnKeyMap.put(CommonConstants.MANUFACTURER_PART_ID, batch.getManufacturerPartId());
- bPNDiscoveryUseCaseHandler.run(bpnKeyMap);
- }
-
- storeBatchCsvHandlerUseCase.run(batch);
-
- }
-
- @Override
- public List readCreatedTwinsforDelete(String refProcessId) {
- return batchDeleteService.readCreatedTwinsforDelete(refProcessId);
- }
-
- public void executeDeleteRecord(JsonObject jsonObject, String delProcessId, String refProcessId) {
- batchDeleteService.deleteAllDataBySequence(jsonObject);
- }
-
- @Override
- public JsonObject readCreatedTwinsDetails(String uuid) {
- return batchDeleteService.readCreatedTwinsDetails(uuid);
- }
-
- @Override
- public int getUpdatedRecordCount(String processId) {
- return batchDeleteService.getUpdatedData(processId);
- }
-
- @Override
- public List readCreatedTwinsByProcessId(String refProcessId) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void executeDeleteRecord(Integer rowIndex, JsonObject jsonObject, String delProcessId, String refProcessId) {
- // TODO Auto-generated method stub
-
- }
-
-}
\ No newline at end of file
diff --git a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/BatchSubmodel.java b/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/BatchV200.java
similarity index 81%
rename from modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/BatchSubmodel.java
rename to modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/BatchV200.java
index 5352cd2d4..fc8b9a606 100644
--- a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/BatchSubmodel.java
+++ b/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/BatchV200.java
@@ -1,6 +1,6 @@
/********************************************************************************
- * Copyright (c) 2022, 2023 T-Systems International GmbH
- * Copyright (c) 2022, 2023 Contributors to the Eclipse Foundation
+ * Copyright (c) 2024 T-Systems International GmbH
+ * Copyright (c) 2024 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
@@ -23,23 +23,19 @@
import org.eclipse.tractusx.sde.common.extensions.SubmodelExtension;
import org.eclipse.tractusx.sde.common.model.Submodel;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import jakarta.annotation.PostConstruct;
@Component
-public class BatchSubmodel extends SubmodelExtension {
+public class BatchV200 extends SubmodelExtension {
private Submodel submodel = null;
- @Autowired
- private BatchExecutor batchWorkflow;
-
@PostConstruct
public void init() {
- String resource = "batch.json";
+ String resource = "batch-v2.0.0.json";
// this is the path within the jar file
InputStream input = this.getClass().getResourceAsStream("/resources/" + resource);
if (input == null) {
@@ -48,8 +44,6 @@ public void init() {
}
submodel = loadSubmodel(input);
-
- submodel.setExecutor(batchWorkflow);
submodel.addProperties("tableName", "batch");
}
@@ -58,5 +52,4 @@ public void init() {
public Submodel submodel() {
return submodel;
}
-
}
\ No newline at end of file
diff --git a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/BatchV300.java b/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/BatchV300.java
new file mode 100644
index 000000000..4c8b78797
--- /dev/null
+++ b/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/BatchV300.java
@@ -0,0 +1,56 @@
+/********************************************************************************
+ * Copyright (c) 2024 T-Systems International GmbH
+ * 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.sde.submodels.batch;
+
+import java.io.InputStream;
+
+import org.eclipse.tractusx.sde.common.extensions.SubmodelExtension;
+import org.eclipse.tractusx.sde.common.model.Submodel;
+import org.springframework.stereotype.Component;
+
+import jakarta.annotation.PostConstruct;
+
+@Component
+public class BatchV300 extends SubmodelExtension {
+
+ private Submodel submodel = null;
+
+ @PostConstruct
+ public void init() {
+
+ String resource = "batch-v3.0.0.json";
+ // this is the path within the jar file
+ InputStream input = BatchV300.class.getResourceAsStream("/resources/" + resource);
+ if (input == null) {
+ // this is how we load file within editor (eg eclipse)
+ input = this.getClass().getClassLoader().getResourceAsStream(resource);
+ }
+
+ submodel = loadSubmodel(input);
+
+ submodel.addProperties("tableName", "batch_v_300");
+ }
+
+ @Override
+ public Submodel submodel() {
+ return submodel;
+ }
+
+}
diff --git a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/constants/BatchConstants.java b/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/constants/BatchConstants.java
deleted file mode 100644
index 70deeaf52..000000000
--- a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/constants/BatchConstants.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2022, 2023 T-Systems International GmbH
- * Copyright (c) 2022, 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.sde.submodels.batch.constants;
-
-import lombok.Getter;
-
-@Getter
-public class BatchConstants {
-
- private BatchConstants() {
- throw new IllegalStateException("Constant class");
- }
-
- public static final String AS_BUILT = "AsBuilt";
- public static final String BATCH_ID = "batchId";
-
-}
diff --git a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/entity/BatchEntity.java b/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/entity/BatchEntity.java
deleted file mode 100644
index b62a160b6..000000000
--- a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/entity/BatchEntity.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2022, 2024 T-Systems International GmbH
- * Copyright (c) 2022, 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.sde.submodels.batch.entity;
-
-import org.eclipse.tractusx.sde.common.entities.CommonPropEntity;
-
-import jakarta.persistence.Column;
-import jakarta.persistence.Entity;
-import jakarta.persistence.Id;
-import jakarta.persistence.Table;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-@Table(name = "batch")
-@Entity
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class BatchEntity extends CommonPropEntity {
-
- @Id
- @Column(name = "uuid")
- private String uuid;
- @Column(name = "batch_id")
- private String batchId;
- @Column(name = "part_instance_id")
- private String partInstanceId;
- @Column(name = "manufacturing_date")
- private String manufacturingDate;
- @Column(name = "manufacturing_country")
- private String manufacturingCountry;
- @Column(name = "manufacturer_part_id")
- private String manufacturerPartId;
- @Column(name = "classification")
- private String classification;
- @Column(name = "name_at_manufacturer")
- private String nameAtManufacturer;
-
-}
\ No newline at end of file
diff --git a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/mapper/BatchMapper.java b/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/mapper/BatchMapper.java
deleted file mode 100644
index f272c8feb..000000000
--- a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/mapper/BatchMapper.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2022, 2024 T-Systems International GmbH
- * Copyright (c) 2022, 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.sde.submodels.batch.mapper;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.commons.lang3.StringUtils;
-import org.eclipse.tractusx.sde.common.mapper.AspectResponseFactory;
-import org.eclipse.tractusx.sde.common.model.LocalIdentifier;
-import org.eclipse.tractusx.sde.common.model.ManufacturingInformation;
-import org.eclipse.tractusx.sde.common.model.PartTypeInformation;
-import org.eclipse.tractusx.sde.common.model.SubmodelResultResponse;
-import org.eclipse.tractusx.sde.submodels.batch.constants.BatchConstants;
-import org.eclipse.tractusx.sde.submodels.batch.entity.BatchEntity;
-import org.eclipse.tractusx.sde.submodels.batch.model.Batch;
-import org.mapstruct.Mapper;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.gson.Gson;
-import com.google.gson.JsonObject;
-
-import lombok.SneakyThrows;
-
-@Mapper(componentModel = "spring")
-public abstract class BatchMapper {
-
-
- ObjectMapper mapper = new ObjectMapper();
-
- @Autowired
- private AspectResponseFactory aspectResponseFactory;
-
- public abstract Batch mapFrom(BatchEntity batch);
-
- public abstract BatchEntity mapFrom(Batch batch);
-
- @SneakyThrows
- public Batch mapFrom(ObjectNode batch) {
- return mapper.readValue(batch.toString(), Batch.class);
- }
-
- public BatchEntity mapforEntity(JsonObject batch) {
- return new Gson().fromJson(batch, BatchEntity.class);
- }
-
- public JsonObject mapFromEntity(BatchEntity batch) {
- return new Gson().toJsonTree(batch).getAsJsonObject();
- }
-
- public JsonObject mapToResponse(BatchEntity entity) {
-
- if (entity == null) {
- return null;
- }
-
- Batch csvObj = mapFrom(entity);
-
- Set localIdentifiers = new HashSet<>();
- if (StringUtils.isNotBlank(entity.getBatchId()))
- localIdentifiers.add(new LocalIdentifier(BatchConstants.BATCH_ID, entity.getBatchId()));
-
- ManufacturingInformation manufacturingInformation = ManufacturingInformation.builder()
- .date(entity.getManufacturingDate()).country(entity.getManufacturingCountry()).build();
-
- PartTypeInformation partTypeInformation = PartTypeInformation.builder()
- .manufacturerPartId(entity.getManufacturerPartId()).classification(entity.getClassification())
- .nameAtManufacturer(entity.getNameAtManufacturer()).build();
- SubmodelResultResponse build = SubmodelResultResponse.builder().localIdentifiers(localIdentifiers)
- .manufacturingInformation(manufacturingInformation).partTypeInformation(partTypeInformation)
- .catenaXId(entity.getUuid()).build();
-
- return aspectResponseFactory.maptoReponse(csvObj, build);
- }
-}
\ No newline at end of file
diff --git a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/model/Batch.java b/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/model/Batch.java
deleted file mode 100644
index 192e79348..000000000
--- a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/model/Batch.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2022, 2024 T-Systems International GmbH
- * Copyright (c) 2022, 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.sde.submodels.batch.model;
-
-import org.eclipse.tractusx.sde.common.entities.CommonPropEntity;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.NoArgsConstructor;
-
-@Builder
-@Data
-@EqualsAndHashCode(callSuper = false)
-@NoArgsConstructor
-@AllArgsConstructor
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class Batch extends CommonPropEntity {
-
- @JsonProperty(value = "uuid")
- private String uuid;
-
- @JsonProperty(value = "batch_id")
- private String batchId;
-
- @JsonProperty(value = "part_instance_id")
- private String partInstanceId;
-
- @JsonProperty(value = "manufacturing_date")
- private String manufacturingDate;
-
- @JsonProperty(value = "manufacturing_country")
- private String manufacturingCountry;
-
- @JsonProperty(value = "manufacturer_part_id")
- private String manufacturerPartId;
-
- @JsonProperty(value = "customer_part_id")
- private String customerPartId;
-
- @JsonProperty(value = "classification")
- private String classification;
-
- @JsonProperty(value = "name_at_manufacturer")
- private String nameAtManufacturer;
-
- @JsonProperty(value = "name_at_customer")
- private String nameAtCustomer;
-
-}
\ No newline at end of file
diff --git a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/repository/BatchRepository.java b/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/repository/BatchRepository.java
deleted file mode 100644
index 5dade58f4..000000000
--- a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/repository/BatchRepository.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2022, 2023 T-Systems International GmbH
- * Copyright (c) 2022, 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.sde.submodels.batch.repository;
-
-import java.util.List;
-
-import org.eclipse.tractusx.sde.submodels.batch.entity.BatchEntity;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.CrudRepository;
-
-public interface BatchRepository extends CrudRepository {
-
-
- BatchEntity findByUuid(String uuid);
-
- List findByProcessId(String processId);
-
-
- @Query("select count(be) from BatchEntity be where be.updated = ?1 and be.processId = ?2")
- long countByUpdatedAndProcessId(String updated, String processId);
-}
\ No newline at end of file
diff --git a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/service/BatchService.java b/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/service/BatchService.java
deleted file mode 100644
index 01531fb36..000000000
--- a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/service/BatchService.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2022, 2023 T-Systems International GmbH
- * Copyright (c) 2022, 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.sde.submodels.batch.service;
-
-import java.util.List;
-import java.util.Optional;
-
-import org.eclipse.tractusx.sde.common.constants.CommonConstants;
-import org.eclipse.tractusx.sde.common.exception.NoDataFoundException;
-import org.eclipse.tractusx.sde.digitaltwins.facilitator.DigitalTwinsFacilitator;
-import org.eclipse.tractusx.sde.edc.facilitator.DeleteEDCFacilitator;
-import org.eclipse.tractusx.sde.submodels.batch.entity.BatchEntity;
-import org.eclipse.tractusx.sde.submodels.batch.mapper.BatchMapper;
-import org.eclipse.tractusx.sde.submodels.batch.repository.BatchRepository;
-import org.springframework.stereotype.Service;
-
-import com.google.gson.JsonObject;
-
-import lombok.AllArgsConstructor;
-import lombok.SneakyThrows;
-
-@Service
-@AllArgsConstructor
-public class BatchService {
-
- private final BatchRepository batchRepository;
-
- private final BatchMapper batchMapper;
-
- public static final String DELETED_Y = "Y";
-
- private final DeleteEDCFacilitator deleteEDCFacilitator;
-
- private final DigitalTwinsFacilitator deleteDigitalTwinsFacilitator;
-
- public List readCreatedTwinsforDelete(String refProcessId) {
-
- return Optional
- .ofNullable(Optional.ofNullable(batchRepository.findByProcessId(refProcessId)).filter(a -> !a.isEmpty())
- .orElseThrow(() -> new NoDataFoundException(
- String.format("No data found for processid %s ", refProcessId)))
- .stream().filter(e -> !DELETED_Y.equals(e.getDeleted())).map(batchMapper::mapFromEntity)
- .toList())
- .filter(a -> !a.isEmpty()).orElseThrow(
- () -> new NoDataFoundException("No data founds for deletion, All records are already deleted"));
- }
-
- @SneakyThrows
- public void deleteAllDataBySequence(JsonObject jsonObject) {
-
- BatchEntity batchEntity = batchMapper.mapforEntity(jsonObject);
-
- deleteEDCAsset(batchEntity);
-
- deleteDigitalTwinsFacilitator.deleteSubmodelfromShellById(batchEntity.getShellId(),
- batchEntity.getSubModelId());
-
- saveBatchWithDeleted(batchEntity);
- }
-
- @SneakyThrows
- public void deleteEDCAsset(BatchEntity batchEntity) {
-
- deleteEDCFacilitator.deleteContractDefination(batchEntity.getContractDefinationId());
-
- deleteEDCFacilitator.deleteAccessPolicy(batchEntity.getAccessPolicyId());
-
- deleteEDCFacilitator.deleteUsagePolicy(batchEntity.getUsagePolicyId());
-
- deleteEDCFacilitator.deleteAssets(batchEntity.getAssetId());
- }
-
- private void saveBatchWithDeleted(BatchEntity batchEntity) {
- batchEntity.setDeleted(DELETED_Y);
- batchRepository.save(batchEntity);
- }
-
- public JsonObject readCreatedTwinsDetails(String uuid) {
- return batchMapper.mapToResponse(readEntity(uuid));
- }
-
- public BatchEntity readEntity(String uuid) {
- return Optional.ofNullable(batchRepository.findByUuid(uuid))
- .orElseThrow(() -> new NoDataFoundException("No data found uuid " + uuid));
- }
-
- public int getUpdatedData(String refProcessId) {
-
- return (int) batchRepository.countByUpdatedAndProcessId(CommonConstants.UPDATED_Y, refProcessId);
- }
-
-}
diff --git a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/steps/DigitalTwinsBatchCsvHandlerUseCase.java b/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/steps/DigitalTwinsBatchCsvHandlerUseCase.java
deleted file mode 100644
index eebd5d8f3..000000000
--- a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/steps/DigitalTwinsBatchCsvHandlerUseCase.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2022, 2024 T-Systems International GmbH
- * Copyright (c) 2022, 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.sde.submodels.batch.steps;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.lang3.StringUtils;
-import org.eclipse.tractusx.sde.common.constants.CommonConstants;
-import org.eclipse.tractusx.sde.common.entities.PolicyModel;
-import org.eclipse.tractusx.sde.common.exception.CsvHandlerDigitalTwinUseCaseException;
-import org.eclipse.tractusx.sde.common.exception.CsvHandlerUseCaseException;
-import org.eclipse.tractusx.sde.common.submodel.executor.Step;
-import org.eclipse.tractusx.sde.digitaltwins.entities.request.CreateSubModelRequest;
-import org.eclipse.tractusx.sde.digitaltwins.entities.request.ShellDescriptorRequest;
-import org.eclipse.tractusx.sde.digitaltwins.entities.request.ShellLookupRequest;
-import org.eclipse.tractusx.sde.digitaltwins.entities.response.ShellDescriptorResponse;
-import org.eclipse.tractusx.sde.digitaltwins.entities.response.SubModelListResponse;
-import org.eclipse.tractusx.sde.digitaltwins.entities.response.SubModelResponse;
-import org.eclipse.tractusx.sde.digitaltwins.facilitator.DigitalTwinsFacilitator;
-import org.eclipse.tractusx.sde.digitaltwins.facilitator.DigitalTwinsUtility;
-import org.eclipse.tractusx.sde.submodels.batch.constants.BatchConstants;
-import org.eclipse.tractusx.sde.submodels.batch.model.Batch;
-import org.springframework.stereotype.Service;
-
-import lombok.RequiredArgsConstructor;
-import lombok.SneakyThrows;
-
-@Service
-@RequiredArgsConstructor
-public class DigitalTwinsBatchCsvHandlerUseCase extends Step {
-
- private final DigitalTwinsFacilitator digitalTwinsFacilitator;
-
- private final DigitalTwinsUtility digitalTwinsUtility;
-
- @SneakyThrows
- public Batch run(Batch batch, PolicyModel policy) throws CsvHandlerDigitalTwinUseCaseException {
- try {
- return doRun(batch, policy);
- } catch (Exception e) {
- throw new CsvHandlerUseCaseException(batch.getRowNumber(), ": DigitalTwins: " + e.getMessage());
- }
- }
-
- @SneakyThrows
- private Batch doRun(Batch batch, PolicyModel policy) throws CsvHandlerDigitalTwinUseCaseException {
- ShellLookupRequest shellLookupRequest = digitalTwinsUtility.getShellLookupRequest(getSpecificAssetIds(batch));
- List shellIds = digitalTwinsFacilitator.shellLookup(shellLookupRequest);
-
- String shellId;
- ShellDescriptorRequest aasDescriptorRequest = digitalTwinsUtility.getShellDescriptorRequest(
- batch.getNameAtManufacturer()+"_"+batch.getPartInstanceId(), batch.getManufacturerPartId(), batch.getUuid(),
- getSpecificAssetIds(batch), policy);
-
- if (shellIds.isEmpty()) {
-
- logDebug(String.format("No shell id for '%s'", shellLookupRequest.toJsonString()));
- ShellDescriptorResponse result = digitalTwinsFacilitator.createShellDescriptor(aasDescriptorRequest);
- shellId = result.getIdentification();
- logDebug(String.format("Shell created with id '%s'", shellId));
- } else if (shellIds.size() == 1) {
- logDebug(String.format("Shell id found for '%s'", shellLookupRequest.toJsonString()));
- shellId = shellIds.stream().findFirst().orElse(null);
- logDebug(String.format("Shell id '%s'", shellId));
- } else {
- throw new CsvHandlerDigitalTwinUseCaseException(
- String.format("Multiple ids found on aspect %s", shellLookupRequest.toJsonString()));
- }
-
- batch.setShellId(shellId);
- SubModelListResponse subModelResponse = digitalTwinsFacilitator.getSubModels(shellId);
- SubModelResponse foundSubmodel = null;
- if (subModelResponse != null) {
- foundSubmodel = subModelResponse.getResult().stream()
- .filter(x -> getIdShortOfModel().equals(x.getIdShort())).findFirst().orElse(null);
- if (foundSubmodel != null)
- batch.setSubModelId(foundSubmodel.getId());
- }
-
- if (subModelResponse == null || foundSubmodel == null) {
- logDebug(String.format("No submodels for '%s'", shellId));
- CreateSubModelRequest createSubModelRequest = digitalTwinsUtility.getCreateSubModelRequest(
- batch.getShellId(), getsemanticIdOfModel(), getIdShortOfModel(), getNameOfModel(), batch.getUuid(), null);
- digitalTwinsFacilitator.updateShellDetails(shellId, aasDescriptorRequest, createSubModelRequest);
- batch.setSubModelId(createSubModelRequest.getId());
- } else {
- digitalTwinsFacilitator.updateShellDetails(shellId, aasDescriptorRequest, null);
- batch.setUpdated(CommonConstants.UPDATED_Y);
- logDebug("Complete Digital Twins Update Update Digital Twins");
- }
-
- return batch;
- }
-
- private Map getSpecificAssetIds(Batch batch) {
- Map specificIdentifiers = new HashMap<>();
- specificIdentifiers.put(CommonConstants.PART_INSTANCE_ID, batch.getPartInstanceId());
- specificIdentifiers.put(CommonConstants.MANUFACTURER_PART_ID, batch.getManufacturerPartId());
- specificIdentifiers.put(CommonConstants.MANUFACTURER_ID, digitalTwinsUtility.getManufacturerId());
- if (StringUtils.isNotBlank(batch.getBatchId())) {
- specificIdentifiers.put(BatchConstants.BATCH_ID, batch.getBatchId());
- }
-
- return specificIdentifiers;
- }
-}
\ No newline at end of file
diff --git a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/steps/EDCBatchHandlerUseCase.java b/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/steps/EDCBatchHandlerUseCase.java
deleted file mode 100644
index 7cb40e706..000000000
--- a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/steps/EDCBatchHandlerUseCase.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2022, 2024 T-Systems International GmbH
- * Copyright (c) 2022, 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.sde.submodels.batch.steps;
-
-import java.util.Map;
-
-import org.eclipse.tractusx.sde.common.constants.CommonConstants;
-import org.eclipse.tractusx.sde.common.entities.PolicyModel;
-import org.eclipse.tractusx.sde.common.exception.CsvHandlerUseCaseException;
-import org.eclipse.tractusx.sde.common.exception.NoDataFoundException;
-import org.eclipse.tractusx.sde.common.exception.ServiceException;
-import org.eclipse.tractusx.sde.common.submodel.executor.Step;
-import org.eclipse.tractusx.sde.edc.entities.request.asset.AssetEntryRequest;
-import org.eclipse.tractusx.sde.edc.entities.request.asset.AssetEntryRequestFactory;
-import org.eclipse.tractusx.sde.edc.facilitator.CreateEDCAssetFacilator;
-import org.eclipse.tractusx.sde.edc.facilitator.DeleteEDCFacilitator;
-import org.eclipse.tractusx.sde.edc.gateways.external.EDCGateway;
-import org.eclipse.tractusx.sde.submodels.batch.entity.BatchEntity;
-import org.eclipse.tractusx.sde.submodels.batch.model.Batch;
-import org.eclipse.tractusx.sde.submodels.batch.service.BatchService;
-import org.springframework.stereotype.Service;
-
-import lombok.RequiredArgsConstructor;
-import lombok.SneakyThrows;
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Service
-@RequiredArgsConstructor
-public class EDCBatchHandlerUseCase extends Step {
-
- private final AssetEntryRequestFactory assetFactory;
- private final EDCGateway edcGateway;
- private final CreateEDCAssetFacilator createEDCAssetFacilator;
- private final BatchService batchDeleteService;
- private final DeleteEDCFacilitator deleteEDCFacilitator;
-
- @SneakyThrows
- public Batch run(String submodel, Batch input, String processId, PolicyModel policy) {
- String shellId = input.getShellId();
- String subModelId = input.getSubModelId();
-
- try {
-
- AssetEntryRequest assetEntryRequest = assetFactory.getAssetRequest(submodel,
- getSubmodelShortDescriptionOfModel(), shellId, subModelId, input.getUuid(), null, null, null);
-
- Map eDCAsset = null;
-
- if (!edcGateway.assetExistsLookup(assetEntryRequest.getId())) {
- eDCAsset = createEDCAssetFacilator.createEDCAsset(assetEntryRequest, policy);
- } else {
- eDCAsset = createEDCAssetFacilator.updateEDCAsset(assetEntryRequest, policy);
- input.setUpdated(CommonConstants.UPDATED_Y);
- }
-
- // EDC transaction information for DB
- input.setAssetId(eDCAsset.get("assetId"));
- input.setAccessPolicyId(eDCAsset.get("accessPolicyId"));
- input.setUsagePolicyId(eDCAsset.get("usagePolicyId"));
- input.setContractDefinationId(eDCAsset.get("contractDefinitionId"));
-
- return input;
- } catch (Exception e) {
- throw new CsvHandlerUseCaseException(input.getRowNumber(), "EDC: " + e.getMessage());
- }
- }
-
- @SneakyThrows
- private void deleteEDCFirstForUpdate(String submodel, Batch input, String processId) {
- try {
- BatchEntity batchEntity = batchDeleteService.readEntity(input.getUuid());
- batchDeleteService.deleteEDCAsset(batchEntity);
- } catch (NoDataFoundException e) {
- log.warn(
- "The EDC assetInfo not found in local database for delete, looking EDC connector and going to delete asset");
- deleteEDCFacilitator.findEDCOfferInformation(input.getShellId(), input.getSubModelId());
- } catch (Exception e) {
- if (!e.getMessage().contains("404 Not Found")) {
- throw new ServiceException("Unable to delete EDC offer for update: " + e.getMessage());
- }
- }
- }
-
- @SneakyThrows
- private void edcProcessingforBatch(AssetEntryRequest assetEntryRequest, Batch input, PolicyModel policy) {
-
- Map createEDCAsset = createEDCAssetFacilator.createEDCAsset(assetEntryRequest, policy);
-
- // EDC transaction information for DB
- input.setAssetId(assetEntryRequest.getId());
- input.setAccessPolicyId(createEDCAsset.get("accessPolicyId"));
- input.setUsagePolicyId(createEDCAsset.get("usagePolicyId"));
- input.setContractDefinationId(createEDCAsset.get("contractDefinitionId"));
- }
-}
diff --git a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/steps/StoreBatchCsvHandlerUseCase.java b/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/steps/StoreBatchCsvHandlerUseCase.java
deleted file mode 100644
index cad800f4e..000000000
--- a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/steps/StoreBatchCsvHandlerUseCase.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2022, 2023 T-Systems International GmbH
- * Copyright (c) 2022, 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.sde.submodels.batch.steps;
-
-import org.eclipse.tractusx.sde.common.submodel.executor.Step;
-import org.eclipse.tractusx.sde.submodels.batch.entity.BatchEntity;
-import org.eclipse.tractusx.sde.submodels.batch.mapper.BatchMapper;
-import org.eclipse.tractusx.sde.submodels.batch.model.Batch;
-import org.eclipse.tractusx.sde.submodels.batch.repository.BatchRepository;
-import org.springframework.stereotype.Service;
-
-@Service
-public class StoreBatchCsvHandlerUseCase extends Step {
-
- private final BatchRepository batchRepository;
- private final BatchMapper batchMapper;
-
- public StoreBatchCsvHandlerUseCase(BatchRepository batchRepository, BatchMapper mapper) {
- this.batchRepository = batchRepository;
- this.batchMapper = mapper;
- }
-
- public Batch run(Batch input) {
- BatchEntity entity = batchMapper.mapFrom(input);
- batchRepository.save(entity);
-
- return input;
- }
-}
\ No newline at end of file
diff --git a/modules/sde-submodules/batch/src/main/resources/batch.json b/modules/sde-submodules/batch/src/main/resources/batch-v2.0.0.json
similarity index 87%
rename from modules/sde-submodules/batch/src/main/resources/batch.json
rename to modules/sde-submodules/batch/src/main/resources/batch-v2.0.0.json
index 71fcf2c07..93dec0719 100644
--- a/modules/sde-submodules/batch/src/main/resources/batch.json
+++ b/modules/sde-submodules/batch/src/main/resources/batch-v2.0.0.json
@@ -322,5 +322,44 @@
"classification": "component",
"name_at_manufacturer": "Sensor"
}
- ]
+ ],
+ "addOn": {
+ "identifier": "${uuid}",
+ "lookupShellSpecificAssetIdsSpecs": {
+ "partInstanceId": "${part_instance_id}",
+ "manufacturerPartId": "${manufacturer_part_id}",
+ "optionalIdentifier": [
+ {
+ "key": "batchId",
+ "value" :"${batch_id}"
+ }
+ ]
+ },
+ "shortIdSpecs": [
+ "${name_at_manufacturer}",
+ "${part_instance_id}",
+ "${manufacturer_part_id}"
+ ],
+ "bpnDiscoverySpecs": {
+ "manufacturerPartId": "${manufacturer_part_id}"
+ },
+ "responseTemplate": {
+ "localIdentifiers": [
+ {
+ "key": "batchId",
+ "value": "${batch_id}"
+ }
+ ],
+ "manufacturingInformation": {
+ "date": "${manufacturing_date}",
+ "country": "${manufacturing_country}"
+ },
+ "catenaXId": "${uuid}",
+ "partTypeInformation": {
+ "manufacturerPartId": "${manufacturer_part_id}",
+ "classification": "${classification}",
+ "nameAtManufacturer": "${name_at_manufacturer}"
+ }
+ }
+ }
}
diff --git a/modules/sde-submodules/batch/src/main/resources/batch-v3.0.0.json b/modules/sde-submodules/batch/src/main/resources/batch-v3.0.0.json
new file mode 100644
index 000000000..93f34e3c2
--- /dev/null
+++ b/modules/sde-submodules/batch/src/main/resources/batch-v3.0.0.json
@@ -0,0 +1,428 @@
+{
+ "$schema": "https://json-schema.org/draft/2019-09/schema",
+ "$id": "http://example.com/example.json",
+ "type": "array",
+ "id": "batch_300",
+ "idShort": "Batch",
+ "version": "3.0.0",
+ "semantic_id": "urn:samm:io.catenax.batch:3.0.0#Batch",
+ "title": "Batch",
+ "shortDescription": "BoM AsBuilt - Submodel Batch",
+ "description": "A batch is a quantity of (semi-) finished products or (raw) material product that have been produced under the same circumstances (e.g. same production location), as specified groups or amounts, within a certain time frame. Every batch can differ in the number or amount of products. Different batches can have varied specifications, e.g., different colors. A batch is identified via a Batch ID.",
+ "items": {
+ "type": "object",
+ "required": [
+ "part_instance_id",
+ "manufacturing_date",
+ "catenax_site_id",
+ "function",
+ "manufacturer_part_id",
+ "classification_standard",
+ "classification_id",
+ "name_at_manufacturer"
+ ],
+ "dependentRequired": {},
+ "properties": {
+ "uuid": {
+ "type": [
+ "string",
+ "null"
+ ],
+ "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}$",
+ "title": "UUID URN",
+ "description": "The fully anonymous Catena-X ID of the batch, valid for the Catena-X dataspace. The provided regular expression ensures that the UUID is composed of five groups of characters separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters (32 hexadecimal characters and 4 hyphens), optionally prefixed by 'urn:uuid:' to make it an IRI.",
+ "examples": [
+ "urn:uuid:8eea5f45-0823-48ce-a4fc-c3bf1cdfa4c2"
+ ]
+ },
+ "batch_id": {
+ "type": [
+ "string",
+ "null"
+ ],
+ "title": "Batch ID",
+ "description": "The batch number of the batch from the manufacturer. We assume here that the customer does not have or create its own batch number for a batch, but just used the manufacturer's batch number.",
+ "examples": [
+ "NO-159040131155901488695376"
+ ]
+ },
+ "part_instance_id": {
+ "type": [
+ "string"
+ ],
+ "title": "Part Instance ID",
+ "description": "The serial number of the serialized part from the manufacturer. We assume here that the customer does not have or create its own serial number for a part, but just used the manufacturer's serial number.",
+ "minLength": 1,
+ "examples": [
+ "PINO04013115590"
+ ]
+ },
+ "manufacturing_date": {
+ "type": [
+ "string"
+ ],
+ "format": "date-time",
+ "title": "Manufacturing Date",
+ "pattern": "^(?:[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(?:[.][0-9]+)?Z|[0-9]{4}-[0-9]{2}-[0-9]{2}(?:T[0-9]{2}:[0-9]{2}:[0-9]{2}(?:[.][0-9]+)?(?:Z|[+-][0-9]{2}:[0-9]{2}))?)$",
+ "description": "Timestamp of the manufacturing date as the final step in production process (e.g. final quality check, ready-for-shipment event)",
+ "examples": [
+ "2022-02-04T14:48:54"
+ ]
+ },
+ "manufacturing_country": {
+ "type": [
+ "string",
+ "null"
+ ],
+ "enum": [
+ "",
+ "AUS",
+ "ALB",
+ "DZA",
+ "AND",
+ "AGO",
+ "AIA",
+ "ATG",
+ "ARG",
+ "ARM",
+ "ABW",
+ "AUT",
+ "AZE",
+ "BHS",
+ "BHR",
+ "BRB",
+ "BEL",
+ "BLZ",
+ "BEN",
+ "BMU",
+ "BTN",
+ "BOL",
+ "BIH",
+ "BWA",
+ "BRA",
+ "VGB",
+ "BRN",
+ "BGR",
+ "BFA",
+ "BDI",
+ "KHM",
+ "CAN",
+ "CPV",
+ "CYM",
+ "TCD",
+ "CHL",
+ "CHN",
+ "COL",
+ "COM",
+ "COK",
+ "CRI",
+ "HRV",
+ "CYP",
+ "CZE",
+ "COD",
+ "DNK",
+ "DJI",
+ "DMA",
+ "DOM",
+ "ECU",
+ "SLV",
+ "ERI",
+ "EST",
+ "ETH",
+ "FLK",
+ "FRO",
+ "FSM",
+ "FJI",
+ "FIN",
+ "FRA",
+ "GUF",
+ "PYF",
+ "GAB",
+ "GMB",
+ "DEU",
+ "GIB",
+ "GRC",
+ "GRL",
+ "GRD",
+ "GLP",
+ "GTM",
+ "GIN",
+ "GNB",
+ "GUY",
+ "HND",
+ "HKG",
+ "HUN",
+ "ISL",
+ "IND",
+ "IDN",
+ "IRL",
+ "ISR",
+ "ITA",
+ "JAM",
+ "JPN",
+ "JOR",
+ "KAZ",
+ "KEN",
+ "KIR",
+ "KWT",
+ "KGZ",
+ "LAO",
+ "LVA",
+ "LSO",
+ "LIE",
+ "LTU",
+ "LUX",
+ "MDG",
+ "MWI",
+ "MYS",
+ "MDV",
+ "MLI",
+ "MLT",
+ "MHL",
+ "MTQ",
+ "MRT",
+ "MUS",
+ "MYT",
+ "MEX",
+ "MNG",
+ "MSR",
+ "MAR",
+ "MOZ",
+ "NAM",
+ "NRU",
+ "NPL",
+ "NLD",
+ "ANT",
+ "NCL",
+ "NZL",
+ "NIC",
+ "NER",
+ "NIU",
+ "NFK",
+ "NOR",
+ "OMN",
+ "PLW",
+ "PAN",
+ "PNG",
+ "PER",
+ "PHL",
+ "PCN",
+ "POL",
+ "PRT",
+ "QAT",
+ "REU",
+ "ROM",
+ "RUS",
+ "RWA",
+ "VCT",
+ "WSM",
+ "SMR",
+ "STP",
+ "SAU",
+ "SEN",
+ "SYC",
+ "SLE",
+ "SGP",
+ "SVK",
+ "SVN",
+ "SLB",
+ "SOM",
+ "ZAF",
+ "KOR",
+ "ESP",
+ "LKA",
+ "SHN",
+ "KNA",
+ "LCA",
+ "SPM",
+ "SUR",
+ "SJM",
+ "SWZ",
+ "SWE",
+ "CHE",
+ "TWN",
+ "TJK",
+ "TZA",
+ "THA",
+ "TGO",
+ "TON",
+ "TTO",
+ "TUN",
+ "TUR",
+ "TKM",
+ "TCA",
+ "TUV",
+ "UGA",
+ "UKR",
+ "ARE",
+ "GBR",
+ "USA",
+ "URY",
+ "VUT",
+ "VAT",
+ "VEN",
+ "VNM",
+ "WLF",
+ "YEM",
+ "ZMB"
+ ],
+ "title": "Manufacturing Country",
+ "description": "Country code where the part was manufactured",
+ "examples": [
+ "DEU"
+ ]
+ },
+ "catenax_site_id": {
+ "type": [
+ "string"
+ ],
+ "title": "CatenaX site Id",
+ "minLength": 1,
+ "pattern": "^BPNS[a-zA-Z0-9]{12}$",
+ "description": "The identifier of the site according to Catena-X BPDM. The catenaXsiteId must be a valid Catena-X BPN. The BPN is a unique, unchangeable identifier for Business Partners / company locations from foundation to closure, regardless of the different business relationships / structures between or within the Business Partners or company locations.",
+ "examples": [
+ "BPNS1234567890ZZ"
+ ]
+ },
+ "function": {
+ "type": [
+ "string"
+ ],
+ "enum": [
+ "production",
+ "warehouse",
+ "spare part warehouse"
+ ],
+ "title": "function",
+ "minLength": 1,
+ "description": "The function of the site in relation to the part(i.e. the activity within the value chain of the part that is performed at the site)",
+ "examples": [
+ "production"
+ ]
+ },
+ "manufacturer_part_id": {
+ "type": [
+ "string"
+ ],
+ "minLength": 1,
+ "title": "Manufacturer Part ID",
+ "description": "Part ID as assigned by the manufacturer of the part. The Part ID identifies the part (as designed) in the manufacturer`s dataspace. The Part ID does not reference a specific instance of a part and thus should not be confused with the serial number or batch number.",
+ "examples": [
+ "37754B7-76"
+ ]
+ },
+ "name_at_manufacturer": {
+ "type": [
+ "string"
+ ],
+ "minLength": 1,
+ "title": "Name At Manufacturer",
+ "description": "Name of the part as assigned by the manufacturer",
+ "examples": [
+ "Sensor"
+ ]
+ },
+ "classification_standard": {
+ "type": [
+ "string"
+ ],
+ "minLength": 1,
+ "title": "Classification Standard",
+ "description": "Identified classification standards that align to the Catena-X needs.",
+ "examples": [
+ "IEC"
+ ]
+ },
+ "classification_id": {
+ "type": [
+ "string"
+ ],
+ "minLength": 1,
+ "title": "Classification ID",
+ "description": "The classification ID of the part type according to the corresponding standard definition mentioned in the key value pair.",
+ "examples": [
+ "61360- 2:2012"
+ ]
+ },
+ "classification_description": {
+ "type": [
+ "string",
+ "null"
+ ],
+ "title": "Classification Description",
+ "description": "Optional property describing the classification standard.",
+ "examples": [
+ "Standard data element types with associated classification scheme for electric components."
+ ]
+ }
+ }
+ },
+ "examples": [
+ {
+ "uuid": "urn:uuid:8eea5f45-0823-48ce-a4fc-c3bf1cdfa4c2",
+ "batch_id": "NO-159040131155901488695376",
+ "part_instance_id": "PINO-34634534535",
+ "manufacturing_date": "2022-02-04T14:48:54.709Z",
+ "manufacturing_country": "DEU",
+ "catenax_site_id": "BPNS1234567890ZZ",
+ "function": "production",
+ "manufacturer_part_id": "37754B7-76",
+ "name_at_manufacturer": "Sensor",
+ "classification_standard": "IEC",
+ "classification_id": "61360- 2:2012 ",
+ "classification_description": "Standard data element types with associated classification scheme for electric components."
+ }
+ ],
+ "addOn": {
+ "identifier": "${uuid}",
+ "lookupShellSpecificAssetIdsSpecs": {
+ "partInstanceId": "${part_instance_id}",
+ "manufacturerPartId": "${manufacturer_part_id}",
+ "optionalIdentifier": [
+ {
+ "key": "batchId",
+ "value" :"${batch_id}"
+ }
+ ]
+ },
+ "shortIdSpecs": [
+ "${name_at_manufacturer}",
+ "${part_instance_id}",
+ "${manufacturer_part_id}"
+ ],
+ "bpnDiscoverySpecs": {
+ "manufacturerPartId": "${manufacturer_part_id}"
+ },
+ "responseTemplate": {
+ "localIdentifiers": [
+ {
+ "key": "batchId",
+ "value": "${batch_id}"
+ }
+ ],
+ "manufacturingInformation": {
+ "date": "${manufacturing_date}",
+ "country": "${manufacturing_country}",
+ "sites": [
+ {
+ "catenaXsiteId": "${catenax_site_id}",
+ "function": "${function}"
+ }
+ ]
+
+ },
+ "catenaXId": "${uuid}",
+ "partTypeInformation": {
+ "partClassification": [
+ {
+ "classificationStandard": "${classification_standard}",
+ "classificationID": "${classification_id}",
+ "classificationDescription": "${classification_description}"
+ }
+ ],
+ "manufacturerPartId": "${manufacturer_part_id}",
+ "nameAtManufacturer": "${name_at_manufacturer}"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/modules/sde-submodules/batch/src/main/resources/batch.csv b/modules/sde-submodules/batch/src/main/resources/batch.csv
deleted file mode 100644
index dacea3033..000000000
--- a/modules/sde-submodules/batch/src/main/resources/batch.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-uuid;batch_id;part_instance_id;manufacturing_date;manufacturing_country;manufacturer_part_id;classification;name_at_manufacturer;
-urn:uuid:8eea5f45-0823-48ce-a4fc-c3bf1f8ff4c2;BIDNO345678;PIDNO678905;2022-02-05T14:48:54;HUR;122-0.740-3430-A;product;Mirror left
\ No newline at end of file
diff --git a/modules/sde-submodules/batch/src/main/resources/images/batch.png b/modules/sde-submodules/batch/src/main/resources/images/batch.png
deleted file mode 100644
index cd1f7d087..000000000
Binary files a/modules/sde-submodules/batch/src/main/resources/images/batch.png and /dev/null differ