Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(bpdm-gate): Extend error states #985

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
1b5e887
feat: Adding extend error states
kunyao-cofinity-x Jul 2, 2024
9600d6a
feat: Adding logic to TaskResolutionService handling conditions
kunyao-cofinity-x Jul 2, 2024
cb2a888
fix: providing alternative address to orchestrator
nicoprow Jul 3, 2024
b02caa5
docs(CHANGLEOG): update changelog for version 6.0.2 changes
nicoprow Jul 3, 2024
daaafc5
Merge pull request #987 from eclipse-tractusx/fix/gate-task-alt-add
nicoprow Jul 5, 2024
d8901ee
fix(gate): sending business partner data to the golden record service…
nicoprow Jul 5, 2024
1f15ba8
Merge pull request #988 from eclipse-tractusx/fix/gate/input-ready
nicoprow Jul 5, 2024
e4cc1be
fix(gate): sharing states sometimes taking the wrong task id from the…
nicoprow Jul 5, 2024
77e40e8
build(dep): increase tomcat-embed-core dependency version
nicoprow Jul 8, 2024
a0a289a
Merge pull request #992 from eclipse-tractusx/build/tomcat-core
nicoprow Jul 8, 2024
5ea8c20
Merge pull request #989 from eclipse-tractusx/fix/gate/wrong-task-ids
SujitMBRDI Jul 8, 2024
da24adf
feat(bpdm-gate): updated upload partner process to only process site …
SujitMBRDI Jun 27, 2024
201db14
Merge pull request #980 from SujitMBRDI/feat/update_partner_upload_en…
SujitMBRDI Jul 8, 2024
069c5c0
ci(Linting): check version increment only if the chart version is a r…
nicoprow Jul 9, 2024
f6fe478
Merge pull request #995 from eclipse-tractusx/ci/lint-on-release
nicoprow Jul 9, 2024
041f856
ci(Release Chart): fix check for Chart release version
nicoprow Jul 10, 2024
cff1eb6
Merge pull request #997 from eclipse-tractusx/ci/chart-release-check-fix
nicoprow Jul 10, 2024
95de3fe
feat(Charts): add value to delay the startup of BPDM application cont…
nicoprow Jul 10, 2024
b2e0a9f
feat(bpdm-gate): Extend error states
kunyao-cofinity-x Jul 10, 2024
6299ee8
Merge pull request #998 from eclipse-tractusx/feat/chart/uptime-delay
nicoprow Jul 11, 2024
0febf9f
feat(Orchestrator): add persistence layer
nicoprow Jul 9, 2024
879381a
Merge pull request #990 from eclipse-tractusx/feat/orch-persistence-jpa
SujitMBRDI Jul 11, 2024
86c2581
feat: add gate record ID for tasks to identify tasks for the same gat…
nicoprow Jul 8, 2024
8af4933
Merge pull request #991 from eclipse-tractusx/feat/orch-record-id
nicoprow Jul 12, 2024
e344002
build(version): increase BPDM app version to 6.1.0 and charts version…
nicoprow Jul 15, 2024
bedcf07
Merge pull request #999 from eclipse-tractusx/build/version/6.1.0
nicoprow Jul 15, 2024
cb624c8
feat(bpdm-gate): Extend error code with description
kunyao-cofinity-x Jul 15, 2024
fa24b9c
feat: Adding extend error states
kunyao-cofinity-x Jul 2, 2024
0311826
feat: Adding logic to TaskResolutionService handling conditions
kunyao-cofinity-x Jul 2, 2024
2e2b7ab
feat(bpdm-gate): Extend error states
kunyao-cofinity-x Jul 10, 2024
a86e382
feat(bpdm-gate): Extend error code with description
kunyao-cofinity-x Jul 15, 2024
ff2863d
feat(bpdm-gate): Extend error code with description. Extend error cod…
kunyao-cofinity-x Jul 16, 2024
e514159
Revert "feat(bpdm-gate): Extend error code with description. Extend e…
kunyao-cofinity-x Jul 16, 2024
879d878
feat(bpdm-gate): Extend error code with description. Extend error cod…
kunyao-cofinity-x Jul 16, 2024
3fdff66
Merge branch 'feat/Extend-error-states' of github.com:kunyao-cofinity…
kunyao-cofinity-x Jul 16, 2024
ac3cc8a
# This is a combination of 8 commits.
kunyao-cofinity-x Jul 2, 2024
80d20bb
feat(bpdm-gate): resolve changes
kunyao-cofinity-x Jul 18, 2024
04e5cd9
parent 80d20bb61bfb171360d3312781a70a7b5783fe70
kunyao-cofinity-x Jul 18, 2024
a0394c8
Merge branch 'feat/Extend-error-states' of github.com:kunyao-cofinity…
kunyao-cofinity-x Jul 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/app-test-charts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ on:
paths:
- 'pom.xml'
- 'bpdm-**'
- 'charts/**'
push:
branches:
- main
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/chart-test-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ jobs:
with:
fetch-depth: 0

