From a5e34a72189f797aec29c5af3be332235f60be7e Mon Sep 17 00:00:00 2001 From: Sachin Argade Date: Tue, 5 Sep 2023 14:07:15 +0530 Subject: [PATCH 1/6] PCF final working version --- modules/sde-core/pom.xml | 5 + .../sde-core/src/main/resources/use-case.json | 3 +- .../sde/submodels/pcf/mapper/PcfMapper.java | 102 ++++++++++++++++- .../sde/submodels/pcf/model/CompanyIds.java | 33 ++++++ .../pcf/model/CrossSectoralStandardsUsed.java | 33 ++++++ .../pcf/model/DataQualityRating.java | 38 ++++++ .../tractusx/sde/submodels/pcf/model/Pcf.java | 108 ++++++++++++++++++ .../pcf/model/PcfSubmodelResponse.java | 56 +++++++++ .../submodels/pcf/model/PrecedingPfIds.java | 33 ++++++ .../sde/submodels/pcf/model/ProductIds.java | 33 ++++++ .../model/ProductOrSectorSpecificRule.java | 33 ++++++ .../model/ProductOrSectorSpecificRules.java | 42 +++++++ .../model/SecondaryEmissionFactorSources.java | 32 ++++++ 13 files changed, 549 insertions(+), 2 deletions(-) create mode 100644 modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/CompanyIds.java create mode 100644 modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/CrossSectoralStandardsUsed.java create mode 100644 modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/DataQualityRating.java create mode 100644 modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/Pcf.java create mode 100644 modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/PcfSubmodelResponse.java create mode 100644 modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/PrecedingPfIds.java create mode 100644 modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/ProductIds.java create mode 100644 modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/ProductOrSectorSpecificRule.java create mode 100644 modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/ProductOrSectorSpecificRules.java create mode 100644 modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/SecondaryEmissionFactorSources.java diff --git a/modules/sde-core/pom.xml b/modules/sde-core/pom.xml index 3d3317896..3d0cb2080 100644 --- a/modules/sde-core/pom.xml +++ b/modules/sde-core/pom.xml @@ -172,6 +172,11 @@ single-level-usage-as-built 0.0.1 + + org.eclipse.tractusx + pcf + 0.0.1 + diff --git a/modules/sde-core/src/main/resources/use-case.json b/modules/sde-core/src/main/resources/use-case.json index 9ecb129b9..0bb57f2cf 100644 --- a/modules/sde-core/src/main/resources/use-case.json +++ b/modules/sde-core/src/main/resources/use-case.json @@ -31,7 +31,8 @@ "serialpart", "singlelevelbomasbuilt", "batch", - "singlelevelusageasbuilt" + "singlelevelusageasbuilt", + "pcf" ] }, { diff --git a/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/mapper/PcfMapper.java b/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/mapper/PcfMapper.java index afa2d43c1..ffc0cb6ae 100644 --- a/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/mapper/PcfMapper.java +++ b/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/mapper/PcfMapper.java @@ -19,8 +19,20 @@ ********************************************************************************/ package org.eclipse.tractusx.sde.submodels.pcf.mapper; +import java.util.List; + import org.eclipse.tractusx.sde.submodels.pcf.entity.PcfEntity; +import org.eclipse.tractusx.sde.submodels.pcf.model.CompanyIds; +import org.eclipse.tractusx.sde.submodels.pcf.model.CrossSectoralStandardsUsed; +import org.eclipse.tractusx.sde.submodels.pcf.model.DataQualityRating; +import org.eclipse.tractusx.sde.submodels.pcf.model.Pcf; import org.eclipse.tractusx.sde.submodels.pcf.model.PcfAspect; +import org.eclipse.tractusx.sde.submodels.pcf.model.PcfSubmodelResponse; +import org.eclipse.tractusx.sde.submodels.pcf.model.PrecedingPfIds; +import org.eclipse.tractusx.sde.submodels.pcf.model.ProductIds; +import org.eclipse.tractusx.sde.submodels.pcf.model.ProductOrSectorSpecificRule; +import org.eclipse.tractusx.sde.submodels.pcf.model.ProductOrSectorSpecificRules; +import org.eclipse.tractusx.sde.submodels.pcf.model.SecondaryEmissionFactorSources; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.springframework.beans.factory.annotation.Value; @@ -65,7 +77,95 @@ public JsonObject mapToResponse(PcfEntity entity) { return null; } - return null; + Pcf pcfResponse = Pcf.builder() + .biogenicCarbonEmissionsOtherThanCO2(entity.getBiogenicCarbonEmissionsOtherThanCO2()) + .distributionStagePcfExcludingBiogenic(entity.getDistributionStagePcfExcludingBiogenic()) + .distributionStagePcfIncludingBiogenic(entity.getDistributionStagePcfIncludingBiogenic()) + .biogenicCarbonWithdrawal(entity.getBiogenicCarbonWithdrawal()) + .distributionStageBiogenicCarbonEmissionsOtherThanCO2(entity.getDistributionStageBiogenicCarbonEmissionsOtherThanCO2()) + .extWBCSDAllocationRulesDescription(entity.getExtWBCSDAllocationRulesDescription()) + .exemptedEmissionsDescription(entity.getExemptedEmissionsDescription()) + .distributionStageFossilGhgEmissions(entity.getDistributionStageFossilGhgEmissions()) + .exemptedEmissionsPercent(entity.getExemptedEmissionsPercent()) + .geographyCountrySubdivision(entity.getGeographyCountrySubdivision()) + .extTFSLuGhgEmissions(entity.getExtTFSLuGhgEmissions()) + .distributionStageBiogenicCarbonWithdrawal(entity.getDistributionStageBiogenicCarbonWithdrawal()) + .pcfIncludingBiogenic(entity.getPcfIncludingBiogenic()) + .aircraftGhgEmissions(entity.getAircraftGhgEmissions()) + .productMassPerDeclaredUnit(entity.getProductMassPerDeclaredUnit()) + .productOrSectorSpecificRules(List.of(ProductOrSectorSpecificRules.builder() + .extWBCSDOperator(entity.getExtWBCSDOperator()) + .productOrSectorSpecificRulesObj(ProductOrSectorSpecificRule.builder() + .ruleName(entity.getRuleName()) + .build()) + .extWBCSDOtherOperatorName(entity.getExtWBCSDOtherOperatorName()) + .build())) + .extTFSAllocationWasteIncineration(entity.getExtTFSAllocationWasteIncineration()) + .pcfExcludingBiogenic(entity.getPcfExcludingBiogenic()) + .referencePeriodEnd(entity.getReferencePeriodEnd()) + .extWBCSDCharacterizationFactors(entity.getExtWBCSDCharacterizationFactors()) + .secondaryEmissionFactorSources(List.of(SecondaryEmissionFactorSources.builder() + .secondaryEmissionFactorSource(entity.getSecondaryEmissionFactorSource()) + .build())) + .unitaryProductAmount(entity.getUnitaryProductAmount()) + .declaredUnit(entity.getDeclaredUnit()) + .referencePeriodStart(entity.getReferencePeriodStart()) + .geographyRegionOrSubregion(entity.getGeographyRegionOrSubregion()) + .fossilGhgEmissions(entity.getFossilGhgEmissions()) + .extWBCSDPackagingGhgEmissions(entity.getExtWBCSDPackagingGhgEmissions()) + .boundaryProcessesDescription(entity.getBoundaryProcessesDescription()) + .geographyCountry(entity.getGeographyCountry()) + .extWBCSDPackagingEmissionsIncluded(Boolean.parseBoolean(entity.getExtWBCSDPackagingEmissionsIncluded())) + .dlucGhgEmissions(entity.getDlucGhgEmissions()) + .carbonContentTotal(entity.getCarbonContentTotal()) + .extTFSDistributionStageLuGhgEmissions(entity.getExtTFSDistributionStageLuGhgEmissions()) + .extTFSDistributionStageDlucGhgEmissions(entity.getExtTFSDistributionStageDlucGhgEmissions()) + .primaryDataShare(entity.getPrimaryDataShare()) + .dataQualityRating(DataQualityRating.builder() + .completenessDQR(entity.getCompletenessDQR()) + .technologicalDQR(entity.getTechnologicalDQR()) + .geographicalDQR(entity.getGeographicalDQR()) + .temporalDQR(entity.getTemporalDQR()) + .reliabilityDQR(entity.getReliabilityDQR()) + .coveragePercent(entity.getCoveragePercent()) + .build()) + .extWBCSDFossilCarbonContent(entity.getExtWBCSDFossilCarbonContent()) + .crossSectoralStandardsUsed(List.of(CrossSectoralStandardsUsed.builder() + .crossSectoralStandard(entity.getCrossSectoralStandard()) + .build())) + .extTFSAllocationWasteIncineration(entity.getExtTFSAllocationWasteIncineration()) + .carbonContentBiogenic(entity.getCarbonContentBiogenic()) + .build(); + + + return new Gson().toJsonTree(PcfSubmodelResponse.builder() + .specVersion(entity.getSpecVersion()) + .companyIds(CompanyIds.builder() + .companyId(entity.getCompanyId()) + .build()) + .extWBCSDProductCodeCpc(entity.getExtWBCSDProductCodeCpc()) + .created(entity.getCreated()) + .companyName(entity.getCompanyName()) + .extWBCSDPfStatus(entity.getExtWBCSDPfStatus()) + .version(entity.getVersion()) + .productName(entity.getProductName()) + .pcf(pcfResponse) + .partialFullPcf(entity.getPartialFullPcf()) + .productIds(ProductIds.builder() + .productId(entity.getProductId()) + .build()) + + .validityPeriodStart(entity.getValidityPeriodStart()) + .comment(entity.getComment()) + .id(entity.getId()) + .validityPeriodEnd(entity.getValidityPeriodEnd()) + .pcfLegalStatement(entity.getPcfLegalStatement()) + .productDescription(entity.getProductDescription()) + + .precedingPfIds(PrecedingPfIds.builder() + .id(entity.getPrecedingPfId()) + .build()) + .build()).getAsJsonObject(); } diff --git a/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/CompanyIds.java b/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/CompanyIds.java new file mode 100644 index 000000000..ea4dbb9e2 --- /dev/null +++ b/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/CompanyIds.java @@ -0,0 +1,33 @@ +/******************************************************************************** + * Copyright (c) 2023 T-Systems International GmbH + * 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.sde.submodels.pcf.model; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; + +@Builder +@Data +@AllArgsConstructor +public class CompanyIds { + + private String companyId; + +} diff --git a/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/CrossSectoralStandardsUsed.java b/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/CrossSectoralStandardsUsed.java new file mode 100644 index 000000000..e214de888 --- /dev/null +++ b/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/CrossSectoralStandardsUsed.java @@ -0,0 +1,33 @@ +/******************************************************************************** + * Copyright (c) 2023 T-Systems International GmbH + * 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.sde.submodels.pcf.model; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; + +@Builder +@Data +@AllArgsConstructor +public class CrossSectoralStandardsUsed { + + private String crossSectoralStandard; + +} diff --git a/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/DataQualityRating.java b/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/DataQualityRating.java new file mode 100644 index 000000000..9a660d4ce --- /dev/null +++ b/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/DataQualityRating.java @@ -0,0 +1,38 @@ +/******************************************************************************** + * Copyright (c) 2023 T-Systems International GmbH + * 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.sde.submodels.pcf.model; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; + +@Builder +@Data +@AllArgsConstructor +public class DataQualityRating { + + private double completenessDQR; + private double technologicalDQR; + private double geographicalDQR; + private double temporalDQR; + private double reliabilityDQR; + private double coveragePercent; + +} diff --git a/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/Pcf.java b/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/Pcf.java new file mode 100644 index 000000000..c376c368d --- /dev/null +++ b/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/Pcf.java @@ -0,0 +1,108 @@ +/******************************************************************************** + * Copyright (c) 2023 T-Systems International GmbH + * 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.sde.submodels.pcf.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; + +@Builder +@Data +@AllArgsConstructor +public class Pcf { + + private List productOrSectorSpecificRules; + private List secondaryEmissionFactorSources; + + private DataQualityRating dataQualityRating; + + private List crossSectoralStandardsUsed; + + private double biogenicCarbonEmissionsOtherThanCO2; // 1.0, + private double distributionStagePcfExcludingBiogenic; // 1.5, + private double biogenicCarbonWithdrawal; // 0.0, + private double distributionStageBiogenicCarbonEmissionsOtherThanCO2; // 1.0, + + @SerializedName("extWBCSD_allocationRulesDescription") + private String extWBCSDAllocationRulesDescription;//In accordance with Catena-X PCF Rulebook + + private String exemptedEmissionsDescription;//No exemption + private double distributionStageFossilGhgEmissions; // 0.5, + private double exemptedEmissionsPercent; // 0.0, + private String geographyCountrySubdivision;//US-NY + + @SerializedName("extTFS_luGhgEmissions") + private double extTFSLuGhgEmissions; // 0.3, + private double distributionStageBiogenicCarbonWithdrawal; // 0.5, + private double pcfIncludingBiogenic; // 1.0, + private double aircraftGhgEmissions; // 0.0, + private double productMassPerDeclaredUnit; // 0.456, + + @SerializedName("extWBCSD_operator") + private String extWBCSDOperator;//PEF + + private String ruleName;//urn:tfs-initiative.com:PCR:The Product Carbon Footprint Guideline for the Chemical Industry:version:v2.0 + + @SerializedName("extWBCSD_otherOperatorName") + private String extWBCSDOtherOperatorName;//NSF + + @SerializedName("extTFS_allocationWasteIncineration") + private String extTFSAllocationWasteIncineration;//cut-off + private double pcfExcludingBiogenic; // 2.0, + private String referencePeriodEnd;//2022-12-31T23:59:59Z + + @SerializedName("extWBCSD_characterizationFactors") + private String extWBCSDCharacterizationFactors;//AR5 + private String secondaryEmissionFactorSource;//ecoinvent 3.8 + private double unitaryProductAmount; // 1000.0, + private String declaredUnit;//liter + private String referencePeriodStart;//2022-01-01T00:00:01Z + private String geographyRegionOrSubregion;//Africa + private double fossilGhgEmissions; // 0.5, + private String boundaryProcessesDescription;//Electricity consumption included as an input in the production phase + private String geographyCountry;//DE + + @SerializedName("extWBCSD_packagingGhgEmissions") + private double extWBCSDPackagingGhgEmissions; // 0, + private double dlucGhgEmissions; // 0.4, + private double carbonContentTotal; // 2.5, + + @SerializedName("extTFS_distributionStageLuGhgEmissions") + private double extTFSDistributionStageLuGhgEmissions; // 1.1, + private double primaryDataShare; // 56.12, + + @SerializedName("extWBCSD_packagingEmissionsIncluded") + private boolean extWBCSDPackagingEmissionsIncluded;//true + + @SerializedName("extWBCSD_fossilCarbonContent") + private double extWBCSDFossilCarbonContent; // 0.1, + + private String crossSectoralStandard;//GHG Protocol Product standard + + @SerializedName("extTFS_distributionStageDlucGhgEmissions") + private double extTFSDistributionStageDlucGhgEmissions; // 1.0, + private double distributionStagePcfIncludingBiogenic; // 0.0, + private double carbonContentBiogenic; // 0.0, + +} diff --git a/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/PcfSubmodelResponse.java b/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/PcfSubmodelResponse.java new file mode 100644 index 000000000..66b28af42 --- /dev/null +++ b/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/PcfSubmodelResponse.java @@ -0,0 +1,56 @@ +/******************************************************************************** + * Copyright (c) 2023 T-Systems International GmbH + * 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.sde.submodels.pcf.model; + +import com.google.gson.annotations.SerializedName; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; + +@Builder +@Data +@AllArgsConstructor +public class PcfSubmodelResponse { + + private String specVersion; + private CompanyIds companyIds; + + @SerializedName(value = "extWBCSD_productCodeCpc") + private String extWBCSDProductCodeCpc; + private String created; + private String companyName; + + @SerializedName(value = "extWBCSD_pfStatus") + private String extWBCSDPfStatus; + private String productName; + private double version; + private Pcf pcf; + private String partialFullPcf; + private ProductIds productIds; + private String validityPeriodStart; + private String comment; + private String id; + private String validityPeriodEnd; + private String pcfLegalStatement; + private String productDescription; + private PrecedingPfIds precedingPfIds; + +} diff --git a/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/PrecedingPfIds.java b/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/PrecedingPfIds.java new file mode 100644 index 000000000..5233699e2 --- /dev/null +++ b/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/PrecedingPfIds.java @@ -0,0 +1,33 @@ +/******************************************************************************** + * Copyright (c) 2023 T-Systems International GmbH + * 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.sde.submodels.pcf.model; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; + +@Builder +@Data +@AllArgsConstructor +public class PrecedingPfIds { + + private String id; + +} diff --git a/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/ProductIds.java b/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/ProductIds.java new file mode 100644 index 000000000..c5ebbcc88 --- /dev/null +++ b/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/ProductIds.java @@ -0,0 +1,33 @@ +/******************************************************************************** + * Copyright (c) 2023 T-Systems International GmbH + * 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.sde.submodels.pcf.model; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; + +@Builder +@Data +@AllArgsConstructor +public class ProductIds { + + private String productId; + +} diff --git a/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/ProductOrSectorSpecificRule.java b/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/ProductOrSectorSpecificRule.java new file mode 100644 index 000000000..eb9f27d4e --- /dev/null +++ b/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/ProductOrSectorSpecificRule.java @@ -0,0 +1,33 @@ +/******************************************************************************** + * Copyright (c) 2023 T-Systems International GmbH + * 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.sde.submodels.pcf.model; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; + +@Builder +@Data +@AllArgsConstructor +public class ProductOrSectorSpecificRule { + + private String ruleName; + +} diff --git a/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/ProductOrSectorSpecificRules.java b/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/ProductOrSectorSpecificRules.java new file mode 100644 index 000000000..4e5937714 --- /dev/null +++ b/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/ProductOrSectorSpecificRules.java @@ -0,0 +1,42 @@ +/******************************************************************************** + * Copyright (c) 2023 T-Systems International GmbH + * 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.sde.submodels.pcf.model; + +import com.google.gson.annotations.SerializedName; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; + +@Builder +@Data +@AllArgsConstructor +public class ProductOrSectorSpecificRules { + + @SerializedName(value = "extWBCSD_operator") + private String extWBCSDOperator; + + @SerializedName(value = "productOrSectorSpecificRules") + private ProductOrSectorSpecificRule productOrSectorSpecificRulesObj; + + @SerializedName(value = "extWBCSD_otherOperatorName") + private String extWBCSDOtherOperatorName; + +} diff --git a/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/SecondaryEmissionFactorSources.java b/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/SecondaryEmissionFactorSources.java new file mode 100644 index 000000000..03ad376f0 --- /dev/null +++ b/modules/sde-submodules/pcf/src/main/java/org/eclipse/tractusx/sde/submodels/pcf/model/SecondaryEmissionFactorSources.java @@ -0,0 +1,32 @@ +/******************************************************************************** + * Copyright (c) 2023 T-Systems International GmbH + * 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.sde.submodels.pcf.model; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; + +@Builder +@Data +@AllArgsConstructor +public class SecondaryEmissionFactorSources { + + private String secondaryEmissionFactorSource; +} From 88aa1972927d687b117e2fbe8b4b3cea6b90bc22 Mon Sep 17 00:00:00 2001 From: Sachin Argade Date: Tue, 5 Sep 2023 16:27:44 +0530 Subject: [PATCH 2/6] Change csv download escape character for space --- .../main/java/org/eclipse/tractusx/sde/core/utils/CsvUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/utils/CsvUtil.java b/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/utils/CsvUtil.java index 3e2b5b058..a43e9cf81 100644 --- a/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/utils/CsvUtil.java +++ b/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/utils/CsvUtil.java @@ -54,7 +54,7 @@ public ResponseEntity generateCSV(String fileName, List> @SneakyThrows public static ByteArrayInputStream writeCsv(List> data) { - final CSVFormat format = CSVFormat.EXCEL.withEscape(' ').withQuoteMode(QuoteMode.NONE).withDelimiter(';'); + final CSVFormat format = CSVFormat.EXCEL.withEscape('/').withQuoteMode(QuoteMode.NONE).withDelimiter(';'); try (ByteArrayOutputStream out = new ByteArrayOutputStream(); CSVPrinter csvPrinter = new CSVPrinter(new PrintWriter(out), format);) { From ccb34bf645436f58d30ebb8074ab31a798af79cf Mon Sep 17 00:00:00 2001 From: adityagajbhiye9 <133367448+adityagajbhiye9@users.noreply.github.com> Date: Wed, 6 Sep 2023 13:01:55 +0530 Subject: [PATCH 3/6] Change log updated. - Change csv download escape character for space. - PCF final working version. --- CHANGELOG.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eeee77a83..ece58f697 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,19 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +## [2.2.0] - 2023-09-06 +### Added +- Change csv download escape character for space. +- PCF final working version. + +## [2.1.2] - 2023-09-06 +### Added +- Add entity mapping and model for pcf model execution. + +## [2.1.1] - 2023-09-06 +### Added +- Pcf model schema and model registration. + ## [2.1.0] - 2023-08-30 ### Fixed - Added external subject in specific asset Ids. @@ -215,7 +228,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Compliance with Catena-X Guidelines - Integration with Digital Twin registry service. -[unreleased]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/v2.1.0...main +[unreleased]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/v2.2.0...main +[2.2.0]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/v2.1.2...v2.2.0 +[2.1.2]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/v2.1.1...v2.1.2 +[2.1.1]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/v2.1.0...v2.1.1 [2.1.0]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/v2.0.11...v2.1.0 [2.0.11]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/v2.0.10...v2.0.11 [2.0.10]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/sdebackend-2.0.9...v2.0.10 From 54c242b69f8004b08be8779424695df686aafa89 Mon Sep 17 00:00:00 2001 From: ChetanT-System Date: Thu, 7 Sep 2023 16:24:26 +0530 Subject: [PATCH 4/6] - Documents updated for PCF submodel --- README.md | 3 ++ modules/README.md | 1 + modules/sde-submodules/pcf/pcf.md | 81 +++++++++++++++++++++++++++- modules/sde-submodules/submodules.md | 2 + 4 files changed, 85 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fba42f50a..c0343eaa7 100644 --- a/README.md +++ b/README.md @@ -189,6 +189,7 @@ To find information about supported submodules and there version in SDE please v * SingleLevelBoMAsPlanned * PartSiteInformationAsPlanned * SingleLevelUsageAsBuilt + * Product Carbon Footprint(PCF) 2. ***Json Update*** * SerialPart * SingleLevelBoMAsBuilt @@ -197,6 +198,7 @@ To find information about supported submodules and there version in SDE please v * SingleLevelBoMAsPlanned * PartSiteInformationAsPlanned * SingleLevelUsageAsBuilt + * Product Carbon Footprint(PCF) 3. ***Application UI*** * SerialPart * SingleLevelBoMAsBuilt @@ -205,6 +207,7 @@ To find information about supported submodules and there version in SDE please v * SingleLevelBoMAsPlanned * PartSiteInformationAsPlanned * SingleLevelUsageAsBuilt + * Product Carbon Footprint(PCF) --- diff --git a/modules/README.md b/modules/README.md index 3fa0875da..7bc540739 100644 --- a/modules/README.md +++ b/modules/README.md @@ -22,4 +22,5 @@ SDE backend splited into multiple services loosely-coupled Maven modules. - modules/sde-submodules/part-site-information-as-planned - modules/sde-submodules/single-level-usage-as-built - modules/sde-submodules/single-level-bom-as-planned +- modules/sde-submodules/pcf - modules/sde-usecases/traceability diff --git a/modules/sde-submodules/pcf/pcf.md b/modules/sde-submodules/pcf/pcf.md index 0f4d39407..87535416f 100644 --- a/modules/sde-submodules/pcf/pcf.md +++ b/modules/sde-submodules/pcf/pcf.md @@ -2,6 +2,7 @@ --- ## Description +This module use for PCF submodel specification and descriptors. It's contain the codes related to PCF to validate, parse and transfer data for DigitalTwins and EDC to create aspect twins and data offer. --- #### Version: 4.0.1 @@ -18,6 +19,71 @@ Please find below links for schema details: ### PCF CSV file headers +| Headers Name | Mandatory | Position | +|---------------------------------- |----------------------------- |-------- | +| id | No | 1 | +| specVersion | Yes | 2 | +| partialFullPcf | Yes | 3 | +| precedingPfId | Yes | 4 | +| version | No | 5 | +| created | Yes | 6 | +| extWBCSD_pfStatus | Yes | 7 | +| validityPeriodStart | Yes | 8 | +| validityPeriodEnd | No | 9 | +| comment | Yes | 10 | +| pcfLegalStatement | Yes | 11 | +| companyName | No | 12 | +| companyId | Yes | 13 | +| productDescription | Yes | 14 | +| productId | Yes | 15 | +| extWBCSD_productCodeCpc | No | 16 | +| productName | Yes | 17 | +| declaredUnit | Yes | 18 | +| unitaryProductAmount | No | 19 | +| productMassPerDeclaredUnit | Yes | 20 | +| exemptedEmissionsPercent | Yes | 21 | +| exemptedEmissionsDescription | Yes | 22 | +| extWBCSD_packagingEmissionsIncluded | No | 23 | +| boundaryProcessesDescription | Yes | 24 | +| geographyCountrySubdivision | Yes | 25 | +| geographyCountry | No | 26 | +| geographyRegionOrSubregion | Yes | 27 | +| referencePeriodStart | Yes | 28 | +| referencePeriodEnd | Yes | 30 | +| crossSectoralStandard | No | 31 | +| extWBCSD_operator | Yes | 32 | +| ruleName | Yes | 33 | +| extWBCSD_otherOperatorName | No | 34 | +| extWBCSD_characterizationFactors | Yes | 35 | +| extWBCSD_allocationRulesDescription | Yes | 36 | +| extTFS_allocationWasteIncineration | Yes | 37 | +| primaryDataShare | No | 38 | +| secondaryEmissionFactorSource | Yes | 39 | +| coveragePercent | Yes | 40 | +| technologicalDQRtemporalDQR | No | 41 | +| geographicalDQR | Yes | 42 | +| completenessDQR | Yes | 43 | +| reliabilityDQR | Yes | 44 | +| pcfExcludingBiogenic | No | 45 | +| pcfIncludingBiogenic | Yes | 46 | +| fossilGhgEmissions | Yes | 47 | +| biogenicCarbonEmissionsOtherThanCO2 | No | 48 | +| biogenicCarbonWithdrawal | Yes | 49 | +| dlucGhgEmissions | Yes | 50 | +| extTFS_luGhgEmissions | Yes | 51 | +| aircraftGhgEmissions | No | 52 | +| extWBCSD_packagingGhgEmissions | Yes | 53 | +| distributionStagePcfExcludingBiogenic | Yes | 54 | +| distributionStagePcfIncludingBiogenic | No | 55 | +| distributionStageFossilGhgEmissions | Yes | 56 | +| distributionStageBiogenicCarbonEmissionsOtherThanCO2 | Yes | 57 | +| distributionStageBiogenicCarbonWithdrawal | Yes | 58 | +| extTFS_distributionStageDlucGhgEmissions | No | 59 | +| extTFS_distributionStageLuGhgEmissions | Yes | 60 | +| carbonContentTotal | Yes | 61 | +| extWBCSD_fossilCarbonContent | No | 62 | +| carbonContentBiogenic | Yes | 63 | +| assetLifeCyclePhase | Yes | 64 | #### [CSV Sample File Link] @@ -28,8 +94,19 @@ Please find below links for schema details: ### Work Flow - + - CSV to POJO + - CSV column validation and mandatory field validation + - POJO TO DTO + - UUID generate v4 + - DigitalTwins API's calls + - EDC API's calls + - BPN Discovery API Call + - DB Store ### External Services Call - + - DigitalTwins + - EDC Connectors + - BPN Discovery + +[CSV Sample File Link]: src/main/resources/pcf.csv diff --git a/modules/sde-submodules/submodules.md b/modules/sde-submodules/submodules.md index a88bb663d..fad15975c 100644 --- a/modules/sde-submodules/submodules.md +++ b/modules/sde-submodules/submodules.md @@ -15,6 +15,7 @@ Currently SDE supports below submodels. #### [singleLevelBoMAsPlanned in Version 1.0.1] #### [partSiteInformationAsPlanned in Version 1.0.0] #### [SingleLevelUsageAsBuilt in Version 1.0.1] +#### [Product Carbon Footprint(PCF) in Version 4.0.1] ### How we can add Submodels? @@ -42,3 +43,4 @@ Once your maven module ready just do the clean build and install so submodel wil [singleLevelBoMAsPlanned in Version 1.0.1]: single-level-bom-as-planned/single-level-bom-as-planned.md [partSiteInformationAsPlanned in Version 1.0.0]: part-site-information-as-planned/part-site-information-as-planned.md [SingleLevelUsageAsBuilt in Version 1.0.1]: single-level-usage-as-built/single-level-usage-as-built.md +[Product Carbon Footprint(PCF) in Version 4.0.1]: pcf/pcf.md From 2657ba0917c84cfa3b836b5df09449e8e6b22ef5 Mon Sep 17 00:00:00 2001 From: Sachin Argade Date: Wed, 20 Sep 2023 10:30:27 +0530 Subject: [PATCH 5/6] Update dependency file for PCF --- DEPENDENCIES | 1 + 1 file changed, 1 insertion(+) diff --git a/DEPENDENCIES b/DEPENDENCIES index b0dc6336f..78cbe77f2 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -70,6 +70,7 @@ maven/mavencentral/org.eclipse.tractusx/digital-twins/0.0.1, Apache-2.0, approve maven/mavencentral/org.eclipse.tractusx/edc/0.0.1, Apache-2.0, approved, automotive.tractusx maven/mavencentral/org.eclipse.tractusx/part-as-planned/0.0.1, Apache-2.0, approved, automotive.tractusx maven/mavencentral/org.eclipse.tractusx/part-site-information-as-planned/0.0.1, Apache-2.0, approved, automotive.tractusx +maven/mavencentral/org.eclipse.tractusx/pcf/0.0.1, Apache-2.0, approved, automotive.tractusx maven/mavencentral/org.eclipse.tractusx/portal/0.0.1, Apache-2.0, approved, automotive.tractusx maven/mavencentral/org.eclipse.tractusx/sde-common/0.0.1, Apache-2.0, approved, automotive.tractusx maven/mavencentral/org.eclipse.tractusx/serial-part-typization/0.0.1, Apache-2.0, approved, automotive.tractusx From 7152583fdb44a0b79e2b5328eacc5ba71c4a0d45 Mon Sep 17 00:00:00 2001 From: adityagajbhiye9 <133367448+adityagajbhiye9@users.noreply.github.com> Date: Wed, 20 Sep 2023 10:35:19 +0530 Subject: [PATCH 6/6] Updated change log --- CHANGELOG.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce2f4ae6b..4a4c43d1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +## [2.2.0] - 2023-09-20 +### Added +- Pcf model schema and model registration. +- Add entity mapping and model for pcf model execution. +- Support pcf submodel in sde. + ## [2.1.1] - 2023-09-06 - bumped version @@ -218,7 +224,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Compliance with Catena-X Guidelines - Integration with Digital Twin registry service. -[unreleased]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/v2.1.1...main +[unreleased]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/v2.2.0...main +[2.2.0]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/v2.1.1...v2.2.0 [2.1.1]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/v2.1.0...v2.1.1 [2.1.0]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/v2.0.11...v2.1.0 [2.0.11]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/v2.0.10...v2.0.11