From cccb5dbc3c97cbe64b07d5edd51186dcb16e5dfd Mon Sep 17 00:00:00 2001 From: rschneider <97682836+rainer-exxcellent@users.noreply.github.com> Date: Thu, 25 May 2023 09:16:06 +0200 Subject: [PATCH] feat(api): #177 API: Physical Address Merge District Level 1 & 2 #176 Remove Admin Level 2 - 4 from alternative address response object add @get:Schema to Response objects --- .../bpdm/common/dto/AreaDistrictDto.kt | 5 +- .../dto/response/AddressIdentifierResponse.kt | 4 +- .../dto/response/AddressStateResponse.kt | 8 +- .../AlternativePostalAddressResponse.kt | 13 +- ...e.kt => AreaDistrictAlternativResponse.kt} | 16 +- .../dto/response/AreaDistrictResponse.kt | 39 ++++ .../dto/response/BasePostalAddressResponse.kt | 21 +-- .../dto/response/ClassificationResponse.kt | 6 +- .../response/LegalEntityIdentifierResponse.kt | 6 +- .../dto/response/LegalEntityResponse.kt | 12 +- .../dto/response/LegalEntityStateResponse.kt | 8 +- .../common/dto/response/LegalFormResponse.kt | 6 +- .../dto/response/LogisticAddressResponse.kt | 4 +- .../bpdm/common/dto/response/NameResponse.kt | 6 +- .../bpdm/common/dto/response/PageResponse.kt | 10 +- .../response/PhysicalPostalAddressResponse.kt | 15 +- .../common/dto/response/RelationResponse.kt | 12 +- .../bpdm/common/dto/response/SiteResponse.kt | 10 +- .../common/dto/response/SiteStateResponse.kt | 8 +- .../common/service/SaasAddressToDtoMapping.kt | 4 +- .../bpdm/common/service/SaasMappings.kt | 3 +- .../bpdm/gate/service/ResponseMappings.kt | 3 +- .../service/SaasDtoToSaasAddressMapping.kt | 7 +- .../SaasDtoToSaasAddressMappingTest.kt | 9 +- .../tractusx/bpdm/gate/util/CommonValues.kt | 10 +- .../tractusx/bpdm/gate/util/RequestValues.kt | 6 +- .../tractusx/bpdm/gate/util/ResponseValues.kt | 33 ++-- .../tractusx/bpdm/gate/util/SaasValues.kt | 38 ++-- .../service/BusinessPartnerBuildService.kt | 3 +- .../bpdm/pool/service/ResponseMappings.kt | 19 +- .../service/SaasAddressToDtoMappingTest.kt | 11 +- .../pool/controller/SuggestionControllerIT.kt | 7 +- .../tractusx/bpdm/pool/util/CommonValues.kt | 14 +- .../tractusx/bpdm/pool/util/RequestValues.kt | 12 +- .../tractusx/bpdm/pool/util/ResponseValues.kt | 95 +++++----- .../tractusx/bpdm/pool/util/SaasValues.kt | 176 +++++++++--------- 36 files changed, 341 insertions(+), 318 deletions(-) rename bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/{AddressBpnResponse.kt => AreaDistrictAlternativResponse.kt} (63%) create mode 100644 bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/AreaDistrictResponse.kt diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/AreaDistrictDto.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/AreaDistrictDto.kt index 779539b0c..d8a3665f0 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/AreaDistrictDto.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/AreaDistrictDto.kt @@ -34,8 +34,5 @@ data class AreaDistrictDto( 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, + val district: String? = null, ) diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/AddressIdentifierResponse.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/AddressIdentifierResponse.kt index 3f2d71e0a..b65f9f0d3 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/AddressIdentifierResponse.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/AddressIdentifierResponse.kt @@ -24,9 +24,9 @@ import org.eclipse.tractusx.bpdm.common.dto.response.type.TypeKeyNameDto @Schema(name = "IdentifierResponse", description = "Identifier record of a logistic address") data class AddressIdentifierResponse( - @Schema(description = "Value of the identifier") + @get:Schema(description = "Value of the identifier") val value: String, - @Schema(description = "Type of the identifier") + @get:Schema(description = "Type of the identifier") val type: TypeKeyNameDto, ) \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/AddressStateResponse.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/AddressStateResponse.kt index a983f9e5a..c82658504 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/AddressStateResponse.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/AddressStateResponse.kt @@ -26,15 +26,15 @@ import java.time.LocalDateTime @Schema(name = "AddressStateResponse", description = "Status record of a legal entity") data class AddressStateResponse( - @Schema(description = "Exact, official denotation of the status") + @get:Schema(description = "Exact, official denotation of the status") val officialDenotation: 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 status") + @get:Schema(description = "The type of this status") val type: TypeKeyNameDto ) \ No newline at end of file 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 a35e2ab1b..334359ca7 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 @@ -29,12 +29,15 @@ import org.eclipse.tractusx.bpdm.common.service.DataClassUnwrappedJsonDeserializ @Schema(name = "AlternativePostalAddress", description = "Alternative Postal Address Part") data class AlternativePostalAddressResponse( - @Schema(description = "Describes the PO Box or private Bag number the delivery should be placed at.") + @field:JsonUnwrapped + val baseAddress: BasePostalAddressResponse, + + @field:JsonUnwrapped + val areaPart: AreaDistrictAlternativResponse, + + @get:Schema(description = "Describes the PO Box or private Bag number the delivery should be placed at.") val deliveryServiceNumber: String = "", - @Schema(description = "The type of this specified delivery") + @get:Schema(description = "The type of this specified delivery") val type: DeliveryServiceType = DeliveryServiceType.PO_BOX, - - @field:JsonUnwrapped - val baseAddress: BasePostalAddressResponse, ) diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/AddressBpnResponse.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/AreaDistrictAlternativResponse.kt similarity index 63% rename from bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/AddressBpnResponse.kt rename to bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/AreaDistrictAlternativResponse.kt index 405f0dca4..ab8c00143 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/AddressBpnResponse.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/AreaDistrictAlternativResponse.kt @@ -19,16 +19,12 @@ package org.eclipse.tractusx.bpdm.common.dto.response -import com.fasterxml.jackson.annotation.JsonUnwrapped -import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.swagger.v3.oas.annotations.media.Schema -import org.eclipse.tractusx.bpdm.common.service.DataClassUnwrappedJsonDeserializer +import org.eclipse.tractusx.bpdm.common.dto.NameRegioncodeDto -@JsonDeserialize(using = DataClassUnwrappedJsonDeserializer::class) -@Schema(name = "AddressBpnResponse", description = "Localized address record of a business partner") -data class AddressBpnResponse( - @Schema(description = "Business Partner Number, main identifier value for addresses") - val bpn: String, - @field:JsonUnwrapped - val address: BasePostalAddressResponse +@Schema(name = "AreaDistrictDto", description = "Record for administrativeAreaLevel and district part of an alternativ address") +data class AreaDistrictAlternativResponse( + + @get:Schema(description = "Region within the country") + val administrativeAreaLevel1: NameRegioncodeDto? = null, ) diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/AreaDistrictResponse.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/AreaDistrictResponse.kt new file mode 100644 index 000000000..8294db0a3 --- /dev/null +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/AreaDistrictResponse.kt @@ -0,0 +1,39 @@ +/******************************************************************************* + * 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.response + +import io.swagger.v3.oas.annotations.media.Schema +import org.eclipse.tractusx.bpdm.common.dto.NameRegioncodeDto + +@Schema(name = "AreaDistrictDto", description = "Record for administrativeAreaLevel and district part of an address") +data class AreaDistrictResponse( + + @get:Schema(description = "Region within the country") + val administrativeAreaLevel1: NameRegioncodeDto? = 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 district: String? = null, +) diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/BasePostalAddressResponse.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/BasePostalAddressResponse.kt index 8f6f7e75b..2eebfc054 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/BasePostalAddressResponse.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/BasePostalAddressResponse.kt @@ -22,11 +22,10 @@ package org.eclipse.tractusx.bpdm.common.dto.response import com.neovisionaries.i18n.CountryCode import io.swagger.v3.oas.annotations.media.Schema import org.eclipse.tractusx.bpdm.common.dto.GeoCoordinateDto -import org.eclipse.tractusx.bpdm.common.dto.NameRegioncodeDto import org.eclipse.tractusx.bpdm.common.dto.StreetDto import org.eclipse.tractusx.bpdm.common.dto.response.type.TypeKeyNameDto -@Schema(name = "PostalAddressResponse", description = "Aaddress record of a business partner") +@Schema(name = "PostalAddressResponse", description = "Address record of a business partner") data class BasePostalAddressResponse( @get:Schema(description = "Geographic coordinates to find this location") @@ -35,28 +34,12 @@ data class BasePostalAddressResponse( @get:Schema(description = "Describes the full name of the country") val country: TypeKeyNameDto, - @get:Schema(description = "Region within the country") - val administrativeAreaLevel1: NameRegioncodeDto? = null, - - @get:Schema(description = "Further possibility to describe the region/address(e.g. County)") - val administrativeAreaLevel2: String? = null, - - @get:Schema(description = "Further possibility to describe the region/address(e.g. Township)") - 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 = "Street") val street: StreetDto? = null, - - ) \ No newline at end of file +) \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/ClassificationResponse.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/ClassificationResponse.kt index 8d3b4b6b0..7882112f8 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/ClassificationResponse.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/ClassificationResponse.kt @@ -25,12 +25,12 @@ import org.eclipse.tractusx.bpdm.common.model.ClassificationType @Schema(name = "ClassificationResponse", description = "Classification record of a business partner") data class ClassificationResponse( - @Schema(description = "Name of the classification") + @get:Schema(description = "Name of the classification") val value: String? = null, - @Schema(description = "Identifying code of the classification, if applicable") + @get:Schema(description = "Identifying code of the classification, if applicable") val code: String? = null, - @Schema(description = "Type of specified classification") + @get:Schema(description = "Type of specified classification") val type: TypeKeyNameDto ) \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/LegalEntityIdentifierResponse.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/LegalEntityIdentifierResponse.kt index a98436afa..ec17a3378 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/LegalEntityIdentifierResponse.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/LegalEntityIdentifierResponse.kt @@ -24,12 +24,12 @@ import org.eclipse.tractusx.bpdm.common.dto.response.type.TypeKeyNameDto @Schema(name = "LegalEntityIdentifierResponse", description = "Identifier record of a legal entity") data class LegalEntityIdentifierResponse( - @Schema(description = "Value of the identifier") + @get:Schema(description = "Value of the identifier") val value: String, - @Schema(description = "Type of the identifier") + @get:Schema(description = "Type of the identifier") val type: TypeKeyNameDto, - @Schema(description = "Body which issued the identifier") + @get:Schema(description = "Body which issued the identifier") val issuingBody: String? = null ) \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/LegalEntityResponse.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/LegalEntityResponse.kt index 7feeee605..6d8218bf6 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/LegalEntityResponse.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/LegalEntityResponse.kt @@ -26,16 +26,16 @@ import java.time.Instant // TODO probably rename to LegalEntityDetailedDto @Schema(name = "LegalEntityResponse", description = "Legal entity record") data class LegalEntityResponse( - @Schema(description = "Business Partner Number of this legal entity") + @get:Schema(description = "Business Partner Number of this legal entity") val bpn: String, @ArraySchema(arraySchema = Schema(description = "All identifiers of the business partner, including BPN information")) val identifiers: Collection = emptyList(), - @Schema(description = "Legal name the partner goes by") + @get:Schema(description = "Legal name the partner goes by") val legalName: NameResponse, - @Schema(description = "Legal form of the business partner") + @get:Schema(description = "Legal form of the business partner") val legalForm: LegalFormResponse? = null, @ArraySchema(arraySchema = Schema(description = "Business status")) @@ -47,12 +47,12 @@ data class LegalEntityResponse( @ArraySchema(arraySchema = Schema(description = "Relations to other business partners")) val relations: Collection = emptyList(), - @Schema(description = "The timestamp the business partner data was last indicated to be still current") + @get:Schema(description = "The timestamp the business partner data was last indicated to be still current") val currentness: Instant, - @Schema(description = "The timestamp the business partner data was created") + @get:Schema(description = "The timestamp the business partner data was created") val createdAt: Instant, - @Schema(description = "The timestamp the business partner data was last updated") + @get:Schema(description = "The timestamp the business partner data was last updated") val updatedAt: Instant ) diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/LegalEntityStateResponse.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/LegalEntityStateResponse.kt index 23cf4275d..d8a4f74d3 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/LegalEntityStateResponse.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/LegalEntityStateResponse.kt @@ -26,15 +26,15 @@ import java.time.LocalDateTime @Schema(name = "LegalEntityStateResponse", description = "Status record of a legal entity") data class LegalEntityStateResponse( - @Schema(description = "Exact, official denotation of the status") + @get:Schema(description = "Exact, official denotation of the status") val officialDenotation: 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 status") + @get:Schema(description = "The type of this status") val type: TypeKeyNameDto ) \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/LegalFormResponse.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/LegalFormResponse.kt index b37382a4b..a55bbb171 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/LegalFormResponse.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/LegalFormResponse.kt @@ -23,12 +23,12 @@ import io.swagger.v3.oas.annotations.media.Schema @Schema(name = "LegalFormResponse", description = "Legal form a business partner can have") data class LegalFormResponse( - @Schema(description = "Unique key to be used for reference") + @get:Schema(description = "Unique key to be used for reference") val technicalKey: String, - @Schema(description = "Full name of the legal form") + @get:Schema(description = "Full name of the legal form") val name: String, - @Schema(description = "Abbreviation of the legal form name") + @get:Schema(description = "Abbreviation of the legal form name") val abbreviation: String? = null, ) \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/LogisticAddressResponse.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/LogisticAddressResponse.kt index 2f8949715..51c6d402e 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/LogisticAddressResponse.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/LogisticAddressResponse.kt @@ -42,10 +42,10 @@ data class LogisticAddressResponse( @ArraySchema(arraySchema = Schema(description = "All identifiers of the Address")) val identifiers: Collection = emptyList(), - @Schema(description = "Physical postal address") + @get:Schema(description = "Physical postal address") val physicalPostalAddress: PhysicalPostalAddressResponse, - @Schema(description = "Alternative postal address") + @get:Schema(description = "Alternative postal address") val alternativePostalAddress: AlternativePostalAddressResponse? = null, @get:Schema(description = "BPN of the related legal entity, if available") diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/NameResponse.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/NameResponse.kt index fe5c7b671..a2555b56f 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/NameResponse.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/NameResponse.kt @@ -22,10 +22,10 @@ package org.eclipse.tractusx.bpdm.common.dto.response import io.swagger.v3.oas.annotations.media.Schema @Schema(name = "NameResponse", description = "Name record of a business partner") -data class NameResponse ( - @Schema(description = "Full name") +data class NameResponse( + @get:Schema(description = "Full name") val value: String, - @Schema(description = "Abbreviated name or shorthand") + @get:Schema(description = "Abbreviated name or shorthand") val shortName: String? = null ) \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/PageResponse.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/PageResponse.kt index f88643ed7..7d951b96a 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/PageResponse.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/PageResponse.kt @@ -23,14 +23,14 @@ import io.swagger.v3.oas.annotations.media.Schema @Schema(description = "Paginated collection of results") data class PageResponse( - @Schema(description = "Total number of all results in all pages") + @get:Schema(description = "Total number of all results in all pages") val totalElements: Long, - @Schema(description = "Total number pages") + @get:Schema(description = "Total number pages") val totalPages: Int, - @Schema(description = "Current page number") + @get:Schema(description = "Current page number") val page: Int, - @Schema(description = "Number of results in the page") + @get:Schema(description = "Number of results in the page") val contentSize: Int, - @Schema(description = "Collection of results in the page") + @get:Schema(description = "Collection of results in the page") val content: Collection ) \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/PhysicalPostalAddressResponse.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/PhysicalPostalAddressResponse.kt index e581e56b0..33fbccef6 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/PhysicalPostalAddressResponse.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/PhysicalPostalAddressResponse.kt @@ -26,23 +26,26 @@ import org.eclipse.tractusx.bpdm.common.service.DataClassUnwrappedJsonDeserializ @JsonDeserialize(using = DataClassUnwrappedJsonDeserializer::class) @Schema(name = "PhysicalPostalAddress", description = "Physical Postal Address Part") -data class PhysicalPostalAddressResponse ( +data class PhysicalPostalAddressResponse( @field:JsonUnwrapped val baseAddress: BasePostalAddressResponse, - @Schema(description = "A separate postal code for a company, also known as postcode, PIN or ZIP Code") + @field:JsonUnwrapped + val areaPart: AreaDistrictResponse, + + @get:Schema(description = "A separate postal code for a company, also known as postcode, PIN or ZIP Code") val companyPostCode: String? = null, - @Schema(description = "The practice of designating an area for industrial development") + @get:Schema(description = "The practice of designating an area for industrial development") val industrialZone: String? = null, - @Schema(description = "Describes a specific building within the address") + @get:Schema(description = "Describes a specific building within the address") val building: String? = null, - @Schema(description = "Describes the floor/level the delivery shall take place") + @get:Schema(description = "Describes the floor/level the delivery shall take place") val floor: String? = null, - @Schema(description = "Describes the door/room/suite on the respective floor the delivery shall take place") + @get:Schema(description = "Describes the door/room/suite on the respective floor the delivery shall take place") val door: String? = null, ) diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/RelationResponse.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/RelationResponse.kt index 49ddb5ebf..21b93806d 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/RelationResponse.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/RelationResponse.kt @@ -25,19 +25,19 @@ import org.eclipse.tractusx.bpdm.common.model.RelationType import java.time.LocalDateTime @Schema(name = "RelationResponse", description = "Directed relation between two business partners") -data class RelationResponse ( - @Schema(description = "Type of relation like predecessor or ownership relation") +data class RelationResponse( + @get:Schema(description = "Type of relation like predecessor or ownership relation") val type: TypeKeyNameDto, - @Schema(description = "BPN of partner which is the source of the relation") + @get:Schema(description = "BPN of partner which is the source of the relation") val startBpn: String, - @Schema(description = "BPN of partner which is the target of the relation") + @get:Schema(description = "BPN of partner which is the target of the relation") val endBpn: String, - @Schema(description = "Time when the relation started") + @get:Schema(description = "Time when the relation started") val validFrom: LocalDateTime? = null, - @Schema(description = "Time when the relation ended") + @get:Schema(description = "Time when the relation ended") val validTo: LocalDateTime? = null ) \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/SiteResponse.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/SiteResponse.kt index f41eb6ee2..c43d6284f 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/SiteResponse.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/SiteResponse.kt @@ -25,21 +25,21 @@ import java.time.Instant @Schema(name = "SiteResponse", description = "Site of a legal entity") data class SiteResponse( - @Schema(description = "Business Partner Number, main identifier value for sites") + @get:Schema(description = "Business Partner Number, main identifier value for sites") val bpn: String, - @Schema(description = "Site name") + @get:Schema(description = "Site name") val name: String, @ArraySchema(arraySchema = Schema(description = "Business status")) val states: Collection = emptyList(), - @Schema(description = "Business Partner Number of the related legal entity") + @get:Schema(description = "Business Partner Number of the related legal entity") val bpnLegalEntity: String, - @Schema(description = "The timestamp the business partner data was created") + @get:Schema(description = "The timestamp the business partner data was created") val createdAt: Instant, - @Schema(description = "The timestamp the business partner data was last updated") + @get:Schema(description = "The timestamp the business partner data was last updated") val updatedAt: Instant ) \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/SiteStateResponse.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/SiteStateResponse.kt index 928b17221..1393e3175 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/SiteStateResponse.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/SiteStateResponse.kt @@ -26,15 +26,15 @@ import java.time.LocalDateTime @Schema(name = "SiteStateResponse", description = "Status record of a site") data class SiteStateResponse( - @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 status") + @get:Schema(description = "The type of this status") val type: TypeKeyNameDto ) \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasAddressToDtoMapping.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasAddressToDtoMapping.kt index ba4d96cd1..a9003411e 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasAddressToDtoMapping.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasAddressToDtoMapping.kt @@ -64,12 +64,12 @@ class SaasAddressToDtoMapping(private val address: AddressSaas) { return locality?.value } - fun districtLevel1(): String? { + fun district(): String? { val locality = findType(address.localities, SaasLocalityType.DISTRICT) return locality?.value } - fun districtLevel2(): String? { + fun quarter(): String? { val locality = findType(address.localities, SaasLocalityType.QUARTER) return locality?.value } 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 cd3439830..dc3232022 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 @@ -221,8 +221,7 @@ object SaasMappings { administrativeAreaLevel1 = map.adminAreaLevel1(), administrativeAreaLevel2 = map.adminAreaLevel2(), administrativeAreaLevel3 = null, - districtLevel1 = map.districtLevel1(), - districtLevel2 = map.districtLevel2(), + district = map.district(), ), baseAddress = BasePostalAddressDto( geographicCoordinates = map.geoCoordinates(), 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 9209e4cd4..5874694ec 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 @@ -82,8 +82,7 @@ fun PhysicalPostalAddressDto.toPhysicalPostalAddressEntity(): PhysicalPostalAddr administrativeAreaLevel3 = areaPart.administrativeAreaLevel3, postCode = baseAddress.postCode, city = baseAddress.city, - districtLevel1 = areaPart.districtLevel1, - districtLevel2 = areaPart.districtLevel2, + districtLevel1 = areaPart.district, street = baseAddress.street?.toStreetEntity(), companyPostCode = companyPostCode, industrialZone = industrialZone, diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SaasDtoToSaasAddressMapping.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SaasDtoToSaasAddressMapping.kt index ebd49b834..fc2bc625e 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SaasDtoToSaasAddressMapping.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SaasDtoToSaasAddressMapping.kt @@ -99,16 +99,11 @@ class SaasDtoToSaasAddressMapping(private val postalAdress: BasePostalAddressDto LocalitySaas( value = postalAdress.city, type = SaasLocalityType.CITY.toSaasTypeDto() ), - physicalAddress?.areaPart?.districtLevel1?.let { + physicalAddress?.areaPart?.district?.let { LocalitySaas( value = it, type = SaasLocalityType.DISTRICT.toSaasTypeDto() ) }, - physicalAddress?.areaPart?.districtLevel2?.let { - LocalitySaas( - value = it, type = SaasLocalityType.QUARTER.toSaasTypeDto() - ) - } ) } diff --git a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/service/SaasDtoToSaasAddressMappingTest.kt b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/service/SaasDtoToSaasAddressMappingTest.kt index 0f684431f..fbee43383 100644 --- a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/service/SaasDtoToSaasAddressMappingTest.kt +++ b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/service/SaasDtoToSaasAddressMappingTest.kt @@ -26,8 +26,7 @@ class SaasDtoToSaasAddressMappingTest { assertThat(areaPart.administrativeAreaLevel3).isEqualTo(null) assertThat(baseAddressDto.city).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.CITY)) assertThat(baseAddressDto.country).isEqualTo(addressSaas.country?.shortName) - assertThat(areaPart.districtLevel1).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.DISTRICT)) - assertThat(areaPart.districtLevel2).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.QUARTER)) + assertThat(areaPart.district).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.DISTRICT)) assertThat(baseAddressDto.geographicCoordinates?.latitude).isEqualTo(addressSaas.geographicCoordinates?.latitude) assertThat(baseAddressDto.geographicCoordinates?.longitude).isEqualTo(addressSaas.geographicCoordinates?.longitude) assertThat(baseAddressDto.postCode).isEqualTo(findValue(addressSaas.postCodes, SaasPostCodeType.REGULAR)) @@ -71,8 +70,7 @@ class SaasDtoToSaasAddressMappingTest { assertThat(areaPart.administrativeAreaLevel3).isEqualTo(null) assertThat(baseAddressDto.city).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.CITY)) assertThat(baseAddressDto.country).isEqualTo(addressSaas.country?.shortName) - assertThat(areaPart.districtLevel1).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.DISTRICT)) - assertThat(areaPart.districtLevel2).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.QUARTER)) + assertThat(areaPart.district).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.DISTRICT)) assertThat(baseAddressDto.geographicCoordinates?.latitude).isEqualTo(addressSaas.geographicCoordinates?.latitude) assertThat(baseAddressDto.geographicCoordinates?.longitude).isEqualTo(addressSaas.geographicCoordinates?.longitude) assertThat(baseAddressDto.postCode).isEqualTo(findValue(addressSaas.postCodes, SaasPostCodeType.REGULAR)) @@ -100,8 +98,7 @@ class SaasDtoToSaasAddressMappingTest { assertThat(areaPart.administrativeAreaLevel3).isEqualTo(null) assertThat(baseAddressDto.city).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.CITY)) assertThat(baseAddressDto.country).isEqualTo(addressSaas.country?.shortName) - assertThat(areaPart.districtLevel1).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.DISTRICT)) - assertThat(areaPart.districtLevel2).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.QUARTER)) + assertThat(areaPart.district).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.DISTRICT)) assertThat(baseAddressDto.geographicCoordinates?.latitude).isEqualTo(addressSaas.geographicCoordinates?.latitude) assertThat(baseAddressDto.geographicCoordinates?.longitude).isEqualTo(addressSaas.geographicCoordinates?.longitude) assertThat(baseAddressDto.postCode).isEqualTo(findValue(addressSaas.postCodes, SaasPostCodeType.REGULAR)) diff --git a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/CommonValues.kt b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/CommonValues.kt index 6425b84fb..26ba7c8fb 100644 --- a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/CommonValues.kt +++ b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/CommonValues.kt @@ -198,13 +198,9 @@ object CommonValues { const val city2 = "Atlanta" - const val districtLevel1_1 = "Vaihingen" - const val districtLevel1_2 = "TODO" - const val districtLevel1_3= "TODO" - - const val districtLevel2_1 = "Vaihingen-Level2" - const val districtLevel2_2 = "TODO" - const val districtLevel2_3 = "TODO" + const val district1 = "Vaihingen" + const val district2 = "TODO" + const val district3 = "TODO" const val street1 = "Mercedesstraße" const val street2 = "TODO" 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 f13dd6d8f..8966d5670 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 @@ -125,8 +125,7 @@ object RequestValues { areaPart = AreaDistrictDto( administrativeAreaLevel1 = CommonValues.adminAreaLevel1RegionCode_1, administrativeAreaLevel2 = CommonValues.county1, - districtLevel1 = CommonValues.districtLevel1_1, - districtLevel2 = CommonValues.districtLevel2_1, + district = CommonValues.district1, ), baseAddress = BasePostalAddressDto( geographicCoordinates = geoCoordinate1, @@ -145,8 +144,7 @@ object RequestValues { areaPart = AreaDistrictDto( administrativeAreaLevel1 = CommonValues.adminAreaLevel1RegionCode_2, administrativeAreaLevel2 = CommonValues.county2, - districtLevel1 = CommonValues.districtLevel1_2, - districtLevel2 = CommonValues.districtLevel2_2, + district = CommonValues.district2, ), baseAddress = BasePostalAddressDto( geographicCoordinates = geoCoordinate2, 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 370f0991a..17b12f9a4 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 @@ -169,15 +169,16 @@ object ResponseValues { building = CommonValues.building1, floor = CommonValues.floor1, door = CommonValues.door1, + areaPart = AreaDistrictResponse( + administrativeAreaLevel1 = CommonValues.adminAreaLevel1Region1, + administrativeAreaLevel2 = CommonValues.county1, + district = CommonValues.district1, + ), baseAddress = BasePostalAddressResponse( geographicCoordinates = geoCoordinate1, country = country1, - administrativeAreaLevel1 = CommonValues.adminAreaLevel1Region1, - administrativeAreaLevel2 = CommonValues.county1, postCode = CommonValues.postCode1, city = CommonValues.city1, - districtLevel1 = CommonValues.districtLevel1_1, - districtLevel2 = CommonValues.districtLevel2_1, street = StreetDto(CommonValues.street1, CommonValues.houseNumber1), ) ) @@ -187,15 +188,16 @@ object ResponseValues { building = CommonValues.building2, floor = CommonValues.floor2, door = CommonValues.door2, + areaPart = AreaDistrictResponse( + administrativeAreaLevel1 = CommonValues.adminAreaLevel1Region2, + administrativeAreaLevel2 = CommonValues.county2, + district = CommonValues.district2, + ), baseAddress = BasePostalAddressResponse( geographicCoordinates = geoCoordinate2, country = country2, - administrativeAreaLevel1 = CommonValues.adminAreaLevel1Region2, - administrativeAreaLevel2 = CommonValues.county2, postCode = CommonValues.postCode2, city = CommonValues.city2, - districtLevel1 = CommonValues.districtLevel1_2, - districtLevel2 = CommonValues.districtLevel2_2, street = StreetDto(CommonValues.street2, CommonValues.houseNumber2), ) ) @@ -315,8 +317,10 @@ object ResponseValues { val addressGateInputResponse1 = AddressGateInputResponse( address = RequestValues.address1 - .copy(name = CommonValues.name1, - identifiers = listOf(AddressIdentifierDto(SaasValues.identifier1.value!!, SaasValues.identifier1.type?.technicalKey!!), + .copy( + name = CommonValues.name1, + identifiers = listOf( + AddressIdentifierDto(SaasValues.identifier1.value!!, SaasValues.identifier1.type?.technicalKey!!), AddressIdentifierDto(SaasValues.identifier2.value!!, SaasValues.identifier2.type?.technicalKey!!) ) ), @@ -328,11 +332,14 @@ object ResponseValues { val addressGateInputResponse2 = AddressGateInputResponse( address = RequestValues.address2 - .copy(name = CommonValues.nameSite1, - identifiers = listOf(AddressIdentifierDto(SaasValues.identifier1.value!!, SaasValues.identifier1.type?.technicalKey!!), + .copy( + name = CommonValues.nameSite1, + identifiers = listOf( + AddressIdentifierDto(SaasValues.identifier1.value!!, SaasValues.identifier1.type?.technicalKey!!), AddressIdentifierDto(SaasValues.identifier2.value!!, SaasValues.identifier2.type?.technicalKey!!) ) - ), externalId = CommonValues.externalIdAddress2, + ), + externalId = CommonValues.externalIdAddress2, siteExternalId = CommonValues.externalIdSite1, bpn = CommonValues.bpnAddress2, processStartedAt = SaasValues.modificationTime2, diff --git a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/SaasValues.kt b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/SaasValues.kt index 1a32ebaa7..4c60bbf78 100644 --- a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/SaasValues.kt +++ b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/SaasValues.kt @@ -284,19 +284,21 @@ object SaasValues { private val postCodeRegular2 = PostCodeSaas(CommonValues.postCode2, SaasPostCodeType.REGULAR) private val localityCity1 = LocalitySaas(CommonValues.city1, SaasLocalityType.CITY, language1) - private val localityDistrict1 = LocalitySaas(CommonValues.districtLevel1_1, SaasLocalityType.DISTRICT, language1) - private val localityQuarter1 = LocalitySaas(CommonValues.districtLevel2_1, SaasLocalityType.QUARTER, language1) + private val localityDistrict1 = LocalitySaas(CommonValues.district1, SaasLocalityType.DISTRICT, language1) + private val localityQuarter1 = LocalitySaas("Quarter1", SaasLocalityType.QUARTER, language1) - private val localityCity2 = LocalitySaas(CommonValues.city2, SaasLocalityType.CITY, language2) - private val localityDistrict2 = LocalitySaas(CommonValues.districtLevel1_2, SaasLocalityType.DISTRICT, language2) - private val localityQuarter2 = LocalitySaas(CommonValues.districtLevel2_2, SaasLocalityType.QUARTER, language2) + private val localityCity2 = LocalitySaas(CommonValues.city2, SaasLocalityType.CITY, language2) + private val localityDistrict2 = LocalitySaas(CommonValues.district2, SaasLocalityType.DISTRICT, language2) + private val localityQuarter2 = LocalitySaas("Quarter2", SaasLocalityType.QUARTER, language2) private val thoroughfareZone1 = ThoroughfareSaas(name = CommonValues.industrialZone1, saasType = INDUSTRIAL_ZONE, language = language1) - private val thoroughfareStreet1 = ThoroughfareSaas(name = CommonValues.street1, direction = CommonValues.direction1 - , number = CommonValues.houseNumber1, saasType = STREET, language = language1) + private val thoroughfareStreet1 = ThoroughfareSaas( + name = CommonValues.street1, direction = CommonValues.direction1, number = CommonValues.houseNumber1, saasType = STREET, language = language1 + ) private val thoroughfareZone2 = ThoroughfareSaas(name = CommonValues.industrialZone2, saasType = INDUSTRIAL_ZONE, language = language2) - private val thoroughfareStreet2 = ThoroughfareSaas(name = CommonValues.street2, direction = CommonValues.direction2 - , number = CommonValues.houseNumber2, saasType = STREET, language = language2) + private val thoroughfareStreet2 = ThoroughfareSaas( + name = CommonValues.street2, direction = CommonValues.direction2, number = CommonValues.houseNumber2, saasType = STREET, language = language2 + ) private val premiseBuilding1 = PremiseSaas(CommonValues.building1, SaasPremiseType.BUILDING, language1) @@ -380,8 +382,12 @@ object SaasValues { ) val siteBusinessPartner1 = BusinessPartnerSaas( - status = BusinessPartnerStatusSaas(type = TypeKeyNameUrlSaas(CommonValues.businessStateType1.name), - validFrom = CommonValues.businessStatusValidFrom1, validUntil = CommonValues.businessStatusValidUntil1, officialDenotation = CommonValues.businessStatusOfficialDenotation1), + status = BusinessPartnerStatusSaas( + type = TypeKeyNameUrlSaas(CommonValues.businessStateType1.name), + validFrom = CommonValues.businessStatusValidFrom1, + validUntil = CommonValues.businessStatusValidUntil1, + officialDenotation = CommonValues.businessStatusOfficialDenotation1 + ), externalId = CommonValues.externalIdSite1, identifiers = listOf(identifierBpnSite1, identifier1, identifier2), // identifiers copied from legal entity names = listOf(nameSite1), @@ -399,8 +405,12 @@ object SaasValues { ) val siteBusinessPartner2 = BusinessPartnerSaas( - status = BusinessPartnerStatusSaas(type = TypeKeyNameUrlSaas(CommonValues.businessStateType2.name), - validFrom = CommonValues.businessStatusValidFrom2, validUntil = CommonValues.businessStatusValidUntil2, officialDenotation = CommonValues.businessStatusOfficialDenotation2), + status = BusinessPartnerStatusSaas( + type = TypeKeyNameUrlSaas(CommonValues.businessStateType2.name), + validFrom = CommonValues.businessStatusValidFrom2, + validUntil = CommonValues.businessStatusValidUntil2, + officialDenotation = CommonValues.businessStatusOfficialDenotation2 + ), externalId = CommonValues.externalIdSite2, identifiers = listOf(identifierBpnSite2, identifier3, identifier4), // identifiers copied from legal entity names = listOf(nameSite2), @@ -470,7 +480,7 @@ object SaasValues { lastModifiedAt = modificationTime1, metadata = BusinessPartnerMetadataSaas( sharingStatus = SharingStatusSaas(SharingStatusType.SHARED_WITH_CONFIDENT_MATCH, "OK") - ), + ), ) val addressBusinessPartnerRequest1 = addressBusinessPartner1.copy( 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 27764e710..9728b8d75 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 @@ -434,8 +434,7 @@ class BusinessPartnerBuildService( administrativeAreaLevel3 = area.administrativeAreaLevel3, postCode = baseAddress.postCode, city = baseAddress.city, - districtLevel1 = area.districtLevel1, - districtLevel2 = area.districtLevel2, + districtLevel1 = area.district, street = baseAddress.street?.let { createStreet(it) }, companyPostCode = physicalAddress.companyPostCode, industrialZone = physicalAddress.industrialZone, 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 5265d0967..fda64d160 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 @@ -151,15 +151,16 @@ fun PhysicalPostalAddress.toDto(): PhysicalPostalAddressResponse { baseAddress = BasePostalAddressResponse( geographicCoordinates = geographicCoordinates?.toDto(), country = country.toDto(), - administrativeAreaLevel1 = administrativeAreaLevel1?.let { NameRegioncodeDto(it.regionName, it.regionCode) }, - administrativeAreaLevel2 = administrativeAreaLevel2, - administrativeAreaLevel3 = administrativeAreaLevel3, postCode = postCode, city = city, - districtLevel1 = districtLevel1, - districtLevel2 = districtLevel2, street = street?.toDto() ), + areaPart = AreaDistrictResponse( + administrativeAreaLevel1 = administrativeAreaLevel1?.let { NameRegioncodeDto(it.regionName, it.regionCode) }, + administrativeAreaLevel2 = administrativeAreaLevel2, + administrativeAreaLevel3 = administrativeAreaLevel3, + district = districtLevel1, + ), companyPostCode = companyPostCode, industrialZone = industrialZone, building = building, @@ -173,15 +174,13 @@ fun AlternativePostalAddress.toDto(): AlternativePostalAddressResponse { baseAddress = BasePostalAddressResponse( geographicCoordinates = geographicCoordinates?.toDto(), country = country.toDto(), - administrativeAreaLevel1 = administrativeAreaLevel1?.let { NameRegioncodeDto(it.regionName, it.regionCode) }, - administrativeAreaLevel2 = administrativeAreaLevel2, - administrativeAreaLevel3 = administrativeAreaLevel3, postCode = postCode, city = city, - districtLevel1 = districtLevel1, - districtLevel2 = districtLevel2, street = street?.toDto() ), + areaPart = AreaDistrictAlternativResponse( + administrativeAreaLevel1 = administrativeAreaLevel1?.let { NameRegioncodeDto(it.regionName, it.regionCode) }, + ), type = deliveryServiceType, deliveryServiceNumber = deliveryServiceNumber ) diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasAddressToDtoMappingTest.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasAddressToDtoMappingTest.kt index 058b2b21f..4fc40600a 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasAddressToDtoMappingTest.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasAddressToDtoMappingTest.kt @@ -53,13 +53,13 @@ class SaasAddressToDtoMappingTest { private fun checkMappingResponsePhysicalAddress(physicalAddressDto: PhysicalPostalAddressResponse, addressSaas: AddressSaas) { val baseAddressDto = physicalAddressDto.baseAddress + val areaDto = physicalAddressDto.areaPart //TODO Assertions.assertThat(baseAddressDto.administrativeAreaLevel1?.name).isEqualTo(findValue(addressSaas.administrativeAreas, SaasAdministrativeAreaType.REGION)) - Assertions.assertThat(baseAddressDto.administrativeAreaLevel2).isEqualTo(findValue(addressSaas.administrativeAreas, SaasAdministrativeAreaType.COUNTY)) - Assertions.assertThat(baseAddressDto.administrativeAreaLevel3).isEqualTo(null) + Assertions.assertThat(areaDto.administrativeAreaLevel2).isEqualTo(findValue(addressSaas.administrativeAreas, SaasAdministrativeAreaType.COUNTY)) + Assertions.assertThat(areaDto.administrativeAreaLevel3).isEqualTo(null) Assertions.assertThat(baseAddressDto.city).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.CITY)) Assertions.assertThat(baseAddressDto.country.technicalKey).isEqualTo(addressSaas.country?.shortName) - Assertions.assertThat(baseAddressDto.districtLevel1).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.DISTRICT)) - Assertions.assertThat(baseAddressDto.districtLevel2).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.QUARTER)) + Assertions.assertThat(areaDto.district).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.DISTRICT)) Assertions.assertThat(baseAddressDto.geographicCoordinates?.latitude).isEqualTo(addressSaas.geographicCoordinates?.latitude) Assertions.assertThat(baseAddressDto.geographicCoordinates?.longitude).isEqualTo(addressSaas.geographicCoordinates?.longitude) Assertions.assertThat(baseAddressDto.postCode).isEqualTo(findValue(addressSaas.postCodes, SaasPostCodeType.REGULAR)) @@ -83,8 +83,7 @@ class SaasAddressToDtoMappingTest { Assertions.assertThat(areaDto.administrativeAreaLevel3).isEqualTo(null) Assertions.assertThat(baseAddressDto.city).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.CITY)) Assertions.assertThat(baseAddressDto.country).isEqualTo(addressSaas.country?.shortName) - Assertions.assertThat(areaDto.districtLevel1).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.DISTRICT)) - Assertions.assertThat(areaDto.districtLevel2).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.QUARTER)) + Assertions.assertThat(areaDto.district).isEqualTo(findValue(addressSaas.localities, SaasLocalityType.DISTRICT)) Assertions.assertThat(baseAddressDto.geographicCoordinates?.latitude).isEqualTo(addressSaas.geographicCoordinates?.latitude) Assertions.assertThat(baseAddressDto.geographicCoordinates?.longitude).isEqualTo(addressSaas.geographicCoordinates?.longitude) Assertions.assertThat(baseAddressDto.postCode).isEqualTo(findValue(addressSaas.postCodes, SaasPostCodeType.REGULAR)) diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/SuggestionControllerIT.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/SuggestionControllerIT.kt index 3959ff45c..368ca3af9 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/SuggestionControllerIT.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/SuggestionControllerIT.kt @@ -112,7 +112,7 @@ class SuggestionControllerIT @Autowired constructor( expectedLegalEntityName ), Arguments.of( - expectedLegalAddress.physicalPostalAddress.baseAddress.administrativeAreaLevel2, + expectedLegalAddress.physicalPostalAddress.areaPart.administrativeAreaLevel2, EndpointValues.CATENA_SUGGESTION_ADDRESS_ADMIN_AREA_PATH, expectedLegalEntityName ), @@ -150,7 +150,10 @@ class SuggestionControllerIT @Autowired constructor( Arguments.of(nonlatinLegalEntity.legalName.value, EndpointValues.CATENA_SUGGESTION_LE_NAME_PATH), Arguments.of(nonlatinLegalEntity.legalForm!!.name, EndpointValues.CATENA_SUGGESTION_LE_LEGAL_FORM_PATH), Arguments.of(nonlatinSite.site.name, EndpointValues.CATENA_SUGGESTION_SITE_NAME_PATH), - Arguments.of(nonlatinLegalAddress.physicalPostalAddress.baseAddress.administrativeAreaLevel2, EndpointValues.CATENA_SUGGESTION_ADDRESS_ADMIN_AREA_PATH), + Arguments.of( + nonlatinLegalAddress.physicalPostalAddress.areaPart.administrativeAreaLevel2, + EndpointValues.CATENA_SUGGESTION_ADDRESS_ADMIN_AREA_PATH + ), Arguments.of(nonlatinLegalAddress.physicalPostalAddress.baseAddress.postCode, EndpointValues.CATENA_SUGGESTION_ADDRESS_POST_CODE_PATH), Arguments.of(nonlatinLegalAddress.physicalPostalAddress.baseAddress.city, EndpointValues.CATENA_SUGGESTION_ADDRESS_LOCALITY_PATH), Arguments.of(nonlatinLegalAddress.physicalPostalAddress.baseAddress.street!!.name, EndpointValues.CATENA_SUGGESTION_ADDRESS_THOROUGHFARE_PATH), diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/CommonValues.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/CommonValues.kt index e9fbb7ed9..04e3fe975 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/CommonValues.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/CommonValues.kt @@ -22,11 +22,9 @@ package org.eclipse.tractusx.bpdm.pool.util import com.neovisionaries.i18n.CountryCode import com.neovisionaries.i18n.LanguageCode import org.eclipse.tractusx.bpdm.common.dto.NameRegioncodeDto -import org.eclipse.tractusx.bpdm.common.dto.saas.ThoroughfareSaas import org.eclipse.tractusx.bpdm.common.model.BusinessStateType import org.eclipse.tractusx.bpdm.common.model.CharacterSet import org.eclipse.tractusx.bpdm.common.model.ClassificationType -import org.eclipse.tractusx.bpdm.common.model.SaasThoroughfareType import java.time.Instant import java.time.LocalDateTime import java.util.* @@ -160,14 +158,10 @@ object CommonValues { val city2 = "Atlanta" val city3 = "Atlanta" - val districtLevel1_1 = "Sindelfingen-Ost" - val districtLevel1_2 = "District Level 1" - val districtLevel1_3 = "DL 1" - - val districtLevel2_1 = "Sindelfingen-Ost-Level2" - val districtLevel2_2 = "District Level 2" - val districtLevel2_3 = "DL 2" - + val district1 = "Sindelfingen-Ost" + val district2 = "District Level 1" + val district3 = "DL 1" + val street1 = "Bela-Barenyi-Straße" val street2 = "" val street3 = "" diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/RequestValues.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/RequestValues.kt index 6d19f9622..fe863ee55 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/RequestValues.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/RequestValues.kt @@ -99,8 +99,7 @@ object RequestValues { areaPart = AreaDistrictDto( administrativeAreaLevel1 = CommonValues.adminAreaLevel1RegionCode_1, administrativeAreaLevel2 = CommonValues.county1, - districtLevel1 = CommonValues.districtLevel1_1, - districtLevel2 = CommonValues.districtLevel2_1, + district = CommonValues.district1, ), baseAddress = BasePostalAddressDto( geographicCoordinates = null, @@ -119,8 +118,7 @@ object RequestValues { areaPart = AreaDistrictDto( administrativeAreaLevel1 = CommonValues.adminAreaLevel1RegionCode_2, administrativeAreaLevel2 = CommonValues.county2, - districtLevel1 = CommonValues.districtLevel1_2, - districtLevel2 = CommonValues.districtLevel2_2, + district = CommonValues.district2, ), baseAddress = BasePostalAddressDto( geographicCoordinates = null, @@ -135,11 +133,11 @@ object RequestValues { industrialZone = CommonValues.industrialZone3, building = CommonValues.building3, floor = CommonValues.floor3, - door = CommonValues.door3, areaPart = AreaDistrictDto( + door = CommonValues.door3, + areaPart = AreaDistrictDto( administrativeAreaLevel1 = CommonValues.adminAreaLevel1RegionCode_3, administrativeAreaLevel2 = CommonValues.county3, - districtLevel1 = CommonValues.districtLevel1_3, - districtLevel2 = CommonValues.districtLevel2_3, + district = CommonValues.district3, ), baseAddress = BasePostalAddressDto( geographicCoordinates = null, diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/ResponseValues.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/ResponseValues.kt index c927525a2..49da1cef0 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/ResponseValues.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/ResponseValues.kt @@ -40,22 +40,22 @@ object ResponseValues { val language2 = TypeKeyNameDto(CommonValues.language2, CommonValues.language2.getName()) val language3 = TypeKeyNameDto(CommonValues.language3, CommonValues.language3.getName()) - val country1 = TypeKeyNameDto(CommonValues.country1, CommonValues.country1.getName()) - val country2 = TypeKeyNameDto(CommonValues.country2, CommonValues.country2.getName()) - val country3 = TypeKeyNameDto(CommonValues.country3, CommonValues.country3.getName()) - - val identifier1 = - LegalEntityIdentifierResponse(CommonValues.identifierValue1, RequestValues.identifierType1, CommonValues.issuingBody1) - val identifier2 = - LegalEntityIdentifierResponse(CommonValues.identifierValue2, RequestValues.identifierType2, CommonValues.issuingBody2) - val identifier3 = + private val country1 = TypeKeyNameDto(CommonValues.country1, CommonValues.country1.getName()) + private val country2 = TypeKeyNameDto(CommonValues.country2, CommonValues.country2.getName()) + private val country3 = TypeKeyNameDto(CommonValues.country3, CommonValues.country3.getName()) + + private val identifier1 = + LegalEntityIdentifierResponse(CommonValues.identifierValue1, RequestValues.identifierType1, CommonValues.issuingBody1) + private val identifier2 = + LegalEntityIdentifierResponse(CommonValues.identifierValue2, RequestValues.identifierType2, CommonValues.issuingBody2) + private val identifier3 = LegalEntityIdentifierResponse(CommonValues.identifierValue3, RequestValues.identifierType3, CommonValues.issuingBody3) - val name1 = NameResponse(value = CommonValues.name1) - val name2 = NameResponse(value = CommonValues.name2) - val name3 = NameResponse(value = CommonValues.name3) - val name4 = NameResponse(value = CommonValues.name4) - val name5 = NameResponse(value = CommonValues.name5) + private val name1 = NameResponse(value = CommonValues.name1) + private val name2 = NameResponse(value = CommonValues.name2) + private val name3 = NameResponse(value = CommonValues.name3) + private val name4 = NameResponse(value = CommonValues.name4) + private val name5 = NameResponse(value = CommonValues.name5) val legalForm1 = LegalFormResponse( technicalKey = CommonValues.legalFormTechnicalKey1, @@ -73,77 +73,80 @@ object ResponseValues { abbreviation = CommonValues.legalFormAbbreviation3, ) - val statusType1 = TypeKeyNameDto(CommonValues.statusType1, CommonValues.statusType1.getTypeName()) - val statusType2 = TypeKeyNameDto(CommonValues.statusType2, CommonValues.statusType2.getTypeName()) - val statusType3 = TypeKeyNameDto(CommonValues.statusType3, CommonValues.statusType3.getTypeName()) + private val statusType1 = TypeKeyNameDto(CommonValues.statusType1, CommonValues.statusType1.getTypeName()) + private val statusType2 = TypeKeyNameDto(CommonValues.statusType2, CommonValues.statusType2.getTypeName()) + private val statusType3 = TypeKeyNameDto(CommonValues.statusType3, CommonValues.statusType3.getTypeName()) - val leStatus1 = LegalEntityStateResponse(CommonValues.statusDenotation1, CommonValues.statusValidFrom1, null, statusType1) - val leStatus2 = LegalEntityStateResponse(CommonValues.statusDenotation2, CommonValues.statusValidFrom2, null, statusType2) - val leStatus3 = LegalEntityStateResponse(CommonValues.statusDenotation3, CommonValues.statusValidFrom3, null, statusType3) + private val leStatus1 = LegalEntityStateResponse(CommonValues.statusDenotation1, CommonValues.statusValidFrom1, null, statusType1) + private val leStatus2 = LegalEntityStateResponse(CommonValues.statusDenotation2, CommonValues.statusValidFrom2, null, statusType2) + private val leStatus3 = LegalEntityStateResponse(CommonValues.statusDenotation3, CommonValues.statusValidFrom3, null, statusType3) - val siteStatus1 = SiteStateResponse(CommonValues.statusDenotation1, CommonValues.statusValidFrom1, null, CommonValues.statusType1.toDto()) - val siteStatus2 = SiteStateResponse(CommonValues.statusDenotation2, CommonValues.statusValidFrom2, null, CommonValues.statusType2.toDto()) - val siteStatus3 = SiteStateResponse(CommonValues.statusDenotation3, CommonValues.statusValidFrom3, null, CommonValues.statusType3.toDto()) + private val siteStatus1 = SiteStateResponse(CommonValues.statusDenotation1, CommonValues.statusValidFrom1, null, CommonValues.statusType1.toDto()) + private val siteStatus2 = SiteStateResponse(CommonValues.statusDenotation2, CommonValues.statusValidFrom2, null, CommonValues.statusType2.toDto()) + private val siteStatus3 = SiteStateResponse(CommonValues.statusDenotation3, CommonValues.statusValidFrom3, null, CommonValues.statusType3.toDto()) - val classificationType = TypeKeyNameDto(CommonValues.classificationType, CommonValues.classificationType.name) + private val classificationType = TypeKeyNameDto(CommonValues.classificationType, CommonValues.classificationType.name) - val classification1 = ClassificationResponse(CommonValues.classification1, null, classificationType) - val classification2 = ClassificationResponse(CommonValues.classification2, null, classificationType) - val classification3 = ClassificationResponse(CommonValues.classification3, null, classificationType) - val classification4 = ClassificationResponse(CommonValues.classification4, null, classificationType) - val classification5 = ClassificationResponse(CommonValues.classification5, null, classificationType) + private val classification1 = ClassificationResponse(CommonValues.classification1, null, classificationType) + private val classification2 = ClassificationResponse(CommonValues.classification2, null, classificationType) + private val classification3 = ClassificationResponse(CommonValues.classification3, null, classificationType) + private val classification4 = ClassificationResponse(CommonValues.classification4, null, classificationType) + private val classification5 = ClassificationResponse(CommonValues.classification5, null, classificationType) - val address1 = PhysicalPostalAddressResponse( + private val address1 = PhysicalPostalAddressResponse( companyPostCode = CommonValues.postCode2, industrialZone = CommonValues.industrialZone1, building = CommonValues.building1, floor = CommonValues.floor1, door = CommonValues.door1, + areaPart = AreaDistrictResponse( + administrativeAreaLevel1 = CommonValues.adminAreaLevel1Region1, + administrativeAreaLevel2 = CommonValues.county1, + district = CommonValues.district1, + ), baseAddress = BasePostalAddressResponse( geographicCoordinates = null, country = country1, - administrativeAreaLevel1 = CommonValues.adminAreaLevel1Region1, - administrativeAreaLevel2 = CommonValues.county1, postCode = CommonValues.postCode1, city = CommonValues.city1, - districtLevel1 = CommonValues.districtLevel1_1, - districtLevel2 = CommonValues.districtLevel2_1, street = StreetDto(CommonValues.street1, CommonValues.houseNumber1), ) ) - val address2 = PhysicalPostalAddressResponse( + private val address2 = PhysicalPostalAddressResponse( industrialZone = CommonValues.industrialZone2, building = CommonValues.building2, floor = CommonValues.floor2, door = CommonValues.door2, + areaPart = AreaDistrictResponse( + administrativeAreaLevel1 = CommonValues.adminAreaLevel1Region2, + administrativeAreaLevel2 = CommonValues.county2, + district = CommonValues.district2, + ), baseAddress = BasePostalAddressResponse( geographicCoordinates = null, country = country2, - administrativeAreaLevel1 = CommonValues.adminAreaLevel1Region2, - administrativeAreaLevel2 = CommonValues.county2, postCode = CommonValues.postCode2, city = CommonValues.city2, - districtLevel1 = CommonValues.districtLevel1_2, - districtLevel2 = CommonValues.districtLevel2_2, street = StreetDto(CommonValues.street2, CommonValues.houseNumber2), ) ) - val address3 = PhysicalPostalAddressResponse( + private val address3 = PhysicalPostalAddressResponse( industrialZone = CommonValues.industrialZone3, building = CommonValues.building3, floor = CommonValues.floor3, door = CommonValues.door3, + areaPart = AreaDistrictResponse( + administrativeAreaLevel1 = CommonValues.adminAreaLevel1Region3, + administrativeAreaLevel2 = CommonValues.county3, + district = CommonValues.district3, + ), baseAddress = BasePostalAddressResponse( geographicCoordinates = null, country = country3, - administrativeAreaLevel1 = CommonValues.adminAreaLevel1Region3, - administrativeAreaLevel2 = CommonValues.county3, postCode = CommonValues.postCode3, city = CommonValues.city3, - districtLevel1 = CommonValues.districtLevel1_3, - districtLevel2 = CommonValues.districtLevel2_3, street = StreetDto(CommonValues.street3, CommonValues.houseNumber3), ) ) @@ -304,7 +307,7 @@ object ResponseValues { legalEntity = LegalEntityResponse( bpn = CommonValues.bpnL2, legalName = name3, - identifiers = listOf( LegalEntityIdentifierResponse(CommonValues.identifierValue2, RequestValues.identifierType2, CommonValues.issuingBody2)), + identifiers = listOf(LegalEntityIdentifierResponse(CommonValues.identifierValue2, RequestValues.identifierType2, CommonValues.issuingBody2)), legalForm = legalForm2, states = listOf(leStatus2), classifications = listOf(classification3, classification4), @@ -323,7 +326,7 @@ object ResponseValues { legalEntity = LegalEntityResponse( bpn = CommonValues.bpnL3, legalName = name5, - identifiers = listOf(LegalEntityIdentifierResponse(CommonValues.identifierValue3, RequestValues.identifierType3, CommonValues.issuingBody3 )), + identifiers = listOf(LegalEntityIdentifierResponse(CommonValues.identifierValue3, RequestValues.identifierType3, CommonValues.issuingBody3)), legalForm = legalForm3, states = listOf(leStatus3), classifications = listOf(classification5), diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/SaasValues.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/SaasValues.kt index 8466cb2b2..3414af9c8 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/SaasValues.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/util/SaasValues.kt @@ -63,9 +63,9 @@ object SaasValues { val identifierType2 = TypeKeyNameUrlSaas(CommonValues.identifierTypeTechnicalKey2, CommonValues.identifierTypeName2) val identifierType3 = TypeKeyNameUrlSaas(CommonValues.identifierTypeTechnicalKey3, CommonValues.identifierTypeName3) - val issuingBody1 = TypeKeyNameUrlSaas(name=CommonValues.issuingBody1) - val issuingBody2 = TypeKeyNameUrlSaas(name=CommonValues.issuingBody2) - val issuingBody3 = TypeKeyNameUrlSaas(name=CommonValues.issuingBody3) + val issuingBody1 = TypeKeyNameUrlSaas(name = CommonValues.issuingBody1) + val issuingBody2 = TypeKeyNameUrlSaas(name = CommonValues.issuingBody2) + val issuingBody3 = TypeKeyNameUrlSaas(name = CommonValues.issuingBody3) val identifierStatus1 = TypeKeyNameSaas("identifierstatuskey", "identifierstatusname") @@ -222,7 +222,7 @@ object SaasValues { identifiers = listOf(identifier3), legalForm = legalForm3, status = status3, - profile = PartnerProfileSaas(classifications = listOf(classification5)), + profile = PartnerProfileSaas(classifications = listOf(classification5)), addresses = listOf(address3), types = listOf(legalEntityType) ) @@ -349,16 +349,16 @@ object SaasValues { ) private val thoroughfareZone1 = ThoroughfareSaas(name = CommonValues.industrialZone1, saasType = SaasThoroughfareType.INDUSTRIAL_ZONE, language = language1) - private val thoroughfareStreet1 = ThoroughfareSaas(name = CommonValues.street1, direction = null - , number = CommonValues.houseNumber1, saasType = SaasThoroughfareType.STREET, language = language1 + private val thoroughfareStreet1 = ThoroughfareSaas( + name = CommonValues.street1, direction = null, number = CommonValues.houseNumber1, saasType = SaasThoroughfareType.STREET, language = language1 ) private val thoroughfareZone2 = ThoroughfareSaas(name = CommonValues.industrialZone2, saasType = SaasThoroughfareType.INDUSTRIAL_ZONE, language = language2) - private val thoroughfareStreet2 = ThoroughfareSaas(name = CommonValues.street2, direction = null - , number = CommonValues.houseNumber2, saasType = SaasThoroughfareType.STREET, language = language2 + private val thoroughfareStreet2 = ThoroughfareSaas( + name = CommonValues.street2, direction = null, number = CommonValues.houseNumber2, saasType = SaasThoroughfareType.STREET, language = language2 ) private val thoroughfareZone3 = ThoroughfareSaas(name = CommonValues.industrialZone3, saasType = SaasThoroughfareType.INDUSTRIAL_ZONE, language = language3) - private val thoroughfareStreet3 = ThoroughfareSaas(name = CommonValues.street3, direction = null - , number = CommonValues.houseNumber3, saasType = SaasThoroughfareType.STREET, language = language3 + private val thoroughfareStreet3 = ThoroughfareSaas( + name = CommonValues.street3, direction = null, number = CommonValues.houseNumber3, saasType = SaasThoroughfareType.STREET, language = language3 ) @@ -368,31 +368,33 @@ object SaasValues { lastModifiedAt = createdTime1, externalId = partnerId7, dataSource = datasource1, - addresses = listOf( AddressSaas( - id = addressId1, - externalId = addressId1, - saasId = addressId1, - country = CountrySaas(CommonValues.country1, CommonValues.country1.getName()), - administrativeAreas = listOf( - AdministrativeAreaSaas(CommonValues.adminArea1, SaasAdministrativeAreaType.REGION, language1), - AdministrativeAreaSaas(CommonValues.county1, SaasAdministrativeAreaType.COUNTY, language1) - ), - postCodes = listOf(PostCodeSaas(CommonValues.postCode1, SaasPostCodeType.REGULAR)), - localities = listOf( - city1, LocalitySaas(CommonValues.districtLevel1_1, SaasLocalityType.DISTRICT, language1), - LocalitySaas(CommonValues.districtLevel2_1, SaasLocalityType.QUARTER, language1) - ), - thoroughfares = listOf(thoroughfareZone1, thoroughfareStreet1), - premises = listOf( - PremiseSaas(CommonValues.building1, SaasPremiseType.BUILDING, language1), - PremiseSaas(CommonValues.door1, SaasPremiseType.ROOM, language1), - PremiseSaas(CommonValues.floor1, SaasPremiseType.LEVEL, language1) - ), - postalDeliveryPoints = listOf( - PostalDeliveryPointSaas(value = CommonValues.postalDeliveryPoint1), PostalDeliveryPointSaas(value = CommonValues.postalDeliveryPoint2) - ), - types = listOf(SaasAddressType.LEGAL.toSaasTypeDto()), - )), + addresses = listOf( + AddressSaas( + id = addressId1, + externalId = addressId1, + saasId = addressId1, + country = CountrySaas(CommonValues.country1, CommonValues.country1.getName()), + administrativeAreas = listOf( + AdministrativeAreaSaas(CommonValues.adminArea1, SaasAdministrativeAreaType.REGION, language1), + AdministrativeAreaSaas(CommonValues.county1, SaasAdministrativeAreaType.COUNTY, language1) + ), + postCodes = listOf(PostCodeSaas(CommonValues.postCode1, SaasPostCodeType.REGULAR)), + localities = listOf( + city1, LocalitySaas(CommonValues.district1, SaasLocalityType.DISTRICT, language1), + LocalitySaas("Quarter1", SaasLocalityType.QUARTER, language1) + ), + thoroughfares = listOf(thoroughfareZone1, thoroughfareStreet1), + premises = listOf( + PremiseSaas(CommonValues.building1, SaasPremiseType.BUILDING, language1), + PremiseSaas(CommonValues.door1, SaasPremiseType.ROOM, language1), + PremiseSaas(CommonValues.floor1, SaasPremiseType.LEVEL, language1) + ), + postalDeliveryPoints = listOf( + PostalDeliveryPointSaas(value = CommonValues.postalDeliveryPoint1), PostalDeliveryPointSaas(value = CommonValues.postalDeliveryPoint2) + ), + types = listOf(SaasAddressType.LEGAL.toSaasTypeDto()), + ) + ), types = listOf(addressType), relations = listOf( RelationSaas( @@ -411,32 +413,34 @@ object SaasValues { lastModifiedAt = createdTime1, externalId = partnerId8, dataSource = datasource1, - addresses = listOf(AddressSaas( - id = addressId2, - externalId = addressId2, - saasId = addressId2, - country = CountrySaas(CommonValues.country2, CommonValues.country2.getName()), - administrativeAreas = listOf( - AdministrativeAreaSaas(CommonValues.adminArea2, SaasAdministrativeAreaType.REGION, language2), - AdministrativeAreaSaas(CommonValues.county2, SaasAdministrativeAreaType.COUNTY, language2) - ), - postCodes = listOf(PostCodeSaas(CommonValues.postCode2, SaasPostCodeType.REGULAR)), - localities = listOf( - city2, - LocalitySaas(CommonValues.districtLevel1_2, SaasLocalityType.DISTRICT, language1), - LocalitySaas(CommonValues.districtLevel2_2, SaasLocalityType.QUARTER, language1) - ), - thoroughfares = listOf(thoroughfareZone2, thoroughfareStreet2), - premises = listOf( - PremiseSaas(CommonValues.building2, SaasPremiseType.BUILDING, language2), - PremiseSaas(CommonValues.door2, SaasPremiseType.ROOM, language2), - PremiseSaas(CommonValues.floor2, SaasPremiseType.LEVEL, language2) - ), - postalDeliveryPoints = listOf( - PostalDeliveryPointSaas(value = CommonValues.postalDeliveryPoint3), PostalDeliveryPointSaas(value = CommonValues.postalDeliveryPoint4) - ), - types = listOf(SaasAddressType.LEGAL.toSaasTypeDto()), - )), + addresses = listOf( + AddressSaas( + id = addressId2, + externalId = addressId2, + saasId = addressId2, + country = CountrySaas(CommonValues.country2, CommonValues.country2.getName()), + administrativeAreas = listOf( + AdministrativeAreaSaas(CommonValues.adminArea2, SaasAdministrativeAreaType.REGION, language2), + AdministrativeAreaSaas(CommonValues.county2, SaasAdministrativeAreaType.COUNTY, language2) + ), + postCodes = listOf(PostCodeSaas(CommonValues.postCode2, SaasPostCodeType.REGULAR)), + localities = listOf( + city2, + LocalitySaas(CommonValues.district2, SaasLocalityType.DISTRICT, language1), + LocalitySaas("Quarter2", SaasLocalityType.QUARTER, language1) + ), + thoroughfares = listOf(thoroughfareZone2, thoroughfareStreet2), + premises = listOf( + PremiseSaas(CommonValues.building2, SaasPremiseType.BUILDING, language2), + PremiseSaas(CommonValues.door2, SaasPremiseType.ROOM, language2), + PremiseSaas(CommonValues.floor2, SaasPremiseType.LEVEL, language2) + ), + postalDeliveryPoints = listOf( + PostalDeliveryPointSaas(value = CommonValues.postalDeliveryPoint3), PostalDeliveryPointSaas(value = CommonValues.postalDeliveryPoint4) + ), + types = listOf(SaasAddressType.LEGAL.toSaasTypeDto()), + ) + ), types = listOf(addressType), relations = listOf( RelationSaas( @@ -455,30 +459,32 @@ object SaasValues { lastModifiedAt = createdTime1, externalId = partnerId9, dataSource = datasource1, - addresses = listOf(AddressSaas( - id = addressId3, - externalId = addressId3, - saasId = addressId3, - country = CountrySaas(CommonValues.country3, CommonValues.country3.getName()), - administrativeAreas = listOf( - AdministrativeAreaSaas(CommonValues.adminArea3, SaasAdministrativeAreaType.REGION, language3), - AdministrativeAreaSaas(CommonValues.county3, SaasAdministrativeAreaType.COUNTY, language3) - ), - postCodes = listOf(PostCodeSaas(CommonValues.postCode3, SaasPostCodeType.REGULAR)), - localities = listOf( - city3, - LocalitySaas(CommonValues.districtLevel1_3, SaasLocalityType.DISTRICT, language1), - LocalitySaas(CommonValues.districtLevel2_3, SaasLocalityType.QUARTER, language1) - ), - thoroughfares = listOf(thoroughfareZone3, thoroughfareStreet3), - premises = listOf( - PremiseSaas(CommonValues.building3, SaasPremiseType.BUILDING, language2), - PremiseSaas(CommonValues.door3, SaasPremiseType.ROOM, language2), - PremiseSaas(CommonValues.floor3, SaasPremiseType.LEVEL, language2) - ), - postalDeliveryPoints = listOf(PostalDeliveryPointSaas(value = CommonValues.postalDeliveryPoint5)), - types = listOf(SaasAddressType.LEGAL.toSaasTypeDto()), - )), + addresses = listOf( + AddressSaas( + id = addressId3, + externalId = addressId3, + saasId = addressId3, + country = CountrySaas(CommonValues.country3, CommonValues.country3.getName()), + administrativeAreas = listOf( + AdministrativeAreaSaas(CommonValues.adminArea3, SaasAdministrativeAreaType.REGION, language3), + AdministrativeAreaSaas(CommonValues.county3, SaasAdministrativeAreaType.COUNTY, language3) + ), + postCodes = listOf(PostCodeSaas(CommonValues.postCode3, SaasPostCodeType.REGULAR)), + localities = listOf( + city3, + LocalitySaas(CommonValues.district3, SaasLocalityType.DISTRICT, language1), + LocalitySaas("Quarter3", SaasLocalityType.QUARTER, language1) + ), + thoroughfares = listOf(thoroughfareZone3, thoroughfareStreet3), + premises = listOf( + PremiseSaas(CommonValues.building3, SaasPremiseType.BUILDING, language2), + PremiseSaas(CommonValues.door3, SaasPremiseType.ROOM, language2), + PremiseSaas(CommonValues.floor3, SaasPremiseType.LEVEL, language2) + ), + postalDeliveryPoints = listOf(PostalDeliveryPointSaas(value = CommonValues.postalDeliveryPoint5)), + types = listOf(SaasAddressType.LEGAL.toSaasTypeDto()), + ) + ), types = listOf(addressType), relations = listOf( RelationSaas(