- name: Check for Release Version
id: checkRelease
run: |
CHART_VERSION=$(grep 'version:' ./charts/bpdm/Chart.yaml | head -n1 | awk '{ print $2}')
echo "CHART_VERSION: $CHART_VERSION"
SNAPSHOT=$(echo "$CHART_VERSION" | grep 'SNAPSHOT' || echo "" )
echo "SNAPSHOT: $SNAPSHOT"
if [[ -z "$SNAPSHOT" ]]; then
IS_RELEASE=true
else
IS_RELEASE=false
fi
echo "IS_RELEASE: $IS_RELEASE"
echo "isRelease=$IS_RELEASE" >> $GITHUB_OUTPUT

- name: Set up Helm
uses: azure/setup-helm@v4
with:
Expand All @@ -57,6 +72,7 @@ jobs:
run: |
cat <<EOF > .chart-testing-config.yaml
validate-maintainers: false
check-version-increment: ${{ steps.checkRelease.outputs.isRelease }}
chart-repos:
- bitnami=https://charts.bitnami.com/bitnami
EOF
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/helm-chart-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,15 @@ jobs:
id: checkRelease
run: |
CHART_VERSION=$(grep 'version:' ./charts/bpdm/Chart.yaml | head -n1 | awk '{ print $2}')
SNAPSHOT=$(echo $CHART_VERSION | grep 'SNAPSHOT')
if test -z $SNAPSHOT; then IS_RELEASE=true; else IS_RELEASE=false fi
echo "CHART_VERSION: $CHART_VERSION"
SNAPSHOT=$(echo "$CHART_VERSION" | grep 'SNAPSHOT' || echo "" )
echo "SNAPSHOT: $SNAPSHOT"
if [[ -z "$SNAPSHOT" ]]; then
IS_RELEASE=true
else
IS_RELEASE=false
fi
echo "IS_RELEASE: $IS_RELEASE"
echo "isRelease=$IS_RELEASE" >> $GITHUB_OUTPUT

