diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/AlternativePostalAddressDto.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/AlternativePostalAddressDto.kt index 13a333433..2ab6287ac 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/AlternativePostalAddressDto.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/AlternativePostalAddressDto.kt @@ -42,5 +42,5 @@ data class AlternativePostalAddressDto( val deliveryServiceType: DeliveryServiceType = DeliveryServiceType.PO_BOX, @get:Schema(description = "Delivery Service Qualifier") - val deliveryServiceQualifier: String = "", + val deliveryServiceQualifier: String?, ) diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/AlternativePostalAddressResponse.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/AlternativePostalAddressResponse.kt index 57b988195..eb5881fca 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/AlternativePostalAddressResponse.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/AlternativePostalAddressResponse.kt @@ -42,5 +42,5 @@ data class AlternativePostalAddressResponse( val type: DeliveryServiceType = DeliveryServiceType.PO_BOX, @get:Schema(description = "Delivery Service Qualifier") - val deliveryServiceQualifier: String = "", + val deliveryServiceQualifier: String?, ) diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasMappings.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasMappings.kt index 06f2b2c97..317fecbdf 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasMappings.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasMappings.kt @@ -245,6 +245,7 @@ object SaasMappings { return AlternativePostalAddressDto( deliveryServiceNumber = deliveryServiceNumber, deliveryServiceType = deliveryServiceType, + deliveryServiceQualifier = null, areaPart = AreaDistrictAlternativDto( administrativeAreaLevel1 = map.adminAreaLevel1() ), diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/AlternativePostalAddress.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/AlternativePostalAddress.kt index b5326fb4a..d9d6d4dea 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/AlternativePostalAddress.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/AlternativePostalAddress.kt @@ -41,18 +41,6 @@ class AlternativePostalAddress( @Column(name = "alt_admin_area_l1_region") val administrativeAreaLevel1: String? = null, - /** - * Further possibility to describe the region/address(e.g. County) - */ - @Column(name = "alt_admin_area_l2") - val administrativeAreaLevel2: String? = null, - - /** - * Further possibility to describe the region/address(e.g. Township) - */ - @Column(name = "alt_admin_area_l3") - val administrativeAreaLevel3: String? = null, - /** * A postal code, also known as postcode, PIN or ZIP Code */ @@ -65,27 +53,6 @@ class AlternativePostalAddress( @Column(name = "alt_city") val city: String, - /** - * Divides the city in several smaller areas - */ - @Column(name = "alt_district_l1") - val districtLevel1: String? = null, - - /** - * Divides the DistrictLevel1 in several smaller areas. Synonym: Subdistrict - */ - @Column(name = "alt_district_l2") - val districtLevel2: String? = null, - - @Embedded - @AttributeOverride(name = "name", column = Column(name = "alt_street_name")) - @AttributeOverride(name = "houseNumber", column = Column(name = "alt_street_number")) - @AttributeOverride(name = "milestone", column = Column(name = "alt_street_milestone")) - @AttributeOverride(name = "direction", column = Column(name = "alt_street_direction")) - val street: Street? = null, - - // specific for AlternativePostalAddress - /** * The type of this specified delivery */ @@ -98,4 +65,7 @@ class AlternativePostalAddress( */ @Column(name = "alt_delivery_service_number") val deliveryServiceNumber: String = "", + + @Column(name = "alt_delivery_service_qualifier") + val deliveryServiceQualifier: String?, ) \ 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 7763a0a01..a14b515f2 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 @@ -75,7 +75,8 @@ fun AlternativePostalAddressDto.toAlternativePostalAddressEntity(): AlternativeP postCode = baseAddress.postalCode, city = baseAddress.city, deliveryServiceType = deliveryServiceType, - deliveryServiceNumber = deliveryServiceNumber + deliveryServiceNumber = deliveryServiceNumber, + deliveryServiceQualifier = deliveryServiceQualifier ) } @@ -287,6 +288,7 @@ fun AlternativePostalAddress.toAlternativePostalAddressDto(): AlternativePostalA return AlternativePostalAddressDto( deliveryServiceType = deliveryServiceType, deliveryServiceNumber = deliveryServiceNumber, + deliveryServiceQualifier = deliveryServiceQualifier, areaPart = areaDistrictAlternativDto, baseAddress = basePostalAddressDto ) diff --git a/bpdm-gate/src/main/resources/db/migration/V4_0_0_3__removal_entity_fields.sql b/bpdm-gate/src/main/resources/db/migration/V4_0_0_3__removal_entity_fields.sql new file mode 100644 index 000000000..778c736f7 --- /dev/null +++ b/bpdm-gate/src/main/resources/db/migration/V4_0_0_3__removal_entity_fields.sql @@ -0,0 +1,14 @@ +ALTER TABLE logistic_addresses +DROP COLUMN IF EXISTS alt_district_l1, +DROP COLUMN IF EXISTS alt_district_l2, +DROP COLUMN IF EXISTS alt_admin_area_l2, +DROP COLUMN IF EXISTS alt_admin_area_l3, +DROP COLUMN IF EXISTS alt_admin_area_l4, +DROP COLUMN IF EXISTS alt_street_name, +DROP COLUMN IF EXISTS alt_street_number, +DROP COLUMN IF EXISTS alt_street_milestone, +DROP COLUMN IF EXISTS alt_street_direction; + +ALTER TABLE logistic_addresses +ADD COLUMN IF NOT EXISTS alt_delivery_service_qualifier VARCHAR(255); + diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/AlternativePostalAddressToSaasMapping.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/AlternativePostalAddressToSaasMapping.kt index b10678fa4..47a4d99ec 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/AlternativePostalAddressToSaasMapping.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/AlternativePostalAddressToSaasMapping.kt @@ -46,8 +46,7 @@ class AlternativePostalAddressToSaasMapping(private val postalAdress: Alternativ (postalAdress.administrativeAreaLevel1)?.let { postalAdress.administrativeAreaLevel1.regionCode - }, - postalAdress.administrativeAreaLevel2 + } ) } @@ -63,9 +62,7 @@ class AlternativePostalAddressToSaasMapping(private val postalAdress: Alternativ return listOfNotNull( - postalAdress.city, - postalAdress.districtLevel1, - postalAdress.districtLevel2 + postalAdress.city ) } @@ -73,10 +70,6 @@ class AlternativePostalAddressToSaasMapping(private val postalAdress: Alternativ return listOfNotNull( - postalAdress.street?.name, - postalAdress.street?.houseNumber, - postalAdress.street?.milestone, - postalAdress.street?.direction, ) } diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/entity/AlternativePostalAddress.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/entity/AlternativePostalAddress.kt index ab8ffda8e..c5237b90f 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/entity/AlternativePostalAddress.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/entity/AlternativePostalAddress.kt @@ -42,24 +42,6 @@ class AlternativePostalAddress( @JoinColumn(name = "alt_admin_area_l1_region") val administrativeAreaLevel1: Region?, - /** - * Further possibility to describe the region/address(e.g. County) - */ - @Column(name = "alt_admin_area_l2") - val administrativeAreaLevel2: String? = null, - - /** - * Further possibility to describe the region/address(e.g. Township) - */ - @Column(name = "alt_admin_area_l3") - val administrativeAreaLevel3: String? = null, - - /** - * Further possibility to describe the region/address(e.g. Sub-Province for China - */ - @Column(name = "alt_admin_area_l4") - val administrativeAreaLevel4: String? = null, - /** * A postal code, also known as postcode, PIN or ZIP Code */ @@ -72,27 +54,6 @@ class AlternativePostalAddress( @Column(name = "alt_city") val city: String, - /** - * Divides the city in several smaller areas - */ - @Column(name = "alt_district_l1") - val districtLevel1: String? = null, - - /** - * Divides the DistrictLevel1 in several smaller areas. Synonym: Subdistrict - */ - @Column(name = "alt_district_l2") - val districtLevel2: String? = null, - - @Embedded - @AttributeOverride(name = "name", column = Column(name = "alt_street_name")) - @AttributeOverride(name = "houseNumber", column = Column(name = "alt_street_number")) - @AttributeOverride(name = "milestone", column = Column(name = "alt_street_milestone")) - @AttributeOverride(name = "direction", column = Column(name = "alt_street_direction")) - val street: Street? = null, - - // specific for AlternativePostalAddress - /** * The type of this specified delivery */ @@ -105,4 +66,7 @@ class AlternativePostalAddress( */ @Column(name = "alt_delivery_service_number") val deliveryServiceNumber: String = "", + + @Column(name = "alt_delivery_service_qualifier") + val deliveryServiceQualifier: String?, ) \ No newline at end of file diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerBuildService.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerBuildService.kt index c8f88f3ec..17fd80a40 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerBuildService.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerBuildService.kt @@ -469,7 +469,8 @@ class BusinessPartnerBuildService( postCode = baseAddress.postalCode, city = baseAddress.city, deliveryServiceType = alternativeAddress.deliveryServiceType, - deliveryServiceNumber = alternativeAddress.deliveryServiceNumber + deliveryServiceNumber = alternativeAddress.deliveryServiceNumber, + deliveryServiceQualifier = alternativeAddress.deliveryServiceQualifier ) } diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/ResponseMappings.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/ResponseMappings.kt index 23869d29f..6415baf79 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/ResponseMappings.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/ResponseMappings.kt @@ -191,7 +191,8 @@ fun AlternativePostalAddress.toDto(): AlternativePostalAddressResponse { administrativeAreaLevel1 = administrativeAreaLevel1?.let { NameRegioncodeDto(it.regionName, it.regionCode) }, ), type = deliveryServiceType, - deliveryServiceNumber = deliveryServiceNumber + deliveryServiceNumber = deliveryServiceNumber, + deliveryServiceQualifier = deliveryServiceQualifier ) } diff --git a/bpdm-pool/src/main/resources/db/migration/V4_0_0_4__removal_entity_fields.sql b/bpdm-pool/src/main/resources/db/migration/V4_0_0_4__removal_entity_fields.sql new file mode 100644 index 000000000..489a0e4c1 --- /dev/null +++ b/bpdm-pool/src/main/resources/db/migration/V4_0_0_4__removal_entity_fields.sql @@ -0,0 +1,13 @@ +ALTER TABLE logistic_addresses +DROP COLUMN IF EXISTS alt_district_l1, +DROP COLUMN IF EXISTS alt_district_l2, +DROP COLUMN IF EXISTS alt_admin_area_l2, +DROP COLUMN IF EXISTS alt_admin_area_l3, +DROP COLUMN IF EXISTS alt_admin_area_l4, +DROP COLUMN IF EXISTS alt_street_name, +DROP COLUMN IF EXISTS alt_street_number, +DROP COLUMN IF EXISTS alt_street_milestone, +DROP COLUMN IF EXISTS alt_street_direction; + +ALTER TABLE logistic_addresses +ADD COLUMN IF NOT EXISTS alt_delivery_service_qualifier VARCHAR(255); \ No newline at end of file