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(api): #176 Remove Admin Level 2 - 4 from alternative address #195

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import io.swagger.v3.oas.annotations.media.Schema

@Schema(name = "AddressIdentifier", description = "Identifier record for a logistic address")
data class AddressIdentifierDto(
@Schema(description = "Value of the identifier")
@get:Schema(description = "Value of the identifier")
val value: String,

@Schema(description = "Technical key of the type to which this identifier belongs to")
@get:Schema(description = "Technical key of the type to which this identifier belongs to")
val type: String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ import java.time.LocalDateTime

@Schema(name = "AddressState", description = "Status record for a address")
data class AddressStateDto(
@Schema(description = "Description of the status")
@get:Schema(description = "Description of the status")
val description: String?,

@Schema(description = "Since when the status is/was valid")
@get:Schema(description = "Since when the status is/was valid")
val validFrom: LocalDateTime?,

@Schema(description = "Until the status was valid, if applicable")
@get:Schema(description = "Until the status was valid, if applicable")
val validTo: LocalDateTime?,

@Schema(description = "The type of this specified status")
@get:Schema(description = "The type of this specified status")
val type: BusinessStateType
)
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ import org.eclipse.tractusx.bpdm.common.model.CharacterSet

@Schema(name = "AddressVersion", description = "Localization record for an address")
data class AddressVersionDto(
@Schema(description = "Character set in which the address is written", defaultValue = "UNDEFINED")

@get:Schema(description = "Character set in which the address is written", defaultValue = "UNDEFINED")
val characterSet: CharacterSet = CharacterSet.UNDEFINED,
@Schema(description = "Language in which the address is written", defaultValue = "undefined")

@get:Schema(description = "Language in which the address is written", defaultValue = "undefined")
val language: LanguageCode = LanguageCode.undefined
)
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@ import org.eclipse.tractusx.bpdm.common.service.DataClassUnwrappedJsonDeserializ
@Schema(name = "AlternativePostalAddress", description = "Alternative Postal Address Part")
data class AlternativePostalAddressDto(

@field:JsonUnwrapped
val baseAddress: BasePostalAddressDto,

@field:JsonUnwrapped
val areaPart: AreaDistrictAlternativDto,

@get:Schema(description = "Describes the PO Box or private Bag number the delivery should be placed at.")
val deliveryServiceNumber: String = "",

@get:Schema(description = "The type of this specified delivery")
val deliveryServiceType: DeliveryServiceType = DeliveryServiceType.PO_BOX,

@field:JsonUnwrapped
val baseAddress: BasePostalAddressDto,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*******************************************************************************
* Copyright (c) 2021,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.bpdm.common.dto

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

@Schema(name = "AreaDistrictDto", description = "Record for administrativeAreaLevel and district part of an alternativ address")
data class AreaDistrictAlternativDto(

@get:Schema(description = "Identifying code of the Region within the country (e.g. Bayern)")
val administrativeAreaLevel1: String? = null,

@get:Schema(description = "Divides the city in several smaller areas")
val districtLevel1: String? = null,

@get:Schema(description = "Divides the DistrictLevel1 in several smaller areas. Synonym: Subdistrict")
val districtLevel2: String? = null,

)
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*******************************************************************************
* Copyright (c) 2021,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.bpdm.common.dto

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

@Schema(name = "AreaDistrictDto", description = "Record for administrativeAreaLevel and district part of an address")
data class AreaDistrictDto(

@get:Schema(description = "Identifying code of the Region within the country (e.g. Bayern)")
val administrativeAreaLevel1: String? = null,

@get:Schema(description = "Further possibility to describe the region/address(e.g. County/Landkreis)")
val administrativeAreaLevel2: String? = null,

@get:Schema(description = "Further possibility to describe the region/address(e.g. Township/Gemeinde)")
val administrativeAreaLevel3: String? = null,

@get:Schema(description = "Divides the city in several smaller areas")
val districtLevel1: String? = null,

@get:Schema(description = "Divides the DistrictLevel1 in several smaller areas. Synonym: Subdistrict")
val districtLevel2: String? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,12 @@ data class BasePostalAddressDto(
@get:Schema(description = "Describes the country")
val country: CountryCode,

@get:Schema(description = "Identifying code of the Region within the country (e.g. Bayern)")
val administrativeAreaLevel1: String? = null,

@get:Schema(description = "Further possibility to describe the region/address(e.g. County/Landkreis)")
val administrativeAreaLevel2: String? = null,

@get:Schema(description = "Further possibility to describe the region/address(e.g. Township/Gemeinde)")
val administrativeAreaLevel3: String? = null,

@get:Schema(description = "A postal code, also known as postcode, PIN or ZIP Code")
val postCode: String? = null,

@get:Schema(description = "The city of the address (Synonym: Town, village, municipality)")
val city: String,

@get:Schema(description = "Divides the city in several smaller areas")
val districtLevel1: String? = null,

@get:Schema(description = "Divides the DistrictLevel1 in several smaller areas. Synonym: Subdistrict")
val districtLevel2: String? = null,


@get:Schema(description = "Address country")
val street: StreetDto? = null,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ import org.eclipse.tractusx.bpdm.common.model.ClassificationType

@Schema(name = "Classification", description = "Classification record for a business partner")
data class ClassificationDto(
@Schema(description = "Name of the classification")
@get:Schema(description = "Name of the classification")
val value: String?,

@Schema(description = "Identifying code of the classification, if applicable")
@get:Schema(description = "Identifying code of the classification, if applicable")
val code: String?,

@Schema(description = "Type of specified classification")
@get:Schema(description = "Type of specified classification")
val type: ClassificationType
)
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ import io.swagger.v3.oas.annotations.media.Schema
@Schema(name = "FieldQualityRuleDto", description = "Rule for the quality level of an entity field ")
data class FieldQualityRuleDto(

@Schema(description = "Path to the field")
@get:Schema(description = "Path to the field")
val fieldPath: String,

@Schema(description = "Schema name of the entity the field belongs to")
@get:Schema(description = "Schema name of the entity the field belongs to")
val schemaName: String?,

@Schema(description = "Country for wich the rule is valid")
@get:Schema(description = "Country for wich the rule is valid")
val country: CountryCode,

@Schema(description = "Quality level of the field")
@get:Schema(description = "Quality level of the field")
val qualityLevel: QualityLevel
)
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import io.swagger.v3.oas.annotations.media.Schema

@Schema(name = "GenericIdentifier", description = "Identifier record for a generic business partner")
data class GenericIdentifierDto(
@Schema(description = "Value of the identifier")
@get:Schema(description = "Value of the identifier")
val value: String,

@Schema(description = "Technical key of the type to which this identifier belongs to")
@get:Schema(description = "Technical key of the type to which this identifier belongs to")
val type: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ import io.swagger.v3.oas.annotations.media.Schema

@Schema(name = "GeoCoordinates", description = "Geo coordinates record for an address")
data class GeoCoordinateDto(
@Schema(description = "Longitude coordinate")

@get:Schema(description = "Longitude coordinate")
val longitude: Float,
@Schema(description = "Latitude coordinate")

@get:Schema(description = "Latitude coordinate")
val latitude: Float,
@Schema(description = "Altitude, if applicable")

@get:Schema(description = "Altitude, if applicable")
val altitude: Float? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ data class PhysicalPostalAddressDto(
@field:JsonUnwrapped
val baseAddress: BasePostalAddressDto,

@field:JsonUnwrapped
val areaPart: AreaDistrictDto,

@get:Schema(description = "A separate postal code for a company, also known as postcode, PIN or ZIP Code")
val companyPostCode: String? = null,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,18 @@ object SaasMappings {
building = map.building(),
floor = map.floor(),
door = map.door(),
baseAddress = BasePostalAddressDto(
geographicCoordinates = map.geoCoordinates(),
city = city,
country = country,
areaPart = AreaDistrictDto(
administrativeAreaLevel1 = map.adminAreaLevel1(),
administrativeAreaLevel2 = map.adminAreaLevel2(),
administrativeAreaLevel3 = null,
postCode = map.postcode(),
districtLevel1 = map.districtLevel1(),
districtLevel2 = map.districtLevel2(),
),
baseAddress = BasePostalAddressDto(
geographicCoordinates = map.geoCoordinates(),
city = city,
country = country,
postCode = map.postcode(),
street = toStreetDto(map),
)
)
Expand All @@ -251,16 +253,16 @@ object SaasMappings {
return AlternativePostalAddressDto(
deliveryServiceNumber = deliveryServiceNumber,
deliveryServiceType = deliveryServiceType,
areaPart = AreaDistrictAlternativDto(
administrativeAreaLevel1 = map.adminAreaLevel1(),
districtLevel1 = map.districtLevel1(),
districtLevel2 = map.districtLevel2(),
),
baseAddress = BasePostalAddressDto(
geographicCoordinates = map.geoCoordinates(),
city = city,
country = country,
administrativeAreaLevel1 = map.adminAreaLevel1(),
administrativeAreaLevel2 = map.adminAreaLevel2(),
administrativeAreaLevel3 = null,
postCode = map.postcode(),
districtLevel1 = map.districtLevel1(),
districtLevel2 = map.districtLevel2(),
street = toStreetDto(map),
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,10 @@ fun AlternativePostalAddressDto.toAlternativePostalAddressEntity(): AlternativeP
geographicCoordinates = baseAddress.geographicCoordinates?.toGeographicCoordinateEntity(),
country = baseAddress.country,
administrativeAreaLevel1 = null, // TODO Add region mapping Logic
administrativeAreaLevel2 = baseAddress.administrativeAreaLevel2,
administrativeAreaLevel3 = baseAddress.administrativeAreaLevel3,
postCode = baseAddress.postCode,
city = baseAddress.city,
districtLevel1 = baseAddress.districtLevel1,
districtLevel2 = baseAddress.districtLevel2,
districtLevel1 = areaPart.districtLevel1,
districtLevel2 = areaPart.districtLevel2,
street = baseAddress.street?.toStreetEntity(),
deliveryServiceType = deliveryServiceType,
deliveryServiceNumber = deliveryServiceNumber
Expand All @@ -82,12 +80,12 @@ fun PhysicalPostalAddressDto.toPhysicalPostalAddressEntity(): PhysicalPostalAddr
geographicCoordinates = baseAddress.geographicCoordinates?.toGeographicCoordinateEntity(),
country = baseAddress.country,
administrativeAreaLevel1 = null, // TODO Add region mapping Logic
administrativeAreaLevel2 = baseAddress.administrativeAreaLevel2,
administrativeAreaLevel3 = baseAddress.administrativeAreaLevel3,
administrativeAreaLevel2 = areaPart.administrativeAreaLevel2,
administrativeAreaLevel3 = areaPart.administrativeAreaLevel3,
postCode = baseAddress.postCode,
city = baseAddress.city,
districtLevel1 = baseAddress.districtLevel1,
districtLevel2 = baseAddress.districtLevel2,
districtLevel1 = areaPart.districtLevel1,
districtLevel2 = areaPart.districtLevel2,
street = baseAddress.street?.toStreetEntity(),
companyPostCode = companyPostCode,
industrialZone = industrialZone,
Expand Down
Loading