diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/AddressGateInputRequest.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/AddressGateInputRequest.kt index dc6b54920..845edc629 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/AddressGateInputRequest.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/AddressGateInputRequest.kt @@ -42,6 +42,4 @@ data class AddressGateInputRequest( @Schema(description = "External id of the related site") val siteExternalId: String? = null, - @Schema(description = "Business Partner Number") - val bpn: String? = null ) diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/AddressGateInputResponse.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/AddressGateInputResponse.kt index d7642a7eb..c5b15f6b0 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/AddressGateInputResponse.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/AddressGateInputResponse.kt @@ -44,9 +44,6 @@ data class AddressGateInputResponse( @Schema(description = "External id of the related site") val siteExternalId: String? = null, - @Schema(description = "Business Partner Number") - val bpn: String? = null, - @Schema(description = "Time the sharing process was started according to SaaS") val processStartedAt: LocalDateTime? = null, ) diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateInputRequest.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateInputRequest.kt index 1c7ec2bd6..a82785af0 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateInputRequest.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateInputRequest.kt @@ -39,6 +39,4 @@ data class LegalEntityGateInputRequest( @Schema(description = "ID the record has in the external system where the record originates from", required = true) val externalId: String, - @Schema(description = "Business Partner Number") - val bpn: String?, ) diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateInputResponse.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateInputResponse.kt index 74b0abf43..fd8667a02 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateInputResponse.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateInputResponse.kt @@ -41,9 +41,6 @@ data class LegalEntityGateInputResponse( @Schema(description = "ID the record has in the external system where the record originates from", required = true) val externalId: String, - @Schema(description = "Business Partner Number") - val bpn: String?, - @Schema(description = "Time the sharing process was started according to SaaS") val processStartedAt: LocalDateTime? = null, ) diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/SiteGateInputRequest.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/SiteGateInputRequest.kt index b42937a30..3701ab3cd 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/SiteGateInputRequest.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/SiteGateInputRequest.kt @@ -38,6 +38,4 @@ data class SiteGateInputRequest( @Schema(description = "External id of the related legal entity") val legalEntityExternalId: String, - @Schema(description = "Business Partner Number") - val bpn: String?, ) diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/SiteGateInputResponse.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/SiteGateInputResponse.kt index 7732cc602..16e5cd6fa 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/SiteGateInputResponse.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/SiteGateInputResponse.kt @@ -39,9 +39,6 @@ data class SiteGateInputResponse( @Schema(description = "External id of the related legal entity") val legalEntityExternalId: String, - @Schema(description = "Business Partner Number") - val bpn: String?, - @Schema(description = "Time the sharing process was started according to SaaS") val processStartedAt: LocalDateTime? = null, ) diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/LegalEntity.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/LegalEntity.kt index e22dfba33..f5cb24bb0 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/LegalEntity.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/LegalEntity.kt @@ -30,7 +30,7 @@ import java.time.Instant ) class LegalEntity( @Column(name = "bpn") - var bpn: String?, + var bpn: String? = null, @Column(name = "externalId", nullable = false, unique = true) var externalId: String, diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/LogisticAddress.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/LogisticAddress.kt index d20c80e27..38e5f09e4 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/LogisticAddress.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/LogisticAddress.kt @@ -32,7 +32,7 @@ import org.eclipse.tractusx.bpdm.common.model.BaseEntity ) class LogisticAddress( @Column(name = "bpn") - var bpn: String?, + var bpn: String? = null, @Column(name = "external_id", nullable = false, unique = true) var externalId: String, diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/Site.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/Site.kt index 4baf5df32..791f345c2 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/Site.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/Site.kt @@ -26,7 +26,7 @@ import org.eclipse.tractusx.bpdm.common.model.BaseEntity @Table(name = "sites") class Site( @Column(name = "bpn") - var bpn: String?, + var bpn: String? = null, @Column(name = "name", nullable = false) var name: String, diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/AddressPersistenceService.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/AddressPersistenceService.kt index 563e3e4f0..5e491a22f 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/AddressPersistenceService.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/AddressPersistenceService.kt @@ -67,7 +67,6 @@ class AddressPersistenceService( private fun updateAddress(address: LogisticAddress, changeAddress: AddressGateInputRequest, legalEntityRecord: LegalEntity?, siteRecord: Site?) { address.name = changeAddress.address.name - address.bpn = changeAddress.bpn address.externalId = changeAddress.externalId address.legalEntity = legalEntityRecord address.site = siteRecord diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/LegalEntityPersistenceService.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/LegalEntityPersistenceService.kt index 59ea7c114..153c27351 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/LegalEntityPersistenceService.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/LegalEntityPersistenceService.kt @@ -67,7 +67,6 @@ class LegalEntityPersistenceService( legalEntityRequest: LegalEntityGateInputRequest, logisticAddressRecord: LogisticAddress ): LegalEntity { - legalEntity.bpn = legalEntityRequest.bpn legalEntity.externalId = legalEntityRequest.externalId legalEntity.legalForm = legalEntityRequest.legalEntity.legalForm legalEntity.legalName = Name(value = legalEntityRequest.legalNameParts[0], shortName = legalEntityRequest.legalEntity.legalShortName) @@ -82,7 +81,6 @@ class LegalEntityPersistenceService( private fun updateAddress(address: LogisticAddress, changeAddress: LogisticAddress) { address.name = changeAddress.name - address.bpn = changeAddress.bpn address.externalId = changeAddress.externalId address.legalEntity = changeAddress.legalEntity address.siteExternalId = changeAddress.siteExternalId diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/LegalEntityService.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/LegalEntityService.kt index 876ff9cc5..69398cc1a 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/LegalEntityService.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/LegalEntityService.kt @@ -162,7 +162,6 @@ private fun toValidSingleLegalEntity(legalEntity: LegalEntity): LegalEntityGateI return LegalEntityGateInputResponse( legalEntity = legalEntity.toLegalEntityDto(), legalAddress = legalEntity.legalAddress.toLogisticAddressDto(), - bpn = legalEntity.bpn, externalId = legalEntity.externalId ) } \ No newline at end of file diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt index 4b237c4da..5dfc57076 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt @@ -31,7 +31,6 @@ import java.time.temporal.ChronoUnit fun AddressGateInputRequest.toAddressGate(legalEntity: LegalEntity?, site: Site?): LogisticAddress { val logisticAddress = LogisticAddress( - bpn = bpn, externalId = externalId, siteExternalId = siteExternalId.toString(), name = address.name, @@ -117,10 +116,9 @@ fun SiteGateInputRequest.toSiteGate(legalEntity: LegalEntity): Site { ) val site = Site( - bpn = bpn, name = site.name, externalId = externalId, - legalEntity = legalEntity + legalEntity = legalEntity, ) site.states.addAll(this.site.states.map { toEntityAddress(it, site) }.toSet()) @@ -150,7 +148,6 @@ fun LegalEntityGateInputRequest.toLegalEntity(): LegalEntity { ) val legalEntity = LegalEntity( - bpn = bpn, externalId = externalId, currentness = createCurrentnessTimestamp(), legalForm = legalEntity.legalForm, @@ -198,7 +195,6 @@ fun LogisticAddress.toAddressGateInputResponse(logisticAddressPage: LogisticAddr externalId = externalId, legalEntityExternalId = legalEntity?.externalId, siteExternalId = site?.externalId, - bpn = bpn, processStartedAt = null //TODO Remove ? ) @@ -323,7 +319,6 @@ fun LegalEntity.LegalEntityGateInputResponse(legalEntity: LegalEntity): LegalEnt legalEntity = legalEntity.toLegalEntityDto(), legalAddress = legalAddress.toLogisticAddressDto(), externalId = legalEntity.externalId, - bpn = legalEntity.bpn, processStartedAt = null ) } @@ -349,7 +344,6 @@ fun Site.toSiteGateInputResponse(sitePage: Site): SiteGateInputResponse { site = sitePage.toSiteDto(), externalId = externalId, legalEntityExternalId = legalEntity.externalId, - bpn = bpn, processStartedAt = null //TODO Remove this? ) diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SaasRequestMappingService.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SaasRequestMappingService.kt index dc17ac9a1..7d3b8c93c 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SaasRequestMappingService.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SaasRequestMappingService.kt @@ -40,7 +40,7 @@ class SaasRequestMappingService( externalId = request.externalId, dataSource = saasConfigProperties.datasource, types = listOf(TypeKeyNameUrlSaas(BusinessPartnerTypeSaas.LEGAL_ENTITY.name)), - identifiers = toLegalEntityIdentifiersSaas(legalEntity.identifiers, request.bpn), + identifiers = toLegalEntityIdentifiersSaas(legalEntity.identifiers, ""), names = toNamesSaas(request.legalNameParts[0]), // TODO Only the first state is passed to SaaS, any others are ignored status = legalEntity.states.map { it.toSaasModel() }.firstOrNull(), @@ -57,7 +57,7 @@ class SaasRequestMappingService( externalId = request.externalId, dataSource = saasConfigProperties.datasource, types = listOf(TypeKeyNameUrlSaas(BusinessPartnerTypeSaas.ORGANIZATIONAL_UNIT.name)), - identifiers = toIdentifiersSaas(request.bpn), + identifiers = toIdentifiersSaas(""), names = toNamesSaas(site.name), status = site.states.map { it.toSaasModel() }.firstOrNull(), // TODO Known issue: Name, state, BPN-A and identifiers of the main address are not transferred to SaaS yet!! @@ -72,7 +72,7 @@ class SaasRequestMappingService( externalId = request.externalId, dataSource = saasConfigProperties.datasource, types = listOf(TypeKeyNameUrlSaas(BusinessPartnerTypeSaas.BP_ADDRESS.name)), - identifiers = toAddressIdentifiersSaas(address.identifiers, request.bpn), + identifiers = toAddressIdentifiersSaas(address.identifiers, ""), names = toNamesSaas(address.name), status = address.states.map { it.toSaasModel() }.firstOrNull(), addresses = toAddressesSaasModel(address) diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SitePersistenceService.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SitePersistenceService.kt index 48ab746a6..2f8f59ea1 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SitePersistenceService.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SitePersistenceService.kt @@ -74,7 +74,6 @@ class SitePersistenceService( private fun updateSite(site: Site, updatedSite: SiteGateInputRequest, legalEntityRecord: LegalEntity) { - site.bpn = updatedSite.bpn site.name = updatedSite.site.name site.externalId = updatedSite.externalId site.legalEntity = legalEntityRecord @@ -85,7 +84,6 @@ class SitePersistenceService( private fun updateAddress(address: LogisticAddress, changeAddress: LogisticAddress) { address.name = changeAddress.name - address.bpn = changeAddress.bpn address.externalId = changeAddress.externalId address.legalEntity = changeAddress.legalEntity address.siteExternalId = changeAddress.siteExternalId diff --git a/bpdm-gate/src/main/resources/db/migration/V0_1_6_0__drop_bpn_not_null_from_legal_entity.sql b/bpdm-gate/src/main/resources/db/migration/V0_1_6_0__drop_bpn_not_null_from_legal_entity.sql new file mode 100644 index 000000000..aac72803b --- /dev/null +++ b/bpdm-gate/src/main/resources/db/migration/V0_1_6_0__drop_bpn_not_null_from_legal_entity.sql @@ -0,0 +1 @@ +ALTER TABLE bpdmgate.legal_entities ALTER COLUMN bpn DROP NOT NULL; \ No newline at end of file diff --git a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/RequestValues.kt b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/RequestValues.kt index 60515865b..27472342b 100644 --- a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/RequestValues.kt +++ b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/RequestValues.kt @@ -267,7 +267,7 @@ object RequestValues { legalAddress = address1, legalNameParts = arrayOf(CommonValues.name1), externalId = CommonValues.externalId1, - bpn = CommonValues.bpn1 + ) val legalEntityGateInputRequest2 = LegalEntityGateInputRequest( @@ -275,16 +275,16 @@ object RequestValues { legalAddress = address2, legalNameParts = arrayOf(CommonValues.name3), externalId = CommonValues.externalId2, - bpn = CommonValues.bpn2 - ) + + ) val legalEntityGateInputRequest3 = LegalEntityGateInputRequest( legalEntity = legalEntity3, legalAddress = address3, legalNameParts = arrayOf(CommonValues.name1), externalId = CommonValues.externalId3, - bpn = CommonValues.bpn3 - ) + + ) val site1 = SiteGateDto( name = CommonValues.nameSite1, @@ -302,15 +302,15 @@ object RequestValues { site = site1, externalId = CommonValues.externalIdSite1, legalEntityExternalId = CommonValues.externalId1, - bpn = CommonValues.bpnSite1 - ) + + ) val siteGateInputRequest2 = SiteGateInputRequest( site = site2, externalId = CommonValues.externalIdSite2, legalEntityExternalId = CommonValues.externalId2, - bpn = CommonValues.bpnSite2 - ) + + ) val addressGateInputRequest1 = AddressGateInputRequest( address = address1.copy( @@ -321,8 +321,8 @@ object RequestValues { ), externalId = CommonValues.externalIdAddress1, legalEntityExternalId = CommonValues.externalId1, - bpn = CommonValues.bpnAddress1 - ) + + ) val addressGateInputRequest2 = AddressGateInputRequest( address = address2.copy( @@ -333,7 +333,7 @@ object RequestValues { ), externalId = CommonValues.externalIdAddress2, siteExternalId = CommonValues.externalIdSite1, - bpn = CommonValues.bpnAddress2 - ) + + ) } \ No newline at end of file diff --git a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/ResponseValues.kt b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/ResponseValues.kt index e0c0fcf9c..26734d755 100644 --- a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/ResponseValues.kt +++ b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/ResponseValues.kt @@ -281,7 +281,6 @@ object ResponseValues { legalEntity = RequestValues.legalEntity1, legalAddress = RequestValues.address1, externalId = CommonValues.externalId1, - bpn = CommonValues.bpn1, processStartedAt = SaasValues.modificationTime1, ) @@ -289,7 +288,6 @@ object ResponseValues { legalEntity = RequestValues.legalEntity2, legalAddress = RequestValues.address2, externalId = CommonValues.externalId2, - bpn = CommonValues.bpn2, processStartedAt = SaasValues.modificationTime2, ) @@ -297,7 +295,6 @@ object ResponseValues { legalEntity = RequestValues.legalEntity3, legalAddress = RequestValues.address3, externalId = CommonValues.externalId3, - bpn = CommonValues.bpn3, processStartedAt = null, ) @@ -306,14 +303,12 @@ object ResponseValues { legalEntity = RequestValues.legalEntity1, legalAddress = RequestValues.address1, externalId = CommonValues.externalId1, - bpn = CommonValues.bpn1, processStartedAt = null ) val newLegalEntityGateInputResponse2 = LegalEntityGateInputResponse( legalEntity = RequestValues.legalEntity2, legalAddress = RequestValues.address2, externalId = CommonValues.externalId2, - bpn = CommonValues.bpn2, processStartedAt = null, ) @@ -352,7 +347,6 @@ object ResponseValues { site = RequestValues.site1, externalId = CommonValues.externalIdSite1, legalEntityExternalId = CommonValues.externalId1, - bpn = CommonValues.bpnSite1, processStartedAt = SaasValues.modificationTime1, ) @@ -360,7 +354,6 @@ object ResponseValues { site = RequestValues.site2, externalId = CommonValues.externalIdSite2, legalEntityExternalId = CommonValues.externalId2, - bpn = CommonValues.bpnSite2, processStartedAt = SaasValues.modificationTime2, ) @@ -369,7 +362,6 @@ object ResponseValues { site = RequestValues.site1, externalId = CommonValues.externalIdSite1, legalEntityExternalId = CommonValues.externalId1, - bpn = CommonValues.bpnSite1, processStartedAt = null, ) @@ -377,7 +369,6 @@ object ResponseValues { site = RequestValues.site2, externalId = CommonValues.externalIdSite2, legalEntityExternalId = CommonValues.externalId2, - bpn = CommonValues.bpnSite2, processStartedAt = null, ) @@ -404,7 +395,6 @@ object ResponseValues { ), externalId = CommonValues.externalIdAddress1, legalEntityExternalId = CommonValues.externalId1, - bpn = CommonValues.bpnAddress1, processStartedAt = SaasValues.modificationTime1, ) @@ -419,7 +409,6 @@ object ResponseValues { ), externalId = CommonValues.externalIdAddress2, siteExternalId = CommonValues.externalIdSite1, - bpn = CommonValues.bpnAddress2, processStartedAt = SaasValues.modificationTime2, ) @@ -441,7 +430,6 @@ object ResponseValues { ), externalId = CommonValues.externalIdAddress1, legalEntityExternalId = null, - bpn = CommonValues.bpnAddress1, processStartedAt = null, ) @@ -453,7 +441,6 @@ object ResponseValues { ) ), externalId = CommonValues.externalIdAddress2, - bpn = CommonValues.bpnAddress2, siteExternalId = null, processStartedAt = null, )