- name: Configure Git
Expand Down
18 changes: 17 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,29 @@ The format is based on Keep a Changelog (https://keepachangelog.com/en/1.0.0/),

For changes to the BPDM Helm charts please consult the [changelog](charts/bpdm/CHANGELOG.md) of the charts directly.

## [6.1.0] - [tbd]
## [6.1.0] - [2024-07-15]

### Added

- BPDM Gate: Post endpoint to upload business partner input data using csv file.(#700)
- BPDM Gate: GET endpoint to download the csv file template for business partner upload. (#700)
- Apps: Tax Jurisdiction Code to the physical address of a business partner (#955)
- BPDM Orchestrator: Tasks will now be persisted
- BPDM Orchestrator: Tasks now come with a gate record identifier. This makes it possible for cleaning services to match tasks for the same Gate record

### Changed:

- BPDM Gate: Fix sending business partner data to the golden record service even when they have no changes
- BPDM Gate: Fix sharing states sometimes taking the wrong task id from the orchestrator


## [6.0.2] - [2024-07-03]

### Changed

- BPDM Gate: Now sends alternative addresses which are NULL correctly to the Orchestrator
- BPDM Pool: Changed Checksum generation algorithm: Now checksum includes the BPN with prefix


## [6.0.1] - [2024-05-27]

Expand Down
22 changes: 11 additions & 11 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ maven/mavencentral/com.github.dasniko/testcontainers-keycloak/3.2.0, Apache-2.0,
maven/mavencentral/com.github.docker-java/docker-java-api/3.3.6, Apache-2.0, approved, #10346
maven/mavencentral/com.github.docker-java/docker-java-transport-zerodep/3.3.6, Apache-2.0 AND (Apache-2.0 AND BSD-3-Clause), approved, #15251
maven/mavencentral/com.github.docker-java/docker-java-transport/3.3.6, Apache-2.0, approved, #7942
maven/mavencentral/com.github.java-json-tools/btf/1.3, Apache-2.0 AND GPL-1.0-or-later AND LGPL-3.0-only AND Apache-2.0 AND LGPL-3.0-only, restricted, #15201
maven/mavencentral/com.github.java-json-tools/btf/1.3, Apache-2.0 OR LGPL-3.0-only, approved, #15201
maven/mavencentral/com.github.java-json-tools/jackson-coreutils/2.0, Apache-2.0 OR LGPL-3.0-or-later, approved, #15186
maven/mavencentral/com.github.java-json-tools/json-patch/1.13, Apache-2.0 OR LGPL-3.0-or-later, approved, CQ23929
maven/mavencentral/com.github.java-json-tools/msg-simple/1.2, Apache-2.0 AND LGPL-2.1-or-later AND LGPL-3.0-only AND (Apache-2.0 AND GPL-1.0-or-later AND LGPL-3.0-only) AND Apache-2.0 AND LGPL-3.0-only, restricted, #15239
maven/mavencentral/com.github.java-json-tools/msg-simple/1.2, Apache-2.0 OR LGPL-3.0-or-later, approved, #15239
maven/mavencentral/com.github.stephenc.jcip/jcip-annotations/1.0-1, Apache-2.0, approved, CQ21949
maven/mavencentral/com.github.tomakehurst/wiremock-jre8-standalone/2.35.2, MIT AND Apache-2.0, approved, #6979
maven/mavencentral/com.google.code.gson/gson/2.10.1, Apache-2.0, approved, #6159
Expand Down Expand Up @@ -109,7 +109,7 @@ maven/mavencentral/org.apache.james/apache-mime4j-dom/0.8.9, Apache-2.0, approve
maven/mavencentral/org.apache.james/apache-mime4j-storage/0.8.9, Apache-2.0, approved, clearlydefined
maven/mavencentral/org.apache.logging.log4j/log4j-api/2.21.1, Apache-2.0 AND (Apache-2.0 AND LGPL-2.0-or-later), approved, #11079
maven/mavencentral/org.apache.logging.log4j/log4j-to-slf4j/2.21.1, Apache-2.0, approved, #15262
maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-core/10.1.20, 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-core/10.1.25, Apache-2.0 AND (EPL-2.0 OR (GPL-2.0 WITH Classpath-exception-2.0)) AND CDDL-1.0 AND (CDDL-1.1 OR (GPL-2.0-only WITH Classpath-exception-2.0)) AND EPL-2.0, approved, #15195
maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-el/10.1.20, Apache-2.0, approved, #6997
maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.20, Apache-2.0, approved, #7920
maven/mavencentral/org.apiguardian/apiguardian-api/1.1.2, Apache-2.0, approved, clearlydefined
Expand All @@ -119,12 +119,12 @@ maven/mavencentral/org.awaitility/awaitility/4.2.1, Apache-2.0, approved, #14178
maven/mavencentral/org.checkerframework/checker-qual/3.31.0, MIT, approved, clearlydefined
maven/mavencentral/org.eclipse.angus/angus-activation/2.0.2, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.angus
maven/mavencentral/org.eclipse.angus/angus-mail/2.0.3, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.angus
maven/mavencentral/org.eclipse.tractusx/bpdm-common-test/6.0.2-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx/bpdm-common/6.0.2-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx/bpdm-gate-api/6.0.2-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx/bpdm-orchestrator-api/6.0.2-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx/bpdm-orchestrator/6.0.2-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx/bpdm-pool-api/6.0.2-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx/bpdm-common-test/6.1.0-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx/bpdm-common/6.1.0-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx/bpdm-gate-api/6.1.0-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx/bpdm-orchestrator-api/6.1.0-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx/bpdm-orchestrator/6.1.0-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx/bpdm-pool-api/6.1.0-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.flywaydb/flyway-core/9.22.3, Apache-2.0, approved, #15215
maven/mavencentral/org.glassfish.jaxb/codemodel/4.0.5, BSD-3-Clause, approved, ee4j.jaxb-impl
maven/mavencentral/org.glassfish.jaxb/jaxb-core/4.0.5, BSD-3-Clause, approved, ee4j.jaxb-impl
Expand Down Expand Up @@ -173,7 +173,7 @@ maven/mavencentral/org.mockito/mockito-junit-jupiter/5.7.0, MIT, approved, #1142
maven/mavencentral/org.objenesis/objenesis/3.3, Apache-2.0, approved, clearlydefined
maven/mavencentral/org.opentest4j/opentest4j/1.3.0, Apache-2.0, approved, #9713
maven/mavencentral/org.ow2.asm/asm/9.6, BSD-3-Clause, approved, #10776
maven/mavencentral/org.postgresql/postgresql/42.6.2, BSD-2-Clause AND Apache-2.0, approved, #9159
maven/mavencentral/org.postgresql/postgresql/42.6.2, BSD-2-Clause AND Apache-2.0, approved, #15238
maven/mavencentral/org.reactivestreams/reactive-streams/1.0.4, CC0-1.0, approved, CQ16332
maven/mavencentral/org.rnorth.duct-tape/duct-tape/1.0.8, MIT, approved, clearlydefined
maven/mavencentral/org.skyscreamer/jsonassert/1.5.1, Apache-2.0, approved, clearlydefined
Expand Down Expand Up @@ -234,7 +234,7 @@ maven/mavencentral/org.testcontainers/database-commons/1.19.8, Apache-2.0, appro
maven/mavencentral/org.testcontainers/jdbc/1.19.8, Apache-2.0, approved, #10348
maven/mavencentral/org.testcontainers/junit-jupiter/1.19.8, MIT, approved, #10344
maven/mavencentral/org.testcontainers/postgresql/1.19.8, MIT, approved, #10350
maven/mavencentral/org.testcontainers/testcontainers/1.19.8, Apache-2.0 AND MIT, approved, #10347
maven/mavencentral/org.testcontainers/testcontainers/1.19.8, MIT, approved, #15203
maven/mavencentral/org.webjars/swagger-ui/5.13.0, Apache-2.0, approved, #14547
maven/mavencentral/org.xmlunit/xmlunit-core/2.9.1, Apache-2.0, approved, #6272
maven/mavencentral/org.yaml/snakeyaml/2.2, 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, #10232
2 changes: 1 addition & 1 deletion bpdm-cleaning-service-dummy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<parent>
<groupId>org.eclipse.tractusx</groupId>
<artifactId>bpdm-parent</artifactId>
<version>6.1.0-SNAPSHOT</version>
<version>6.1.0</version>
</parent>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import org.springframework.test.context.ActiveProfiles
import org.springframework.test.context.DynamicPropertyRegistry
import org.springframework.test.context.DynamicPropertySource
import java.time.Instant
import java.util.*

@SpringBootTest(
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
Expand Down Expand Up @@ -373,7 +374,7 @@ class CleaningServiceApiCallsTest @Autowired constructor(

// Helper method to create a sample TaskStepReservationResponse
private fun createSampleTaskStepReservationResponse(businessPartner: BusinessPartner): TaskStepReservationResponse {
return TaskStepReservationResponse(listOf(TaskStepReservationEntryDto(fixedTaskId, businessPartner)), Instant.MIN)
return TaskStepReservationResponse(listOf(TaskStepReservationEntryDto(fixedTaskId, UUID.randomUUID().toString(), businessPartner)), Instant.MIN)
}


Expand Down
2 changes: 1 addition & 1 deletion bpdm-common-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<parent>
<groupId>org.eclipse.tractusx</groupId>
<artifactId>bpdm-parent</artifactId>
<version>6.1.0-SNAPSHOT</version>
<version>6.1.0</version>
</parent>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class KeyCloakInitializer: ApplicationContextInitializer<ConfigurableApplication
.withRealmImportFile("keycloak/CX-Central.json")

const val REALM = "CX-Central"
const val TENANT_BPNL = "BPNL000000000010"
}

override fun initialize(applicationContext: ConfigurableApplicationContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import org.testcontainers.containers.PostgreSQLContainer
*/
class PostgreSQLContextInitializer : ApplicationContextInitializer<ConfigurableApplicationContext> {
companion object {
val postgreSQLContainer = PostgreSQLContainer("postgres:13.2")
val postgreSQLContainer = PostgreSQLContainer("postgres:15.4")
.withAccessToHost(true)
.withNetwork(Network.SHARED)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class DbTestHelpers(private val entityManagerFactory: EntityManagerFactory?) {
truncateDbTablesFromSchema("bpdm")
truncateDbTablesFromSchema("bpdmgate")
truncateDbTablesFromSchema("bpdm-bridge-dummy")
truncateDbTablesFromSchema("bpdm-orchestrator")
}

private fun truncateDbTablesFromSchema(dbSchemaName: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2626,7 +2626,7 @@
"id.token.claim" : "false",
"lightweight.claim" : "false",
"access.token.claim" : "true",
"claim.name" : "BPN",
"claim.name" : "bpn",
"jsonType.label" : "String"
}
} ]
Expand Down
2 changes: 1 addition & 1 deletion bpdm-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<parent>
<groupId>org.eclipse.tractusx</groupId>
<artifactId>bpdm-parent</artifactId>
<version>6.1.0-SNAPSHOT</version>
<version>6.1.0</version>
</parent>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ fun <T> MutableCollection<T>.replace(elements: Collection<T>) {
addAll(elements)
}

fun <K, V> MutableMap<K, V>.replace(map: Map<K, V>) {
clear()
putAll(map)
}


/**
* Copy overlapping elements by index from [elements] to [this] collection by applying the [copyFunction].
Expand Down
2 changes: 1 addition & 1 deletion bpdm-gate-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<parent>
<artifactId>bpdm-parent</artifactId>
<groupId>org.eclipse.tractusx</groupId>
<version>6.1.0-SNAPSHOT</version>
<version>6.1.0</version>
</parent>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

package org.eclipse.tractusx.bpdm.gate.api.exception

import io.swagger.v3.oas.annotations.media.Schema

/**
* For every combination of possible errors a separate enum class is defined extending this marker interface.
* We need separate enum classes in order to get the correct error codes for each endpoint in the Swagger schema.
Expand All @@ -30,6 +32,24 @@ enum class BusinessPartnerSharingError : ErrorCode {
SharingTimeout,
BpnNotInPool,
MissingTaskID,

@Schema(description = "The provided record contains natural person information. ")
NaturalPersonError,

@Schema(description = "The provided record can not be matched to a legal entity or an address.")
BpnErrorNotFound,

@Schema(description = "The provided record can not link to a clear legal entity.")
BpnErrorTooManyOptions,

@Schema(description = "The provided record does not fulfill mandatory validation rules. ")
MandatoryFieldValidationFailed,

@Schema(description = "The provided record is part of a country that is not allowed to be processed by the GR process (example: Brazil).")
BlacklistCountryPresent,

@Schema(description = "The provided record contains unalloyed special characters. ")
UnknownSpecialCharacters
}

enum class ChangeLogOutputError : ErrorCode {
Expand Down
2 changes: 1 addition & 1 deletion bpdm-gate/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<parent>
<groupId>org.eclipse.tractusx</groupId>
<artifactId>bpdm-parent</artifactId>
<version>6.1.0-SNAPSHOT</version>
<version>6.1.0</version>
</parent>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import org.eclipse.tractusx.bpdm.common.model.BaseEntity
import org.eclipse.tractusx.bpdm.gate.api.exception.BusinessPartnerSharingError
import org.eclipse.tractusx.bpdm.gate.api.model.SharingStateType
import java.time.LocalDateTime
import java.util.*


@Entity
Expand All @@ -36,6 +37,9 @@ class SharingStateDb(
@Column(name = "tenant_bpnl", nullable = true)
var tenantBpnl: String? = null,

@Column(name = "orchestrator_record_id", nullable = true, unique = true)
var orchestratorRecordId: UUID?,

@Enumerated(EnumType.STRING)
@Column(name = "sharing_state_type", nullable = false)
var sharingStateType: SharingStateType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,6 @@ object PartnerUploadFileHeader {
const val STATES_TYPE_2 = "states2.type"
const val ROLES = "roles"
const val IS_OWN_COMPANY_DATA = "isOwnCompanyData"
const val LEGAL_ENTITY_BPN = "legalEntity.legalEntityBpn"
const val LEGAL_ENTITY_NAME = "legalEntity.legalName"
const val LEGAL_ENTITY_SHORT_NAME = "legalEntity.shortName"
const val LEGAL_ENTITY_LEGAL_FORM = "legalEntity.legalForm"
const val LEGAL_ENTITY_STATES_VALID_FROM = "legalEntity.states.validFrom"
const val LEGAL_ENTITY_STATES_VALID_TO = "legalEntity.states.validTo"
const val LEGAL_ENTITY_STATES_TYPE = "legalEntity.states.type"
const val SITE_BPN = "site.siteBpn"
const val SITE_NAME = "site.name"
const val SITE_STATES_VALID_FROM = "site.states.validFrom"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,27 +91,6 @@ data class PartnerUploadFileRow(
@CsvBindByName(column = PartnerUploadFileHeader.IS_OWN_COMPANY_DATA)
val isOwnCompanyData: String? = null,

@CsvBindByName(column = PartnerUploadFileHeader.LEGAL_ENTITY_BPN)
val legalEntityBpn: String? = null,

@CsvBindByName(column = PartnerUploadFileHeader.LEGAL_ENTITY_NAME)
val legalEntityName: String? = null,

@CsvBindByName(column = PartnerUploadFileHeader.LEGAL_ENTITY_SHORT_NAME)
val legalEntityShortName: String? = null,

@CsvBindByName(column = PartnerUploadFileHeader.LEGAL_ENTITY_LEGAL_FORM)
val legalEntityLegalForm: String? = null,

@CsvBindByName(column = PartnerUploadFileHeader.LEGAL_ENTITY_STATES_VALID_FROM)
val legalEntityStatesValidFrom: String? = null,

@CsvBindByName(column = PartnerUploadFileHeader.LEGAL_ENTITY_STATES_VALID_TO)
val legalEntityStatesValidTo: String? = null,

@CsvBindByName(column = PartnerUploadFileHeader.LEGAL_ENTITY_STATES_TYPE)
val legalEntityStatesType: String? = null,

@CsvBindByName(column = PartnerUploadFileHeader.SITE_BPN)
val siteBpn: String? = null,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,11 @@ class BusinessPartnerService(
val updatedData = businessPartnerMappings.toBusinessPartnerInput(request, sharingState)
val existingInput = existingInputsByExternalId[request.externalId]

sharingStateService.setInitial(sharingState)
upsertFromEntity(existingInput, updatedData).takeIf { it.hadChanges }?.businessPartner

upsertFromEntity(existingInput, updatedData)
.takeIf { it.hadChanges }
?.also { sharingStateService.setInitial(sharingState) }
?.businessPartner
}

return updatedEntities.map(businessPartnerMappings::toBusinessPartnerInputDto)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ class OrchestratorMappings(
) {
private val logger = KotlinLogging.logger { }

fun toCreateRequest(entity: BusinessPartnerDb): TaskCreateRequestEntry{
return TaskCreateRequestEntry(
recordId = entity.sharingState.orchestratorRecordId?.toString(),
businessPartner = toOrchestratorDto(entity)
)
}

fun toOrchestratorDto(entity: BusinessPartnerDb): BusinessPartner {
val postalAddress = toPostalAddress(entity)

Expand Down Expand Up @@ -134,7 +141,7 @@ class OrchestratorMappings(
deliveryServiceNumber
)
}
} ?: AlternativeAddress.empty,
},
hasChanged = null
)
}
Expand Down
Loading