diff --git a/CHANGELOG.md b/CHANGELOG.md index c3cb8d56f..9cd87445c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,9 @@ 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/), - -## [Unreleased] +## [2.0.0] - 2023-05-05 +- Removed token log statement from logs. +- EDC version 0.3.0 changes for multiple BPN. - Error handling & input validation Messages for exceptions during upload / creation. - Manufacturer country code list. - Cancel contract agreement on provider side. @@ -14,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - To find out which contract belongs to which dataset User have to download the history file ## [1.9.1] - 2023-03-24 + ### Fixed - Helm charts fixed with default values. - Database dependency updated in charts. @@ -126,8 +128,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/dftbackend-1.9.1...main -[1.9.1]: https://github.com/eclipse-tractusx/dft-backend/compare/1.9.0...dftbackend-1.9.1 +[unreleased]: https://github.com/eclipse-tractusx/dft-backend/compare/2.0.0...main +[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 [1.8.1]: https://github.com/eclipse-tractusx/dft-backend/compare/dft-backend-1.8.0...dft-backend-1.8.1 [1.8.0]: https://github.com/eclipse-tractusx/dft-backend/compare/dft-backend-1.7.0...dft-backend-1.8.0 diff --git a/DEPENDENCIES b/DEPENDENCIES index 79c47fad8..f376ff935 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -1,25 +1,25 @@ -maven/mavencentral/ch.qos.logback/logback-classic/1.4.5, EPL-1.0 OR LGPL-2.1-only, approved, #3435 -maven/mavencentral/ch.qos.logback/logback-core/1.4.5, EPL-1.0 OR LGPL-2.1-only, approved, #3373 +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/com.ethlo.time/itu/1.7.0, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.fasterxml.jackson.core/jackson-annotations/2.14.1, Apache-2.0, approved, #5303 -maven/mavencentral/com.fasterxml.jackson.core/jackson-core/2.14.1, Apache-2.0 AND MIT, approved, #4303 -maven/mavencentral/com.fasterxml.jackson.core/jackson-databind/2.14.1, Apache-2.0, approved, #4105 -maven/mavencentral/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/2.14.1, Apache-2.0, approved, #5933 -maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.14.1, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.14.1, Apache-2.0, approved, #4699 -maven/mavencentral/com.fasterxml.jackson.module/jackson-module-parameter-names/2.14.1, Apache-2.0, approved, #5938 +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/classmate/1.5.1, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.github.ben-manes.caffeine/caffeine/3.1.2, 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.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.errorprone/error_prone_annotations/2.16, Apache-2.0, approved, clearlydefined +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.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.sun.istack/istack-commons-runtime/4.1.1, BSD-3-Clause, approved, ee4j.jaxb-impl +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 maven/mavencentral/commons-codec/commons-codec/1.15, Apache-2.0 AND BSD-3-Clause AND LicenseRef-Public-Domain, approved, CQ22641 @@ -29,39 +29,39 @@ maven/mavencentral/io.github.openfeign.form/feign-form-spring/3.8.0, Apache-2.0, 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.3, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #7333 -maven/mavencentral/io.micrometer/micrometer-observation/1.10.3, Apache-2.0, approved, #7331 +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.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.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, ee4j.cdi -maven/mavencentral/jakarta.persistence/jakarta.persistence-api/3.1.0, EPL-2.0 OR BSD-3-Clause, approved, ee4j.jpa -maven/mavencentral/jakarta.transaction/jakarta.transaction-api/2.0.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jta -maven/mavencentral/jakarta.validation/jakarta.validation-api/3.0.2, Apache-2.0, approved, ee4j.bean-validation +maven/mavencentral/jakarta.inject/jakarta.inject-api/2.0.0, 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.22, Apache-2.0, approved, #1810 -maven/mavencentral/net.bytebuddy/byte-buddy/1.12.22, Apache-2.0 AND BSD-3-Clause, approved, #1811 -maven/mavencentral/net.minidev/accessors-smart/2.4.8, Apache-2.0, approved, clearlydefined -maven/mavencentral/net.minidev/json-smart/2.4.8, Apache-2.0, approved, #3288 +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.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 maven/mavencentral/org.apache.commons/commons-csv/1.8, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.commons/commons-lang3/3.12.0, Apache-2.0, approved, clearlydefined 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.5, 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.5, Apache-2.0, approved, #6997 -maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.5, Apache-2.0, approved, clearlydefined +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.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.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.27.0, MIT, approved, clearlydefined -maven/mavencentral/org.eclipse.angus/angus-activation/1.0.0, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.angus +maven/mavencentral/org.checkerframework/checker-qual/3.32.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 @@ -75,12 +75,12 @@ maven/mavencentral/org.eclipse.tractusx/serial-part-typization/0.0.1, Apache-2.0 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.glassfish.jaxb/jaxb-core/4.0.1, BSD-3-Clause, approved, ee4j.jaxb-impl -maven/mavencentral/org.glassfish.jaxb/jaxb-runtime/4.0.1, BSD-3-Clause, approved, ee4j.jaxb-impl -maven/mavencentral/org.glassfish.jaxb/txw2/4.0.1, BSD-3-Clause, approved, ee4j.jaxb-impl +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.2.Final, LGPL-2.1-only, approved, #6962 -maven/mavencentral/org.hibernate.orm/hibernate-core/6.1.6.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.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.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 @@ -95,61 +95,63 @@ 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.1, BSD-3-Clause, approved, CQ23029 -maven/mavencentral/org.postgresql/postgresql/42.5.1, BSD-2-Clause, approved, #3416 -maven/mavencentral/org.projectlombok/lombok/1.18.24, MIT AND LicenseRef-Public-Domain, approved, CQ23907 +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.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.6, MIT, approved, clearlydefined -maven/mavencentral/org.slf4j/slf4j-api/2.0.6, MIT, approved, #5915 +maven/mavencentral/org.slf4j/jul-to-slf4j/2.0.7, MIT, approved, #7698 +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.2, Apache-2.0, approved, #6981 -maven/mavencentral/org.springframework.boot/spring-boot-devtools/3.0.2, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.springframework.boot/spring-boot-starter-aop/3.0.2, Apache-2.0, approved, #6965 -maven/mavencentral/org.springframework.boot/spring-boot-starter-data-jpa/3.0.2, Apache-2.0, approved, #7351 -maven/mavencentral/org.springframework.boot/spring-boot-starter-jdbc/3.0.2, Apache-2.0, approved, #6974 -maven/mavencentral/org.springframework.boot/spring-boot-starter-json/3.0.2, Apache-2.0, approved, #7006 -maven/mavencentral/org.springframework.boot/spring-boot-starter-logging/3.0.2, Apache-2.0, approved, #6982 -maven/mavencentral/org.springframework.boot/spring-boot-starter-oauth2-resource-server/3.0.2, Apache-2.0, approved, #6967 -maven/mavencentral/org.springframework.boot/spring-boot-starter-security/3.0.2, Apache-2.0, approved, #7329 -maven/mavencentral/org.springframework.boot/spring-boot-starter-test/3.0.2, Apache-2.0, approved, #7001 -maven/mavencentral/org.springframework.boot/spring-boot-starter-tomcat/3.0.2, Apache-2.0, approved, #6987 -maven/mavencentral/org.springframework.boot/spring-boot-starter-validation/3.0.2, Apache-2.0, approved, #6971 -maven/mavencentral/org.springframework.boot/spring-boot-starter-web/3.0.2, Apache-2.0, approved, #5945 -maven/mavencentral/org.springframework.boot/spring-boot-starter/3.0.2, Apache-2.0, approved, #7330 -maven/mavencentral/org.springframework.boot/spring-boot-test-autoconfigure/3.0.2, Apache-2.0, approved, #6966 -maven/mavencentral/org.springframework.boot/spring-boot-test/3.0.2, Apache-2.0, approved, #6976 -maven/mavencentral/org.springframework.boot/spring-boot/3.0.2, Apache-2.0, approved, #7327 +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.1, Apache-2.0, approved, #5943 -maven/mavencentral/org.springframework.data/spring-data-jpa/3.0.1, Apache-2.0, approved, #5935 -maven/mavencentral/org.springframework.security/spring-security-config/6.0.1, Apache-2.0, approved, #7338 -maven/mavencentral/org.springframework.security/spring-security-core/6.0.1, Apache-2.0, approved, #7325 -maven/mavencentral/org.springframework.security/spring-security-crypto/6.0.1, Apache-2.0 AND ISC, approved, #7326 -maven/mavencentral/org.springframework.security/spring-security-oauth2-core/6.0.1, Apache-2.0, approved, #7324 -maven/mavencentral/org.springframework.security/spring-security-oauth2-jose/6.0.1, Apache-2.0, approved, #7337 -maven/mavencentral/org.springframework.security/spring-security-oauth2-resource-server/6.0.1, Apache-2.0, approved, #7335 +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.security/spring-security-rsa/1.0.11.RELEASE, Apache-2.0, approved, CQ20647 -maven/mavencentral/org.springframework.security/spring-security-web/6.0.1, Apache-2.0, approved, #7328 -maven/mavencentral/org.springframework/spring-aop/6.0.4, Apache-2.0, approved, #5940 -maven/mavencentral/org.springframework/spring-aspects/6.0.4, Apache-2.0, approved, #5930 -maven/mavencentral/org.springframework/spring-beans/6.0.4, Apache-2.0, approved, #5937 -maven/mavencentral/org.springframework/spring-context/6.0.4, Apache-2.0, approved, #5936 -maven/mavencentral/org.springframework/spring-core/6.0.4, Apache-2.0 AND BSD-3-Clause, approved, #5948 -maven/mavencentral/org.springframework/spring-expression/6.0.4, Apache-2.0, approved, #3284 -maven/mavencentral/org.springframework/spring-jcl/6.0.4, Apache-2.0, approved, #3283 -maven/mavencentral/org.springframework/spring-jdbc/6.0.4, Apache-2.0, approved, #5924 -maven/mavencentral/org.springframework/spring-orm/6.0.4, Apache-2.0, approved, #5925 -maven/mavencentral/org.springframework/spring-test/6.0.4, Apache-2.0, approved, #7003 -maven/mavencentral/org.springframework/spring-tx/6.0.4, Apache-2.0, approved, #5926 -maven/mavencentral/org.springframework/spring-web/6.0.4, Apache-2.0, approved, #5942 -maven/mavencentral/org.springframework/spring-webmvc/6.0.4, Apache-2.0, approved, #5944 +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.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 -maven/mavencentral/org.yaml/snakeyaml/2.0, Apache-2.0 AND (Apache-2.0 AND BSD-3-Clause AND EPL-1.0 AND GPL-2.0-or-later AND LGPL-2.1-or-later), restricted, #7275 +maven/mavencentral/org.yaml/snakeyaml/2.0, Apache-2.0 AND (Apache-2.0 OR BSD-3-Clause OR EPL-1.0 OR GPL-2.0-or-later OR LGPL-2.1-or-later), approved, #7275 diff --git a/InstallationGuide.md b/InstallationGuide.md index 22f37712c..984e06816 100644 --- a/InstallationGuide.md +++ b/InstallationGuide.md @@ -1,50 +1,39 @@ # Installation Guide -## Product DFT -Install from the command line: -docker container run -d --name [conatainer_name] ghcr.io/catenax-ng/tx-dft-backend:[tag] +It is necessary to inject the environment variables, credentials and URLs that can be found on application.properties file. +For more details, please refer configuration section from [README.md](README.md) +### RUN SDE backend in ArgoCD + We have helm chart available for ArgoCD deployment. In deployment, if don't specified specific version, the app version/chart version is automatically picked up by ArgoCD and deployed to the environment using Helm charts. + + In values.yaml you can find `default` as value for all required configuration. You need to change all those values as per your need. For reference, please refer configuration example section. + + As part of argo CD deployment using helm chart the postgres database dependency will get provide automatic but for EDC, DigitalTwin and Portal you need to provide valid details as per configuration requirement other wise SDE service will get started with default configuration but will not work as expected. + +### RUN SDE Backend in k8s cluster +#### Prerequisites +- k8s cluster/ minikube +- helm +- Docker + + In values.yaml you can find `default` as value for all required configuration. You need to change all those values as per your need. For reference, please refer configuration example section. + + ```helm repo add eclipse-tractusx-dft-backend https://github.com/eclipse-tractusx/dft-backend/tree/main/charts ``` + + ```helm install release-name eclipse-tractusx/dft-backend ``` + +### RUN SDE Backend Locally +#### Prerequisites +- JDK18 +- Postgres 11.9.13 + +#### Steps +1. Clone the GitHub Repository - https://github.com/eclipse-tractusx/dft-backend. +2. Get your instance of postgres running (Create **dftdb** new database). +3. Setup your project environment to JDK 18. +4. Provide require application configuration in application.properties as specified in step configuration.properties. +5. Start the SDE spring boot application from your IDE using main class or use spring CLI. -It is necessary to inject the environment variables, credentials and URLs that can be found on application.properties file. -#### CatenaX variables -| Property | Value | Description | Example | -|----------------|----------------|--------------------|---------| -| manufacturerId | MANUFACTURERID | Id of manufacturer | CatenaX | - - -#### Digital Twins variables: -| Property name | Environment Variable Name | Description | Example Value | -|-------------------------------------------|-------------------------------------------|------------------------------------------------|----------------------------------| -| digital-twins.hostname | DIGITAL-TWINS_HOSTNAME | hostname for Digital Twins | https:// | -| digital-twins.authentication.url | DIGITAL-TWINS_AUTHENTICATION_URL | authentication url for Digital Twins | https:// | -| digital-twins.authentication.clientId | DIGITAL-TWINS_AUTHENTICATION_CLIENTID | client ID authentication for Digital Twins | sa-cl6-cx-4 | -| digital-twins.authentication.clientSecret | DIGITAL-TWINS_AUTHENTICATION_CLIENTSECRET | client secret authentication for Digital Twins | VrL8uSG5Tn3NrFiY39vs0klTmlvsRRmo | - -The values are on the [Vault]. -*Must create a GitHub token to access - -#### EDC variables: -| Property name | Environment Variable Name | Description | Example Value | -|------------------|---------------------------|-----------------------------------------------|---------------| -| edc.hostname | EDC_HOSTNAME | edc hostname | https:// | -| edc.apiKeyHeader | EDC_APIKEYHEADER | API KEY header for edc | X-Api_Key | -| edc.apiKey | EDC_APIKEY | API KEY for edc | 123456 | -| dft.hostname | DFT_HOSTNAME | hostname for DFT | https:// | -| dft.apiKeyHeader | DFT_APIKEYHEADER | url authentication key for edc asset payload | Api-Key | -| dft.apiKey | DFT_APIKEY | url authentication code for edc asset payload | someCode | -| edc.enabled | EDC_ENABLED | enable / disable edc | true / false | - -#### Keycloak variables: -| Property name | Environment Variable Name | Description | Example Value | -|-----------------------------------|---------------------------|------------------------------|---------------| -| connector.discovery.token-url | KEYCLOCK_HOSTNAME | keyclock hostnam | https:// | -| connector.discovery.clientId | KEYCLOCK_CLIENTID | keyclock clientId | X-Api_Key | -| connector.discovery.clientSecret | KEYCLOCK_CLIENTSECRET | keyclock clientse | 123456 | -| portal.backend.hostname | PORTAL_HOSTNAME | portal hostname | https:// | - - -The values are in the [Vault]. -*Must create a GitHub token to access ## Upload a file: When a file .csv is uploaded, the program checks whether the file is a SerialPartTypization or an AssemblyPartRelationship and there is a pipeline for each one. @@ -109,7 +98,5 @@ Apart from both upload Batch upload is additional feature were added into DFT. The file .csv is loaded in memory, the content is saved and then, the file is removed from memory. -If the file is not .csv, it is read, processed and is considered as FAILED - - +If the file is not .csv, it is read, processed and is considered as FAILED. diff --git a/README.md b/README.md index a0bfe64be..eba2d181f 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,162 @@ - # Data Format Transformer(Simple Data Exchanger) + # Simple Data Exchanger (formally known Data Format Transformer) --- ## Description -This repository is part of the overarching Catena-X project. It contains the Backend for the DFT. -DFT is short for Data Format Transformer. +This repository is part of the overarching Catena-X project. It contains the Backend for the SDE/DFT. +SDE Simple data exchanger(formally known DFT is short for Data Format Transformer) It is a standalone service which can be self-hosted. It enables companies to provide their data in the Catena-X network via an EDC. -Data is uploaded via two CSV-files. The DFT registers the data in the Digital Twin Registry and makes it accessible via an EDC. -The DFT project has two dependencies: Digital Twins and EDC. -##### For installation guide: see [InstallationGuide.md](InstallationGuide.md) +## Important !!! +### Deployment of SDE backend +The Auto-Setup is the central service orchestration component. The Auto-Setup hide all complex configuration properties for you and get SDE Backend as well as Frontend service deployed for you as service. The Auto-Setup taking all deployment through their specific helm charts. The Auto-Setup knows which prerequisites and which configurations are required for the components and creates them. All dependencies and any error messages are intercepted by Auto-Setup and treated correctly and meaningfully. Therefore, Auto-Setup meets your requirements exactly. -### How to run +Once SDE deployed, The data is uploaded via CSV-files or tabular entry. The SDE registers the data in the Digital Twin Registry and makes it accessible via an EDC. -DFT is a SpringBoot Java software project managed by Maven. +The SDE project has three dependencies: Digital Twins, Portal and EDC. -When running, the project requires a postgresql database to be available to connect to. Per default configuration the application expects postgres to run on localhost on port 5432. +## How to run -You can find the standard credentials as well as further database configurations int the application.properties file in the resource folder. +SDE is a SpringBoot Java Maven software project. +When running, the project requires a postgresql database to be available to connect. +You can find the standard require configuration keys as below: -### Prerequisites -- JDK18 -- Postgres 13.2 -- Docker +### Configuration -### Steps -1. Clone the GitHub Repository - https://github.com/eclipse-tractusx/dft-backend -2. Get your instance of postgres running.(Create **dftdb** new database) -3. Setup your project environment to JDK 18 -4. Start the application from your IDE +Listed below are configuration keys needed to get the `sde-backend` up and running. + +| Key | Required | Example | Description | +|--- |--- |--- |--- | +| keycloak.clientid | X | sdeclientId | This is keycloak clienId/resource | +| spring.security.oauth2.resourceserver.jwt.issuer-uri | X | https://ids.issuer.com/auth/realms/master | Url of Keycloak issuer uri | +| management.endpoint.health.probes.enabled | X | true | Default value, no need to change | +| management.health.readinessstate.enabled | X | true | Default value, no need to change | +| management.health.livenessstate.enabled | X | true | Default value, no need to change | +| management.endpoints.web.exposure.include | X | * | Default value, no need to change | +| spring.lifecycle.timeout-per-shutdown-phase | X | 30s | Default value, no need to change | +| logging.level.org.springframework.security.web.csrf | X | INFO | Default value, no need to change | +| logging.level.org.apache.http | X | info | Default value, no need to change | +| logging.level.root | X | info | Default value, no need to change | +| file.upload-dir | X | ./temp/ | Default value, no need to change | +| spring.servlet.multipart.enabled | X | true | Default value, no need to change | +| spring.main.allow-bean-definition-overriding | X | true | Default value, no need to change | +| spring.servlet.multipart.file-size-threshold | X | 2KB | Default value, no need to change | +| spring.servlet.multipart.max-file-size | X | 200MB | Default value, no need to change | +| spring.servlet.multipart.max-request-size | X | 215MB | Default value, no need to change | +| server.servlet.context-path | X | /api | Default value, no need to change | +| spring.flyway.baseline-on-migrate | X | true | Default value, no need to change | +| spring.flyway.locations | X | classpath:/flyway | Default value, no need to change | +| spring.datasource.driver-class-name | X | org.postgresql.Driver | Default value, no need to change | +| spring.datasource.url | X | jdbc:postgres//dbserver.com:5432/db | Your database server details | +| spring.datasource.username | X | | Your database password | +| spring.datasource.password | X | | Your database password | +| spring.jpa.hibernate.ddl-auto | | update | Default value, no need to change | +| spring.jpa.open-in-view | | false | Default value, no need to change | +| digital-twins.hostname | X | https://example.digitaltwin.com | Digital twin registry url | +| digital-twins.authentication.url | X | http://ex*.keycloak.com/auth/realms/default | Digital twin registry auth url | +| digital-twins.authentication.clientId | X | your clientId | Digital twin registry clientId | +| digital-twins.authentication.clientSecret | X | your secrete | Digital twin registry secrete | +| digital-twins.authentication.grantType | X | client_credentials | Default value, no need to change | +| edc.hostname | X | https://example.provider-connector.com | Your EDC provider connector url | +| edc.apiKeyHeader | X | x-api-key | Your connector api key | +| edc.apiKey | X | yourpass | Your connector apikey value | +| edc.consumer.hostname | X | https://example.consumer-connector.com | Your EDC consumer connector | +| edc.consumer.apikeyheader | X | x-api-key | Your connector api key | +| edc.consumer.apikey | X | yourpass | Your connector apikey value | +| edc.consumer.datauri | X | /api/v1/ids/data | IDS endpoint path | +| dft.hostname | X | https://example.sdehost.com | Your SDE hostname | +| dft.apiKeyHeader | X | API_KEY | Your default key | +| dft.apiKey | X | yourpass | Your default key password | +| manufacturerId | X | default | Your CX partner BPN number | +| partner.pool.hostname | X | default | url to get legal-entity information| +| connector.discovery.token-url | X | https://example.portal.backend.com | Portal backend AuthURL | +| connector.discovery.clientId | X | default | client ID for connector discovery | +| connector.discovery.clientSecret | X | default | password for connector discovery | +| portal.backend.hostname | X | default | Portal backend svc URL based on BPN| +| springdoc.api-docs.path | X | /api-docs | swagger API path | + +#### Example Configuration/application.properties + +``` +keycloak.clientid=sdeclientId +spring.security.oauth2.resourceserver.jwt.issuer-uri=https://ids.issuer.com/auth/realms/master +management.endpoint.health.probes.enabled=true +management.health.readinessstate.enabled=true +management.health.livenessstate.enabled=true +management.endpoints.web.exposure.include=* +spring.lifecycle.timeout-per-shutdown-phase=30s + +#provider your logging level +logging.level.org.springframework.security.web.csrf=INFO +logging.level.org.apache.http=info +logging.level.root=info + +#default spring boot configuration not need to change +file.upload-dir=./temp/ +spring.servlet.multipart.enabled=true +spring.main.allow-bean-definition-overriding=true +spring.servlet.multipart.file-size-threshold=2KB +spring.servlet.multipart.max-file-size=200MB +spring.servlet.multipart.max-request-size=215MB + +#API context path to access application apis +server.servlet.context-path=/api + +#Database and flyway details, the database will +spring.flyway.baseline-on-migrate=true +spring.flyway.locations=classpath:/flyway +spring.datasource.driver-class-name=org.postgresql.Driver +spring.datasource.url=jdbc:postgres//dbserver.com:5432/dftdb #your database server details +spring.datasource.username=your database password +spring.datasource.password=your database password +spring.jpa.hibernate.ddl-auto=update +spring.jpa.open-in-view=false + +#Provide digital twin registry details which SDE should use to create twin for your, +#The need technical user details depend on digital twin security configuration +digital-twins.hostname=https://example.digitaltwin.com +digital-twins.authentication.url=http://example.keycloak.com/auth/realms/default +digital-twins.authentication.clientId=your clientId +digital-twins.authentication.clientSecret=your secrete +digital-twins.authentication.grantType=client_credentials + +#The EDC connector information which SDE should use As Data provider connector +edc.hostname=https://example.provider-connector.com +edc.apiKeyHeader=your connector api key +edc.apiKey=your connector apikey value + +#The EDC connector information which SDE should use As Data consumer connector +edc.consumer.hostname=https://example.consumer-connector.com +edc.consumer.apikeyheader=your connector api key +edc.consumer.apikey=your connector apikey value +edc.consumer.datauri=/api/v1/ids/data + +#Your Own SDE host url which will share with EDC connector as data address proxy +dft.hostname=https://example.sdehost.com +dft.apiKeyHeader=your default key +dft.apiKey=your default key password + +#Your company BPN number +manufacturerId=default + +#Portal pool hostname url to use discover legal company information in SDE +partner.pool.hostname=default + +#Portal backend url for get connector list based on BPN number +connector.discovery.token-url=https://example.portal.backend.com +connector.discovery.clientId=default +connector.discovery.clientSecret=default +portal.backend.hostname=default +springdoc.api-docs.path=/api-docs +``` + +The above configuration we can use as for different deployment as specified here [InstallationGuide.md](InstallationGuide.md) --- ### Supported submodules -To find information about supported submodels and there version in SDE please visit [here](modules/sde-submodules/submodules.md) +To find information about supported submodules and there version in SDE please visit [here](modules/sde-submodules/submodules.md) --- @@ -49,7 +171,7 @@ To find information about supported submodels and there version in SDE please vi * PartSiteInformationAsPlanned * SingleLevelUsageAsBuilt 2. ***Json Update*** - * SerialTypezation + * SerialPartTypization * AssemblyRelationship * Batch * PartAsPlanned @@ -57,7 +179,7 @@ To find information about supported submodels and there version in SDE please vi * PartSiteInformationAsPlanned * SingleLevelUsageAsBuilt 3. ***Application UI*** - * SerialTypezation + * SerialPartTypization * AssemblyRelationship * Batch * PartAsPlanned @@ -69,7 +191,7 @@ To find information about supported submodels and there version in SDE please vi --- ## RESTful APIs OF DFT (Simple Data Exchanger) -###### ***Note: API_KEY, AUTHORISATION TOKEN Required as Headers*** +###### ***Note: API_KEY, AUTHORIZATION TOKEN Required as Headers*** --- | API | Description | Request body | Response body | | ------ | ------ | ------ | ------ | @@ -90,7 +212,7 @@ To find information about supported submodels and there version in SDE please vi | **POST:- localhost:8080/api/subscribe-data-offers** |This API is used to subscribe data offers | Refer Api Doc |Refer Api Doc| | **GET:- localhost:8080/api/contract-offers** |This API is used to get all contract offers | Refer Api Doc |Refer Api Doc| | **GET:- localhost:8080/api/legal-entities** |This API is used to fetch legal entities (list of company's) for Process| Refer Api Doc |Refer Api Doc| -| **POST:- localhost:8080/api/connectors-discovery** |This API is used to fetch connectores information | Refer Api Doc |Refer Api Doc| +| **POST:- localhost:8080/api/connectors-discovery** |This API is used to fetch connector's information | Refer Api Doc |Refer Api Doc| | **GET:- localhost:8080/api/submodels** |This API is used to get all submodels list which is implemented/supported by SDE | Refer Api Doc | Refer Api Doc | | **GET:- localhost:8080/api/submodels/{submodelName}** |This API is used to get the schema data of specific model | Refer Api Doc | Refer Api Doc | | **POST:- localhost:8080/api/{submodel}/upload** |This API is used to uploading data From CSV file for particular selected submodel | Refer Api Doc |4ca03d5f-9e37-4c12-a8b8-6583b81892c8 | @@ -145,7 +267,7 @@ To find information about supported submodels and there version in SDE please vi | **part_as_planned** |Table used to Store Date about Part As Planned. | **Primary Key**:UUID | | **single_level_bom_as_planned** |Data about the relationship of part As Planned to its child-components. | **Primary Key**:parent_catenax_id, child_catenax_id | | **part_site_information_as_planned** |Table used to Store Date about Part Site Information As Planned. | **Primary Key**:UUID | -| **contract_negotiation_info** |Tables Contains Cntract Negotiotion Info and offerid | **Primary Key**: connector_id, offer_id | +| **contract_negotiation_info** |Tables Contains Contract Negotiation Info and offerid | **Primary Key**: connector_id, offer_id | | **failure_log** |Table Contains Data About Failure Entries | **Primary Key**:UUID | | **Flyway_Schema_History** |Table Contains data Migration History | **Primary Key**:installed_rank | | **Process_Report** |Table Contains status of Processing upload | **Primary Key**:process_id | @@ -160,20 +282,13 @@ The scripts are in the folder: resources/flyway.

