diff --git a/.github/workflows/trivy.yml b/.github/workflows/trivy.yml index b58655a20..a1361b882 100644 --- a/.github/workflows/trivy.yml +++ b/.github/workflows/trivy.yml @@ -52,7 +52,7 @@ jobs: uses: aquasecurity/trivy-action@master with: # Path to Docker image - image-ref: "ghcr.io/catenax-ng/tx-dft-backend:latest" + image-ref: "ghcr.io/catenax-ng/tx-managed-simple-data-exchanger-backend:latest" format: "sarif" output: "trivy-results.sarif" exit-code: "1" diff --git a/CHANGELOG.md b/CHANGELOG.md index da392f949..1f7add15e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,19 @@ # Changelog All notable changes to this project will be documented in this file. +## [Unreleased] +- Support EDC version 4.1. +- Renamed SerialPartTypization aspect submodel to SerialPart. +- Renamed AssemblyPartRelationship aspect submodel to SingleLevelBoMAsBuilt. + The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +## [2.0.2] - 2023-06-21 +### Added +- BPN Discovery service integration for DDTR. + +### Fixed +- Upgradation of springboot(3.0.5-3.1.0) for security. + ## [2.0.1] - 2023-05-23 - Add automatic identification of submodel for processing. @@ -134,8 +146,9 @@ 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/dft-backend/compare/2.0.1...main -[2.0.1]:https://github.com/eclipse-tractusx/dft-backend/compare/2.0.0...2.0.1 +[unreleased]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/dftbackend-2.0.2...main +[2.0.2]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/dftbackend-2.0.1...dftbackend-2.0.2 +[2.0.1]: https://github.com/eclipse-tractusx/managed-simple-data-exchanger-backend/compare/dftbackend-2.0.0...dftbackend-2.0.1 [2.0.0]: https://github.com/eclipse-tractusx/dft-backend/compare/1.9.1...2.0.0 [1.9.1]: https://github.com/eclipse-tractusx/dft-backend/compare/1.9.0...1.9.1 [1.9.0]: https://github.com/eclipse-tractusx/dft-backend/compare/dft-backend-1.8.1...1.9.0 diff --git a/DEPENDENCIES b/DEPENDENCIES index f376ff935..a0837c278 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -1,24 +1,23 @@ -maven/mavencentral/ch.qos.logback/logback-classic/1.4.6, EPL-1.0 OR LGPL-2.1-only, approved, #3435 -maven/mavencentral/ch.qos.logback/logback-core/1.4.6, EPL-1.0 OR LGPL-2.1-only, approved, #3373 -maven/mavencentral/com.electronwill.night-config/core/3.6.6, LGPL-3.0-only, approved, #3767 -maven/mavencentral/com.electronwill.night-config/toml/3.6.6, LGPL-3.0-only, approved, #3766 +maven/mavencentral/ch.qos.logback/logback-classic/1.4.7, EPL-1.0 OR LGPL-2.1-only, approved, #3435 +maven/mavencentral/ch.qos.logback/logback-core/1.4.7, EPL-1.0 OR LGPL-2.1-only, approved, #3373 maven/mavencentral/com.ethlo.time/itu/1.7.0, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.fasterxml.jackson.core/jackson-annotations/2.14.2, Apache-2.0, approved, #5303 -maven/mavencentral/com.fasterxml.jackson.core/jackson-core/2.14.2, Apache-2.0 AND MIT, approved, #4303 -maven/mavencentral/com.fasterxml.jackson.core/jackson-databind/2.14.2, Apache-2.0, approved, #4105 -maven/mavencentral/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/2.14.2, Apache-2.0, approved, #5933 -maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.14.2, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.14.2, Apache-2.0, approved, #4699 -maven/mavencentral/com.fasterxml.jackson.module/jackson-module-parameter-names/2.14.2, Apache-2.0, approved, #5938 +maven/mavencentral/com.fasterxml.jackson.core/jackson-annotations/2.15.0, Apache-2.0, approved, #7947 +maven/mavencentral/com.fasterxml.jackson.core/jackson-core/2.15.0, MIT AND Apache-2.0, approved, #7932 +maven/mavencentral/com.fasterxml.jackson.core/jackson-databind/2.15.0, Apache-2.0, approved, #7934 +maven/mavencentral/com.fasterxml.jackson.dataformat/jackson-dataformat-toml/2.15.0, Apache-2.0, approved, #9160 +maven/mavencentral/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/2.15.0, Apache-2.0, approved, #8802 +maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.15.0, Apache-2.0, approved, #8808 +maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.15.0, Apache-2.0, approved, #7930 +maven/mavencentral/com.fasterxml.jackson.module/jackson-module-parameter-names/2.15.0, Apache-2.0, approved, #8803 maven/mavencentral/com.fasterxml/classmate/1.5.1, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.github.ben-manes.caffeine/caffeine/3.1.5, Apache-2.0, approved, clearlydefined +maven/mavencentral/com.github.ben-manes.caffeine/caffeine/3.1.6, Apache-2.0, approved, clearlydefined maven/mavencentral/com.github.stephenc.jcip/jcip-annotations/1.0-1, Apache-2.0, approved, CQ21949 maven/mavencentral/com.google.code.gson/gson/2.10, Apache-2.0, approved, #6159 -maven/mavencentral/com.google.code.gson/gson/2.9.1, Apache-2.0, approved, clearlydefined +maven/mavencentral/com.google.code.gson/gson/2.10.1, Apache-2.0, approved, #6159 maven/mavencentral/com.google.errorprone/error_prone_annotations/2.18.0, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.jayway.jsonpath/json-path/2.7.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/com.jayway.jsonpath/json-path/2.8.0, Apache-2.0, approved, clearlydefined maven/mavencentral/com.networknt/json-schema-validator/1.0.72, Apache-2.0, approved, CQ22638 -maven/mavencentral/com.nimbusds/nimbus-jose-jwt/9.24.4, Apache-2.0, approved, clearlydefined +maven/mavencentral/com.nimbusds/nimbus-jose-jwt/9.31, Apache-2.0, approved, clearlydefined maven/mavencentral/com.sun.istack/istack-commons-runtime/4.1.1, BSD-3-Clause, approved, #2590 maven/mavencentral/com.vaadin.external.google/android-json/0.0.20131108.vaadin1, Apache-2.0, approved, CQ21310 maven/mavencentral/com.zaxxer/HikariCP/5.0.1, Apache-2.0, approved, clearlydefined @@ -27,22 +26,23 @@ maven/mavencentral/commons-io/commons-io/2.7, Apache-2.0, approved, clearlydefin maven/mavencentral/io.github.classgraph/classgraph/4.8.149, MIT, approved, CQ22530 maven/mavencentral/io.github.openfeign.form/feign-form-spring/3.8.0, Apache-2.0, approved, clearlydefined maven/mavencentral/io.github.openfeign.form/feign-form/3.8.0, Apache-2.0, approved, clearlydefined -maven/mavencentral/io.github.openfeign/feign-core/12.1, Apache-2.0, approved, clearlydefined -maven/mavencentral/io.github.openfeign/feign-slf4j/12.1, Apache-2.0, approved, clearlydefined -maven/mavencentral/io.micrometer/micrometer-commons/1.10.5, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #7333 -maven/mavencentral/io.micrometer/micrometer-observation/1.10.5, Apache-2.0, approved, #7331 +maven/mavencentral/io.github.openfeign/feign-core/12.3, Apache-2.0, approved, clearlydefined +maven/mavencentral/io.github.openfeign/feign-slf4j/12.3, Apache-2.0, approved, clearlydefined +maven/mavencentral/io.micrometer/micrometer-commons/1.11.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/io.micrometer/micrometer-observation/1.11.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/io.smallrye/jandex/3.0.5, Apache-2.0, approved, clearlydefined maven/mavencentral/io.swagger.core.v3/swagger-annotations-jakarta/2.2.7, Apache-2.0, approved, #5947 maven/mavencentral/io.swagger.core.v3/swagger-core-jakarta/2.2.7, Apache-2.0, approved, #5929 maven/mavencentral/io.swagger.core.v3/swagger-models-jakarta/2.2.7, Apache-2.0, approved, #5919 -maven/mavencentral/jakarta.activation/jakarta.activation-api/2.1.1, EPL-2.0 OR BSD-3-Clause OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jaf +maven/mavencentral/jakarta.activation/jakarta.activation-api/2.1.2, EPL-2.0 OR BSD-3-Clause OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jaf maven/mavencentral/jakarta.annotation/jakarta.annotation-api/2.1.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.ca -maven/mavencentral/jakarta.inject/jakarta.inject-api/2.0.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/jakarta.inject/jakarta.inject-api/2.0.1, Apache-2.0, approved, clearlydefined maven/mavencentral/jakarta.persistence/jakarta.persistence-api/3.1.0, EPL-2.0 OR BSD-3-Clause AND (EPL-2.0 OR BSD-3-Clause AND BSD-3-Clause), approved, #7696 maven/mavencentral/jakarta.transaction/jakarta.transaction-api/2.0.1, EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0, approved, #7697 maven/mavencentral/jakarta.validation/jakarta.validation-api/3.0.2, Apache-2.0, approved, clearlydefined maven/mavencentral/jakarta.xml.bind/jakarta.xml.bind-api/4.0.0, BSD-3-Clause, approved, ee4j.jaxb -maven/mavencentral/net.bytebuddy/byte-buddy-agent/1.12.23, Apache-2.0, approved, #1810 -maven/mavencentral/net.bytebuddy/byte-buddy/1.12.23, Apache-2.0 AND BSD-3-Clause, approved, #1811 +maven/mavencentral/net.bytebuddy/byte-buddy-agent/1.14.4, Apache-2.0, approved, #7164 +maven/mavencentral/net.bytebuddy/byte-buddy/1.14.4, Apache-2.0 AND BSD-3-Clause, approved, #7163 maven/mavencentral/net.minidev/accessors-smart/2.4.9, Apache-2.0, approved, #7515 maven/mavencentral/net.minidev/json-smart/2.4.10, Apache-2.0, approved, #3288 maven/mavencentral/org.antlr/antlr4-runtime/4.10.1, BSD-3-Clause AND LicenseRef-Public-domain AND MIT AND LicenseRef-Unicode-TOU, approved, #7065 @@ -51,20 +51,21 @@ maven/mavencentral/org.apache.commons/commons-lang3/3.12.0, Apache-2.0, approved maven/mavencentral/org.apache.commons/commons-text/1.10.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.logging.log4j/log4j-api/2.17.1, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.logging.log4j/log4j-to-slf4j/2.17.1, Apache-2.0, approved, #2163 -maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-core/10.1.7, Apache-2.0 AND (EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND (CDDL-1.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND W3C AND CC0-1.0, approved, #5949 -maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-el/10.1.7, Apache-2.0, approved, #6997 -maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.7, Apache-2.0, approved, #7920 +maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-core/10.1.8, Apache-2.0 AND (EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND (CDDL-1.0 OR GPL-2.0-only WITH Classpath-exception-2.0) AND W3C AND CC0-1.0, approved, #5949 +maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-el/10.1.8, Apache-2.0, approved, #6997 +maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.8, Apache-2.0, approved, #7920 maven/mavencentral/org.apiguardian/apiguardian-api/1.1.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.aspectj/aspectjweaver/1.9.19, EPL-1.0, approved, tools.aspectj -maven/mavencentral/org.assertj/assertj-core/3.23.1, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.assertj/assertj-core/3.24.2, Apache-2.0, approved, #6161 maven/mavencentral/org.bouncycastle/bcpkix-jdk15on/1.69, MIT, approved, clearlydefined maven/mavencentral/org.bouncycastle/bcprov-jdk15on/1.69, MIT, approved, clearlydefined maven/mavencentral/org.bouncycastle/bcutil-jdk15on/1.69, MIT, approved, clearlydefined -maven/mavencentral/org.checkerframework/checker-qual/3.32.0, MIT, approved, clearlydefined +maven/mavencentral/org.checkerframework/checker-qual/3.33.0, MIT, approved, clearlydefined maven/mavencentral/org.eclipse.angus/angus-activation/2.0.0, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.angus maven/mavencentral/org.eclipse.persistence/eclipselink/3.0.3, EPL-2.0 OR BSD-3-Clause, approved, ee4j.eclipselink maven/mavencentral/org.eclipse.tractusx/assembly-part-relationship/0.0.1, Apache-2.0, approved, automotive.tractusx maven/mavencentral/org.eclipse.tractusx/batch/0.0.1, Apache-2.0, approved, automotive.tractusx +maven/mavencentral/org.eclipse.tractusx/bpn-discovery/0.0.1, Apache-2.0, approved, automotive.tractusx maven/mavencentral/org.eclipse.tractusx/digital-twins/0.0.1, Apache-2.0, approved, automotive.tractusx 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 @@ -74,29 +75,28 @@ maven/mavencentral/org.eclipse.tractusx/sde-common/0.0.1, Apache-2.0, approved, maven/mavencentral/org.eclipse.tractusx/serial-part-typization/0.0.1, Apache-2.0, approved, automotive.tractusx maven/mavencentral/org.eclipse.tractusx/single-level-bom-as-planned/0.0.1, Apache-2.0, approved, automotive.tractusx maven/mavencentral/org.eclipse.tractusx/single-level-usage-as-built/0.0.1, Apache-2.0, approved, automotive.tractusx -maven/mavencentral/org.flywaydb/flyway-core/9.5.1, Apache-2.0, approved, #7296 +maven/mavencentral/org.flywaydb/flyway-core/9.16.3, Apache-2.0, approved, #7935 maven/mavencentral/org.glassfish.jaxb/jaxb-core/4.0.2, BSD-3-Clause, approved, ee4j.jaxb maven/mavencentral/org.glassfish.jaxb/jaxb-runtime/4.0.2, BSD-3-Clause, approved, ee4j.jaxb maven/mavencentral/org.glassfish.jaxb/txw2/4.0.2, BSD-3-Clause, approved, ee4j.jaxb maven/mavencentral/org.hamcrest/hamcrest/2.2, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.hibernate.common/hibernate-commons-annotations/6.0.6.Final, LGPL-2.1-only, approved, #6962 -maven/mavencentral/org.hibernate.orm/hibernate-core/6.1.7.Final, LGPL-2.1-or-later AND (Apache-2.0 AND LGPL-2.1-only) AND (CC-PDDC AND LGPL-2.1-only) AND (EPL-2.0 OR BSD-3-Clause), approved, #5939 +maven/mavencentral/org.hibernate.orm/hibernate-core/6.2.2.Final, LGPL-2.1-only AND Apache-2.0 AND MIT AND CC-PDDC AND (EPL-2.0 OR BSD-3-Clause), approved, #9121 maven/mavencentral/org.hibernate.validator/hibernate-validator/8.0.0.Final, Apache-2.0, approved, clearlydefined maven/mavencentral/org.jboss.logging/jboss-logging/3.5.0.Final, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.jboss/jandex/2.4.2.Final, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.junit.jupiter/junit-jupiter-api/5.9.2, EPL-2.0, approved, #3133 -maven/mavencentral/org.junit.jupiter/junit-jupiter-engine/5.9.2, EPL-2.0, approved, #3125 -maven/mavencentral/org.junit.jupiter/junit-jupiter-params/5.9.2, EPL-2.0, approved, #3134 -maven/mavencentral/org.junit.jupiter/junit-jupiter/5.9.2, EPL-2.0, approved, #6972 -maven/mavencentral/org.junit.platform/junit-platform-commons/1.9.2, EPL-2.0, approved, #3130 -maven/mavencentral/org.junit.platform/junit-platform-engine/1.9.2, EPL-2.0, approved, #3128 +maven/mavencentral/org.junit.jupiter/junit-jupiter-api/5.9.3, EPL-2.0, approved, #3133 +maven/mavencentral/org.junit.jupiter/junit-jupiter-engine/5.9.3, EPL-2.0, approved, #3125 +maven/mavencentral/org.junit.jupiter/junit-jupiter-params/5.9.3, EPL-2.0, approved, #3134 +maven/mavencentral/org.junit.jupiter/junit-jupiter/5.9.3, EPL-2.0, approved, #6972 +maven/mavencentral/org.junit.platform/junit-platform-commons/1.9.3, EPL-2.0, approved, #3130 +maven/mavencentral/org.junit.platform/junit-platform-engine/1.9.3, EPL-2.0, approved, #3128 maven/mavencentral/org.mapstruct/mapstruct/1.4.2.Final, Apache-2.0, approved, #2483 maven/mavencentral/org.mockito/mockito-core/4.8.1, MIT, approved, clearlydefined maven/mavencentral/org.mockito/mockito-junit-jupiter/4.8.1, MIT, approved, clearlydefined maven/mavencentral/org.objenesis/objenesis/3.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.opentest4j/opentest4j/1.2.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.ow2.asm/asm/9.3, BSD-3-Clause, approved, clearlydefined -maven/mavencentral/org.postgresql/postgresql/42.5.4, BSD-2-Clause, approved, #3416 +maven/mavencentral/org.postgresql/postgresql/42.6.0, BSD-2-Clause AND LicenseRef-scancode-free-unknown AND Apache-2.0, restricted, #9159 maven/mavencentral/org.projectlombok/lombok/1.18.26, MIT AND LicenseRef-Public-Domain, approved, CQ23907 maven/mavencentral/org.skyscreamer/jsonassert/1.5.1, Apache-2.0, approved, clearlydefined maven/mavencentral/org.slf4j/jul-to-slf4j/2.0.7, MIT, approved, #7698 @@ -104,53 +104,53 @@ maven/mavencentral/org.slf4j/slf4j-api/2.0.7, MIT, approved, #5915 maven/mavencentral/org.springdoc/springdoc-openapi-starter-common/2.0.2, Apache-2.0, approved, #5920 maven/mavencentral/org.springdoc/springdoc-openapi-starter-webmvc-api/2.0.2, Apache-2.0, approved, #5950 maven/mavencentral/org.springdoc/springdoc-openapi-starter-webmvc-ui/2.0.2, Apache-2.0, approved, #5923 -maven/mavencentral/org.springframework.boot/spring-boot-autoconfigure/3.0.5, Apache-2.0, approved, #6981 -maven/mavencentral/org.springframework.boot/spring-boot-devtools/3.0.5, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.springframework.boot/spring-boot-starter-aop/3.0.5, Apache-2.0, approved, #6965 -maven/mavencentral/org.springframework.boot/spring-boot-starter-cache/3.0.5, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.springframework.boot/spring-boot-starter-data-jpa/3.0.5, Apache-2.0, approved, #7351 -maven/mavencentral/org.springframework.boot/spring-boot-starter-jdbc/3.0.5, Apache-2.0, approved, #6974 -maven/mavencentral/org.springframework.boot/spring-boot-starter-json/3.0.5, Apache-2.0, approved, #7006 -maven/mavencentral/org.springframework.boot/spring-boot-starter-logging/3.0.5, Apache-2.0, approved, #6982 -maven/mavencentral/org.springframework.boot/spring-boot-starter-oauth2-resource-server/3.0.5, Apache-2.0, approved, #6967 -maven/mavencentral/org.springframework.boot/spring-boot-starter-security/3.0.5, Apache-2.0, approved, #7329 -maven/mavencentral/org.springframework.boot/spring-boot-starter-test/3.0.5, Apache-2.0, approved, #7001 -maven/mavencentral/org.springframework.boot/spring-boot-starter-tomcat/3.0.5, Apache-2.0, approved, #6987 -maven/mavencentral/org.springframework.boot/spring-boot-starter-validation/3.0.5, Apache-2.0, approved, #6971 -maven/mavencentral/org.springframework.boot/spring-boot-starter-web/3.0.5, Apache-2.0, approved, #5945 -maven/mavencentral/org.springframework.boot/spring-boot-starter/3.0.5, Apache-2.0, approved, #7330 -maven/mavencentral/org.springframework.boot/spring-boot-test-autoconfigure/3.0.5, Apache-2.0, approved, #6966 -maven/mavencentral/org.springframework.boot/spring-boot-test/3.0.5, Apache-2.0, approved, #6976 -maven/mavencentral/org.springframework.boot/spring-boot/3.0.5, Apache-2.0, approved, #7327 -maven/mavencentral/org.springframework.cloud/spring-cloud-commons/4.0.0-RC3, Apache-2.0, approved, #7292 -maven/mavencentral/org.springframework.cloud/spring-cloud-context/4.0.0-RC3, Apache-2.0, approved, #7306 -maven/mavencentral/org.springframework.cloud/spring-cloud-openfeign-core/4.0.0-RC3, Apache-2.0, approved, #7305 -maven/mavencentral/org.springframework.cloud/spring-cloud-starter-openfeign/4.0.0-RC3, Apache-2.0, approved, #7302 -maven/mavencentral/org.springframework.cloud/spring-cloud-starter/4.0.0-RC3, Apache-2.0, approved, #7299 -maven/mavencentral/org.springframework.data/spring-data-commons/3.0.4, Apache-2.0, approved, #5943 -maven/mavencentral/org.springframework.data/spring-data-jpa/3.0.4, Apache-2.0, approved, #5935 -maven/mavencentral/org.springframework.security/spring-security-config/6.0.2, Apache-2.0, approved, #7338 -maven/mavencentral/org.springframework.security/spring-security-core/6.0.3, Apache-2.0, approved, #7325 -maven/mavencentral/org.springframework.security/spring-security-crypto/6.0.2, Apache-2.0 AND ISC, approved, #7326 -maven/mavencentral/org.springframework.security/spring-security-oauth2-core/6.0.2, Apache-2.0, approved, #7324 -maven/mavencentral/org.springframework.security/spring-security-oauth2-jose/6.0.2, Apache-2.0, approved, #7337 -maven/mavencentral/org.springframework.security/spring-security-oauth2-resource-server/6.0.2, Apache-2.0, approved, #7335 +maven/mavencentral/org.springframework.boot/spring-boot-autoconfigure/3.1.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.boot/spring-boot-devtools/3.1.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.boot/spring-boot-starter-aop/3.1.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.boot/spring-boot-starter-cache/3.1.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.boot/spring-boot-starter-data-jpa/3.1.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.boot/spring-boot-starter-jdbc/3.1.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.boot/spring-boot-starter-json/3.1.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.boot/spring-boot-starter-logging/3.1.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.boot/spring-boot-starter-oauth2-resource-server/3.1.0, Apache-2.0, approved, #8804 +maven/mavencentral/org.springframework.boot/spring-boot-starter-security/3.1.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.boot/spring-boot-starter-test/3.1.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.boot/spring-boot-starter-tomcat/3.1.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.boot/spring-boot-starter-validation/3.1.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.boot/spring-boot-starter-web/3.1.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.boot/spring-boot-starter/3.1.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.boot/spring-boot-test-autoconfigure/3.1.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.boot/spring-boot-test/3.1.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.boot/spring-boot/3.1.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.cloud/spring-cloud-commons/4.0.3, Apache-2.0, approved, #7292 +maven/mavencentral/org.springframework.cloud/spring-cloud-context/4.0.3, Apache-2.0, approved, #7306 +maven/mavencentral/org.springframework.cloud/spring-cloud-openfeign-core/4.0.3, Apache-2.0, approved, #7305 +maven/mavencentral/org.springframework.cloud/spring-cloud-starter-openfeign/4.0.3, Apache-2.0, approved, #7302 +maven/mavencentral/org.springframework.cloud/spring-cloud-starter/4.0.3, Apache-2.0, approved, #7299 +maven/mavencentral/org.springframework.data/spring-data-commons/3.1.0, Apache-2.0, approved, #8805 +maven/mavencentral/org.springframework.data/spring-data-jpa/3.1.0, Apache-2.0, approved, #9120 +maven/mavencentral/org.springframework.security/spring-security-config/6.1.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.security/spring-security-core/6.1.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.security/spring-security-crypto/6.1.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.security/spring-security-oauth2-core/6.1.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.security/spring-security-oauth2-jose/6.1.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.security/spring-security-oauth2-resource-server/6.1.0, Apache-2.0, approved, #8798 maven/mavencentral/org.springframework.security/spring-security-rsa/1.0.11.RELEASE, Apache-2.0, approved, CQ20647 -maven/mavencentral/org.springframework.security/spring-security-web/6.0.3, Apache-2.0, approved, #7328 -maven/mavencentral/org.springframework/spring-aop/6.0.7, Apache-2.0, approved, #5940 -maven/mavencentral/org.springframework/spring-aspects/6.0.7, Apache-2.0, approved, #5930 -maven/mavencentral/org.springframework/spring-beans/6.0.7, Apache-2.0, approved, #5937 -maven/mavencentral/org.springframework/spring-context-support/6.0.7, Apache-2.0, approved, #6960 -maven/mavencentral/org.springframework/spring-context/6.0.7, Apache-2.0, approved, #5936 -maven/mavencentral/org.springframework/spring-core/6.0.8, Apache-2.0 AND BSD-3-Clause, approved, #5948 -maven/mavencentral/org.springframework/spring-expression/6.0.8, Apache-2.0, approved, #3284 -maven/mavencentral/org.springframework/spring-jcl/6.0.7, Apache-2.0, approved, #3283 -maven/mavencentral/org.springframework/spring-jdbc/6.0.7, Apache-2.0, approved, #5924 -maven/mavencentral/org.springframework/spring-orm/6.0.7, Apache-2.0, approved, #5925 -maven/mavencentral/org.springframework/spring-test/6.0.7, Apache-2.0, approved, #7003 -maven/mavencentral/org.springframework/spring-tx/6.0.7, Apache-2.0, approved, #5926 -maven/mavencentral/org.springframework/spring-web/6.0.7, Apache-2.0, approved, #5942 -maven/mavencentral/org.springframework/spring-webmvc/6.0.8, Apache-2.0, approved, #5944 +maven/mavencentral/org.springframework.security/spring-security-web/6.1.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework/spring-aop/6.0.9, Apache-2.0, approved, #5940 +maven/mavencentral/org.springframework/spring-aspects/6.0.9, Apache-2.0, approved, #5930 +maven/mavencentral/org.springframework/spring-beans/6.0.9, Apache-2.0, approved, #5937 +maven/mavencentral/org.springframework/spring-context-support/6.0.9, Apache-2.0, approved, #6960 +maven/mavencentral/org.springframework/spring-context/6.0.9, Apache-2.0, approved, #5936 +maven/mavencentral/org.springframework/spring-core/6.0.9, Apache-2.0 AND BSD-3-Clause, approved, #5948 +maven/mavencentral/org.springframework/spring-expression/6.0.9, Apache-2.0, approved, #3284 +maven/mavencentral/org.springframework/spring-jcl/6.0.9, Apache-2.0, approved, #3283 +maven/mavencentral/org.springframework/spring-jdbc/6.0.9, Apache-2.0, approved, #5924 +maven/mavencentral/org.springframework/spring-orm/6.0.9, Apache-2.0, approved, #5925 +maven/mavencentral/org.springframework/spring-test/6.0.9, Apache-2.0, approved, #7003 +maven/mavencentral/org.springframework/spring-tx/6.0.9, Apache-2.0, approved, #5926 +maven/mavencentral/org.springframework/spring-web/6.0.9, Apache-2.0, approved, #5942 +maven/mavencentral/org.springframework/spring-webmvc/6.0.9, Apache-2.0, approved, #5944 maven/mavencentral/org.webjars/swagger-ui/4.15.5, Apache-2.0 AND MIT, approved, #5921 maven/mavencentral/org.webjars/webjars-locator-core/0.52, MIT, approved, clearlydefined maven/mavencentral/org.xmlunit/xmlunit-core/2.9.1, Apache-2.0, approved, #6272 diff --git a/charts/dftbackend/Chart.yaml b/charts/dftbackend/Chart.yaml index 7f589afec..d6d28b092 100644 --- a/charts/dftbackend/Chart.yaml +++ b/charts/dftbackend/Chart.yaml @@ -37,13 +37,13 @@ sources: # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 2.0.1 +version: 2.0.2 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "2.0.1" +appVersion: "2.0.2" dependencies: - condition: dftpostgresql.enabled diff --git a/charts/dftbackend/values.yaml b/charts/dftbackend/values.yaml index db7f94acd..db019d1bb 100644 --- a/charts/dftbackend/values.yaml +++ b/charts/dftbackend/values.yaml @@ -173,3 +173,8 @@ configuration: connector.discovery.clientSecret=default portal.backend.hostname=default springdoc.api-docs.path=/api-docs + bpndiscovery.hostname=default + discovery.authentication.url=default + discovery.clientId=default + discovery.clientSecret=default + discovery.grantType=default diff --git a/modules/sde-core/src/main/resources/application.properties b/modules/sde-core/src/main/resources/application.properties index 5bcf64052..221bdbe54 100644 --- a/modules/sde-core/src/main/resources/application.properties +++ b/modules/sde-core/src/main/resources/application.properties @@ -101,4 +101,11 @@ partner.pool.hostname= ## Portal Backend service URL portal.backend.hostname= +## bpn & discovery finder +bpndiscovery.hostname= +discovery.authentication.url= +discovery.clientId= +discovery.clientSecret= +discovery.grantType= + springdoc.api-docs.path=/api-docs \ No newline at end of file diff --git a/modules/sde-external-services/bpn-discovery/pom.xml b/modules/sde-external-services/bpn-discovery/pom.xml new file mode 100644 index 000000000..324b16753 --- /dev/null +++ b/modules/sde-external-services/bpn-discovery/pom.xml @@ -0,0 +1,69 @@ + + + 4.0.0 + + org.eclipse.tractusx + sde + 0.0.1 + ../../../ + + bpn-discovery + bpn-discovery + jar + + + org.eclipse.tractusx + sde-common + 0.0.1 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + org.projectlombok + lombok + ${lombok.version} + + + org.mapstruct + mapstruct-processor + ${org.mapstruct.processor.version} + + + + + -Amapstruct.unmappedTargetPolicy=IGNORE + + + + + + + \ No newline at end of file diff --git a/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/api/IBpndiscoveryExternalServiceApi.java b/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/api/IBpndiscoveryExternalServiceApi.java new file mode 100644 index 000000000..41b73c68e --- /dev/null +++ b/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/api/IBpndiscoveryExternalServiceApi.java @@ -0,0 +1,59 @@ +/******************************************************************************** + * 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.bpndiscovery.api; + +import java.net.URI; +import java.util.List; + +import org.eclipse.tractusx.sde.bpndiscovery.model.request.BpnDiscoveryRequest; +import org.eclipse.tractusx.sde.bpndiscovery.model.request.BpnDiscoverySearchRequest; +import org.eclipse.tractusx.sde.bpndiscovery.model.response.BpnDiscoveryBatchResponse; +import org.eclipse.tractusx.sde.bpndiscovery.model.response.BpnDiscoveryResponse; +import org.eclipse.tractusx.sde.bpndiscovery.model.response.BpnDiscoverySearchResponse; +import org.eclipse.tractusx.sde.bpndiscovery.model.response.KeycloakJWTTokenResponse; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.http.ResponseEntity; +import org.springframework.util.MultiValueMap; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; + +@FeignClient(value = "IBpndiscoveryExternalServiceApi", url = "${bpndiscovery.hostname}") +public interface IBpndiscoveryExternalServiceApi { + + @PostMapping + KeycloakJWTTokenResponse getBpnDiscoveryAuthToken(URI url, @RequestBody MultiValueMap body); + + @PostMapping(path = "/api/administration/connectors/bpnDiscovery") + BpnDiscoveryResponse bpnDiscoveryDataByKey(@RequestBody BpnDiscoveryRequest bpnDiscoveryKey, @RequestHeader("Authorization") String bearerToken); + + @PostMapping(path = "/api/administration/connectors/bpnDiscovery/batch") + List bpnDiscoveryBatchDataByList(@RequestBody List bpnDiscoveryKeyList, @RequestHeader("Authorization") String bearerToken); + + @PostMapping(path = "/api/administration/connectors/bpnDiscovery/search") + BpnDiscoverySearchResponse bpnDiscoverySearchData(@RequestBody BpnDiscoverySearchRequest bpnDiscoverySearchRequest, @RequestHeader("Authorization") String bearerToken); + + @DeleteMapping(path = "/api/administration/connectors/bpnDiscovery/{resourceId}") + ResponseEntity deleteBpnDiscoveryData(@PathVariable String resourceId, @RequestHeader("Authorization") String bearerToken); + + +} diff --git a/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/handler/BPNDiscoveryUseCaseHandler.java b/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/handler/BPNDiscoveryUseCaseHandler.java new file mode 100644 index 000000000..29f6a4893 --- /dev/null +++ b/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/handler/BPNDiscoveryUseCaseHandler.java @@ -0,0 +1,55 @@ +/******************************************************************************** + * 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.bpndiscovery.handler; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.eclipse.tractusx.sde.bpndiscovery.model.request.BpnDiscoveryRequest; +import org.eclipse.tractusx.sde.common.submodel.executor.Step; +import org.springframework.stereotype.Service; + +import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; + +@Service +@RequiredArgsConstructor +public class BPNDiscoveryUseCaseHandler extends Step { + + private final BpnDiscoveryProxyService bpnDiscoveryProxyService; + + @SneakyThrows + public void run(Map input) { + + BpnDiscoveryRequest bpnDiscoveryRequest = new BpnDiscoveryRequest(); + List bpnDiscoveryKeyList = new ArrayList<>(); + + input.entrySet().stream().forEach(e -> { + bpnDiscoveryRequest.setType(e.getKey()); + bpnDiscoveryRequest.setKey(e.getValue()); + bpnDiscoveryKeyList.add(bpnDiscoveryRequest); + }); + + bpnDiscoveryProxyService.bpnDiscoveryBatchData(bpnDiscoveryKeyList); + + } + +} diff --git a/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/handler/BpnDiscoveryProxyService.java b/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/handler/BpnDiscoveryProxyService.java new file mode 100644 index 000000000..d8095fa1f --- /dev/null +++ b/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/handler/BpnDiscoveryProxyService.java @@ -0,0 +1,65 @@ +/******************************************************************************** + * 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.bpndiscovery.handler; + +import java.util.List; + +import org.eclipse.tractusx.sde.bpndiscovery.api.IBpndiscoveryExternalServiceApi; +import org.eclipse.tractusx.sde.bpndiscovery.model.request.BpnDiscoveryRequest; +import org.eclipse.tractusx.sde.bpndiscovery.model.request.BpnDiscoverySearchRequest; +import org.eclipse.tractusx.sde.bpndiscovery.model.response.BpnDiscoveryBatchResponse; +import org.eclipse.tractusx.sde.bpndiscovery.model.response.BpnDiscoveryResponse; +import org.eclipse.tractusx.sde.bpndiscovery.model.response.BpnDiscoverySearchResponse; +import org.eclipse.tractusx.sde.bpndiscovery.utils.BpnDiscoveryAuthToken; +import org.springframework.stereotype.Service; + +import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; + +@Service +@RequiredArgsConstructor +public class BpnDiscoveryProxyService { + + private final IBpndiscoveryExternalServiceApi bpndiscoveryExternalServiceApi; + + private final BpnDiscoveryAuthToken bpnDiscoveryAuthToken; + + + @SneakyThrows + public BpnDiscoveryResponse bpnDiscoveryData(BpnDiscoveryRequest bpnDiscoveryRequest) { + return bpndiscoveryExternalServiceApi.bpnDiscoveryDataByKey(bpnDiscoveryRequest, bpnDiscoveryAuthToken.getToken()); + } + + @SneakyThrows + public BpnDiscoverySearchResponse bpnDiscoverySearchData(BpnDiscoverySearchRequest bpnDiscoverySearchRequest) { + return bpndiscoveryExternalServiceApi.bpnDiscoverySearchData(bpnDiscoverySearchRequest, bpnDiscoveryAuthToken.getToken()); + } + + @SneakyThrows + public List bpnDiscoveryBatchData(List bpnDiscoveryKeyList) { + return bpndiscoveryExternalServiceApi.bpnDiscoveryBatchDataByList(bpnDiscoveryKeyList, bpnDiscoveryAuthToken.getToken()); + } + + @SneakyThrows + public void deleteBpnDiscoveryData(String resourceId) { + bpndiscoveryExternalServiceApi.deleteBpnDiscoveryData(resourceId, bpnDiscoveryAuthToken.getToken()); + } + +} diff --git a/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/model/request/BpnDiscoveryRequest.java b/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/model/request/BpnDiscoveryRequest.java new file mode 100644 index 000000000..3c4e78004 --- /dev/null +++ b/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/model/request/BpnDiscoveryRequest.java @@ -0,0 +1,37 @@ +/******************************************************************************** + * 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.bpndiscovery.model.request; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class BpnDiscoveryRequest { + + private String type; + private String key; + +} diff --git a/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/model/request/BpnDiscoverySearchRequest.java b/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/model/request/BpnDiscoverySearchRequest.java new file mode 100644 index 000000000..7139c6293 --- /dev/null +++ b/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/model/request/BpnDiscoverySearchRequest.java @@ -0,0 +1,45 @@ +/******************************************************************************** + * 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.bpndiscovery.model.request; + +import java.util.List; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class BpnDiscoverySearchRequest { + + private List searchFilter; + + @Data + @NoArgsConstructor + @AllArgsConstructor + @Builder + public static class Search { + private String type; + private List keys; + } +} diff --git a/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/model/response/BpnDiscoveryBatchResponse.java b/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/model/response/BpnDiscoveryBatchResponse.java new file mode 100644 index 000000000..f42b74a12 --- /dev/null +++ b/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/model/response/BpnDiscoveryBatchResponse.java @@ -0,0 +1,45 @@ +/******************************************************************************** + * 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.bpndiscovery.model.response; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class BpnDiscoveryBatchResponse { + + private String message; + private Details details; + private String key; + private String status; + + @Data + @NoArgsConstructor + @AllArgsConstructor + @Builder + public static class Details { + private String type; + } +} diff --git a/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/model/response/BpnDiscoveryResponse.java b/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/model/response/BpnDiscoveryResponse.java new file mode 100644 index 000000000..941980f08 --- /dev/null +++ b/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/model/response/BpnDiscoveryResponse.java @@ -0,0 +1,37 @@ +/******************************************************************************** + * 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.bpndiscovery.model.response; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class BpnDiscoveryResponse { + + private String type; + private String key; + private String value; + private String resourceId; +} diff --git a/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/model/response/BpnDiscoverySearchResponse.java b/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/model/response/BpnDiscoverySearchResponse.java new file mode 100644 index 000000000..b2a624751 --- /dev/null +++ b/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/model/response/BpnDiscoverySearchResponse.java @@ -0,0 +1,37 @@ +/******************************************************************************** + * 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.bpndiscovery.model.response; + +import java.util.List; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class BpnDiscoverySearchResponse { + + private List bpns; + +} diff --git a/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/model/response/KeycloakJWTTokenResponse.java b/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/model/response/KeycloakJWTTokenResponse.java new file mode 100644 index 000000000..0ebe6a392 --- /dev/null +++ b/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/model/response/KeycloakJWTTokenResponse.java @@ -0,0 +1,36 @@ +/******************************************************************************** + * 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.bpndiscovery.model.response; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.Data; + +@Data +public class KeycloakJWTTokenResponse { + + @JsonProperty("access_token") + private String accessToken; + @JsonProperty("expires_in") + private Integer expiresIn; + @JsonProperty("token_type") + private String tokenType; + private String scope; +} diff --git a/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/utils/BpnDiscoveryAuthToken.java b/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/utils/BpnDiscoveryAuthToken.java new file mode 100644 index 000000000..cea1ebe1e --- /dev/null +++ b/modules/sde-external-services/bpn-discovery/src/main/java/org/eclipse/tractusx/sde/bpndiscovery/utils/BpnDiscoveryAuthToken.java @@ -0,0 +1,98 @@ +/******************************************************************************** + * 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.bpndiscovery.utils; + +import java.net.URI; +import java.util.Base64; + +import org.eclipse.tractusx.sde.bpndiscovery.api.IBpndiscoveryExternalServiceApi; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; + +@Component +@RequiredArgsConstructor +public class BpnDiscoveryAuthToken { + + private final IBpndiscoveryExternalServiceApi bpndiscoveryExternalServiceApi; + + private static final String CLIENT_ID = "client_id"; + private static final String CLIENT_SECRET = "client_secret"; + private static final String GRANT_TYPE = "grant_type"; + + @Value(value = "${discovery.authentication.url}") + private URI authTokenUrl; + + @Value(value = "${discovery.clientId}") + private String clientId; + + @Value(value = "${discovery.clientSecret}") + private String clientSecret; + + @Value(value = "${discovery.grantType}") + private String grantType; + + private String accessToken; + + + @SneakyThrows + public String getToken() { + + if (accessToken != null && isTokenValid()) { + return "Bearer " + accessToken; + } + + MultiValueMap body = new LinkedMultiValueMap<>(); + body.add(GRANT_TYPE, grantType); + body.add(CLIENT_ID, clientId); + body.add(CLIENT_SECRET, clientSecret); + + var resultBody = bpndiscoveryExternalServiceApi.getBpnDiscoveryAuthToken(authTokenUrl, body); + + if (resultBody != null) { + accessToken = resultBody.getAccessToken(); + return "Bearer "+accessToken; + } + return null; + } + + + @SneakyThrows + private boolean isTokenValid() { + String[] str = accessToken.split("\\."); + Base64.Decoder decoder = Base64.getUrlDecoder(); + String body = new String(decoder.decode(str[1])); + + ObjectMapper mapper = new ObjectMapper(); + JsonNode actualObj = mapper.readTree(body); + long tokenExpirationTime = actualObj.get("exp").asLong() * 1000; + long currentTime = System.currentTimeMillis(); + + return tokenExpirationTime - 20000 > currentTime; + } + +} diff --git a/modules/sde-external-services/digital-twins/src/main/java/org/eclipse/tractusx/sde/digitaltwins/gateways/external/DigitalTwinGateway.java b/modules/sde-external-services/digital-twins/src/main/java/org/eclipse/tractusx/sde/digitaltwins/gateways/external/DigitalTwinGateway.java index 5e3c8743e..4d2b06fc2 100644 --- a/modules/sde-external-services/digital-twins/src/main/java/org/eclipse/tractusx/sde/digitaltwins/gateways/external/DigitalTwinGateway.java +++ b/modules/sde-external-services/digital-twins/src/main/java/org/eclipse/tractusx/sde/digitaltwins/gateways/external/DigitalTwinGateway.java @@ -82,6 +82,13 @@ public class DigitalTwinGateway { @Value(value = "${digital-twins.authentication.url}") private String tokenUrl; + private String ddtrUrl; + + public void init(String ddtrUrl) { + this.ddtrUrl = ddtrUrl; + + } + public ShellLookupResponse shellLookup(ShellLookupRequest request) throws ServiceException { RestTemplate restTemplate = new RestTemplate(); @@ -92,7 +99,9 @@ public ShellLookupResponse shellLookup(ShellLookupRequest request) throws Servic Map queryParameters = new HashMap<>(); queryParameters.put(ASSET_IDS_QUERY_PARAMETER, request.toJsonString()); - String url = digitalTwinsHost + "/lookup/shells"; + String dtURL = (this.ddtrUrl == null || this.ddtrUrl.length() < 0) ? digitalTwinsHost : ddtrUrl; + + String url = dtURL + "/lookup/shells"; String urlTemplate = UriComponentsBuilder.fromHttpUrl(url).queryParam(ASSET_IDS_QUERY_PARAMETER, "{assetIds}") .encode().toUriString(); ShellLookupResponse responseBody = null; @@ -234,5 +243,4 @@ private boolean isTokenValid() { return tokenExpirationTime - 20000 > currentTime; } - } \ No newline at end of file diff --git a/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/constants/EDCAssetConstant.java b/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/constants/EDCAssetConstant.java index 8ffa289b0..6e929316f 100644 --- a/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/constants/EDCAssetConstant.java +++ b/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/constants/EDCAssetConstant.java @@ -31,6 +31,7 @@ public final class EDCAssetConstant { public static final String ASSET_PROP_VERSION = "asset:prop:version"; public static final String ASSET_PROP_CONTENTTYPE = "asset:prop:contenttype"; public static final String ASSET_PROP_FILENAME = "asset:prop:fileName"; + public static final String ASSET_PROP_TYPE ="asset:prop:type"; private EDCAssetConstant() {} diff --git a/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/model/asset/DataAddress.java b/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/model/asset/DataAddress.java new file mode 100644 index 000000000..d54fb121f --- /dev/null +++ b/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/model/asset/DataAddress.java @@ -0,0 +1,51 @@ +/******************************************************************************** + * 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.edc.model.asset; + +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.databind.ObjectMapper; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.SneakyThrows; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(Include.NON_NULL) +public class DataAddress { + +private Map properties; + + @SneakyThrows + public String toJsonString() { + final ObjectMapper mapper = new ObjectMapper(); + return mapper.writeValueAsString(this); + } + +} diff --git a/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/model/contractoffers/ContractOffer.java b/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/model/contractoffers/ContractOffer.java index 7ffcd2b54..11156ead6 100644 --- a/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/model/contractoffers/ContractOffer.java +++ b/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/model/contractoffers/ContractOffer.java @@ -21,6 +21,7 @@ package org.eclipse.tractusx.sde.edc.model.contractoffers; import org.eclipse.tractusx.sde.edc.model.asset.Asset; +import org.eclipse.tractusx.sde.edc.model.asset.DataAddress; import org.eclipse.tractusx.sde.edc.model.policies.PolicyDefinition; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @@ -52,6 +53,7 @@ public class ContractOffer { private String offerEnd; private String contractStart; private String contractEnd; + private DataAddress dataAddress; @SneakyThrows public String toJsonString() { diff --git a/modules/sde-submodules/assembly-part-relationship/src/main/java/org/eclipse/tractusx/sde/submodels/apr/steps/DigitalTwinsAspectRelationShipCsvHandlerUseCase.java b/modules/sde-submodules/assembly-part-relationship/src/main/java/org/eclipse/tractusx/sde/submodels/apr/steps/DigitalTwinsAspectRelationShipCsvHandlerUseCase.java index 96c99c89e..02130d994 100644 --- a/modules/sde-submodules/assembly-part-relationship/src/main/java/org/eclipse/tractusx/sde/submodels/apr/steps/DigitalTwinsAspectRelationShipCsvHandlerUseCase.java +++ b/modules/sde-submodules/assembly-part-relationship/src/main/java/org/eclipse/tractusx/sde/submodels/apr/steps/DigitalTwinsAspectRelationShipCsvHandlerUseCase.java @@ -39,6 +39,10 @@ import org.eclipse.tractusx.sde.digitaltwins.entities.response.SubmodelDescriptionListResponse; import org.eclipse.tractusx.sde.digitaltwins.facilitator.DigitalTwinsUtility; import org.eclipse.tractusx.sde.digitaltwins.gateways.external.DigitalTwinGateway; +import org.eclipse.tractusx.sde.edc.model.response.QueryDataOfferModel; +import org.eclipse.tractusx.sde.edc.services.ConsumerControlPanelService; +import org.eclipse.tractusx.sde.portal.handler.PortalProxyService; +import org.eclipse.tractusx.sde.portal.model.ConnectorInfo; import org.eclipse.tractusx.sde.submodels.apr.model.AspectRelationship; import org.springframework.stereotype.Service; @@ -51,6 +55,8 @@ public class DigitalTwinsAspectRelationShipCsvHandlerUseCase extends Step { private final DigitalTwinGateway gateway; private final DigitalTwinsUtility digitalTwinsUtility; + private final PortalProxyService portalProxyService; + private final ConsumerControlPanelService consumerControlPanelService; @SneakyThrows public AspectRelationship run(AspectRelationship aspectRelationShip) throws CsvHandlerDigitalTwinUseCaseException { @@ -182,12 +188,21 @@ private ShellLookupRequest getShellLookupRequestforChild(AspectRelationship aspe @SneakyThrows private CreateSubModelRequest getCreateSubModelRequest(AspectRelationship aspectRelationShip) { + ArrayList value = new ArrayList<>(); + String ddtUrl = ""; value.add(getsemanticIdOfModel()); - ShellLookupRequest shellLookupRequest = getShellLookupRequestforChild(aspectRelationShip); - ShellLookupResponse childshellIds = gateway.shellLookup(shellLookupRequest); + List connectorEndpoints = portalProxyService.fetchConnectorInfo(List.of(aspectRelationShip.getChildManufacturerId())); + + ddtUrl = getDDTRUrl(connectorEndpoints); + + if (!ddtUrl.isEmpty()) { + gateway.init(ddtUrl); + } + + ShellLookupResponse childshellIds = gateway.shellLookup(shellLookupRequest); String childUUID = null; if (childshellIds.isEmpty()) { @@ -216,5 +231,16 @@ private CreateSubModelRequest getCreateSubModelRequest(AspectRelationship aspect return CreateSubModelRequest.builder().idShort(getIdShortOfModel()).identification(identification) .semanticId(semanticId).endpoints(endpoints).build(); } + + private String getDDTRUrl(List connectorEndpoints) { + + connectorEndpoints.stream().forEach(connectorEndpoint -> + connectorEndpoint.getConnectorEndpoint().stream().forEach(conn -> { + List queryDataOfferModel = consumerControlPanelService.queryOnDataOffers(conn, + null, null); + }) + ); + return ""; + } } \ No newline at end of file diff --git a/modules/sde-submodules/batch/pom.xml b/modules/sde-submodules/batch/pom.xml index b89d231af..0cec64e74 100644 --- a/modules/sde-submodules/batch/pom.xml +++ b/modules/sde-submodules/batch/pom.xml @@ -52,6 +52,11 @@ digital-twins 0.0.1 + + org.eclipse.tractusx + bpn-discovery + 0.0.1 + 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 index a0c4f0f10..0c472a069 100644 --- 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 @@ -19,8 +19,13 @@ ********************************************************************************/ 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.csv.RowData; import org.eclipse.tractusx.sde.common.exception.CsvHandlerDigitalTwinUseCaseException; import org.eclipse.tractusx.sde.common.submodel.executor.SubmodelExecutor; @@ -63,6 +68,8 @@ public class BatchExecutor extends SubmodelExecutor { private final BatchMapper batchMapper; private final BatchService batchDeleteService; + + private final BPNDiscoveryUseCaseHandler bPNDiscoveryUseCaseHandler; @SneakyThrows public void executeCsvRecord(RowData rowData, ObjectNode jsonObject, String processId) { @@ -98,6 +105,12 @@ private void nextSteps(Integer rowIndex, ObjectNode jsonObject, String processId eDCBatchHandlerUseCase.init(getSubmodelSchema()); eDCBatchHandlerUseCase.run(getNameOfModel(), batch, processId); + + if (StringUtils.isBlank(batch.getUpdated())) { + Map bpnKeyMap = new HashMap<>(); + bpnKeyMap.put(CommonConstants.MANUFACTURER_PART_ID, batch.getManufacturerPartId()); + bPNDiscoveryUseCaseHandler.run(bpnKeyMap); + } storeBatchCsvHandlerUseCase.run(batch); diff --git a/modules/sde-submodules/part-as-planned/pom.xml b/modules/sde-submodules/part-as-planned/pom.xml index 448eb575a..115e11284 100644 --- a/modules/sde-submodules/part-as-planned/pom.xml +++ b/modules/sde-submodules/part-as-planned/pom.xml @@ -52,6 +52,11 @@ digital-twins 0.0.1 + + org.eclipse.tractusx + bpn-discovery + 0.0.1 + diff --git a/modules/sde-submodules/part-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/pap/PartAsPlannedExecutor.java b/modules/sde-submodules/part-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/pap/PartAsPlannedExecutor.java index 00f461cce..ee7a044f8 100644 --- a/modules/sde-submodules/part-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/pap/PartAsPlannedExecutor.java +++ b/modules/sde-submodules/part-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/pap/PartAsPlannedExecutor.java @@ -19,8 +19,13 @@ ********************************************************************************/ package org.eclipse.tractusx.sde.submodels.pap; +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.csv.RowData; import org.eclipse.tractusx.sde.common.exception.CsvHandlerDigitalTwinUseCaseException; import org.eclipse.tractusx.sde.common.submodel.executor.SubmodelExecutor; @@ -63,6 +68,8 @@ public class PartAsPlannedExecutor extends SubmodelExecutor { private final StorePartAsPlannedHandlerStep storePartAsPlannedCsvHandlerUseCase; private final PartAsPlannedService partAsPlannedService; + + private final BPNDiscoveryUseCaseHandler bPNDiscoveryUseCaseHandler; @SneakyThrows public void executeCsvRecord(RowData rowData, ObjectNode jsonObject, String processId) { @@ -99,6 +106,12 @@ private void nextSteps(Integer rowIndex, ObjectNode jsonObject, String processId eDCPartAsPlannedHandlerUseCase.init(getSubmodelSchema()); eDCPartAsPlannedHandlerUseCase.run(getNameOfModel(), partAsPlannedAspect, processId); + + if (StringUtils.isBlank(partAsPlannedAspect.getUpdated())) { + Map bpnKeyMap = new HashMap<>(); + bpnKeyMap.put(CommonConstants.MANUFACTURER_PART_ID, partAsPlannedAspect.getManufacturerPartId()); + bPNDiscoveryUseCaseHandler.run(bpnKeyMap); + } storePartAsPlannedCsvHandlerUseCase.run(partAsPlannedAspect); } diff --git a/modules/sde-submodules/part-site-information-as-planned/pom.xml b/modules/sde-submodules/part-site-information-as-planned/pom.xml index 7b426f795..f3eb88e76 100644 --- a/modules/sde-submodules/part-site-information-as-planned/pom.xml +++ b/modules/sde-submodules/part-site-information-as-planned/pom.xml @@ -51,6 +51,11 @@ digital-twins 0.0.1 + + org.eclipse.tractusx + bpn-discovery + 0.0.1 + diff --git a/modules/sde-submodules/part-site-information-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/psiap/PartSiteInformationAsPlannedExecutor.java b/modules/sde-submodules/part-site-information-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/psiap/PartSiteInformationAsPlannedExecutor.java index baf4d4a5b..988f9174f 100644 --- a/modules/sde-submodules/part-site-information-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/psiap/PartSiteInformationAsPlannedExecutor.java +++ b/modules/sde-submodules/part-site-information-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/psiap/PartSiteInformationAsPlannedExecutor.java @@ -19,8 +19,13 @@ ********************************************************************************/ package org.eclipse.tractusx.sde.submodels.psiap; +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.csv.RowData; import org.eclipse.tractusx.sde.common.exception.CsvHandlerDigitalTwinUseCaseException; import org.eclipse.tractusx.sde.common.submodel.executor.SubmodelExecutor; @@ -63,6 +68,8 @@ public class PartSiteInformationAsPlannedExecutor extends SubmodelExecutor { private final StorePartSiteInformationAsPlannedHandlerStep storePartSiteInformationAsPlannedCsvHandlerUseCase; private final PartSiteInformationAsPlannedService partSiteInformationAsPlannedService; + + private final BPNDiscoveryUseCaseHandler bPNDiscoveryUseCaseHandler; @SneakyThrows public void executeCsvRecord(RowData rowData, ObjectNode jsonObject, String processId) { @@ -99,6 +106,12 @@ private void nextSteps(Integer rowIndex, ObjectNode jsonObject, String processId eDCPartSiteInformationAsPlannedHandlerUseCase.init(getSubmodelSchema()); eDCPartSiteInformationAsPlannedHandlerUseCase.run(getNameOfModel(), partAsPlannedAspect, processId); + + if (StringUtils.isBlank(partAsPlannedAspect.getUpdated())) { + Map bpnKeyMap = new HashMap<>(); + bpnKeyMap.put(CommonConstants.MANUFACTURER_PART_ID, partAsPlannedAspect.getManufacturerPartId()); + bPNDiscoveryUseCaseHandler.run(bpnKeyMap); + } storePartSiteInformationAsPlannedCsvHandlerUseCase.run(partAsPlannedAspect); } diff --git a/modules/sde-submodules/serial-part-typization/pom.xml b/modules/sde-submodules/serial-part-typization/pom.xml index c7373e535..2c709b56c 100644 --- a/modules/sde-submodules/serial-part-typization/pom.xml +++ b/modules/sde-submodules/serial-part-typization/pom.xml @@ -51,6 +51,11 @@ digital-twins 0.0.1 + + org.eclipse.tractusx + bpn-discovery + 0.0.1 + diff --git a/modules/sde-submodules/serial-part-typization/src/main/java/org/eclipse/tractusx/sde/submodels/spt/SerialPartTypizationExecutor.java b/modules/sde-submodules/serial-part-typization/src/main/java/org/eclipse/tractusx/sde/submodels/spt/SerialPartTypizationExecutor.java index 84f5c2a99..f62e4bfce 100644 --- a/modules/sde-submodules/serial-part-typization/src/main/java/org/eclipse/tractusx/sde/submodels/spt/SerialPartTypizationExecutor.java +++ b/modules/sde-submodules/serial-part-typization/src/main/java/org/eclipse/tractusx/sde/submodels/spt/SerialPartTypizationExecutor.java @@ -21,8 +21,13 @@ ********************************************************************************/ package org.eclipse.tractusx.sde.submodels.spt; +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.csv.RowData; import org.eclipse.tractusx.sde.common.exception.CsvHandlerDigitalTwinUseCaseException; import org.eclipse.tractusx.sde.common.submodel.executor.SubmodelExecutor; @@ -63,6 +68,8 @@ public class SerialPartTypizationExecutor extends SubmodelExecutor { private final EDCAspectHandlerUseCase eDCAspectHandlerUseCase; private final StoreAspectCsvHandlerUseCase storeAspectCsvHandlerUseCase; + + private final BPNDiscoveryUseCaseHandler bPNDiscoveryUseCaseHandler; private final AspectService aspectService; @@ -101,6 +108,12 @@ private void nextSteps(Integer rowIndex, ObjectNode jsonObject, String processId eDCAspectHandlerUseCase.init(getSubmodelSchema()); eDCAspectHandlerUseCase.run(getNameOfModel(), aspect, processId); + + if (StringUtils.isBlank(aspect.getUpdated())) { + Map bpnKeyMap = new HashMap<>(); + bpnKeyMap.put(CommonConstants.MANUFACTURER_PART_ID, aspect.getManufacturerPartId()); + bPNDiscoveryUseCaseHandler.run(bpnKeyMap); + } storeAspectCsvHandlerUseCase.run(aspect); } diff --git a/pom.xml b/pom.xml index d2c238cf4..53a373642 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ org.springframework.boot spring-boot-starter-parent - 3.0.5 + 3.1.0 @@ -42,7 +42,7 @@ 18 2.17.1 - 2022.0.0-RC3 + 2022.0.3 1.4.2.Final 1.3.1.Final 2.0 @@ -52,6 +52,7 @@ modules/sde-external-services/edc modules/sde-external-services/digital-twins modules/sde-external-services/portal + modules/sde-external-services/bpn-discovery modules/sde-common modules/sde-core @@ -79,10 +80,6 @@ org.hibernate hibernate-core - - org.springframework - spring-expression - @@ -94,14 +91,6 @@ logback-classic slf4j-log4j12 - - org.yaml - snakeyaml - - - org.springframework - spring-expression - @@ -119,32 +108,10 @@ - - org.yaml - snakeyaml - ${snakey-version} - org.springframework.boot spring-boot-starter-security - - - org.springframework - spring-expression - - - org.springframework.security - spring-security-web - - - - - org.springframework.security - spring-security-web - 6.0.3 - org.springframework.boot spring-boot-devtools @@ -166,7 +133,6 @@ spring-boot-starter-test test - org.springframework.boot spring-boot-starter-validation @@ -175,26 +141,10 @@ com.fasterxml.jackson.core jackson-databind - - - org.springframework - spring-expression - 6.0.8 - - org.springframework - spring-webmvc - 6.0.8 - - - org.springframework - spring-core - 6.0.8 - - - org.springframework.security - spring-security-core - 6.0.3 + org.yaml + snakeyaml + ${snakey-version}