Skip to content

Commit

Permalink
Merge pull request #303 from catenax-ng/fix/persistence_gate_pool_ent…
Browse files Browse the repository at this point in the history
…ity_changes

Fix - Removal of unused fields on Pool and Gate Entities and addition of Delivery Service Qualifier
  • Loading branch information
nicoprow authored Jun 26, 2023
2 parents f141875 + 264bdb5 commit 971769a
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -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?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ object SaasMappings {
return AlternativePostalAddressDto(
deliveryServiceNumber = deliveryServiceNumber,
deliveryServiceType = deliveryServiceType,
deliveryServiceQualifier = null,
areaPart = AreaDistrictAlternativDto(
administrativeAreaLevel1 = map.adminAreaLevel1()
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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
*/
Expand All @@ -98,4 +65,7 @@ class AlternativePostalAddress(
*/
@Column(name = "alt_delivery_service_number")
val deliveryServiceNumber: String = "",

@Column(name = "alt_delivery_service_qualifier")
val deliveryServiceQualifier: String?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ fun AlternativePostalAddressDto.toAlternativePostalAddressEntity(): AlternativeP
postCode = baseAddress.postalCode,
city = baseAddress.city,
deliveryServiceType = deliveryServiceType,
deliveryServiceNumber = deliveryServiceNumber
deliveryServiceNumber = deliveryServiceNumber,
deliveryServiceQualifier = deliveryServiceQualifier
)

}
Expand Down Expand Up @@ -287,6 +288,7 @@ fun AlternativePostalAddress.toAlternativePostalAddressDto(): AlternativePostalA
return AlternativePostalAddressDto(
deliveryServiceType = deliveryServiceType,
deliveryServiceNumber = deliveryServiceNumber,
deliveryServiceQualifier = deliveryServiceQualifier,
areaPart = areaDistrictAlternativDto,
baseAddress = basePostalAddressDto
)
Expand Down
Original file line number Diff line number Diff line change
@@ -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);

Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ class AlternativePostalAddressToSaasMapping(private val postalAdress: Alternativ

(postalAdress.administrativeAreaLevel1)?.let {
postalAdress.administrativeAreaLevel1.regionCode
},
postalAdress.administrativeAreaLevel2
}
)
}

Expand All @@ -63,20 +62,14 @@ class AlternativePostalAddressToSaasMapping(private val postalAdress: Alternativ

return listOfNotNull(

postalAdress.city,
postalAdress.districtLevel1,
postalAdress.districtLevel2
postalAdress.city
)
}

override fun thoroughfares(): Collection<String> {

return listOfNotNull(

postalAdress.street?.name,
postalAdress.street?.houseNumber,
postalAdress.street?.milestone,
postalAdress.street?.direction,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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
*/
Expand All @@ -105,4 +66,7 @@ class AlternativePostalAddress(
*/
@Column(name = "alt_delivery_service_number")
val deliveryServiceNumber: String = "",

@Column(name = "alt_delivery_service_qualifier")
val deliveryServiceQualifier: String?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,8 @@ class BusinessPartnerBuildService(
postCode = baseAddress.postalCode,
city = baseAddress.city,
deliveryServiceType = alternativeAddress.deliveryServiceType,
deliveryServiceNumber = alternativeAddress.deliveryServiceNumber
deliveryServiceNumber = alternativeAddress.deliveryServiceNumber,
deliveryServiceQualifier = alternativeAddress.deliveryServiceQualifier
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ fun AlternativePostalAddress.toDto(): AlternativePostalAddressResponse {
administrativeAreaLevel1 = administrativeAreaLevel1?.let { NameRegioncodeDto(it.regionName, it.regionCode) },
),
type = deliveryServiceType,
deliveryServiceNumber = deliveryServiceNumber
deliveryServiceNumber = deliveryServiceNumber,
deliveryServiceQualifier = deliveryServiceQualifier
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit 971769a

Please sign in to comment.