Skip to content

Commit

Permalink
feat(api): eclipse-tractusx#177 API: Physical Address Merge District …
Browse files Browse the repository at this point in the history
…Level 1 & 2

eclipse-tractusx#176 Remove Admin Level 2 - 4 from alternative address response object
add @get:Schema to Response objects
  • Loading branch information
rainer-exxcellent committed May 25, 2023
1 parent bd5b501 commit cccb5db
Show file tree
Hide file tree
Showing 36 changed files with 341 additions and 318 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
)
Original file line number Diff line number Diff line change
Expand Up @@ -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<BusinessStateType>
)
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 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,
)
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Original file line number Diff line number Diff line change
@@ -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,
)
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -35,28 +34,12 @@ data class BasePostalAddressResponse(
@get:Schema(description = "Describes the full name of the country")
val country: TypeKeyNameDto<CountryCode>,

@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,

)
)
Original file line number Diff line number Diff line change
Expand Up @@ -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<ClassificationType>
)
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,

@Schema(description = "Body which issued the identifier")
@get:Schema(description = "Body which issued the identifier")
val issuingBody: String? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -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<LegalEntityIdentifierResponse> = 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"))
Expand All @@ -47,12 +47,12 @@ data class LegalEntityResponse(
@ArraySchema(arraySchema = Schema(description = "Relations to other business partners"))
val relations: Collection<RelationResponse> = 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
)
Original file line number Diff line number Diff line change
Expand Up @@ -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<BusinessStateType>
)
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ data class LogisticAddressResponse(
@ArraySchema(arraySchema = Schema(description = "All identifiers of the Address"))
val identifiers: Collection<AddressIdentifierResponse> = 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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ import io.swagger.v3.oas.annotations.media.Schema

@Schema(description = "Paginated collection of results")
data class PageResponse<T>(
@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<T>
)
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Original file line number Diff line number Diff line change
Expand Up @@ -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<RelationType>,

@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
)
Loading

0 comments on commit cccb5db

Please sign in to comment.