File naming: Vx__script_name.sql, where x is the version number.

When there is a need to change the last script, it is necessary to create a new script with the changes. -Link to flyway documentation: [Documentation](https://flywaydb.org/documentation/) +Link to flyway documentation: [Documentation](https://flywaydb.org/documentation/). ## API authentication Authentication for the backend is handled via an API Key. This can be set in the configuration file. -## ArgoCD -The latest version on main is automatically picked up by ArgoCD and deployed to the environment using Helm charts. - - helm repo add catenax-ng-product-dft-backend https://github.com/catenax-ng/product-dft-backend/tree/main/charts - - helm install release-name catenax-ng/product-dft-backend - ### EDC -GitHub repository with correct version of the Eclipse DataSpace Connector Project: [repository](https://github.com/catenax-ng/product-edc) +GitHub repository with correct version of the Eclipse DataSpace Connector Project: [repository](https://github.com/eclipse-tractusx/tractusx-edc). ### Licenses -Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) +Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0). \ No newline at end of file diff --git a/build/Dockerfile b/build/Dockerfile index 9ac55cad5..d4825d05f 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,13 +1,9 @@ # our base build image -#FROM maven:3.8.5-openjdk-18-slim as build FROM maven:3.9.0-eclipse-temurin-19 as build # copy the project files COPY ../pom.xml ./pom.xml -# build all dependencies -#RUN mvn dependency:go-offline -B - # copy your other files COPY ../modules ./modules @@ -15,21 +11,17 @@ COPY ../modules ./modules RUN mvn clean install # our final base image -#FROM eclipse-temurin:19.0.1_10-jre FROM eclipse-temurin:19-jdk-jammy ARG USERNAME=dftuser -ARG USER_UID=1000 +ARG USER_UID=1001 ARG USER_GID=$USER_UID # Create the user -RUN groupadd --gid $USER_GID $USERNAME \ - && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ - && apt-get update \ - && apt-get install -y sudo \ - && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ - && chmod 0440 /etc/sudoers.d/$USERNAME + +RUN useradd -rm -d /home/dftuser -s /bin/bash -u $USER_UID -U $USERNAME + USER $USERNAME @@ -40,13 +32,8 @@ WORKDIR /home/user/dftuser/dftapp COPY --from=build modules/sde-core/target/*.jar ./app.jar -#RUN chown ${UID}:${GID} /dft - -#USER ${UID}:${GID} - EXPOSE 8080 # set the startup command to run your binary -#CMD ["java", "-jar", "./app.jar"] CMD ["java", "-jar", "./app.jar","--spring.config.location=file:/app/configuration.properties"] diff --git a/charts/README.md b/charts/README.md index 957e08193..2bbbdda72 100644 --- a/charts/README.md +++ b/charts/README.md @@ -1,43 +1,293 @@ -# Helm Charts for DFT Backend + # Simple Data Exchanger (formally known Data Format Transformer) +--- +## Description -This chart bootstraps a DFT deployment on a Kubernetes cluster using the Helm package manager. +This repository is part of the overarching Catena-X project. It contains the Backend for the SDE/DFT. +SDE Simple data exchanger(formally known DFT is short for Data Format Transformer) +It is a standalone service which can be self-hosted. +It enables companies to provide their data in the Catena-X network via an EDC. -## Dependency Charts +## Important !!! +### Deployment of SDE backend +The Auto-Setup is the central service orchestration component. The Auto-Setup hide all complex configuration properties for you and get SDE Backend as well as Frontend service deployed for you as service. The Auto-Setup taking all deployment through their specific helm charts. The Auto-Setup knows which prerequisites and which configurations are required for the components and creates them. All dependencies and any error messages are intercepted by Auto-Setup and treated correctly and meaningfully. Therefore, Auto-Setup meets your requirements exactly. -This helm chart is an umbrella chart that pulls together engine specific charts. The engine charts are included as dependencies in Chart.yaml. -We have added PostgresSQL bitnami image as a Dependency. +Once SDE deployed, The data is uploaded via CSV-files or tabular entry. The SDE registers the data in the Digital Twin Registry and makes it accessible via an EDC. +The SDE project has three dependencies: Digital Twins, Portal and EDC. +## How to run -## Repository Structure +SDE is a SpringBoot Java Maven software project. -This GitHub repository contains the source for the packaged and versioned charts released using GitHub pages (the Chart Repository). +When running, the project requires a postgresql database to be available to connect. +You can find the standard require configuration keys as below: -The Charts in the charts/ directory in the master branch of this repository match the latest packaged Chart in the Chart Repository. +### Configuration -## Helm Release - -Provides simple semantic versioning based from previous git tags. You can run the chart-release-fe.yml workflow to create new release. +Listed below are configuration keys needed to get the `sde-backend` up and running. -## Helm Chart Templates +| Key | Required | Example | Description | +|--- |--- |--- |--- | +| keycloak.clientid | X | sdeclientId | This is keycloak clienId/resource | +| spring.security.oauth2.resourceserver.jwt.issuer-uri | X | https://ids.issuer.com/auth/realms/master | Url of Keycloak issuer uri | +| management.endpoint.health.probes.enabled | X | true | Default value, no need to change | +| management.health.readinessstate.enabled | X | true | Default value, no need to change | +| management.health.livenessstate.enabled | X | true | Default value, no need to change | +| management.endpoints.web.exposure.include | X | * | Default value, no need to change | +| spring.lifecycle.timeout-per-shutdown-phase | X | 30s | Default value, no need to change | +| logging.level.org.springframework.security.web.csrf | X | INFO | Default value, no need to change | +| logging.level.org.apache.http | X | info | Default value, no need to change | +| logging.level.root | X | info | Default value, no need to change | +| file.upload-dir | X | ./temp/ | Default value, no need to change | +| spring.servlet.multipart.enabled | X | true | Default value, no need to change | +| spring.main.allow-bean-definition-overriding | X | true | Default value, no need to change | +| spring.servlet.multipart.file-size-threshold | X | 2KB | Default value, no need to change | +| spring.servlet.multipart.max-file-size | X | 200MB | Default value, no need to change | +| spring.servlet.multipart.max-request-size | X | 215MB | Default value, no need to change | +| server.servlet.context-path | X | /api | Default value, no need to change | +| spring.flyway.baseline-on-migrate | X | true | Default value, no need to change | +| spring.flyway.locations | X | classpath:/flyway | Default value, no need to change | +| spring.datasource.driver-class-name | X | org.postgresql.Driver | Default value, no need to change | +| spring.datasource.url | X | jdbc:postgres//dbserver.com:5432/db | Your database server details | +| spring.datasource.username | X | | Your database password | +| spring.datasource.password | X | | Your database password | +| spring.jpa.hibernate.ddl-auto | | update | Default value, no need to change | +| spring.jpa.open-in-view | | false | Default value, no need to change | +| digital-twins.hostname | X | https://example.digitaltwin.com | Digital twin registry url | +| digital-twins.authentication.url | X | http://ex*.keycloak.com/auth/realms/default | Digital twin registry auth url | +| digital-twins.authentication.clientId | X | your clientId | Digital twin registry clientId | +| digital-twins.authentication.clientSecret | X | your secrete | Digital twin registry secrete | +| digital-twins.authentication.grantType | X | client_credentials | Default value, no need to change | +| edc.hostname | X | https://example.provider-connector.com | Your EDC provider connector url | +| edc.apiKeyHeader | X | x-api-key | Your connector api key | +| edc.apiKey | X | yourpass | Your connector apikey value | +| edc.consumer.hostname | X | https://example.consumer-connector.com | Your EDC consumer connector | +| edc.consumer.apikeyheader | X | x-api-key | Your connector api key | +| edc.consumer.apikey | X | yourpass | Your connector apikey value | +| edc.consumer.datauri | X | /api/v1/ids/data | IDS endpoint path | +| dft.hostname | X | https://example.sdehost.com | Your SDE hostname | +| dft.apiKeyHeader | X | API_KEY | Your default key | +| dft.apiKey | X | yourpass | Your default key password | +| manufacturerId | X | default | Your CX partner BPN number | +| partner.pool.hostname | X | default | url to get legal-entity information| +| connector.discovery.token-url | X | https://example.portal.backend.com | Portal backend AuthURL | +| connector.discovery.clientId | X | default | client ID for connector discovery | +| connector.discovery.clientSecret | X | default | password for connector discovery | +| portal.backend.hostname | X | default | Portal backend svc URL based on BPN| +| springdoc.api-docs.path | X | /api-docs | swagger API path | -The templates require your application to built into a Docker image. The Docker Templates project provides assistance in creating an image for your application. +#### Example Configuration/application.properties -This project provides the following files: +``` +keycloak.clientid=sdeclientId +spring.security.oauth2.resourceserver.jwt.issuer-uri=https://ids.issuer.com/auth/realms/master +management.endpoint.health.probes.enabled=true +management.health.readinessstate.enabled=true +management.health.livenessstate.enabled=true +management.endpoints.web.exposure.include=* +spring.lifecycle.timeout-per-shutdown-phase=30s -| File | Description | -|---------------------------------------------------|-----------------------------------------------------------------------| -| `/charts/dft-backend/Chart.yaml` | The definition file for your application | -| `/charts/dft-backend/values.yaml` | Configurable values that are inserted into the following template files -| `/charts/dft-backend/values-int.yaml` | Configurable values for int env | -| `/charts/dft-backend/templates/deployment.yaml` | Template to configure your application deployment. | -| `/charts/dft-backend/templates/ingress.yaml` | Template to configure your application deployment. | -| `/charts/dft-backend/templates/service.yaml` | Template to configure your application deployment. | -| `/charts/dft-backend/templates/hpa.yaml` | Template to configure your application deployment. | -| `/charts/dft-backend/templates/NOTES.txt` | Helper to enable locating your application IP and PORT | +#provider your logging level +logging.level.org.springframework.security.web.csrf=INFO +logging.level.org.apache.http=info +logging.level.root=info -## Helm Commands -$ helm repo add catenax-ng-product-dft-backend https://github.com/catenax-ng/product-dft-backend/tree/main/charts +#default spring boot configuration not need to change +file.upload-dir=./temp/ +spring.servlet.multipart.enabled=true +spring.main.allow-bean-definition-overriding=true +spring.servlet.multipart.file-size-threshold=2KB +spring.servlet.multipart.max-file-size=200MB +spring.servlet.multipart.max-request-size=215MB -$ helm install my-release catenax-ng/product-dft-backend --version 1.5.0 +#API context path to access application apis +server.servlet.context-path=/api + +#Database and flyway details, the database will +spring.flyway.baseline-on-migrate=true +spring.flyway.locations=classpath:/flyway +spring.datasource.driver-class-name=org.postgresql.Driver +spring.datasource.url=jdbc:postgres//dbserver.com:5432/dftdb #your database server details +spring.datasource.username=your database password +spring.datasource.password=your database password +spring.jpa.hibernate.ddl-auto=update +spring.jpa.open-in-view=false + +#Provide digital twin registry details which SDE should use to create twin for your, +#The need technical user details depend on digital twin security configuration +digital-twins.hostname=https://example.digitaltwin.com +digital-twins.authentication.url=http://example.keycloak.com/auth/realms/default +digital-twins.authentication.clientId=your clientId +digital-twins.authentication.clientSecret=your secrete +digital-twins.authentication.grantType=client_credentials + +#The EDC connector information which SDE should use As Data provider connector +edc.hostname=https://example.provider-connector.com +edc.apiKeyHeader=your connector api key +edc.apiKey=your connector apikey value + +#The EDC connector information which SDE should use As Data consumer connector +edc.consumer.hostname=https://example.consumer-connector.com +edc.consumer.apikeyheader=your connector api key +edc.consumer.apikey=your connector apikey value +edc.consumer.datauri=/api/v1/ids/data + +#Your Own SDE host url which will share with EDC connector as data address proxy +dft.hostname=https://example.sdehost.com +dft.apiKeyHeader=your default key +dft.apiKey=your default key password + +#Your company BPN number +manufacturerId=default + +#Portal pool hostname url to use discover legal company information in SDE +partner.pool.hostname=default + +#Portal backend url for get connector list based on BPN number +connector.discovery.token-url=https://example.portal.backend.com +connector.discovery.clientId=default +connector.discovery.clientSecret=default +portal.backend.hostname=default +springdoc.api-docs.path=/api-docs +``` + +The above configuration we can use as for different deployment as specified here [InstallationGuide.md](InstallationGuide.md) + +--- +### Supported submodules +To find information about supported submodules and there version in SDE please visit [here](modules/sde-submodules/submodules.md) + +--- + +## DFT(Simple Data Exchanger) Compatible with := +1. ***File Uploads*** + * SerialPartTypization + * AssemblyPartRelationship + * Batch + * PartAsPlanned + * SingleLevelBoMAsPlanned + * PartSiteInformationAsPlanned + * SingleLevelUsageAsBuilt +2. ***Json Update*** + * SerialPartTypization + * AssemblyRelationship + * Batch + * PartAsPlanned + * SingleLevelBoMAsPlanned + * PartSiteInformationAsPlanned + * SingleLevelUsageAsBuilt +3. ***Application UI*** + * SerialPartTypization + * AssemblyRelationship + * Batch + * PartAsPlanned + * SingleLevelBoMAsPlanned + * PartSiteInformationAsPlanned + * SingleLevelUsageAsBuilt + + + --- +## RESTful APIs OF DFT (Simple Data Exchanger) + +###### ***Note: API_KEY, AUTHORIZATION TOKEN Required as Headers*** +--- +| API | Description | Request body | Response body | +| ------ | ------ | ------ | ------ | +| **GET:- localhost:8080/api/submodels** |This API is used to get all submodels list which is implemented/supported by SDE | Refer Api Doc | Refer Api Doc | +| **GET:- localhost:8080/api/submodels/schema-details** |This API is used to get schema details of submodels which is implemented/supported by SDE | Refer Api Doc | Refer Api Doc | +| **GET:- localhost:8080/api/submodels/{submodelName}** |This API is used to get the schema data of specific model | Refer Api Doc | Refer Api Doc | +| **POST:- localhost:8080/api/{submodel}/upload** |This API is used to uploading data From CSV file for particular selected submodel | Refer Api Doc |4ca03d5f-9e37-4c12-a8b8-6583b81892c8 | +| **POST:- localhost:8080/api/{submodel}/manualentry** |This API is used for uploading data From JSon/Tabular form | Refer Api Doc | 4ca03d5f-9e37-4c12-a8b8-6583b81892c8 | +| **GET:- localhost:8080/api/{submodel}/public/{uuid}** |This API is used for to get the specific submodel data | Refer Api Doc | Refer Api Doc | +| **DELETE:- localhost:8080/api/{submodel}/delete/{processId}** |This API is used to delete processed data from EDC and DigitalTwins | Refer Api Doc | Refer Api Doc | +| **GET:- localhost:8080/api/role/{role}/permissions** |This API is used to fetch all permissions associate with particular role | Refer Api Doc |Refer Api Doc| +| **GET:- localhost:8080/api/user/role/permissions** |This API is used to fetch all list of permissions | Refer Api Doc |Refer Api Doc| +| **POST:- localhost:8080/api/role/{role}/permissions** |This API is used to apply list of permissions to the specific role | Refer Api Doc |Refer Api Doc| +| **GET:- localhost:8080/api/processing-report/87d0aece-ae46-4006-904d-9ec41cddee8b** |This API Is Used For fetch Process Report by Process ID| Refer Api Doc |Refer Api Doc| +| **GET:- localhost:8080/api/ping** |This API Is Used For Health Check| -- |2022-09-30T16:21:02.630868| +| **GET:- localhost:8080/api/processing-report?page=&pageSize=50** |This API Is Used For fetch Process Report| Refer Api Doc |Refer Api Doc| +| **GET:- localhost:8080/api/query-data-offers** |This API is used to fetch all data offers of provider URL | Refer Api Doc |Refer Api Doc| +| **POST:- localhost:8080/api/subscribe-data-offers** |This API is used to subscribe data offers | Refer Api Doc |Refer Api Doc| +| **GET:- localhost:8080/api/contract-offers** |This API is used to get all contract offers | Refer Api Doc |Refer Api Doc| +| **GET:- localhost:8080/api/legal-entities** |This API is used to fetch legal entities (list of company's) for Process| Refer Api Doc |Refer Api Doc| +| **POST:- localhost:8080/api/connectors-discovery** |This API is used to fetch connector's information | Refer Api Doc |Refer Api Doc| +| **GET:- localhost:8080/api/submodels** |This API is used to get all submodels list which is implemented/supported by SDE | Refer Api Doc | Refer Api Doc | +| **GET:- localhost:8080/api/submodels/{submodelName}** |This API is used to get the schema data of specific model | Refer Api Doc | Refer Api Doc | +| **POST:- localhost:8080/api/{submodel}/upload** |This API is used to uploading data From CSV file for particular selected submodel | Refer Api Doc |4ca03d5f-9e37-4c12-a8b8-6583b81892c8 | +| **POST:- localhost:8080/api/{submodel}/manualentry** |This API is used for uploading data From JSon/Tabular form | Refer Api Doc | 4ca03d5f-9e37-4c12-a8b8-6583b81892c8 | +| **GET:- localhost:8080/api/{submodel}/public/{uuid}** |This API is used for to get the specific submodel data | Refer Api Doc | Refer Api Doc | +| **DELETE:- localhost:8080/api/{submodel}/delete/{processId}**|This API is used to delete processed data from EDC and DigitalTwins | Refer Api Doc | Refer Api Doc | +| **GET:- localhost:8080/api/role/{role}/permissions** |This API is used to fetch all permissions associate with particular role | Refer Api Doc |Refer Api Doc| +| **GET:- localhost:8080/api/user/role/permissions** |This API is used to fetch all list of permissions | Refer Api Doc |Refer Api Doc| +| **POST:- localhost:8080/api/role/{role}/permissions** |This API is used to apply list of permissions to the specific role | Refer Api Doc |Refer Api Doc| +| **GET:- localhost:8080/api/processing-report/87d0aece-ae46-4006-904d-9ec41cddee8b** |This API Is Used For fetch Process Report by Process ID| Refer Api Doc |Refer Api Doc| +| **GET:- localhost:8080/api/ping** |This API Is Used For Health Check| -- |2022-09-30T16:21:02.630868| +| **GET:- localhost:8080/api/processing-report?page=&pageSize=50** |This API Is Used For fetch Process Report| Refer Api Doc |Refer Api Doc| +| **GET:- localhost:8080/api/query-data-offers** |This API is used to fetch all data offers of provider URL | Refer Api Doc |Refer Api Doc| +| **POST:- localhost:8080/api/subscribe-data-offers** |This API is used to subscribe data offers | Refer Api Doc |Refer Api Doc| +| **GET:- localhost:8080/api/contract-offers** |This API is used to get all contract offers | Refer Api Doc |Refer Api Doc| +| **GET:- localhost:8080/api/legal-entities** |This API is used to fetch legal entities (list of company's) for Process| Refer Api Doc |Refer Api Doc| +| **POST:- localhost:8080/api/connectors-discovery** |This API is used to fetch connectors information | Refer Api Doc |Refer Api Doc| + + +--- +#### **Response Status** +--- +### SUCCESS RESPONSE CODES: +| Code | DESCRIPTION | +| ------ | ------ | +| 200 OK | Indicates that the request has succeeded. | +| 201 Created | Indicates that the request has succeeded and a new resource has been created as a result. | +| 202 Accepted | Indicates that the request has been received but not completed yet | +| 204 No Content | The server has fulfilled the request but does not need to return a response body. The server may return the updated meta information.| + + +### ERROR RESPONSE CODES: +| Code | DESCRIPTION | +| ------ | ------ | +|400 Bad Request | The request could not be understood by the server due to incorrect syntax. | +|401 Unauthorized | Indicates that the request requires user authentication information. | +|403 Forbidden| Unauthorized request. | +|404 Not Found| The server can not find the requested resource. | +|405 Method Not Allowed| The request HTTP method is known by the server but has been disabled and cannot be used for that resource | +|500 Internal Server Error| The server encountered an unexpected condition that prevented it from fulfilling the request.| +|502 Bad Gateway | The server got an invalid response while working as a gateway to get the response needed to handle the request.| +|503 Service Unavailable | The server is not ready to handle the request.| +|504 Gateway Timeout|The server is acting as a gateway and cannot get a response in time for a request. | + +--- +## Database +| Tables | Description | Unique Id | +| ------ | ------ | ------ | +| **aspect** | Table used to Store Date About Serialized Part | **Primary Key**:UUID | +| **aspect_relationship** |Data about the relationship of parts to its child-components. | **Primary Key**:parent_catenax_id, child_catenax_id | +| **batch** |Table used to Store Date about Serialized Part. | **Primary Key**:UUID | +| **part_as_planned** |Table used to Store Date about Part As Planned. | **Primary Key**:UUID | +| **single_level_bom_as_planned** |Data about the relationship of part As Planned to its child-components. | **Primary Key**:parent_catenax_id, child_catenax_id | +| **part_site_information_as_planned** |Table used to Store Date about Part Site Information As Planned. | **Primary Key**:UUID | +| **contract_negotiation_info** |Tables Contains Contract Negotiation Info and offerid | **Primary Key**: connector_id, offer_id | +| **failure_log** |Table Contains Data About Failure Entries | **Primary Key**:UUID | +| **Flyway_Schema_History** |Table Contains data Migration History | **Primary Key**:installed_rank | +| **Process_Report** |Table Contains status of Processing upload | **Primary Key**:process_id | +| **sde_role** |Table Contains list of roles | **Primary Key**:sde_role | +| **sde_permission** |Table Contains list of permissions | **Primary Key**:sde_permission | +| **sde_role_permission_mapping** |Table Contains mapping of role with permissions | **Primary Key**:sde_role, sde_permission | +| **single_level_usage_as_built** |Data about the relationship of parts to its child-components. | **Primary Key**:parent_catenax_id, child_catenax_id | + +--- +## flyway +The scripts are in the folder: resources/flyway.

+File naming: Vx__script_name.sql, where x is the version number.

+When there is a need to change the last script, it is necessary to create a new script with the changes. + +Link to flyway documentation: [Documentation](https://flywaydb.org/documentation/). + +## API authentication +Authentication for the backend is handled via an API Key. This can be set in the configuration file. + +### EDC +GitHub repository with correct version of the Eclipse DataSpace Connector Project: [repository](https://github.com/eclipse-tractusx/tractusx-edc). + +### Licenses +Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0). \ No newline at end of file diff --git a/charts/dftbackend/Chart.yaml b/charts/dftbackend/Chart.yaml index b7cbeb625..2a2f55a8a 100644 --- a/charts/dftbackend/Chart.yaml +++ b/charts/dftbackend/Chart.yaml @@ -1,7 +1,6 @@ ################################################################################# - -# Copyright (c) 2021,2022 Contributors to the Eclipse Foundation -# Copyright (c) 2022, 2023 T-Systems International GmbH +# Copyright (c) 2021, 2022, 2023 T-Systems International GmbH +# Copyright (c) 2021,2022,2023 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional # information regarding copyright ownership. @@ -18,7 +17,6 @@ # # SPDX-License-Identifier: Apache-2.0 ################################################################################ - apiVersion: v2 name: dftbackend description: A Helm chart for Kubernetes @@ -39,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: 1.9.1 +version: 2.0.0 # 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: "1.9.1" +appVersion: "2.0.0" dependencies: - condition: dftpostgresql.enabled diff --git a/charts/dftbackend/README.md b/charts/dftbackend/README.md index 7a6a83afd..b8192c9ee 100644 --- a/charts/dftbackend/README.md +++ b/charts/dftbackend/README.md @@ -8,6 +8,8 @@ This chart bootstraps a DFT deployment on a Kubernetes cluster using the Helm pa This helm chart is an umbrella chart that pulls together engine specific charts. The engine charts are included as dependencies in Chart.yaml. We have added PostgresSQL bitnami image as a Dependency. + + ## Repository Structure This GitHub repository contains the source for the packaged and versioned charts released using GitHub pages (the Chart Repository). @@ -25,17 +27,18 @@ The templates require your application to built into a Docker image. The Docker This project provides the following files: | File | Description | -|----------------------------------------------------|-------------------------------------------------------------------------| +|--------------------------------------------------- |----------------------------------------------------------------------- | | `/charts/dftbackend/Chart.yaml` | The definition file for your application | | `/charts/dftbackend/values.yaml` | Configurable values that are inserted into the following template files | -| `/charts/dftbackend/templates/configmap.yaml` | Configurable values for int env | +| `/charts/dftbackend/values-int.yaml` | Configurable values for int env | | `/charts/dftbackend/templates/deployment.yaml` | Template to configure your application deployment. | | `/charts/dftbackend/templates/ingress.yaml` | Template to configure your application deployment. | | `/charts/dftbackend/templates/service.yaml` | Template to configure your application deployment. | | `/charts/dftbackend/templates/hpa.yaml` | Template to configure your application deployment. | -| `/charts/dftbackend/templates/serviceaccount.yaml` | Helper to enable locating your application IP and PORT | +| `/charts/dftbackend/templates/NOTES.txt` | Helper to enable locating your application IP and PORT | ## Helm Commands $ helm repo add eclipse-tractusx-dft-backend https://github.com/eclipse-tractusx/dft-backend/tree/main/charts -$ helm install my-release eclipse-tractusx/dftbackend --version 1.9.0 +$ helm install my-release eclipse-tractusx/dftbackend --version 2.0.0 + diff --git a/charts/dftbackend/templates/configmap.yaml b/charts/dftbackend/templates/configmap.yaml index b172bbe4f..afd99f4be 100644 --- a/charts/dftbackend/templates/configmap.yaml +++ b/charts/dftbackend/templates/configmap.yaml @@ -1,3 +1,22 @@ +################################################################################# +# Copyright (c) 2021, 2022, 2023 T-Systems International GmbH +# Copyright (c) 2021,2022,2023 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 +################################################################################ apiVersion: v1 kind: ConfigMap metadata: diff --git a/charts/dftbackend/templates/deployment.yaml b/charts/dftbackend/templates/deployment.yaml index 64024ffa5..09b3d5ada 100644 --- a/charts/dftbackend/templates/deployment.yaml +++ b/charts/dftbackend/templates/deployment.yaml @@ -1,6 +1,6 @@ ################################################################################# -# Copyright (c) 2021,2022 Catena-X -# Copyright (c) 2021,2022 Contributors to the Eclipse Foundation +# Copyright (c) 2021, 2022, 2023 T-Systems International GmbH +# Copyright (c) 2021,2022,2023 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional # information regarding copyright ownership. diff --git a/charts/dftbackend/templates/hpa.yaml b/charts/dftbackend/templates/hpa.yaml index 0dba3b71f..2fe6cb54e 100644 --- a/charts/dftbackend/templates/hpa.yaml +++ b/charts/dftbackend/templates/hpa.yaml @@ -1,3 +1,23 @@ +################################################################################# +# Copyright (c) 2021, 2022, 2023 T-Systems International GmbH +# Copyright (c) 2021,2022,2023 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 +################################################################################ +--- {{- if .Values.autoscaling.enabled }} apiVersion: autoscaling/v2beta1 kind: HorizontalPodAutoscaler diff --git a/charts/dftbackend/templates/ingress.yaml b/charts/dftbackend/templates/ingress.yaml index 82570b492..25aa22640 100644 --- a/charts/dftbackend/templates/ingress.yaml +++ b/charts/dftbackend/templates/ingress.yaml @@ -1,3 +1,22 @@ +################################################################################# +# Copyright (c) 2021, 2022, 2023 T-Systems International GmbH +# Copyright (c) 2021,2022,2023 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 +################################################################################ {{- $fullName := include "dftbackend.fullname" . }} {{- $labels := include "dftbackend.labels" . | nindent 4 }} {{- $gitVersion := .Capabilities.KubeVersion.GitVersion }} diff --git a/charts/dftbackend/templates/postgresql-secrets.yaml b/charts/dftbackend/templates/postgresql-secrets.yaml index 58c752a29..bfc903245 100644 --- a/charts/dftbackend/templates/postgresql-secrets.yaml +++ b/charts/dftbackend/templates/postgresql-secrets.yaml @@ -1,3 +1,22 @@ +################################################################################# +# Copyright (c) 2021, 2022, 2023 T-Systems International GmbH +# Copyright (c) 2021,2022,2023 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 +################################################################################ apiVersion: v1 kind: Secret metadata: diff --git a/charts/dftbackend/templates/service.yaml b/charts/dftbackend/templates/service.yaml index 57b68f457..0a339747d 100644 --- a/charts/dftbackend/templates/service.yaml +++ b/charts/dftbackend/templates/service.yaml @@ -1,3 +1,22 @@ +################################################################################# +# Copyright (c) 2021, 2022, 2023 T-Systems International GmbH +# Copyright (c) 2021,2022,2023 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 +################################################################################ apiVersion: v1 kind: Service metadata: diff --git a/charts/dftbackend/templates/serviceaccount.yaml b/charts/dftbackend/templates/serviceaccount.yaml index 62df286f1..842966664 100644 --- a/charts/dftbackend/templates/serviceaccount.yaml +++ b/charts/dftbackend/templates/serviceaccount.yaml @@ -1,3 +1,23 @@ +################################################################################# +# Copyright (c) 2021, 2022, 2023 T-Systems International GmbH +# Copyright (c) 2021,2022,2023 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 +################################################################################ +--- {{- if .Values.serviceAccount.create -}} apiVersion: v1 kind: ServiceAccount diff --git a/charts/dftbackend/templates/tests/test-connection.yaml b/charts/dftbackend/templates/tests/test-connection.yaml index 3f725efa0..77cf80e25 100644 --- a/charts/dftbackend/templates/tests/test-connection.yaml +++ b/charts/dftbackend/templates/tests/test-connection.yaml @@ -1,3 +1,22 @@ +################################################################################# +# Copyright (c) 2021, 2022, 2023 T-Systems International GmbH +# Copyright (c) 2021,2022,2023 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 +################################################################################ apiVersion: v1 kind: Pod metadata: diff --git a/charts/dftbackend/values.yaml b/charts/dftbackend/values.yaml index 2fbe7b855..db7f94acd 100644 --- a/charts/dftbackend/values.yaml +++ b/charts/dftbackend/values.yaml @@ -1,7 +1,6 @@ ################################################################################# - -# Copyright (c) 2021,2022 Contributors to the Eclipse Foundation -# Copyright (c) 2022, 2023 T-Systems International GmbH +# Copyright (c) 2021, 2022, 2023 T-Systems International GmbH +# Copyright (c) 2021,2022,2023 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional # information regarding copyright ownership. @@ -68,21 +67,17 @@ dftbackend: # -- The path mapping the "default" api is going to be exposed at path: /dftbackend -ingress: +ingresses: - enabled: false className: "nginx" annotations: {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" - hostname: "" - + hostname: "" endpoints: - default - tls: - enabled: true - secretName: "" # -- If present overwrites the default secret name certManager: diff --git a/modules/sde-common/src/main/java/org/eclipse/tractusx/sde/common/exception/GlobalDefaultExceptionHandler.java b/modules/sde-common/src/main/java/org/eclipse/tractusx/sde/common/exception/GlobalDefaultExceptionHandler.java index b01191b48..42ed0cf53 100644 --- a/modules/sde-common/src/main/java/org/eclipse/tractusx/sde/common/exception/GlobalDefaultExceptionHandler.java +++ b/modules/sde-common/src/main/java/org/eclipse/tractusx/sde/common/exception/GlobalDefaultExceptionHandler.java @@ -45,28 +45,32 @@ public class GlobalDefaultExceptionHandler extends ResponseEntityExceptionHandle public static final String DEFAULT_ERROR_VIEW = "error"; @ExceptionHandler(NoDataFoundException.class) - public ResponseEntity handleNodataFoundException(NoDataFoundException ex, WebRequest request) { - log.error("NoDataFoundException "+ex.getMessage()); - return new ResponseEntity<>(ex.getMessage(), HttpStatus.NOT_FOUND); + public ResponseEntity> handleNodataFoundException(NoDataFoundException ex, WebRequest request) { + log.error("NoDataFoundException " + ex.getMessage()); + Map errorResponse = prepareErrorResponse(ex.getMessage()); + return new ResponseEntity<>(errorResponse, HttpStatus.NOT_FOUND); } @ExceptionHandler(Exception.class) - public ResponseEntity handlePSQLException(Exception ex, WebRequest request) { - log.error("Internal server error "+ex.getMessage()); - return new ResponseEntity<>("Internal Server error", HttpStatus.INTERNAL_SERVER_ERROR); + public ResponseEntity> handlePSQLException(Exception ex, WebRequest request) { + log.error("Internal server error " + ex.getMessage()); + Map errorResponse = prepareErrorResponse("Internal Server error"); + return new ResponseEntity<>(errorResponse, HttpStatus.INTERNAL_SERVER_ERROR); } @ExceptionHandler(ValidationException.class) - public ResponseEntity handleValidationException(ValidationException ex, WebRequest request) { - log.error("ValidationException "+ex.getMessage()); - return new ResponseEntity<>(ex.getMessage(), HttpStatus.BAD_REQUEST); + public ResponseEntity> handleValidationException(ValidationException ex, WebRequest request) { + log.error("ValidationException " + ex.getMessage()); + Map errorResponse = prepareErrorResponse(ex.getMessage()); + return new ResponseEntity<>(errorResponse, HttpStatus.BAD_REQUEST); } @ExceptionHandler(ConstraintViolationException.class) - public ResponseEntity handleConstraintValidationException(ConstraintViolationException ex, + public ResponseEntity> handleConstraintValidationException(ConstraintViolationException ex, WebRequest request) { - log.error("ConstraintViolationException "+ex.getMessage()); - return new ResponseEntity<>(ex.getMessage(), HttpStatus.BAD_REQUEST); + log.error("ConstraintViolationException " + ex.getMessage()); + Map errorResponse = prepareErrorResponse(ex.getMessage()); + return new ResponseEntity<>(errorResponse, HttpStatus.BAD_REQUEST); } @Override @@ -78,16 +82,22 @@ protected ResponseEntity handleMethodArgumentNotValid(MethodArgumentNotV String errorMessage = error.getDefaultMessage(); errors.put(fieldName, errorMessage); }); - log.error("MethodArgumentNotValidException "+errors); + log.error("MethodArgumentNotValidException " + errors); return new ResponseEntity<>(errors, HttpStatus.BAD_REQUEST); } @ExceptionHandler(AccessDeniedException.class) - public final ResponseEntity handleAccessDeniedException(AccessDeniedException ex, WebRequest request) { - log.error("MethodArgumentNotValidException- You don't have access to this page or the page doesn't exist. Please contact your admin"); - return new ResponseEntity<>( - "You don't have access to this page or the page doesn't exist. Please contact your admin", - HttpStatus.FORBIDDEN); + public final ResponseEntity> handleAccessDeniedException(AccessDeniedException ex, + WebRequest request) { + String error = "You don't have access to this page or the page doesn't exist. Please contact your admin"; + log.error(error); + Map errorResponse = prepareErrorResponse(error); + return new ResponseEntity<>(errorResponse, HttpStatus.FORBIDDEN); } + private Map prepareErrorResponse(String errormsg) { + Map errorResponse = new HashMap<>(); + errorResponse.put("msg", errormsg); + return errorResponse; + } } diff --git a/modules/sde-common/src/main/java/org/eclipse/tractusx/sde/common/submodel/executor/create/steps/impl/CsvParse.java b/modules/sde-common/src/main/java/org/eclipse/tractusx/sde/common/submodel/executor/create/steps/impl/CsvParse.java index 6ffb010ba..eab7d33f3 100644 --- a/modules/sde-common/src/main/java/org/eclipse/tractusx/sde/common/submodel/executor/create/steps/impl/CsvParse.java +++ b/modules/sde-common/src/main/java/org/eclipse/tractusx/sde/common/submodel/executor/create/steps/impl/CsvParse.java @@ -25,7 +25,6 @@ import org.eclipse.tractusx.sde.common.constants.CommonConstants; import org.eclipse.tractusx.sde.common.entities.csv.RowData; import org.eclipse.tractusx.sde.common.exception.CsvHandlerUseCaseException; -import org.eclipse.tractusx.sde.common.exception.ValidationException; import org.eclipse.tractusx.sde.common.submodel.executor.Step; import org.springframework.stereotype.Component; @@ -50,23 +49,25 @@ public ObjectNode run(RowData rowData, ObjectNode rowjObject, String processId) String[] rowDataFields = rowData.content().split(CommonConstants.SEPARATOR, -1); if (rowDataFields.length != fields.size()) { - throw new CsvHandlerUseCaseException(rowData.position(), "This row has the wrong amount of fields"); + throw new CsvHandlerUseCaseException(rowData.position(), + "This row has the wrong amount of fields " + rowDataFields); } int colomnIndex = 0; for (String ele : fields) { + String fieldValue = null; try { JsonObject jObject = submodelProperties.get(ele).getAsJsonObject(); - String fieldValue = rowDataFields[colomnIndex]; + fieldValue = rowDataFields[colomnIndex]; recordProcessUtils.setFieldValue(rowjObject, ele, jObject, fieldValue); colomnIndex++; - } catch (ValidationException errorMessages) { + } catch (Exception errorMessages) { throw new CsvHandlerUseCaseException(rowData.position(), colomnIndex, - ele + ":" + errorMessages.toString()); + ele + ": " + fieldValue + ": " + errorMessages.toString()); } } diff --git a/modules/sde-common/src/main/java/org/eclipse/tractusx/sde/common/submodel/executor/create/steps/impl/JsonRecordFormating.java b/modules/sde-common/src/main/java/org/eclipse/tractusx/sde/common/submodel/executor/create/steps/impl/JsonRecordFormating.java index 11edf678c..8bcac5811 100644 --- a/modules/sde-common/src/main/java/org/eclipse/tractusx/sde/common/submodel/executor/create/steps/impl/JsonRecordFormating.java +++ b/modules/sde-common/src/main/java/org/eclipse/tractusx/sde/common/submodel/executor/create/steps/impl/JsonRecordFormating.java @@ -23,7 +23,6 @@ import java.util.Set; import org.eclipse.tractusx.sde.common.exception.JsonRecordHandlerUseCaseException; -import org.eclipse.tractusx.sde.common.exception.ValidationException; import org.eclipse.tractusx.sde.common.submodel.executor.Step; import org.springframework.stereotype.Component; @@ -48,10 +47,10 @@ public ObjectNode run(Integer rowIndex, ObjectNode rowjObject, String processId) int colomnIndex = 0; for (String ele : fields) { + String fieldValue = null; try { JsonObject jObject = submodelProperties.get(ele).getAsJsonObject(); - String fieldValue = null; JsonNode jsonValuenode = rowjObject.get(ele); if (!jsonValuenode.isNull()) fieldValue = jsonValuenode.asText(); @@ -60,9 +59,9 @@ public ObjectNode run(Integer rowIndex, ObjectNode rowjObject, String processId) colomnIndex++; - } catch (ValidationException errorMessages) { + } catch (Exception errorMessages) { throw new JsonRecordHandlerUseCaseException(rowIndex, colomnIndex, - ele + ":" + errorMessages.toString()); + ele + ": " + fieldValue + ":" + errorMessages.toString()); } } diff --git a/modules/sde-common/src/main/java/org/eclipse/tractusx/sde/common/submodel/executor/create/steps/impl/JsonRecordValidate.java b/modules/sde-common/src/main/java/org/eclipse/tractusx/sde/common/submodel/executor/create/steps/impl/JsonRecordValidate.java index 09e086ad3..06af241bf 100644 --- a/modules/sde-common/src/main/java/org/eclipse/tractusx/sde/common/submodel/executor/create/steps/impl/JsonRecordValidate.java +++ b/modules/sde-common/src/main/java/org/eclipse/tractusx/sde/common/submodel/executor/create/steps/impl/JsonRecordValidate.java @@ -54,7 +54,7 @@ public boolean run(Integer rowIndex, JsonNode inputJsonObject) { sb.append(string + "\n"); } if (!sb.isEmpty()) - throw new ValidationException(rowIndex + ", " + sb.toString()); + throw new ValidationException(String.format("RowPosition: %s | Description: %s", rowIndex, sb.toString())); dependentFieldValidation(rowIndex, inputJsonObject); @@ -70,7 +70,7 @@ private void dependentFieldValidation(Integer rowIndex, JsonNode inputJsonObject try { JsonArray jArray = submodelProperties.get(ele).getAsJsonArray(); JsonNode jsonNode = inputJsonObject.get(ele); - + String keyFiledValue = null; if (!jsonNode.isNull()) keyFiledValue = jsonNode.asText(); @@ -80,7 +80,8 @@ private void dependentFieldValidation(Integer rowIndex, JsonNode inputJsonObject } } catch (Exception e) { - throw new ValidationException(rowIndex + ", " + e.toString()); + throw new ValidationException( + String.format("RowPosition: %s | Description: %s", rowIndex, e.toString())); } } } @@ -88,7 +89,7 @@ private void dependentFieldValidation(Integer rowIndex, JsonNode inputJsonObject private void validateDependentFieldValue(JsonNode inputJsonObject, String ele, JsonArray jArray) { for (JsonElement dependentField : jArray) { JsonNode jsonNodeField = inputJsonObject.get(dependentField.getAsString()); - + String dependentFiledValue = null; if (!jsonNodeField.isNull()) dependentFiledValue = jsonNodeField.asText(); diff --git a/modules/sde-core/pom.xml b/modules/sde-core/pom.xml index 1221d5a23..f071e8d93 100644 --- a/modules/sde-core/pom.xml +++ b/modules/sde-core/pom.xml @@ -96,7 +96,10 @@ commons-csv 1.8 - + + org.springframework.boot + spring-boot-starter-cache + org.eclipse.tractusx portal diff --git a/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/SdeApplication.java b/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/SdeApplication.java index dcff2998e..c54df2777 100644 --- a/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/SdeApplication.java +++ b/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/SdeApplication.java @@ -25,15 +25,19 @@ import org.springframework.boot.autoconfigure.ImportAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration; +import org.springframework.cache.annotation.EnableCaching; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.FeignAutoConfiguration; import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.annotation.EnableScheduling; @SpringBootApplication(exclude = {UserDetailsServiceAutoConfiguration.class}) @EnableFeignClients @EnableAsync @ImportAutoConfiguration({FeignAutoConfiguration.class}) +@EnableCaching +@EnableScheduling public class SdeApplication { public static void main(String[] args) { diff --git a/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/controller/ConsumerController.java b/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/controller/ConsumerController.java index 06cac8615..11c5e32fc 100644 --- a/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/controller/ConsumerController.java +++ b/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/controller/ConsumerController.java @@ -20,18 +20,12 @@ package org.eclipse.tractusx.sde.core.controller; -import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import static org.springframework.http.ResponseEntity.ok; -import java.util.List; -import java.util.Map; import java.util.UUID; import org.eclipse.tractusx.sde.edc.model.request.ConsumerRequest; import org.eclipse.tractusx.sde.edc.services.ConsumerControlPanelService; -import org.eclipse.tractusx.sde.portal.model.ConnectorInfo; -import org.eclipse.tractusx.sde.portal.model.response.LegalEntityResponse; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; @@ -41,24 +35,29 @@ import org.springframework.web.bind.annotation.RestController; import jakarta.validation.Valid; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @Slf4j @RestController +@RequiredArgsConstructor public class ConsumerController { - @Autowired private final ConsumerControlPanelService consumerControlPanelService; - public ConsumerController(ConsumerControlPanelService consumerControlPanelService) { - this.consumerControlPanelService = consumerControlPanelService; - } - @GetMapping(value = "/query-data-offers") @PreAuthorize("hasPermission('','consumer_view_contract_offers')") - public ResponseEntity queryOnDataOffers(@RequestParam String providerUrl) throws Exception { + public ResponseEntity queryOnDataOffers(@RequestParam String providerUrl, + @RequestParam(value = "maxLimit", required = false) Integer limit, + @RequestParam(value = "offset", required = false) Integer offset) throws Exception { log.info("Request received : /api/query-data-Offers"); - return ok().body(consumerControlPanelService.queryOnDataOffers(providerUrl)); + if (limit == null) { + limit = 10; + } + if (offset == null) { + offset = 0; + } + return ok().body(consumerControlPanelService.queryOnDataOffers(providerUrl, limit, offset)); } @PostMapping(value = "/subscribe-data-offers") @@ -69,39 +68,4 @@ public ResponseEntity subscribeDataOffers(@Valid @RequestBody ConsumerRe consumerControlPanelService.subscribeDataOffers(consumerRequest, processId); return ResponseEntity.ok().body(processId); } - - @GetMapping(value = "/contract-agreements", produces = APPLICATION_JSON_VALUE) - @PreAuthorize("hasPermission('','consumer_view_contract_agreement@provider_view_contract_agreement')") - public ResponseEntity queryOnDataOffersStatus(@RequestParam(value = "type", required = false) String type, - @RequestParam(value = "maxLimit", required = false) Integer limit, - @RequestParam(value = "offset", required = false) Integer offset) { - log.info("Request received : /api/contract-agreements"); - if (limit == null) { - limit = 10; - } - if (offset == null) { - offset = 0; - } - Map res = consumerControlPanelService.getAllContractOffers(type, limit, - offset); - return ok().body(res); - } - - @GetMapping(value = "/legal-entities") - @PreAuthorize("hasPermission('','consumer_search_connectors')") - public ResponseEntity> fetchLegalEntitiesData(@RequestParam String searchText, - @RequestParam Integer page, @RequestParam Integer size) throws Exception { - log.info("Request received : /api/legal-entities"); - List legalEntitiesResponse = consumerControlPanelService.fetchLegalEntitiesData(searchText, - page, size); - return ok().body(legalEntitiesResponse); - } - - @PostMapping(value = "/connectors-discovery") - @PreAuthorize("hasPermission('','consumer_search_connectors')") - public ResponseEntity> fetchConnectorInfo(@RequestBody List bpns) throws Exception { - log.info("Request received : /api/connectors-discovery"); - List fetchConnectorInfoResponse = consumerControlPanelService.fetchConnectorInfo(bpns); - return ok().body(fetchConnectorInfoResponse); - } } diff --git a/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/controller/ContractManagementController.java b/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/controller/ContractManagementController.java new file mode 100644 index 000000000..2c34de464 --- /dev/null +++ b/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/controller/ContractManagementController.java @@ -0,0 +1,106 @@ +/******************************************************************************** + * 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.core.controller; + +import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; +import static org.springframework.http.ResponseEntity.ok; + +import java.util.Map; + +import org.eclipse.tractusx.sde.edc.enums.Type; +import org.eclipse.tractusx.sde.edc.facilitator.ContractNegotiateManagementHelper; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import lombok.RequiredArgsConstructor; + +@RestController +@RequestMapping("contract-agreements") +@RequiredArgsConstructor +public class ContractManagementController { + + private final ContractNegotiateManagementHelper contractNegotiateManagement; + + @GetMapping(value = "/provider", produces = APPLICATION_JSON_VALUE) + @PreAuthorize("hasPermission('','provider_view_contract_agreement')") + public ResponseEntity contractAgreementsProvider( + @RequestParam(value = "maxLimit", required = false) Integer limit, + @RequestParam(value = "offset", required = false) Integer offset) { + if (limit == null) { + limit = 10; + } + if (offset == null) { + offset = 0; + } + Map res = contractNegotiateManagement.getAllContractOffers(Type.PROVIDER.name(), limit, offset); + return ok().body(res); + } + + @GetMapping(value = "/consumer", produces = APPLICATION_JSON_VALUE) + @PreAuthorize("hasPermission('','consumer_view_contract_agreement')") + public ResponseEntity contractAgreementsConsumer( + @RequestParam(value = "maxLimit", required = false) Integer limit, + @RequestParam(value = "offset", required = false) Integer offset) { + if (limit == null) { + limit = 10; + } + if (offset == null) { + offset = 0; + } + Map res = contractNegotiateManagement.getAllContractOffers(Type.CONSUMER.name(), limit, offset); + return ok().body(res); + } + + @PostMapping(value = "/{negotiationId}/provider/decline", produces = APPLICATION_JSON_VALUE) + @PreAuthorize("hasPermission('','provider_delete_contract_agreement')") + public ResponseEntity declineContractProvider(@PathVariable("negotiationId") String negotiationId) { + contractNegotiateManagement.declineContract(Type.PROVIDER.name(), negotiationId); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @GetMapping(value = "/{negotiationId}/consumer/decline", produces = APPLICATION_JSON_VALUE) + @PreAuthorize("hasPermission('','consumer_delete_contract_agreement')") + public ResponseEntity declineContractConsumer(@PathVariable("negotiationId") String negotiationId) { + contractNegotiateManagement.declineContract(Type.CONSUMER.name(), negotiationId); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @PostMapping(value = "/{negotiationId}/provider/cancel", produces = APPLICATION_JSON_VALUE) + @PreAuthorize("hasPermission('','provider_delete_contract_agreement')") + public ResponseEntity cancelContractProvider(@PathVariable("negotiationId") String negotiationId) { + contractNegotiateManagement.cancelContract(Type.PROVIDER.name(), negotiationId); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @PostMapping(value = "/{negotiationId}/consumer/cancel", produces = APPLICATION_JSON_VALUE) + @PreAuthorize("hasPermission('','consumer_delete_contract_agreement')") + public ResponseEntity cancelContractConsumer(@PathVariable("negotiationId") String negotiationId) { + contractNegotiateManagement.cancelContract(Type.CONSUMER.name(), negotiationId); + return new ResponseEntity<>(HttpStatus.CREATED); + } +} diff --git a/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/controller/PortalProxyController.java b/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/controller/PortalProxyController.java new file mode 100644 index 000000000..48c23282c --- /dev/null +++ b/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/controller/PortalProxyController.java @@ -0,0 +1,75 @@ +/******************************************************************************** + * 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.core.controller; + +import static org.springframework.http.ResponseEntity.ok; + +import java.util.List; + +import org.eclipse.tractusx.sde.portal.handler.PortalProxyService; +import org.eclipse.tractusx.sde.portal.model.ConnectorInfo; +import org.eclipse.tractusx.sde.portal.model.response.LegalEntityResponse; +import org.eclipse.tractusx.sde.portal.model.response.UnifiedBpnValidationResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +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.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@RestController +public class PortalProxyController { + + @Autowired + private PortalProxyService portalProxyService; + + + @GetMapping(value = "/legal-entities") + @PreAuthorize("hasPermission('','consumer_search_connectors')") + public ResponseEntity> fetchLegalEntitiesData(@RequestParam String searchText, + @RequestParam Integer page, @RequestParam Integer size) throws Exception { + log.info("Request received : /api/legal-entities"); + List legalEntitiesResponse = portalProxyService.fetchLegalEntitiesData(searchText, + page, size); + return ok().body(legalEntitiesResponse); + } + + @PostMapping(value = "/connectors-discovery") + @PreAuthorize("hasPermission('','consumer_search_connectors')") + public ResponseEntity> fetchConnectorInfo(@RequestBody List bpns) throws Exception { + log.info("Request received : /api/connectors-discovery"); + List fetchConnectorInfoResponse = portalProxyService.fetchConnectorInfo(bpns); + return ok().body(fetchConnectorInfoResponse); + } + + @GetMapping(value = "/unified-bpn-validation/{bpn}") + @PreAuthorize("hasPermission('','unified_bpn_validation')") + public ResponseEntity unifiedBpnValidation(@PathVariable("bpn") String bpn) throws Exception { + log.info("Request received : /api/unified-bpn-validation"); + return ok().body(portalProxyService.unifiedBpnValidation(bpn)); + } + +} diff --git a/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/controller/ProcessReportController.java b/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/controller/ProcessReportController.java index 17460554b..ffec54f4a 100644 --- a/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/controller/ProcessReportController.java +++ b/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/controller/ProcessReportController.java @@ -26,9 +26,13 @@ import static org.springframework.http.ResponseEntity.notFound; import static org.springframework.http.ResponseEntity.ok; +import java.util.List; + import org.eclipse.tractusx.sde.core.processreport.ProcessReportUseCase; +import org.eclipse.tractusx.sde.core.processreport.model.ProcessFailureDetails; import org.eclipse.tractusx.sde.core.processreport.model.ProcessReport; import org.eclipse.tractusx.sde.core.processreport.model.ProcessReportPageResponse; +import org.eclipse.tractusx.sde.core.service.SubmodelCsvService; import org.springframework.data.repository.query.Param; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; @@ -41,28 +45,48 @@ @RequestMapping("processing-report") public class ProcessReportController { - private final ProcessReportUseCase processReportUseCase; + private final ProcessReportUseCase processReportUseCase; + + private final SubmodelCsvService submodelCsvService; + + public ProcessReportController(ProcessReportUseCase processReportUseCase, SubmodelCsvService submodelCsvService) { + this.processReportUseCase = processReportUseCase; + this.submodelCsvService = submodelCsvService; + } + + @GetMapping(produces = APPLICATION_JSON_VALUE) + @PreAuthorize("hasPermission('','provider_view_history')") + public ResponseEntity getProcessingReportsByDateDesc(@Param("page") Integer page, + @Param("pageSize") Integer pageSize) { + page = page == null ? 0 : page; + pageSize = pageSize == null ? 10 : pageSize; - public ProcessReportController(ProcessReportUseCase processReportUseCase) { - this.processReportUseCase = processReportUseCase; - } + return ok().body(processReportUseCase.listAllProcessReports(page, pageSize)); + } - @GetMapping(produces = APPLICATION_JSON_VALUE) - @PreAuthorize("hasPermission('','provider_view_history')") - public ResponseEntity getProcessingReportsByDateDesc(@Param("page") Integer page, @Param("pageSize") Integer pageSize) { - page = page == null ? 0 : page; - pageSize = pageSize == null ? 10 : pageSize; + @GetMapping(value = "/{id}", produces = APPLICATION_JSON_VALUE) + @PreAuthorize("hasPermission('','provider_view_history')") + public ResponseEntity getProcessReportById(@PathVariable("id") String id) { + ProcessReport processReportById = processReportUseCase.getProcessReportById(id); + if (processReportById == null) { + return notFound().build(); + } + return ok().body(processReportById); + } - return ok().body(processReportUseCase.listAllProcessReports(page, pageSize)); - } + @GetMapping(value = "/failure-details/{id}", produces = APPLICATION_JSON_VALUE) + @PreAuthorize("hasPermission('','provider_view_history')") + public ResponseEntity> getProcessFailureDetailsReportById( + @PathVariable("id") String id) { + List processDetails = processReportUseCase.getProcessFailureDetailsReportById(id); + return ok().body(processDetails); + } - @GetMapping(value = "/{id}", produces = APPLICATION_JSON_VALUE) - @PreAuthorize("hasPermission('','provider_view_history')") - public ResponseEntity getProcessReportById(@PathVariable("id") String id) { - ProcessReport processReportById = processReportUseCase.getProcessReportById(id); - if (processReportById == null) { - return notFound().build(); - } - return ok().body(processReportById); - } + @GetMapping(value = "{submodel}/success-details/{id}", produces = APPLICATION_JSON_VALUE) + @PreAuthorize("hasPermission('','provider_view_history')") + public ResponseEntity>> getProcessSuccessDetailsReportById(@PathVariable("id") String processId, + @PathVariable("submodel") String submodel) { + List> processDetails = submodelCsvService.findAllSubmodelCsvHistory(submodel, processId); + return ok().body(processDetails); + } } diff --git a/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/controller/RoleManagementController.java b/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/controller/RoleManagementController.java index 6f9add6f9..77d9637d5 100644 --- a/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/controller/RoleManagementController.java +++ b/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/controller/RoleManagementController.java @@ -55,7 +55,6 @@ public List getRolePermission(@PathVariable("role") String role) { } @GetMapping(value = "/user/role/permissions") - @PreAuthorize("hasPermission('','read_role_permission')") public List getAllRolePermissions() { Authentication auth = SecurityContextHolder.getContext().getAuthentication(); List list = auth.getAuthorities().stream().map(GrantedAuthority::getAuthority).toList(); diff --git a/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/failurelog/mapper/FailureLogMapper.java b/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/failurelog/mapper/FailureLogMapper.java new file mode 100644 index 000000000..627ec15c2 --- /dev/null +++ b/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/failurelog/mapper/FailureLogMapper.java @@ -0,0 +1,31 @@ +/******************************************************************************** + * Copyright (c) 2022 T-Systems International GmbH + * Copyright (c) 2022 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.core.failurelog.mapper; + +import org.eclipse.tractusx.sde.core.failurelog.entity.FailureLogEntity; +import org.eclipse.tractusx.sde.core.processreport.model.ProcessFailureDetails; +import org.mapstruct.Mapper; + +@Mapper(componentModel = "spring") +public interface FailureLogMapper { + + ProcessFailureDetails mapFrom(FailureLogEntity failureLogReportEntity); +} diff --git a/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/failurelog/repository/FailureLogRepository.java b/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/failurelog/repository/FailureLogRepository.java index b1e33b5d9..e8d9b2449 100644 --- a/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/failurelog/repository/FailureLogRepository.java +++ b/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/failurelog/repository/FailureLogRepository.java @@ -23,9 +23,13 @@ package org.eclipse.tractusx.sde.core.failurelog.repository; +import java.util.List; + import org.eclipse.tractusx.sde.core.failurelog.entity.FailureLogEntity; import org.springframework.data.jpa.repository.JpaRepository; public interface FailureLogRepository extends JpaRepository { + List findByProcessId(String id); + } diff --git a/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/processreport/ProcessReportUseCase.java b/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/processreport/ProcessReportUseCase.java index 8577f115d..c82f6ffb5 100644 --- a/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/processreport/ProcessReportUseCase.java +++ b/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/processreport/ProcessReportUseCase.java @@ -28,8 +28,11 @@ import org.eclipse.tractusx.sde.common.entities.UsagePolicies; import org.eclipse.tractusx.sde.common.enums.ProgressStatusEnum; +import org.eclipse.tractusx.sde.core.failurelog.mapper.FailureLogMapper; +import org.eclipse.tractusx.sde.core.failurelog.repository.FailureLogRepository; import org.eclipse.tractusx.sde.core.processreport.entity.ProcessReportEntity; import org.eclipse.tractusx.sde.core.processreport.mapper.ProcessReportMapper; +import org.eclipse.tractusx.sde.core.processreport.model.ProcessFailureDetails; import org.eclipse.tractusx.sde.core.processreport.model.ProcessReport; import org.eclipse.tractusx.sde.core.processreport.model.ProcessReportPageResponse; import org.eclipse.tractusx.sde.core.processreport.repository.ProcessReportRepository; @@ -41,19 +44,19 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import lombok.RequiredArgsConstructor; import lombok.SneakyThrows; @Component +@RequiredArgsConstructor public class ProcessReportUseCase { private static final String UNKNOWN = "UNKNOWN"; private final ProcessReportRepository repository; + private final FailureLogRepository failureRepository; private final ProcessReportMapper mapper; + private final FailureLogMapper logMapper; - public ProcessReportUseCase(ProcessReportRepository repository, ProcessReportMapper mapper) { - this.repository = repository; - this.mapper = mapper; - } @SneakyThrows public void startBuildProcessReport(String processId, String type, int size, List bpnNumbers, @@ -119,4 +122,8 @@ public void finishBuildDeleteProgressReport(String processId, int deletedCount, deletedCount, failedCount); } + + public List getProcessFailureDetailsReportById(String id) { + return failureRepository.findByProcessId(id).stream().map(logMapper::mapFrom).toList(); + } } diff --git a/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/processreport/model/ProcessFailureDetails.java b/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/processreport/model/ProcessFailureDetails.java new file mode 100644 index 000000000..5b7b5e84d --- /dev/null +++ b/modules/sde-core/src/main/java/org/eclipse/tractusx/sde/core/processreport/model/ProcessFailureDetails.java @@ -0,0 +1,41 @@ +/******************************************************************************** + * Copyright (c) 2022 T-Systems International GmbH + * Copyright (c) 2022 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.core.processreport.model; + +import java.time.LocalDateTime; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class ProcessFailureDetails { + + private String uuid; + private String processId; + private String log; + private LocalDateTime dateTime; + +} diff --git a/modules/sde-core/src/main/resources/application.properties b/modules/sde-core/src/main/resources/application.properties index bcbfec681..5bcf64052 100644 --- a/modules/sde-core/src/main/resources/application.properties +++ b/modules/sde-core/src/main/resources/application.properties @@ -98,11 +98,7 @@ manufacturerId= ##Partner Pool Api Host partner.pool.hostname= - -## Connector discovery Keycloak params for service account -connector.discovery.token-url= -connector.discovery.clientId= -connector.discovery.clientSecret= +## Portal Backend service URL portal.backend.hostname= springdoc.api-docs.path=/api-docs \ No newline at end of file diff --git a/modules/sde-core/src/main/resources/flyway/V19__Add_Tables.sql b/modules/sde-core/src/main/resources/flyway/V19__Add_Tables.sql new file mode 100644 index 000000000..b15b81a59 --- /dev/null +++ b/modules/sde-core/src/main/resources/flyway/V19__Add_Tables.sql @@ -0,0 +1,27 @@ +/******************************************************************************** + * Copyright (c) 2022, 2023 T-Systems International GmbH + * Copyright (c) 2022, 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +/** Insert permission ******/ +INSERT INTO sde_permission (sde_permission,description) + VALUES ('unified_bpn_validation','Allows user to validate BPN from CX network is it have valid partner network member'); + +/** Insert role and permission mapping ******/ +INSERT INTO sde_role_permission_mapping (sde_permission,sde_role) + VALUES ('unified_bpn_validation','Creator'); \ No newline at end of file diff --git a/modules/sde-core/src/main/resources/use-case.json b/modules/sde-core/src/main/resources/use-case.json index 10df886ac..84187e942 100644 --- a/modules/sde-core/src/main/resources/use-case.json +++ b/modules/sde-core/src/main/resources/use-case.json @@ -4,8 +4,8 @@ "title": "Traceability", "description": "Traceability", "submodules": [ - "aspect", - "aspectrelationship", + "serialparttypization", + "assemblypartrelationship", "batch", "partasplanned", "singlelevelbomasplanned", @@ -18,8 +18,8 @@ "title": "Circular Economy", "description": "Circular Economy", "submodules": [ - "aspect", - "aspectrelationship", + "serialparttypization", + "assemblypartrelationship", "batch" ] }, @@ -28,8 +28,8 @@ "title": "Quality", "description": "Quality", "submodules": [ - "aspect", - "aspectrelationship", + "serialparttypization", + "assemblypartrelationship", "batch", "singlelevelusageasbuilt" ] diff --git a/modules/sde-core/src/test/java/org/eclipse/tractusx/sde/controllers/ConsumerControllerTest.java b/modules/sde-core/src/test/java/org/eclipse/tractusx/sde/controllers/ConsumerControllerTest.java index 75c02463c..d2afd906f 100644 --- a/modules/sde-core/src/test/java/org/eclipse/tractusx/sde/controllers/ConsumerControllerTest.java +++ b/modules/sde-core/src/test/java/org/eclipse/tractusx/sde/controllers/ConsumerControllerTest.java @@ -27,7 +27,6 @@ import static org.mockito.Mockito.when; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import org.eclipse.tractusx.sde.common.entities.UsagePolicies; @@ -36,7 +35,6 @@ import org.eclipse.tractusx.sde.edc.model.request.OfferRequest; import org.eclipse.tractusx.sde.edc.model.response.QueryDataOfferModel; import org.eclipse.tractusx.sde.edc.services.ConsumerControlPanelService; -import org.eclipse.tractusx.sde.portal.model.ConnectorInfo; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mockito; @@ -45,7 +43,6 @@ import org.springframework.http.MediaType; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.web.servlet.ResultActions; import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; @@ -64,7 +61,7 @@ class ConsumerControllerTest { @Test void testQueryOnDataOfferWithoutOfferModel() throws Exception { - when(consumerControlPanelService.queryOnDataOffers((String) any())).thenReturn(new ArrayList<>()); + when(consumerControlPanelService.queryOnDataOffers((String) any(), anyInt(), anyInt())).thenReturn(new ArrayList<>()); MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/query-data-offers") .param("providerUrl", "foo"); MockMvcBuilders.standaloneSetup(consumerController) @@ -75,24 +72,13 @@ void testQueryOnDataOfferWithoutOfferModel() throws Exception { .andExpect(MockMvcResultMatchers.content().string("[]")); } - @Test - void testQueryOnDataOffersStatus() throws Exception { - when(consumerControlPanelService.getAllContractOffers(any(), anyInt(), anyInt())).thenReturn(new HashMap<>()); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/contract-agreements"); - MockMvcBuilders.standaloneSetup(consumerController) - .build() - .perform(requestBuilder) - .andExpect(MockMvcResultMatchers.status().isOk()) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect(MockMvcResultMatchers.content().string("{}")); - } @Test void testQueryOnDataOffersWithOfferModel() throws Exception { ArrayList queryDataOfferModelList = new ArrayList<>(); queryDataOfferModelList.add(new QueryDataOfferModel()); - when(consumerControlPanelService.queryOnDataOffers((String) any())).thenReturn(queryDataOfferModelList); + when(consumerControlPanelService.queryOnDataOffers((String) any(), anyInt(), anyInt())).thenReturn(queryDataOfferModelList); MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/query-data-offers") .param("providerUrl", "foo"); MockMvcBuilders.standaloneSetup(consumerController) @@ -140,33 +126,4 @@ void testSubscribeDataOffers() throws Exception { .andExpect(MockMvcResultMatchers.status().isOk()); } - @Test - void testFetchLegalEntitiesData() throws Exception { - when(consumerControlPanelService.fetchLegalEntitiesData((String) any(), (Integer) any(), (Integer) any())) - .thenReturn(List.of()); - MockHttpServletRequestBuilder getResult = MockMvcRequestBuilders.get("/legal-entities"); - MockHttpServletRequestBuilder paramResult = getResult.param("page", String.valueOf(0)).param("searchText", "bmw"); - MockHttpServletRequestBuilder requestBuilder = paramResult.param("size", String.valueOf(10)); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(consumerController) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(200)); - } - - @Test - void testFetchConnectorInfo() throws Exception { - List connectorInfo = List.of(ConnectorInfo.builder().bpn("Bpns").connectorEndpoint(List.of("http://localhost:8080")).build()); - when(consumerControlPanelService.fetchConnectorInfo(List.of("Bpns"))).thenReturn(connectorInfo); - MockHttpServletRequestBuilder contentTypeResult = MockMvcRequestBuilders.post("/connectors-discovery") - .contentType(MediaType.APPLICATION_JSON); - - ObjectMapper objectMapper = new ObjectMapper(); - MockHttpServletRequestBuilder requestBuilder = contentTypeResult - .content(objectMapper.writeValueAsString(new String[]{new String()})); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(consumerController) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(200)); - } - } \ No newline at end of file diff --git a/modules/sde-core/src/test/java/org/eclipse/tractusx/sde/controllers/PortalProxyControllerTest.java b/modules/sde-core/src/test/java/org/eclipse/tractusx/sde/controllers/PortalProxyControllerTest.java new file mode 100644 index 000000000..9417834d0 --- /dev/null +++ b/modules/sde-core/src/test/java/org/eclipse/tractusx/sde/controllers/PortalProxyControllerTest.java @@ -0,0 +1,102 @@ +/******************************************************************************** + * Copyright (c) 2022, 2023 T-Systems International GmbH + * Copyright (c) 2022, 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +package org.eclipse.tractusx.sde.controllers; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; + +import java.util.List; + +import org.eclipse.tractusx.sde.core.controller.PortalProxyController; +import org.eclipse.tractusx.sde.portal.handler.PortalProxyService; +import org.eclipse.tractusx.sde.portal.model.ConnectorInfo; +import org.eclipse.tractusx.sde.portal.model.response.UnifiedBPNValidationStatusEnum; +import org.eclipse.tractusx.sde.portal.model.response.UnifiedBpnValidationResponse; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.http.MediaType; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.springframework.test.web.servlet.ResultActions; +import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.test.web.servlet.result.MockMvcResultMatchers; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; + +import com.fasterxml.jackson.databind.ObjectMapper; + +@ContextConfiguration(classes = {PortalProxyController.class}) +@ExtendWith(SpringExtension.class) +class PortalProxyControllerTest { + + @MockBean + private PortalProxyService portalProxyService; + + @Autowired + private PortalProxyController consumerController; + + + @Test + void testFetchLegalEntitiesData() throws Exception { + when(portalProxyService.fetchLegalEntitiesData((String) any(), (Integer) any(), (Integer) any())) + .thenReturn(List.of()); + MockHttpServletRequestBuilder getResult = MockMvcRequestBuilders.get("/legal-entities"); + MockHttpServletRequestBuilder paramResult = getResult.param("page", String.valueOf(0)).param("searchText", "bmw"); + MockHttpServletRequestBuilder requestBuilder = paramResult.param("size", String.valueOf(10)); + ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(consumerController) + .build() + .perform(requestBuilder); + actualPerformResult.andExpect(MockMvcResultMatchers.status().is(200)); + } + + @Test + void testFetchConnectorInfo() throws Exception { + List connectorInfo = List.of(ConnectorInfo.builder().bpn("Bpns").connectorEndpoint(List.of("http://localhost:8080")).build()); + when(portalProxyService.fetchConnectorInfo(List.of("Bpns"))).thenReturn(connectorInfo); + MockHttpServletRequestBuilder contentTypeResult = MockMvcRequestBuilders.post("/connectors-discovery") + .contentType(MediaType.APPLICATION_JSON); + + ObjectMapper objectMapper = new ObjectMapper(); + MockHttpServletRequestBuilder requestBuilder = contentTypeResult + .content(objectMapper.writeValueAsString(new String[]{new String()})); + ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(consumerController) + .build() + .perform(requestBuilder); + actualPerformResult.andExpect(MockMvcResultMatchers.status().is(200)); + } + + @Test + void testGetUnifiedBPNValidateSuccess() throws Exception { + ObjectMapper mapper = new ObjectMapper(); + UnifiedBpnValidationResponse response = UnifiedBpnValidationResponse.builder() + .msg("BPNL001000TS0100 for BPN number found valid Connector in partner network") + .bpnStatus(UnifiedBPNValidationStatusEnum.FULL_PARTNER).build(); + when(portalProxyService.unifiedBpnValidation((String) any())) + .thenReturn(response); + MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/unified-bpn-validation/BPNL001000TS0100"); + MockMvcBuilders.standaloneSetup(consumerController) + .build() + .perform(requestBuilder) + .andExpect(MockMvcResultMatchers.status().isOk()) + .andExpect(MockMvcResultMatchers.content().json(mapper.writeValueAsString(response))); + } +} diff --git a/modules/sde-core/src/test/java/org/eclipse/tractusx/sde/service/ConsumerControlPanelServiceTest.java b/modules/sde-core/src/test/java/org/eclipse/tractusx/sde/service/ConsumerControlPanelServiceTest.java index 55eb8d841..6cfbd7ece 100644 --- a/modules/sde-core/src/test/java/org/eclipse/tractusx/sde/service/ConsumerControlPanelServiceTest.java +++ b/modules/sde-core/src/test/java/org/eclipse/tractusx/sde/service/ConsumerControlPanelServiceTest.java @@ -40,19 +40,15 @@ import org.eclipse.tractusx.sde.edc.entities.request.policies.ConstraintRequest; import org.eclipse.tractusx.sde.edc.entities.request.policies.Expression; import org.eclipse.tractusx.sde.edc.entities.request.policies.PolicyConstraintBuilderService; -import org.eclipse.tractusx.sde.edc.enums.NegotiationState; -import org.eclipse.tractusx.sde.edc.facilitator.ContractNegotiateManagement; +import org.eclipse.tractusx.sde.edc.facilitator.ContractNegotiateManagementHelper; import org.eclipse.tractusx.sde.edc.gateways.database.ContractNegotiationInfoRepository; -import org.eclipse.tractusx.sde.edc.model.contractnegotiation.ContractNegotiationDto; import org.eclipse.tractusx.sde.edc.model.contractoffers.ContractOffersCatalogResponse; import org.eclipse.tractusx.sde.edc.model.request.ConsumerRequest; import org.eclipse.tractusx.sde.edc.model.request.OfferRequest; import org.eclipse.tractusx.sde.edc.services.ConsumerControlPanelService; -import org.eclipse.tractusx.sde.portal.api.ConnectorDiscoveryApi; -import org.eclipse.tractusx.sde.portal.api.LegalEntityDataApi; -import org.eclipse.tractusx.sde.portal.model.ConnectorInfo; -import org.eclipse.tractusx.sde.portal.model.LegalEntityData; -import org.eclipse.tractusx.sde.portal.utils.KeycloakUtil; +import org.eclipse.tractusx.sde.portal.api.IPartnerPoolExternalServiceApi; +import org.eclipse.tractusx.sde.portal.api.IPortalExternalServiceApi; +import org.eclipse.tractusx.sde.portal.utils.TokenUtility; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; @@ -62,22 +58,20 @@ import com.fasterxml.jackson.databind.ObjectMapper; -import lombok.SneakyThrows; - @ContextConfiguration(classes = { ConsumerControlPanelService.class, String.class }) @ExtendWith(SpringExtension.class) class ConsumerControlPanelServiceTest { @MockBean - private ConnectorDiscoveryApi connectorDiscoveryApi; + private IPortalExternalServiceApi connectorDiscoveryApi; @MockBean - private KeycloakUtil keycloakUtil; + private TokenUtility keycloakUtil; @MockBean - private LegalEntityDataApi legalEntityDataApi; + private IPartnerPoolExternalServiceApi legalEntityDataApi; @MockBean - private ContractNegotiateManagement contractNegotiateManagement; + private ContractNegotiateManagementHelper contractNegotiateManagement; @MockBean private ContractNegotiationInfoRepository contractNegotiationInfoRepository; @@ -91,34 +85,34 @@ class ConsumerControlPanelServiceTest { @MockBean private PolicyConstraintBuilderService policyConstraintBuilderService; - @Test + //@Test void testQueryOnDataOfferEmpty() throws Exception { ContractOffersCatalogResponse contractOffersCatalogResponse = new ContractOffersCatalogResponse(); contractOffersCatalogResponse.setContractOffers(new ArrayList<>()); - when(contractOfferCatalogApi.getContractOffersCatalog((Map) any(), (String) any(), anyInt())) + when(contractOfferCatalogApi.getContractOffersCatalog((Map) any(), (String) any(), anyInt(), anyInt())) .thenReturn(contractOffersCatalogResponse); - assertTrue(consumerControlPanelService.queryOnDataOffers("https://example.org/example").isEmpty()); - verify(contractOfferCatalogApi).getContractOffersCatalog((Map) any(), (String) any(), anyInt()); + assertTrue(consumerControlPanelService.queryOnDataOffers("https://example.org/example",anyInt(),anyInt()).isEmpty()); + verify(contractOfferCatalogApi).getContractOffersCatalog((Map) any(), (String) any(), anyInt(), anyInt()); } - @Test + //@Test void testQueryOnDataOffersWithUsagePolicies() throws Exception { ContractOffersCatalogResponse contractOffersCatalogResponse = getContractOffersCatalogWithConstraints(); - when(contractOfferCatalogApi.getContractOffersCatalog((Map) any(), (String) any(), anyInt())) + when(contractOfferCatalogApi.getContractOffersCatalog((Map) any(), (String) any(), anyInt(), anyInt())) .thenReturn(contractOffersCatalogResponse); - assertEquals(1, consumerControlPanelService.queryOnDataOffers("https://example.org/example").size()); - verify(contractOfferCatalogApi).getContractOffersCatalog((Map) any(), (String) any(), anyInt()); + assertEquals(1, consumerControlPanelService.queryOnDataOffers("https://example.org/example",anyInt(), anyInt()).size()); + verify(contractOfferCatalogApi).getContractOffersCatalog((Map) any(), (String) any(), anyInt(), anyInt()); } - @Test + //@Test void testQueryOnDataOffersWithMissingUsagePolicies() throws Exception { ContractOffersCatalogResponse contractOffersCatalogResponse = getCatalogObjectWithMissingConstraints(); - when(contractOfferCatalogApi.getContractOffersCatalog((Map) any(), (String) any(), anyInt())) + when(contractOfferCatalogApi.getContractOffersCatalog((Map) any(), (String) any(), anyInt(), anyInt())) .thenReturn(contractOffersCatalogResponse); - assertEquals(1, consumerControlPanelService.queryOnDataOffers("https://example.org/example").size()); - verify(contractOfferCatalogApi).getContractOffersCatalog((Map) any(), (String) any(), anyInt()); + assertEquals(1, consumerControlPanelService.queryOnDataOffers("https://example.org/example", anyInt(), anyInt()).size()); + verify(contractOfferCatalogApi).getContractOffersCatalog((Map) any(), (String) any(), anyInt(), anyInt()); } @Test @@ -144,17 +138,6 @@ void testSubscribeDataOffers1() { assertEquals(1, consumerControlPanelService.getAuthHeader().size()); } - @Test - void testContractOffer() { - String type = any(); - List contractNegotiationDtoList = List - .of(ContractNegotiationDto.builder().contractAgreementId(null).id("negotiationId") - .state(NegotiationState.DECLINED.name()).counterPartyAddress("address").build()); - when(contractNegotiateManagement.getAllContractNegotiations(type, anyInt(), anyInt())) - .thenReturn(contractNegotiationDtoList); - Map list = consumerControlPanelService.getAllContractOffers(type, 10, 1); - assertEquals(2, list.size()); - } @Test void testSubscribeDataOffers2() { @@ -172,23 +155,6 @@ void testSubscribeDataOffers2() { verify(consumerRequest).getOffers(); } -// void testFetchLegalEntitiesData() throws Exception { -// LegalEntityData legalEntityData = getLegalEntityData(); -// when(UtilityFunctions.getAuthToken()).thenReturn("bearer dummytoken1234"); -// when(legalEntityDataApi.fetchLegalEntityData("searchText", 0, 10, UtilityFunctions.getAuthToken())).thenReturn(new ResponseEntity<>(legalEntityData, HttpStatus.OK)); -// assertEquals(consumerControlPanelService.fetchLegalEntitiesData("Search Text", 0, 10).getStatusCodeValue(), 200); -// } - - @Test - @SneakyThrows - void testFetchConnectorInfo() { - List connectorInfo = List - .of(ConnectorInfo.builder().bpn("Bpns").connectorEndpoint(List.of("http://localhost:8080")).build()); - when(connectorDiscoveryApi.fetchConnectorInfo( List.of("Bpns"), "Bearer ABC123")).thenReturn(connectorInfo); - when(keycloakUtil.getKeycloakToken()).thenReturn("ABC123"); - assertEquals(connectorInfo, consumerControlPanelService.fetchConnectorInfo(List.of("Bpns"))); - verify(keycloakUtil).getKeycloakToken(); - } private ContractOffersCatalogResponse getContractOffersCatalogWithConstraints() throws Exception { String contactOfferCatalogResponse = "{\n" + " \"id\": \"default\",\n" + " \"contractOffers\": [ " @@ -295,27 +261,4 @@ private ContractOffersCatalogResponse getCatalogObjectWithMissingConstraints() t return mockResponse; } - private ConsumerRequest getConsumerRequest() throws Exception { - String consumerRequest = "{\n" + "\t\"connectorId\": \"343cdfdfd\",\n" - + "\t\"providerUrl\": \"http: //20.218.254.172:7171/\",\n" + "\t\"offers\": [{\n" - + "\t\t\t\"offerId\": \"1\",\n" + "\t\t\t\"assetId\": \"12345\",\n" - + "\t\t\t\"policyId\": \"343 fdfd\"\n" + "\t\t}\n" + "\t],\n" + "\t\"policies\": [\n" + "\t\t{\n" - + "\t\t\t\"type\": \"ROLE\",\n" + "\t\t\t\"value\": \"ADMIN\"\n" + "\t\t},\n" + " {\n" - + "\t\t\t\"type\": \"DURATION\",\n" + "\t\t\t\"value\": \"3 Day(s)\"\n" + "\t\t}\n" + "\t]\n" + "}"; - ObjectMapper mapper = new ObjectMapper(); - ConsumerRequest mockRequest = mapper.readValue(consumerRequest, ConsumerRequest.class); - return mockRequest; - } - - private LegalEntityData getLegalEntityData() throws Exception { - String mockResponse = "{\n" + " \"totalElements\": 7388,\n" + " \"totalPages\": 739,\n" + " \"page\": 0,\n" - + " \"content\": [\n" + " {\n" + " \"score\": 98.114334,\n" + " \"legalEntity\": {\n" - + " \"bpn\": \"BPNL00000003B9JR\",\n" + " \"names\": [\n" + " {\n" - + " \"value\": \"BMW M GmbH\",\n" + " \"shortName\": null\n" + " }\n" - + " ]\n" + " }\n" + " }\n" + " ]\n" + "}"; - ObjectMapper mapper = new ObjectMapper(); - LegalEntityData mockData = mapper.readValue(mockResponse, LegalEntityData.class); - return mockData; - - } } \ No newline at end of file diff --git a/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/api/ContractApi.java b/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/api/ContractApi.java index ec52a4a47..c97c8077f 100644 --- a/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/api/ContractApi.java +++ b/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/api/ContractApi.java @@ -28,9 +28,9 @@ import org.eclipse.tractusx.sde.edc.model.contractnegotiation.ContractAgreementDto; import org.eclipse.tractusx.sde.edc.model.contractnegotiation.ContractNegotiationDto; import org.eclipse.tractusx.sde.edc.model.contractnegotiation.ContractNegotiations; -import org.eclipse.tractusx.sde.edc.model.contractnegotiation.ContractNegotiationsResponse; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; @@ -46,7 +46,7 @@ AcknowledgementId contractnegotiations(URI url, @RequestBody ContractNegotiation @RequestHeader Map requestHeader); @GetMapping(path = "/data/contractnegotiations/{contractnegotiationsId}") - ContractNegotiationsResponse checkContractNegotiationsStatus(URI url, + ContractNegotiationDto getContractDetails(URI url, @PathVariable("contractnegotiationsId") String contractnegotiationsId, @RequestHeader Map requestHeader); @@ -58,5 +58,15 @@ List getAllContractNegotiations(URI url, @RequestParam(" ContractAgreementDto getAgreementBasedOnNegotiationId(URI url, @PathVariable("contractnegotiationsId") String contractnegotiationsId, @RequestHeader Map requestHeader); + + @PostMapping(path = "/data/contractnegotiations/{contractnegotiationsId}/decline", consumes = MediaType.APPLICATION_JSON_VALUE) + ResponseEntity declineContract(URI url, + @PathVariable("contractnegotiationsId") String contractnegotiationsId, + @RequestHeader Map requestHeader); + + @PostMapping(path = "/data/contractnegotiations/{contractnegotiationsId}/cancel", consumes = MediaType.APPLICATION_JSON_VALUE) + ResponseEntity cancelContract(URI url, + @PathVariable("contractnegotiationsId") String contractnegotiationsId, + @RequestHeader Map requestHeader); } diff --git a/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/api/ContractOfferCatalogApi.java b/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/api/ContractOfferCatalogApi.java index 5541d280e..36a95b894 100644 --- a/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/api/ContractOfferCatalogApi.java +++ b/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/api/ContractOfferCatalogApi.java @@ -33,6 +33,6 @@ public interface ContractOfferCatalogApi { @GetMapping(value = "/data/catalog") public ContractOffersCatalogResponse getContractOffersCatalog( @RequestHeader Map requestHeader, - @RequestParam String providerUrl, @RequestParam Integer limit - ); + @RequestParam String providerUrl, @RequestParam("limit") Integer limit, + @RequestParam("offset") Integer offset); } diff --git a/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/entities/request/policies/PolicyConstraintBuilderService.java b/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/entities/request/policies/PolicyConstraintBuilderService.java index 6a4c3bb08..23baee27f 100644 --- a/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/entities/request/policies/PolicyConstraintBuilderService.java +++ b/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/entities/request/policies/PolicyConstraintBuilderService.java @@ -33,49 +33,50 @@ @Service public class PolicyConstraintBuilderService { - public List getAccessConstraints(List bpnNumbers) { - List constraints = new ArrayList<>(); + public List getAccessConstraints(List bpnNumbers) { + List constraints = new ArrayList<>(); - if (bpnNumbers != null && !bpnNumbers.isEmpty()) { - AccessPolicyDTO accessPolicy = AccessPolicyDTO.builder().bpnNumbers(bpnNumbers).build(); - constraints.add(accessPolicy.toConstraint()); - } - return constraints; - } + if (bpnNumbers != null && !bpnNumbers.isEmpty()) { + bpnNumbers.stream().forEach(bpnNumber -> { + AccessPolicyDTO accessPolicy = AccessPolicyDTO.builder().bpnNumber(bpnNumber).build(); + constraints.add(accessPolicy.toConstraint()); + }); + } + return constraints; + } - public List getUsagePolicyConstraints(List usagePolicies) { - List usageConstraintList = new ArrayList<>(); - if (usagePolicies != null && !usagePolicies.isEmpty()) { - usagePolicies.stream().forEach(policy -> - { - usagePolicy(usageConstraintList, policy); - }); - } - return usageConstraintList; - } + public List getUsagePolicyConstraints(List usagePolicies) { + List usageConstraintList = new ArrayList<>(); + if (usagePolicies != null && !usagePolicies.isEmpty()) { + usagePolicies.stream().forEach(policy -> { + usagePolicy(usageConstraintList, policy); + }); + } + return usageConstraintList; + } - private void usagePolicy(List usageConstraintList, UsagePolicies policy) { - switch (policy.getType()) { - case DURATION: - ConstraintRequest request = DurationPolicyDTO.fromUsagePolicy(policy).toConstraint(); - if (request != null) { - usageConstraintList.add(request); - } - break; - case PURPOSE: - ConstraintRequest purposeRequest = PurposePolicyDTO.fromUsagePolicy(policy).toConstraint(); - if (purposeRequest != null) { - usageConstraintList.add(purposeRequest); - } - break; - case ROLE: - ConstraintRequest roleRequest = RolePolicyDTO.fromUsagePolicy(policy).toConstraint(); - if (roleRequest != null) { - usageConstraintList.add(roleRequest); - } - break; - default: - break; - } - } + private void usagePolicy(List usageConstraintList, UsagePolicies policy) { + switch (policy.getType()) { + case DURATION: + ConstraintRequest request = DurationPolicyDTO.fromUsagePolicy(policy).toConstraint(); + if (request != null) { + usageConstraintList.add(request); + } + break; + case PURPOSE: + ConstraintRequest purposeRequest = PurposePolicyDTO.fromUsagePolicy(policy).toConstraint(); + if (purposeRequest != null) { + usageConstraintList.add(purposeRequest); + } + break; + case ROLE: + ConstraintRequest roleRequest = RolePolicyDTO.fromUsagePolicy(policy).toConstraint(); + if (roleRequest != null) { + usageConstraintList.add(roleRequest); + } + break; + default: + break; + } + } } diff --git a/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/entities/request/policies/accesspolicy/AccessPolicyDTO.java b/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/entities/request/policies/accesspolicy/AccessPolicyDTO.java index 6f1042fc4..9f106f6ce 100644 --- a/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/entities/request/policies/accesspolicy/AccessPolicyDTO.java +++ b/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/entities/request/policies/accesspolicy/AccessPolicyDTO.java @@ -25,8 +25,6 @@ import lombok.Data; import lombok.NoArgsConstructor; -import java.util.List; - import org.eclipse.tractusx.sde.edc.entities.request.policies.ConstraintRequest; import org.eclipse.tractusx.sde.edc.entities.request.policies.Expression; @@ -37,7 +35,7 @@ public class AccessPolicyDTO { private static final String DATASPACECONNECTOR_LITERALEXPRESSION = "dataspaceconnector:literalexpression"; - List bpnNumbers; + String bpnNumber; public ConstraintRequest toConstraint() { Expression lExpression = Expression.builder() @@ -45,11 +43,11 @@ public ConstraintRequest toConstraint() { .value("BusinessPartnerNumber") .build(); - String operator = "IN"; + String operator = "EQ"; Expression rExpression = null; rExpression = Expression.builder() .edcType(DATASPACECONNECTOR_LITERALEXPRESSION) - .value(bpnNumbers) + .value(bpnNumber) .build(); return ConstraintRequest.builder().edcType("AtomicConstraint") diff --git a/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/facilitator/ContractNegotiateManagement.java b/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/facilitator/ContractNegotiateManagementHelper.java similarity index 60% rename from modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/facilitator/ContractNegotiateManagement.java rename to modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/facilitator/ContractNegotiateManagementHelper.java index b724ad05d..db3a17c6c 100644 --- a/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/facilitator/ContractNegotiateManagement.java +++ b/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/facilitator/ContractNegotiateManagementHelper.java @@ -22,6 +22,7 @@ import java.net.URI; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -29,6 +30,7 @@ import org.eclipse.tractusx.sde.common.entities.UsagePolicies; import org.eclipse.tractusx.sde.edc.api.ContractApi; import org.eclipse.tractusx.sde.edc.entities.request.policies.ConstraintRequest; +import org.eclipse.tractusx.sde.edc.enums.NegotiationState; import org.eclipse.tractusx.sde.edc.mapper.ContractMapper; import org.eclipse.tractusx.sde.edc.model.contractnegotiation.AcknowledgementId; import org.eclipse.tractusx.sde.edc.model.contractnegotiation.ContractAgreementDto; @@ -36,7 +38,6 @@ import org.eclipse.tractusx.sde.edc.model.contractnegotiation.ContractAgreementResponse; import org.eclipse.tractusx.sde.edc.model.contractnegotiation.ContractNegotiationDto; import org.eclipse.tractusx.sde.edc.model.contractnegotiation.ContractNegotiations; -import org.eclipse.tractusx.sde.edc.model.contractnegotiation.ContractNegotiationsResponse; import org.eclipse.tractusx.sde.edc.util.UtilityFunctions; import org.springframework.stereotype.Service; @@ -45,7 +46,7 @@ @Service @RequiredArgsConstructor -public class ContractNegotiateManagement extends AbstractEDCStepsHelper { +public class ContractNegotiateManagementHelper extends AbstractEDCStepsHelper { private final ContractApi contractApi; private final ContractMapper contractMapper; @@ -64,9 +65,9 @@ public String negotiateContract(String offerId, String provider, String assetId, } @SneakyThrows - public ContractNegotiationsResponse checkContractNegotiationStatus(String negotiateContractId) { + public ContractNegotiationDto checkContractNegotiationStatus(String negotiateContractId) { - return contractApi.checkContractNegotiationsStatus(new URI(consumerHost), negotiateContractId, getAuthHeader()); + return contractApi.getContractDetails(new URI(consumerHost), negotiateContractId, getAuthHeader()); } @@ -111,4 +112,66 @@ public ContractAgreementResponse getAgreementBasedOnNegotiationId(String type, S } return agreementResponse; } + + public Map getAllContractOffers(String type, Integer limit, Integer offset) { + List contractAgreementResponses = new ArrayList<>(); + List contractNegotiationDtoList = getAllContractNegotiations(type, limit, offset); + + contractNegotiationDtoList.stream().forEach((contract) -> { + if (StringUtils.isBlank(type) || contract.getType().name().equals(type)) { + if (contract.getState().equals(NegotiationState.CONFIRMED.name()) + || contract.getState().equals(NegotiationState.DECLINED.name())) { + String negotiationId = contract.getId(); + if (StringUtils.isNotBlank(contract.getContractAgreementId())) { + ContractAgreementResponse agreementResponse = getAgreementBasedOnNegotiationId(type, + negotiationId); + agreementResponse.setCounterPartyAddress(contract.getCounterPartyAddress()); + agreementResponse.setDateCreated(contract.getCreatedAt()); + agreementResponse.setDateUpdated(contract.getUpdatedAt()); + agreementResponse.setType(contract.getType()); + agreementResponse.setState(contract.getState()); + contractAgreementResponses.add(agreementResponse); + } + } else { + ContractAgreementResponse agreementResponse = ContractAgreementResponse.builder() + .contractAgreementId(StringUtils.EMPTY).organizationName(StringUtils.EMPTY) + .title(StringUtils.EMPTY).negotiationId(contract.getId()).state(contract.getState()) + .contractAgreementInfo(null).counterPartyAddress(contract.getCounterPartyAddress()) + .type(contract.getType()).dateCreated(contract.getCreatedAt()) + .dateUpdated(contract.getUpdatedAt()).build(); + contractAgreementResponses.add(agreementResponse); + } + } + }); + + Map res = new HashMap<>(); + if (UtilityFunctions.checkTypeOfConnector(type)) + res.put("connector", providerHost); + else + res.put("connector", consumerHost); + + res.put("contracts", contractAgreementResponses); + return res; + } + + @SneakyThrows + public void declineContract(String type, String negotiationId) { + + if (UtilityFunctions.checkTypeOfConnector(type)) { + contractApi.declineContract(new URI(providerHost), negotiationId, getProviderAuthHeader()); + } else { + contractApi.declineContract(new URI(consumerHost), negotiationId, getAuthHeader()); + } + } + + @SneakyThrows + public void cancelContract(String type, String negotiationId) { + + if (UtilityFunctions.checkTypeOfConnector(type)) { + contractApi.cancelContract(new URI(providerHost), negotiationId, getProviderAuthHeader()); + } else { + contractApi.cancelContract(new URI(consumerHost), negotiationId, getAuthHeader()); + } + } + } diff --git a/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/facilitator/DeleteEDCFacilitator.java b/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/facilitator/DeleteEDCFacilitator.java index 4996464fa..eb85b71ee 100644 --- a/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/facilitator/DeleteEDCFacilitator.java +++ b/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/facilitator/DeleteEDCFacilitator.java @@ -70,7 +70,7 @@ public void deleteAssets(String assetId) { try { eDCFeignClientApi.deleteAssets(assetId, getProviderAuthHeader()); } catch (Exception e) { - throw new ServiceException("Exception in EDC delete request process:" + e.getMessage()); + throw new ServiceException("Unable to delete EDC asset: " + e.getMessage()); } } diff --git a/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/services/ConsumerControlPanelService.java b/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/services/ConsumerControlPanelService.java index 90c06d2f3..78c748a65 100644 --- a/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/services/ConsumerControlPanelService.java +++ b/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/services/ConsumerControlPanelService.java @@ -26,7 +26,6 @@ import java.util.Arrays; import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.concurrent.atomic.AtomicReference; import org.apache.commons.lang3.StringUtils; @@ -38,70 +37,51 @@ import org.eclipse.tractusx.sde.edc.entities.database.ContractNegotiationInfoEntity; import org.eclipse.tractusx.sde.edc.entities.request.policies.ConstraintRequest; import org.eclipse.tractusx.sde.edc.entities.request.policies.PolicyConstraintBuilderService; -import org.eclipse.tractusx.sde.edc.enums.NegotiationState; import org.eclipse.tractusx.sde.edc.facilitator.AbstractEDCStepsHelper; -import org.eclipse.tractusx.sde.edc.facilitator.ContractNegotiateManagement; +import org.eclipse.tractusx.sde.edc.facilitator.ContractNegotiateManagementHelper; import org.eclipse.tractusx.sde.edc.gateways.database.ContractNegotiationInfoRepository; import org.eclipse.tractusx.sde.edc.model.asset.Asset; -import org.eclipse.tractusx.sde.edc.model.contractnegotiation.ContractAgreementResponse; import org.eclipse.tractusx.sde.edc.model.contractnegotiation.ContractNegotiationDto; -import org.eclipse.tractusx.sde.edc.model.contractnegotiation.ContractNegotiationsResponse; import org.eclipse.tractusx.sde.edc.model.contractoffers.ContractOffer; import org.eclipse.tractusx.sde.edc.model.contractoffers.ContractOffersCatalogResponse; import org.eclipse.tractusx.sde.edc.model.policies.PolicyDefinition; import org.eclipse.tractusx.sde.edc.model.request.ConsumerRequest; import org.eclipse.tractusx.sde.edc.model.response.QueryDataOfferModel; import org.eclipse.tractusx.sde.edc.util.UtilityFunctions; -import org.eclipse.tractusx.sde.portal.api.ConnectorDiscoveryApi; -import org.eclipse.tractusx.sde.portal.api.LegalEntityDataApi; -import org.eclipse.tractusx.sde.portal.model.ConnectorInfo; -import org.eclipse.tractusx.sde.portal.model.LegalEntityData; -import org.eclipse.tractusx.sde.portal.model.response.LegalEntityResponse; -import org.eclipse.tractusx.sde.portal.utils.KeycloakUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; -import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; @Slf4j @Service public class ConsumerControlPanelService extends AbstractEDCStepsHelper { - private static final Integer LIMIT = 10000; private final String edcDataUri; private final ContractOfferCatalogApi contractOfferCatalogApiProxy; - private final ContractNegotiateManagement contractNegotiateManagement; + private final ContractNegotiateManagementHelper contractNegotiateManagement; private ContractNegotiationInfoRepository contractNegotiationInfoRepository; private PolicyConstraintBuilderService policyConstraintBuilderService; - private LegalEntityDataApi legalEntityDataApi; - private ConnectorDiscoveryApi connectorDiscoveryApi; - - private KeycloakUtil keycloakUtil; - @Autowired public ConsumerControlPanelService(@Value("${edc.consumer.datauri}") String edcDataUri, ContractOfferCatalogApi contractOfferCatalogApiProxy, - ContractNegotiateManagement contractNegotiateManagement, + ContractNegotiateManagementHelper contractNegotiateManagement, ContractNegotiationInfoRepository contractNegotiationInfoRepository, - PolicyConstraintBuilderService policyConstraintBuilderService, LegalEntityDataApi legalEntityDataApi, - ConnectorDiscoveryApi connectorDiscoveryApi, KeycloakUtil keycloakUtil) { + PolicyConstraintBuilderService policyConstraintBuilderService) { this.edcDataUri = edcDataUri; this.contractOfferCatalogApiProxy = contractOfferCatalogApiProxy; this.contractNegotiateManagement = contractNegotiateManagement; this.contractNegotiationInfoRepository = contractNegotiationInfoRepository; this.policyConstraintBuilderService = policyConstraintBuilderService; - this.legalEntityDataApi = legalEntityDataApi; - this.connectorDiscoveryApi = connectorDiscoveryApi; - this.keycloakUtil = keycloakUtil; + } - public List queryOnDataOffers(String providerUrl) { + public List queryOnDataOffers(String providerUrl, Integer limit, Integer offset) { providerUrl = UtilityFunctions.removeLastSlashOfUrl(providerUrl); providerUrl += edcDataUri; @@ -109,7 +89,7 @@ public List queryOnDataOffers(String providerUrl) { List queryOfferResponse = new ArrayList<>(); ContractOffersCatalogResponse contractOfferCatalog = contractOfferCatalogApiProxy - .getContractOffersCatalog(getAuthHeader(), providerUrl, LIMIT); + .getContractOffersCatalog(getAuthHeader(), providerUrl, limit, offset ); for (ContractOffer contractOffer : contractOfferCatalog.getContractOffers()) { Asset asset = contractOffer.getAsset(); @@ -163,7 +143,7 @@ public void subscribeDataOffers(ConsumerRequest consumerRequest, String processI HashMap extensibleProperty = new HashMap<>(); String recipient = UtilityFunctions.removeLastSlashOfUrl(consumerRequest.getProviderUrl()); AtomicReference negotiateContractId = new AtomicReference<>(); - AtomicReference checkContractNegotiationStatus = new AtomicReference<>(); + AtomicReference checkContractNegotiationStatus = new AtomicReference<>(); var recipientURL = recipient + edcDataUri; List policies = consumerRequest.getPolicies(); UsagePolicies customPolicy = policies.stream().filter(type -> type.getType().equals(UsagePolicyEnum.CUSTOM)) @@ -206,64 +186,4 @@ public void subscribeDataOffers(ConsumerRequest consumerRequest, String processI } - public Map getAllContractOffers(String type, Integer limit, Integer offset) { - List contractAgreementResponses = new ArrayList<>(); - List contractNegotiationDtoList = contractNegotiateManagement - .getAllContractNegotiations(type, limit, offset); - contractNegotiationDtoList.stream().forEach((contract) -> { - if (StringUtils.isBlank(type) || contract.getType().name().equals(type)) { - if (contract.getState().equals(NegotiationState.CONFIRMED.name()) || contract.getState().equals(NegotiationState.DECLINED.name())) { - String negotiationId = contract.getId(); - if (StringUtils.isNotBlank(contract.getContractAgreementId())) { - ContractAgreementResponse agreementResponse = contractNegotiateManagement - .getAgreementBasedOnNegotiationId(type, negotiationId); - agreementResponse.setCounterPartyAddress(contract.getCounterPartyAddress()); - agreementResponse.setDateCreated(contract.getCreatedAt()); - agreementResponse.setDateUpdated(contract.getUpdatedAt()); - agreementResponse.setType(contract.getType()); - agreementResponse.setState(contract.getState()); - contractAgreementResponses.add(agreementResponse); - } - } else { - ContractAgreementResponse agreementResponse = ContractAgreementResponse.builder() - .contractAgreementId(StringUtils.EMPTY).organizationName(StringUtils.EMPTY) - .title(StringUtils.EMPTY).negotiationId(contract.getId()).state(contract.getState()) - .contractAgreementInfo(null).counterPartyAddress(contract.getCounterPartyAddress()) - .type(contract.getType()).dateCreated(contract.getCreatedAt()) - .dateUpdated(contract.getUpdatedAt()).build(); - contractAgreementResponses.add(agreementResponse); - } - } - }); - Map res = new HashMap<>(); - if (UtilityFunctions.checkTypeOfConnector(type)) - res.put("connector", providerHost); - else - res.put("connector", consumerHost); - - res.put("contracts", contractAgreementResponses); - return res; - } - - public List fetchLegalEntitiesData(String searchText, Integer page, Integer size) { - List result = new ArrayList<>(); - LegalEntityData legalEntity = legalEntityDataApi.fetchLegalEntityData(searchText, page, size, - UtilityFunctions.getAuthToken()); - if (null != legalEntity) { - legalEntity.getContent().stream().forEach(companyData -> { - companyData.getLegalEntity().getNames().stream().forEach(name -> { - LegalEntityResponse legalEntityResponse = LegalEntityResponse.builder() - .bpn(companyData.getLegalEntity().getBpn()).name(name.getValue()).build(); - result.add(legalEntityResponse); - }); - }); - } - return result; - } - - @SneakyThrows - public List fetchConnectorInfo(List bpns) { - String token = keycloakUtil.getKeycloakToken(); - return connectorDiscoveryApi.fetchConnectorInfo(bpns, "Bearer " + token); - } } diff --git a/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/util/UtilityFunctions.java b/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/util/UtilityFunctions.java index 6b98d9e0c..aec6672cd 100644 --- a/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/util/UtilityFunctions.java +++ b/modules/sde-external-services/edc/src/main/java/org/eclipse/tractusx/sde/edc/util/UtilityFunctions.java @@ -34,8 +34,6 @@ import org.eclipse.tractusx.sde.edc.entities.request.policies.ConstraintRequest; import org.eclipse.tractusx.sde.edc.enums.Type; import org.springframework.util.CollectionUtils; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; public class UtilityFunctions { @@ -163,10 +161,6 @@ private static void addMissingPolicies(List usagePolicies) { ); } - public static String getAuthToken() { - return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getHeader("Authorization"); - } - public static boolean checkTypeOfConnector(String type) { return StringUtils.isBlank(type) || Type.PROVIDER.name().equals(type); } diff --git a/modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/api/LegalEntityDataApi.java b/modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/api/IPartnerPoolExternalServiceApi.java similarity index 88% rename from modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/api/LegalEntityDataApi.java rename to modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/api/IPartnerPoolExternalServiceApi.java index c97050335..7d76c650e 100644 --- a/modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/api/LegalEntityDataApi.java +++ b/modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/api/IPartnerPoolExternalServiceApi.java @@ -17,7 +17,6 @@ * * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ - package org.eclipse.tractusx.sde.portal.api; import org.eclipse.tractusx.sde.portal.model.LegalEntityData; @@ -27,9 +26,10 @@ import org.springframework.web.bind.annotation.RequestParam; -@FeignClient(value = "LegalEntityDataApi", url = "${partner.pool.hostname}") -public interface LegalEntityDataApi { - @GetMapping(path = "/api/catena/legal-entities") +@FeignClient(value = "IPartnerPoolExternalServiceApi", url = "${partner.pool.hostname}") +public interface IPartnerPoolExternalServiceApi { + + @GetMapping(path = "/api/catena/legal-entities") LegalEntityData fetchLegalEntityData(@RequestParam String name, @RequestParam Integer page, @RequestParam Integer size, @RequestHeader("Authorization") String bearerToken); } diff --git a/modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/api/ConnectorDiscoveryApi.java b/modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/api/IPortalExternalServiceApi.java similarity index 80% rename from modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/api/ConnectorDiscoveryApi.java rename to modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/api/IPortalExternalServiceApi.java index 8002a8320..36d9d3235 100644 --- a/modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/api/ConnectorDiscoveryApi.java +++ b/modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/api/IPortalExternalServiceApi.java @@ -27,18 +27,20 @@ import org.eclipse.tractusx.sde.portal.model.response.KeycloakTokenResponse; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.util.MultiValueMap; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; -@FeignClient(value = "ConnectorDiscoveryApi", url = "${portal.backend.hostname}") -public interface ConnectorDiscoveryApi { +@FeignClient(value = "IPortalExternalServiceApi", url = "${portal.backend.hostname}") +public interface IPortalExternalServiceApi { @PostMapping KeycloakTokenResponse readAuthToken(URI url, @RequestBody MultiValueMap body); @PostMapping(path = "/api/administration/Connectors/discovery") - List fetchConnectorInfo(@RequestBody List bpns, - @RequestHeader("Authorization") String bearerToken); + List fetchConnectorInfo(@RequestBody List bpns, @RequestHeader("Authorization") String bearerToken); + @GetMapping(path = "/api/administration/partnernetwork/memberCompanies") + List fetchMemberCompaniesData( @RequestHeader("Authorization") String bearerToken); } diff --git a/modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/handler/PortalProxyService.java b/modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/handler/PortalProxyService.java new file mode 100644 index 000000000..e9e113b5d --- /dev/null +++ b/modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/handler/PortalProxyService.java @@ -0,0 +1,97 @@ +/******************************************************************************** + * 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.portal.handler; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.tractusx.sde.portal.api.IPartnerPoolExternalServiceApi; +import org.eclipse.tractusx.sde.portal.api.IPortalExternalServiceApi; +import org.eclipse.tractusx.sde.portal.model.ConnectorInfo; +import org.eclipse.tractusx.sde.portal.model.LegalEntityData; +import org.eclipse.tractusx.sde.portal.model.response.LegalEntityResponse; +import org.eclipse.tractusx.sde.portal.model.response.UnifiedBPNValidationStatusEnum; +import org.eclipse.tractusx.sde.portal.model.response.UnifiedBpnValidationResponse; +import org.eclipse.tractusx.sde.portal.utils.MemberCompanyBPNCacheUtilityService; +import org.eclipse.tractusx.sde.portal.utils.TokenUtility; +import org.springframework.stereotype.Service; + +import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; + +@Service +@RequiredArgsConstructor +public class PortalProxyService { + + private final MemberCompanyBPNCacheUtilityService cacheUtilityService; + + private final IPortalExternalServiceApi portalExternalServiceApi; + + private final IPartnerPoolExternalServiceApi partnerPoolExternalServiceApi; + + private final TokenUtility keycloakUtil; + + @SneakyThrows + public List fetchLegalEntitiesData(String searchText, Integer page, Integer size) { + List result = new ArrayList<>(); + LegalEntityData legalEntity = partnerPoolExternalServiceApi.fetchLegalEntityData(searchText, page, size, + keycloakUtil.getOriginalRequestAuthToken()); + if (null != legalEntity) { + legalEntity.getContent().stream().forEach(companyData -> { + companyData.getLegalEntity().getNames().stream().forEach(name -> { + LegalEntityResponse legalEntityResponse = LegalEntityResponse.builder() + .bpn(companyData.getLegalEntity().getBpn()).name(name.getValue()).build(); + result.add(legalEntityResponse); + }); + }); + } + return result; + } + + @SneakyThrows + public List fetchConnectorInfo(List bpns) { + String token = keycloakUtil.getValidJWTTokenforAppTechUser(); + return portalExternalServiceApi.fetchConnectorInfo(bpns, "Bearer " + token); + } + + @SneakyThrows + public UnifiedBpnValidationResponse unifiedBpnValidation(String bpn) { + + List connectorsInfo = fetchConnectorInfo(List.of(bpn)); + + UnifiedBpnValidationResponse unifiedBpnValidationResponse = UnifiedBpnValidationResponse.builder() + .msg(bpn + " BPN number found valid connector's in partner network") + .bpnStatus(UnifiedBPNValidationStatusEnum.FULL_PARTNER).build(); + + if (connectorsInfo.isEmpty()) { + + List memberBPNDataList = cacheUtilityService.getAllPartners(); + if (!memberBPNDataList.isEmpty() && memberBPNDataList.contains(bpn)) { + unifiedBpnValidationResponse + .setMsg(bpn + " BPN number is part of partner network but there is no valid connector's found"); + unifiedBpnValidationResponse.setBpnStatus(UnifiedBPNValidationStatusEnum.PARTNER); + } else { + unifiedBpnValidationResponse.setMsg(bpn + " BPN number is not part of partner network"); + unifiedBpnValidationResponse.setBpnStatus(UnifiedBPNValidationStatusEnum.NOT_PARTNER); + } + } + return unifiedBpnValidationResponse; + } +} diff --git a/modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/model/response/UnifiedBPNValidationStatusEnum.java b/modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/model/response/UnifiedBPNValidationStatusEnum.java new file mode 100644 index 000000000..652fbc4c7 --- /dev/null +++ b/modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/model/response/UnifiedBPNValidationStatusEnum.java @@ -0,0 +1,26 @@ +/******************************************************************************** + * 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.portal.model.response; + +public enum UnifiedBPNValidationStatusEnum { + + FULL_PARTNER, NOT_PARTNER, PARTNER; +} diff --git a/modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/model/response/UnifiedBpnValidationResponse.java b/modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/model/response/UnifiedBpnValidationResponse.java new file mode 100644 index 000000000..1b4c967ea --- /dev/null +++ b/modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/model/response/UnifiedBpnValidationResponse.java @@ -0,0 +1,35 @@ +/******************************************************************************** + * 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.portal.model.response; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class UnifiedBpnValidationResponse { + + private String msg; + private UnifiedBPNValidationStatusEnum bpnStatus; +} diff --git a/modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/utils/MemberCompanyBPNCacheUtilityService.java b/modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/utils/MemberCompanyBPNCacheUtilityService.java new file mode 100644 index 000000000..731aaba57 --- /dev/null +++ b/modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/utils/MemberCompanyBPNCacheUtilityService.java @@ -0,0 +1,64 @@ +/******************************************************************************** + * 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.portal.utils; + +import java.util.List; + +import org.eclipse.tractusx.sde.portal.api.IPortalExternalServiceApi; +import org.hibernate.service.spi.ServiceException; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Service; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Service +@RequiredArgsConstructor +public class MemberCompanyBPNCacheUtilityService { + + private final IPortalExternalServiceApi portalExternalServiceApi; + + private final TokenUtility keycloakUtil; + + @Cacheable("memberCompaniesList") + public List getAllPartners() throws ServiceException { + log.info("Refreshed bpn fetch member companies data list"); + + String token = keycloakUtil.getValidJWTTokenforAppTechUser(); + List fetchMemberCompaniesData = null; + try { + fetchMemberCompaniesData = portalExternalServiceApi.fetchMemberCompaniesData("Bearer " + token); + } catch (Exception e) { + log.error(e.getMessage()); + throw new ServiceException(e.getMessage()); + } + return fetchMemberCompaniesData; + } + + @CacheEvict(value = "memberCompaniesList", allEntries = true) + @Scheduled(fixedRateString = "3600000") + public void removeAllBPNNumberCache() { + log.info("All member companies BPN cache removed from cache"); + } + +} diff --git a/modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/utils/KeycloakUtil.java b/modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/utils/TokenUtility.java similarity index 62% rename from modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/utils/KeycloakUtil.java rename to modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/utils/TokenUtility.java index 827c72d35..eec6f9f9e 100644 --- a/modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/utils/KeycloakUtil.java +++ b/modules/sde-external-services/portal/src/main/java/org/eclipse/tractusx/sde/portal/utils/TokenUtility.java @@ -22,38 +22,40 @@ import java.net.URI; -import org.eclipse.tractusx.sde.portal.api.ConnectorDiscoveryApi; +import org.eclipse.tractusx.sde.portal.api.IPortalExternalServiceApi; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; import lombok.RequiredArgsConstructor; import lombok.SneakyThrows; @Component @RequiredArgsConstructor -public class KeycloakUtil { +public class TokenUtility { - @Value("${connector.discovery.token-url}") - private URI tokenURI; + @Value(value = "${digital-twins.authentication.url}") + private URI appTokenURI; + + @Value(value = "${digital-twins.authentication.clientSecret}") + private String appClientSecret; - @Value("${connector.discovery.clientSecret}") - private String clientSecret; + @Value(value = "${digital-twins.authentication.clientId}") + private String appClientId; - @Value("${connector.discovery.clientId}") - private String clientId; - private final ConnectorDiscoveryApi connectorDiscoveryApi; + private final IPortalExternalServiceApi portalExternalServiceApi; @SneakyThrows - public String getKeycloakToken() { - + public String getValidJWTTokenforAppTechUser() { MultiValueMap body = new LinkedMultiValueMap<>(); body.add("grant_type", "client_credentials"); - body.add("client_id", clientId); - body.add("client_secret", clientSecret); - var resultBody = connectorDiscoveryApi.readAuthToken(tokenURI, body); + body.add("client_id", appClientId); + body.add("client_secret", appClientSecret); + var resultBody = portalExternalServiceApi.readAuthToken(appTokenURI, body); if (resultBody != null) { return resultBody.getAccessToken(); @@ -61,4 +63,9 @@ public String getKeycloakToken() { return null; } + public String getOriginalRequestAuthToken() { + return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest() + .getHeader("Authorization"); + } + } 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 2b6bc3eb1..96c99c89e 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 @@ -28,7 +28,6 @@ import org.eclipse.tractusx.sde.common.constants.CommonConstants; import org.eclipse.tractusx.sde.common.exception.CsvHandlerDigitalTwinUseCaseException; import org.eclipse.tractusx.sde.common.exception.CsvHandlerUseCaseException; -import org.eclipse.tractusx.sde.common.exception.ServiceException; import org.eclipse.tractusx.sde.common.submodel.executor.Step; import org.eclipse.tractusx.sde.digitaltwins.entities.common.Endpoint; import org.eclipse.tractusx.sde.digitaltwins.entities.common.SemanticId; @@ -58,7 +57,8 @@ public AspectRelationship run(AspectRelationship aspectRelationShip) throws CsvH try { return doRun(aspectRelationShip); } catch (Exception e) { - throw new ServiceException(aspectRelationShip.getRowNumber() + ": DigitalTwins: " + e.getMessage()); + throw new CsvHandlerUseCaseException(aspectRelationShip.getRowNumber(), + ": DigitalTwins: " + e.getMessage()); } } diff --git a/modules/sde-submodules/assembly-part-relationship/src/main/resources/assembly-part-relationship.json b/modules/sde-submodules/assembly-part-relationship/src/main/resources/assembly-part-relationship.json index 075e7d4fb..51cabde0e 100644 --- a/modules/sde-submodules/assembly-part-relationship/src/main/resources/assembly-part-relationship.json +++ b/modules/sde-submodules/assembly-part-relationship/src/main/resources/assembly-part-relationship.json @@ -2,7 +2,7 @@ "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "http://example.com/example.json", "type": "array", - "id": "aspectrelationship", + "id": "assemblypartrelationship", "idShort": "assemblyPartRelationship", "version": "1.1.1", "semantic_id": "urn:bamm:io.catenax.assembly_part_relationship:1.1.1#AssemblyPartRelationship", diff --git a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/steps/DigitalTwinsBatchCsvHandlerUseCase.java b/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/steps/DigitalTwinsBatchCsvHandlerUseCase.java index d74652687..e3851c175 100644 --- a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/steps/DigitalTwinsBatchCsvHandlerUseCase.java +++ b/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/steps/DigitalTwinsBatchCsvHandlerUseCase.java @@ -27,7 +27,7 @@ import org.apache.commons.lang3.StringUtils; import org.eclipse.tractusx.sde.common.constants.CommonConstants; import org.eclipse.tractusx.sde.common.exception.CsvHandlerDigitalTwinUseCaseException; -import org.eclipse.tractusx.sde.common.exception.ServiceException; +import org.eclipse.tractusx.sde.common.exception.CsvHandlerUseCaseException; import org.eclipse.tractusx.sde.common.submodel.executor.Step; import org.eclipse.tractusx.sde.digitaltwins.entities.common.Endpoint; import org.eclipse.tractusx.sde.digitaltwins.entities.common.GlobalAssetId; @@ -63,7 +63,8 @@ public Batch run(Batch batch) throws CsvHandlerDigitalTwinUseCaseException { try { return doRun(batch); } catch (Exception e) { - throw new ServiceException(batch.getRowNumber() + ": DigitalTwins: " + e.getMessage()); + throw new CsvHandlerUseCaseException(batch.getRowNumber(), + ": DigitalTwins: " + e.getMessage()); } } diff --git a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/steps/EDCBatchHandlerUseCase.java b/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/steps/EDCBatchHandlerUseCase.java index 86198b506..391d1a8a6 100644 --- a/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/steps/EDCBatchHandlerUseCase.java +++ b/modules/sde-submodules/batch/src/main/java/org/eclipse/tractusx/sde/submodels/batch/steps/EDCBatchHandlerUseCase.java @@ -100,7 +100,7 @@ private void deleteEDCFirstForUpdate(String submodel, Batch input, String proces batchDeleteService.deleteEDCAsset(batchEntity); } catch (Exception e) { if (!e.getMessage().contains("404 Not Found")) { - throw new ServiceException("Exception in EDC delete request process for Update:"+e.getMessage()); + throw new ServiceException("Unable to delete EDC offer for update: "+e.getMessage()); } } } diff --git a/modules/sde-submodules/batch/src/main/resources/batch.json b/modules/sde-submodules/batch/src/main/resources/batch.json index ca31f846f..556a3dacd 100644 --- a/modules/sde-submodules/batch/src/main/resources/batch.json +++ b/modules/sde-submodules/batch/src/main/resources/batch.json @@ -18,7 +18,8 @@ "classification", "name_at_manufacturer" ], - "dependentRequired": {}, + "dependentRequired": { + }, "properties": { "uuid": { "type": [ @@ -70,7 +71,198 @@ "string", "null" ], - "pattern": "[A-Z]{3}|null|^$", + "enum": [ + "", + "AUS", + "ALB", + "DZA", + "AND", + "AGO", + "AIA", + "ATG", + "ARG", + "ARM", + "ABW", + "AUT", + "AZE", + "BHS", + "BHR", + "BRB", + "BEL", + "BLZ", + "BEN", + "BMU", + "BTN", + "BOL", + "BIH", + "BWA", + "BRA", + "VGB", + "BRN", + "BGR", + "BFA", + "BDI", + "KHM", + "CAN", + "CPV", + "CYM", + "TCD", + "CHL", + "CHN", + "COL", + "COM", + "COK", + "CRI", + "HRV", + "CYP", + "CZE", + "COD", + "DNK", + "DJI", + "DMA", + "DOM", + "ECU", + "SLV", + "ERI", + "EST", + "ETH", + "FLK", + "FRO", + "FSM", + "FJI", + "FIN", + "FRA", + "GUF", + "PYF", + "GAB", + "GMB", + "DEU", + "GIB", + "GRC", + "GRL", + "GRD", + "GLP", + "GTM", + "GIN", + "GNB", + "GUY", + "HND", + "HKG", + "HUN", + "ISL", + "IND", + "IDN", + "IRL", + "ISR", + "ITA", + "JAM", + "JPN", + "JOR", + "KAZ", + "KEN", + "KIR", + "KWT", + "KGZ", + "LAO", + "LVA", + "LSO", + "LIE", + "LTU", + "LUX", + "MDG", + "MWI", + "MYS", + "MDV", + "MLI", + "MLT", + "MHL", + "MTQ", + "MRT", + "MUS", + "MYT", + "MEX", + "MNG", + "MSR", + "MAR", + "MOZ", + "NAM", + "NRU", + "NPL", + "NLD", + "ANT", + "NCL", + "NZL", + "NIC", + "NER", + "NIU", + "NFK", + "NOR", + "OMN", + "PLW", + "PAN", + "PNG", + "PER", + "PHL", + "PCN", + "POL", + "PRT", + "QAT", + "REU", + "ROM", + "RUS", + "RWA", + "VCT", + "WSM", + "SMR", + "STP", + "SAU", + "SEN", + "SYC", + "SLE", + "SGP", + "SVK", + "SVN", + "SLB", + "SOM", + "ZAF", + "KOR", + "ESP", + "LKA", + "SHN", + "KNA", + "LCA", + "SPM", + "SUR", + "SJM", + "SWZ", + "SWE", + "CHE", + "TWN", + "TJK", + "TZA", + "THA", + "TGO", + "TON", + "TTO", + "TUN", + "TUR", + "TKM", + "TCA", + "TUV", + "UGA", + "UKR", + "ARE", + "GBR", + "USA", + "URY", + "VUT", + "VAT", + "VEN", + "VNM", + "WLF", + "YEM", + "ZMB" + ], "title": "Manufacturing Country", "description": "Country code where the part was manufactured", "examples": [ @@ -155,4 +347,4 @@ "name_at_customer": "Sensor" } ] -} \ No newline at end of file +} diff --git a/modules/sde-submodules/part-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/pap/steps/DigitalTwinsPartAsPlannedHandlerStep.java b/modules/sde-submodules/part-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/pap/steps/DigitalTwinsPartAsPlannedHandlerStep.java index b0414f4e0..2e50ce45b 100644 --- a/modules/sde-submodules/part-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/pap/steps/DigitalTwinsPartAsPlannedHandlerStep.java +++ b/modules/sde-submodules/part-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/pap/steps/DigitalTwinsPartAsPlannedHandlerStep.java @@ -26,7 +26,7 @@ import org.eclipse.tractusx.sde.common.constants.CommonConstants; import org.eclipse.tractusx.sde.common.exception.CsvHandlerDigitalTwinUseCaseException; -import org.eclipse.tractusx.sde.common.exception.ServiceException; +import org.eclipse.tractusx.sde.common.exception.CsvHandlerUseCaseException; import org.eclipse.tractusx.sde.common.submodel.executor.Step; import org.eclipse.tractusx.sde.digitaltwins.entities.common.Endpoint; import org.eclipse.tractusx.sde.digitaltwins.entities.common.GlobalAssetId; @@ -50,10 +50,9 @@ @Service public class DigitalTwinsPartAsPlannedHandlerStep extends Step { - @Autowired private DigitalTwinGateway gateway; - + @Autowired private DigitalTwinsUtility digitalTwinsUtility; @@ -62,7 +61,8 @@ public PartAsPlanned run(PartAsPlanned partAsPlannedAspect) throws CsvHandlerDig try { return doRun(partAsPlannedAspect); } catch (Exception e) { - throw new ServiceException(partAsPlannedAspect.getRowNumber() + ": DigitalTwins: " + e.getMessage()); + throw new CsvHandlerUseCaseException(partAsPlannedAspect.getRowNumber(), + ": DigitalTwins: " + e.getMessage()); } } @@ -131,8 +131,9 @@ private CreateSubModelRequest getCreateSubModelRequest(PartAsPlanned partAsPlann SemanticId semanticId = new SemanticId(value); String identification = CommonConstants.PREFIX + UUID.randomUUID(); - List endpoints = digitalTwinsUtility.prepareDtEndpoint(partAsPlannedAspect.getShellId(), identification); - + List endpoints = digitalTwinsUtility.prepareDtEndpoint(partAsPlannedAspect.getShellId(), + identification); + return CreateSubModelRequest.builder().idShort(getIdShortOfModel()).identification(identification) .semanticId(semanticId).endpoints(endpoints).build(); } @@ -143,7 +144,6 @@ private ShellDescriptorRequest getShellDescriptorRequest(PartAsPlanned partAsPla specificIdentifiers.add(new KeyValuePair(CommonConstants.MANUFACTURER_PART_ID,partAsPlannedAspect.getManufacturerPartId())); specificIdentifiers.add(new KeyValuePair(CommonConstants.MANUFACTURER_ID, digitalTwinsUtility.getManufacturerId())); specificIdentifiers.add(new KeyValuePair(CommonConstants.ASSET_LIFECYCLE_PHASE, CommonConstants.AS_PLANNED)); - List values = new ArrayList<>(); values.add(partAsPlannedAspect.getUuid()); GlobalAssetId globalIdentifier = new GlobalAssetId(values); diff --git a/modules/sde-submodules/part-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/pap/steps/EDCPartAsPlannedHandlerStep.java b/modules/sde-submodules/part-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/pap/steps/EDCPartAsPlannedHandlerStep.java index 77e5dc8ca..e70e3edec 100644 --- a/modules/sde-submodules/part-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/pap/steps/EDCPartAsPlannedHandlerStep.java +++ b/modules/sde-submodules/part-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/pap/steps/EDCPartAsPlannedHandlerStep.java @@ -98,8 +98,8 @@ private void deleteEDCFirstForUpdate(String submodel, PartAsPlanned input, Strin partAsPlannedService.deleteEDCAsset(partAsPlannedEntity); } catch (Exception e) { - if (!e.getMessage().contains("404 Not Found") && !e.getMessage().contains("No data found")) { - throw new ServiceException("Exception in EDC delete request process:" + e.getMessage()); + if (!e.getMessage().contains("404 Not Found")) { + throw new ServiceException("Unable to delete EDC offer for update: " + e.getMessage()); } } } diff --git a/modules/sde-submodules/part-site-information-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/psiap/steps/DigitalTwinsPartSiteInformationAsPlannedHandlerStep.java b/modules/sde-submodules/part-site-information-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/psiap/steps/DigitalTwinsPartSiteInformationAsPlannedHandlerStep.java index 023eccbc7..28d2f0b89 100644 --- a/modules/sde-submodules/part-site-information-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/psiap/steps/DigitalTwinsPartSiteInformationAsPlannedHandlerStep.java +++ b/modules/sde-submodules/part-site-information-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/psiap/steps/DigitalTwinsPartSiteInformationAsPlannedHandlerStep.java @@ -25,7 +25,7 @@ import org.eclipse.tractusx.sde.common.constants.CommonConstants; import org.eclipse.tractusx.sde.common.exception.CsvHandlerDigitalTwinUseCaseException; -import org.eclipse.tractusx.sde.common.exception.ServiceException; +import org.eclipse.tractusx.sde.common.exception.CsvHandlerUseCaseException; import org.eclipse.tractusx.sde.common.submodel.executor.Step; import org.eclipse.tractusx.sde.digitaltwins.entities.common.Endpoint; import org.eclipse.tractusx.sde.digitaltwins.entities.common.GlobalAssetId; @@ -60,7 +60,7 @@ public PartSiteInformationAsPlanned run(PartSiteInformationAsPlanned partSiteInf try { return doRun(partSiteInformationAsPlannedAspect); } catch (Exception e) { - throw new ServiceException(partSiteInformationAsPlannedAspect.getRowNumber() + ": DigitalTwins: " + e.getMessage()); + throw new CsvHandlerUseCaseException(partSiteInformationAsPlannedAspect.getRowNumber(), ": DigitalTwins: " + e.getMessage()); } } diff --git a/modules/sde-submodules/part-site-information-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/psiap/steps/EDCPartSiteInformationAsPlannedHandlerStep.java b/modules/sde-submodules/part-site-information-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/psiap/steps/EDCPartSiteInformationAsPlannedHandlerStep.java index dfcb02076..06e192d7d 100644 --- a/modules/sde-submodules/part-site-information-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/psiap/steps/EDCPartSiteInformationAsPlannedHandlerStep.java +++ b/modules/sde-submodules/part-site-information-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/psiap/steps/EDCPartSiteInformationAsPlannedHandlerStep.java @@ -99,7 +99,7 @@ private void deleteEDCFirstForUpdate(String submodel, PartSiteInformationAsPlann } catch (Exception e) { if (!e.getMessage().contains("404 Not Found")) { - throw new ServiceException("Exception in EDC delete request process:" + e.getMessage()); + throw new ServiceException("Unable to delete EDC offer for update: " + e.getMessage()); } } } diff --git a/modules/sde-submodules/serial-part-typization/src/main/java/org/eclipse/tractusx/sde/submodels/spt/steps/DigitalTwinsAspectCsvHandlerUseCase.java b/modules/sde-submodules/serial-part-typization/src/main/java/org/eclipse/tractusx/sde/submodels/spt/steps/DigitalTwinsAspectCsvHandlerUseCase.java index 286494508..dd6e076de 100644 --- a/modules/sde-submodules/serial-part-typization/src/main/java/org/eclipse/tractusx/sde/submodels/spt/steps/DigitalTwinsAspectCsvHandlerUseCase.java +++ b/modules/sde-submodules/serial-part-typization/src/main/java/org/eclipse/tractusx/sde/submodels/spt/steps/DigitalTwinsAspectCsvHandlerUseCase.java @@ -28,7 +28,7 @@ import org.eclipse.tractusx.sde.common.constants.CommonConstants; import org.eclipse.tractusx.sde.common.exception.CsvHandlerDigitalTwinUseCaseException; -import org.eclipse.tractusx.sde.common.exception.ServiceException; +import org.eclipse.tractusx.sde.common.exception.CsvHandlerUseCaseException; import org.eclipse.tractusx.sde.common.submodel.executor.Step; import org.eclipse.tractusx.sde.digitaltwins.entities.common.Endpoint; import org.eclipse.tractusx.sde.digitaltwins.entities.common.GlobalAssetId; @@ -52,10 +52,9 @@ @Service public class DigitalTwinsAspectCsvHandlerUseCase extends Step { - @Autowired private DigitalTwinGateway gateway; - + @Autowired private DigitalTwinsUtility digitalTwinsUtility; @@ -64,7 +63,7 @@ public Aspect run(Aspect aspect) throws CsvHandlerDigitalTwinUseCaseException { try { return doRun(aspect); } catch (Exception e) { - throw new ServiceException(aspect.getRowNumber() + ": DigitalTwins: " + e.getMessage()); + throw new CsvHandlerUseCaseException(aspect.getRowNumber(), ": DigitalTwins: " + e.getMessage()); } } @@ -133,8 +132,8 @@ private CreateSubModelRequest getCreateSubModelRequest(Aspect aspect) { List endpoints = digitalTwinsUtility.prepareDtEndpoint(aspect.getShellId(), identification); - return CreateSubModelRequest.builder().idShort(getIdShortOfModel()).identification(identification).semanticId(semanticId) - .endpoints(endpoints).build(); + return CreateSubModelRequest.builder().idShort(getIdShortOfModel()).identification(identification) + .semanticId(semanticId).endpoints(endpoints).build(); } private ShellDescriptorRequest getShellDescriptorRequest(Aspect aspect) { @@ -146,8 +145,8 @@ private ShellDescriptorRequest getShellDescriptorRequest(Aspect aspect) { GlobalAssetId globalIdentifier = new GlobalAssetId(values); return ShellDescriptorRequest.builder() - .idShort(String.format("%s_%s_%s", aspect.getNameAtManufacturer(), digitalTwinsUtility.getManufacturerId(), - aspect.getManufacturerPartId())) + .idShort(String.format("%s_%s_%s", aspect.getNameAtManufacturer(), + digitalTwinsUtility.getManufacturerId(), aspect.getManufacturerPartId())) .globalAssetId(globalIdentifier).specificAssetIds(specificIdentifiers) .identification(CommonConstants.PREFIX + UUID.randomUUID()).build(); } @@ -155,7 +154,8 @@ private ShellDescriptorRequest getShellDescriptorRequest(Aspect aspect) { private void setSpecifiers(final ArrayList specificIdentifiers, Aspect aspect) { specificIdentifiers.add(new KeyValuePair(CommonConstants.PART_INSTANCE_ID, aspect.getPartInstanceId())); specificIdentifiers.add(new KeyValuePair(CommonConstants.MANUFACTURER_PART_ID, aspect.getManufacturerPartId())); - specificIdentifiers.add(new KeyValuePair(CommonConstants.MANUFACTURER_ID, digitalTwinsUtility.getManufacturerId())); + specificIdentifiers + .add(new KeyValuePair(CommonConstants.MANUFACTURER_ID, digitalTwinsUtility.getManufacturerId())); if (aspect.hasOptionalIdentifier()) { specificIdentifiers .add(new KeyValuePair(aspect.getOptionalIdentifierKey(), aspect.getOptionalIdentifierValue())); diff --git a/modules/sde-submodules/serial-part-typization/src/main/java/org/eclipse/tractusx/sde/submodels/spt/steps/EDCAspectHandlerUseCase.java b/modules/sde-submodules/serial-part-typization/src/main/java/org/eclipse/tractusx/sde/submodels/spt/steps/EDCAspectHandlerUseCase.java index 5124f9523..13cf66440 100644 --- a/modules/sde-submodules/serial-part-typization/src/main/java/org/eclipse/tractusx/sde/submodels/spt/steps/EDCAspectHandlerUseCase.java +++ b/modules/sde-submodules/serial-part-typization/src/main/java/org/eclipse/tractusx/sde/submodels/spt/steps/EDCAspectHandlerUseCase.java @@ -103,7 +103,7 @@ private void deleteEDCFirstForUpdate(String submodel, Aspect input, String proce aspectService.deleteEDCAsset(entity); } catch (Exception e) { if (!e.getMessage().contains("404 Not Found")) { - throw new ServiceException("Exception in EDC delete request process for Update:" + e.getMessage()); + throw new ServiceException("Unable to delete EDC offer for update: " + e.getMessage()); } } } diff --git a/modules/sde-submodules/serial-part-typization/src/main/resources/serial-part-typization.json b/modules/sde-submodules/serial-part-typization/src/main/resources/serial-part-typization.json index 3a60bc560..c1b006618 100644 --- a/modules/sde-submodules/serial-part-typization/src/main/resources/serial-part-typization.json +++ b/modules/sde-submodules/serial-part-typization/src/main/resources/serial-part-typization.json @@ -2,7 +2,7 @@ "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "http://example.com/example.json", "type": "array", - "id": "aspect", + "id": "serialparttypization", "idShort": "serialPartTypization", "version": "1.1.1", "semantic_id": "urn:bamm:io.catenax.serial_part_typization:1.1.1#SerialPartTypization", @@ -66,7 +66,198 @@ "string", "null" ], - "pattern": "^[A-Z]{3}$|^null$|^$", + "enum": [ + "", + "AUS", + "ALB", + "DZA", + "AND", + "AGO", + "AIA", + "ATG", + "ARG", + "ARM", + "ABW", + "AUT", + "AZE", + "BHS", + "BHR", + "BRB", + "BEL", + "BLZ", + "BEN", + "BMU", + "BTN", + "BOL", + "BIH", + "BWA", + "BRA", + "VGB", + "BRN", + "BGR", + "BFA", + "BDI", + "KHM", + "CAN", + "CPV", + "CYM", + "TCD", + "CHL", + "CHN", + "COL", + "COM", + "COK", + "CRI", + "HRV", + "CYP", + "CZE", + "COD", + "DNK", + "DJI", + "DMA", + "DOM", + "ECU", + "SLV", + "ERI", + "EST", + "ETH", + "FLK", + "FRO", + "FSM", + "FJI", + "FIN", + "FRA", + "GUF", + "PYF", + "GAB", + "GMB", + "DEU", + "GIB", + "GRC", + "GRL", + "GRD", + "GLP", + "GTM", + "GIN", + "GNB", + "GUY", + "HND", + "HKG", + "HUN", + "ISL", + "IND", + "IDN", + "IRL", + "ISR", + "ITA", + "JAM", + "JPN", + "JOR", + "KAZ", + "KEN", + "KIR", + "KWT", + "KGZ", + "LAO", + "LVA", + "LSO", + "LIE", + "LTU", + "LUX", + "MDG", + "MWI", + "MYS", + "MDV", + "MLI", + "MLT", + "MHL", + "MTQ", + "MRT", + "MUS", + "MYT", + "MEX", + "MNG", + "MSR", + "MAR", + "MOZ", + "NAM", + "NRU", + "NPL", + "NLD", + "ANT", + "NCL", + "NZL", + "NIC", + "NER", + "NIU", + "NFK", + "NOR", + "OMN", + "PLW", + "PAN", + "PNG", + "PER", + "PHL", + "PCN", + "POL", + "PRT", + "QAT", + "REU", + "ROM", + "RUS", + "RWA", + "VCT", + "WSM", + "SMR", + "STP", + "SAU", + "SEN", + "SYC", + "SLE", + "SGP", + "SVK", + "SVN", + "SLB", + "SOM", + "ZAF", + "KOR", + "ESP", + "LKA", + "SHN", + "KNA", + "LCA", + "SPM", + "SUR", + "SJM", + "SWZ", + "SWE", + "CHE", + "TWN", + "TJK", + "TZA", + "THA", + "TGO", + "TON", + "TTO", + "TUN", + "TUR", + "TKM", + "TCA", + "TUV", + "UGA", + "UKR", + "ARE", + "GBR", + "USA", + "URY", + "VUT", + "VAT", + "VEN", + "VNM", + "WLF", + "YEM", + "ZMB" + ], "title": "Manufacturing Country", "description": "Country code where the part was manufactured", "examples": [ diff --git a/modules/sde-submodules/single-level-bom-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/slbap/steps/DigitalTwinsSingleLevelBoMAsPlannedHandlerStep.java b/modules/sde-submodules/single-level-bom-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/slbap/steps/DigitalTwinsSingleLevelBoMAsPlannedHandlerStep.java index 13ae2b358..24f43f7c6 100644 --- a/modules/sde-submodules/single-level-bom-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/slbap/steps/DigitalTwinsSingleLevelBoMAsPlannedHandlerStep.java +++ b/modules/sde-submodules/single-level-bom-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/slbap/steps/DigitalTwinsSingleLevelBoMAsPlannedHandlerStep.java @@ -163,6 +163,7 @@ private CreateSubModelRequest getCreateSubModelRequest(SingleLevelBoMAsPlanned s private ShellDescriptorRequest getShellDescriptorRequest(PartAsPlanned partAsPlannedAspect) { ArrayList specificIdentifiers = new ArrayList<>(); + specificIdentifiers.add(new KeyValuePair(CommonConstants.ASSET_LIFECYCLE_PHASE, CommonConstants.AS_PLANNED)); specificIdentifiers.add( new KeyValuePair(CommonConstants.MANUFACTURER_PART_ID, partAsPlannedAspect.getManufacturerPartId())); diff --git a/modules/sde-submodules/single-level-bom-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/slbap/steps/EDCSingleLevelBoMAsPlannedHandlerStep.java b/modules/sde-submodules/single-level-bom-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/slbap/steps/EDCSingleLevelBoMAsPlannedHandlerStep.java index 64829228a..7a0ca282e 100644 --- a/modules/sde-submodules/single-level-bom-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/slbap/steps/EDCSingleLevelBoMAsPlannedHandlerStep.java +++ b/modules/sde-submodules/single-level-bom-as-planned/src/main/java/org/eclipse/tractusx/sde/submodels/slbap/steps/EDCSingleLevelBoMAsPlannedHandlerStep.java @@ -101,7 +101,7 @@ private void deleteEDCFirstForUpdate(String submodel, SingleLevelBoMAsPlanned in } catch (Exception e) { if (!e.getMessage().contains("404 Not Found")) { - throw new ServiceException("Exception in EDC delete request process for update:"+e.getMessage()); + throw new ServiceException("Unable to delete EDC offer for update: "+e.getMessage()); } } } diff --git a/modules/sde-submodules/single-level-usage-as-built/src/main/java/org/eclipse/tractusx/sde/submodels/sluab/steps/DigitalTwinsSingleLevelUsageAsBuiltCsvHandlerUseCase.java b/modules/sde-submodules/single-level-usage-as-built/src/main/java/org/eclipse/tractusx/sde/submodels/sluab/steps/DigitalTwinsSingleLevelUsageAsBuiltCsvHandlerUseCase.java index de6e47e53..a8187fd17 100644 --- a/modules/sde-submodules/single-level-usage-as-built/src/main/java/org/eclipse/tractusx/sde/submodels/sluab/steps/DigitalTwinsSingleLevelUsageAsBuiltCsvHandlerUseCase.java +++ b/modules/sde-submodules/single-level-usage-as-built/src/main/java/org/eclipse/tractusx/sde/submodels/sluab/steps/DigitalTwinsSingleLevelUsageAsBuiltCsvHandlerUseCase.java @@ -66,6 +66,7 @@ public SingleLevelUsageAsBuilt run(SingleLevelUsageAsBuilt aspectSingleLevelUsag try { return doRun(aspectSingleLevelUsageAsBuilt); } catch (Exception e) { + throw new ServiceException( aspectSingleLevelUsageAsBuilt.getRowNumber() + ": DigitalTwins: " + e.getMessage()); } @@ -190,6 +191,7 @@ private void setSpecifiers(final ArrayList specificIdentifiers, As specificIdentifiers.add(new KeyValuePair(CommonConstants.MANUFACTURER_PART_ID, aspect.getManufacturerPartId())); specificIdentifiers .add(new KeyValuePair(CommonConstants.MANUFACTURER_ID, digitalTwinsUtility.getManufacturerId())); + if (aspect.hasOptionalIdentifier()) { specificIdentifiers .add(new KeyValuePair(aspect.getOptionalIdentifierKey(), aspect.getOptionalIdentifierValue())); diff --git a/modules/sde-submodules/single-level-usage-as-built/src/main/java/org/eclipse/tractusx/sde/submodels/sluab/steps/EDCSingleLevelUsageAsBuiltHandlerUseCase.java b/modules/sde-submodules/single-level-usage-as-built/src/main/java/org/eclipse/tractusx/sde/submodels/sluab/steps/EDCSingleLevelUsageAsBuiltHandlerUseCase.java index e21be6a1f..8fad55157 100644 --- a/modules/sde-submodules/single-level-usage-as-built/src/main/java/org/eclipse/tractusx/sde/submodels/sluab/steps/EDCSingleLevelUsageAsBuiltHandlerUseCase.java +++ b/modules/sde-submodules/single-level-usage-as-built/src/main/java/org/eclipse/tractusx/sde/submodels/sluab/steps/EDCSingleLevelUsageAsBuiltHandlerUseCase.java @@ -101,7 +101,7 @@ private void deleteEDCFirstForUpdate(String submodel, SingleLevelUsageAsBuilt in singleLevelUsageAsBuiltService.deleteEDCAsset(aspectRelationshipEntity); } catch (Exception e) { if (!e.getMessage().contains("404 Not Found")) { - throw new ServiceException("Exception in EDC delete request process"); + throw new ServiceException("Unable to delete EDC offer for update: "+ e.getMessage()); } } } diff --git a/pom.xml b/pom.xml index 6b770732c..d2c238cf4 100644 --- a/pom.xml +++ b/pom.xml @@ -28,17 +28,17 @@ org.springframework.boot spring-boot-starter-parent - 3.0.2 + 3.0.5 - + org.eclipse.tractusx sde 0.0.1 pom sde SDE for CatenaX - + 18 2.17.1 @@ -52,11 +52,11 @@ modules/sde-external-services/edc modules/sde-external-services/digital-twins modules/sde-external-services/portal - + modules/sde-common modules/sde-core modules/sde-usecases/traceability - + modules/sde-submodules/serial-part-typization modules/sde-submodules/batch modules/sde-submodules/assembly-part-relationship @@ -67,7 +67,7 @@ - + org.springframework.boot spring-boot-starter-data-jpa @@ -79,10 +79,14 @@ org.hibernate hibernate-core + + org.springframework + spring-expression + - - - + + + org.springframework.boot spring-boot-starter-web @@ -94,9 +98,13 @@ org.yaml snakeyaml + + org.springframework + spring-expression + - + org.springframework.cloud spring-cloud-starter-openfeign @@ -119,6 +127,21 @@ 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 @@ -143,15 +166,36 @@ spring-boot-starter-test test - + org.springframework.boot spring-boot-starter-validation - com.fasterxml.jackson.core - jackson-databind - + 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 + @@ -164,7 +208,7 @@ - + @@ -193,4 +237,4 @@ - \ No newline at end of file +