Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Use interfaces for Generic Business Partner #481

Merged
merged 4 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/

package org.eclipse.tractusx.bpdm.gate.api.model
package org.eclipse.tractusx.bpdm.common.dto

enum class AddressType {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@ data class AlternativePostalAddressDto(

override val geographicCoordinates: GeoCoordinateDto?,

@get:Schema(description = PostalAddressDescription.country)
val country: CountryCode,
override val country: CountryCode,

@get:Schema(description = PostalAddressDescription.administrativeAreaLevel1)
val administrativeAreaLevel1: String?,
override val administrativeAreaLevel1: String?,

override val postalCode: String?,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/

package org.eclipse.tractusx.bpdm.gate.api.model
package org.eclipse.tractusx.bpdm.common.dto

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/

package org.eclipse.tractusx.bpdm.gate.api.model
package org.eclipse.tractusx.bpdm.common.dto

enum class BusinessPartnerRole {
SUPPLIER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/

package org.eclipse.tractusx.bpdm.gate.api.model
package org.eclipse.tractusx.bpdm.common.dto

import io.swagger.v3.oas.annotations.media.Schema
import org.eclipse.tractusx.bpdm.common.dto.openapidescription.LegalEntityStateDescription
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,24 @@ interface IBaseAlternativePostalAddressDto {
// OpenAPI description for complex field does not work!
val geographicCoordinates: GeoCoordinateDto?

@get:Schema(description = PostalAddressDescription.country)
val country: Any?

@get:Schema(description = PostalAddressDescription.administrativeAreaLevel1)
val administrativeAreaLevel1: Any?

@get:Schema(description = PostalAddressDescription.postalCode)
val postalCode: String?

@get:Schema(description = PostalAddressDescription.city)
val city: String
val city: String?

@get:Schema(description = PostalAddressDescription.deliveryServiceType)
val deliveryServiceType: DeliveryServiceType
val deliveryServiceType: DeliveryServiceType?

@get:Schema(description = PostalAddressDescription.deliveryServiceQualifier)
val deliveryServiceQualifier: String?

@get:Schema(description = PostalAddressDescription.deliveryServiceNumber)
val deliveryServiceNumber: String
val deliveryServiceNumber: String?
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,13 @@
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/

package org.eclipse.tractusx.bpdm.gate.api.model
package org.eclipse.tractusx.bpdm.common.dto

import io.swagger.v3.oas.annotations.media.ArraySchema
import io.swagger.v3.oas.annotations.media.Schema
import org.eclipse.tractusx.bpdm.common.dto.ClassificationDto
import org.eclipse.tractusx.bpdm.common.dto.openapidescription.CommonDescription


interface IBaseBusinessPartnerDto {

@get:Schema(description = CommonDescription.externalId)
val externalId: String

@get:ArraySchema(arraySchema = Schema(description = "The list of name parts to accommodate the different number of name fields in different systems."))
val nameParts: List<String>

Expand All @@ -51,6 +45,9 @@ interface IBaseBusinessPartnerDto {
@get:ArraySchema(arraySchema = Schema(description = "Roles this business partner takes in relation to the sharing member. Sorted and duplicates removed by the service."))
val roles: Collection<BusinessPartnerRole>

@get:Schema(description = "Address of the official seat of this business partner.")
val postalAddress: IBaseBusinessPartnerPostalAddressDto

@get:Schema(name = "isOwner", description = "True if the sharing member declares itself as the owner of the business partner.")
val isOwner: Boolean

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*******************************************************************************
* Copyright (c) 2021,2023 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/

package org.eclipse.tractusx.bpdm.common.dto

import io.swagger.v3.oas.annotations.media.Schema
import org.eclipse.tractusx.bpdm.common.dto.openapidescription.LogisticAddressDescription

interface IBaseBusinessPartnerPostalAddressDto {

@get:Schema(description = "Type of the address")
val addressType: AddressType?

// TODO OpenAPI description for complex field does not work!!
@get:Schema(description = LogisticAddressDescription.physicalPostalAddress)
val physicalPostalAddress: IBasePhysicalPostalAddressDto?

// TODO OpenAPI description for complex field does not work!!
@get:Schema(description = LogisticAddressDescription.alternativePostalAddress)
val alternativePostalAddress: IBaseAlternativePostalAddressDto?
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ interface IBasePhysicalPostalAddressDto {
// OpenAPI description for complex field does not work!
val geographicCoordinates: GeoCoordinateDto?

@get:Schema(description = PostalAddressDescription.country)
val country: Any?

@get:Schema(description = PostalAddressDescription.administrativeAreaLevel1)
val administrativeAreaLevel1: Any?

@get:Schema(description = PostalAddressDescription.administrativeAreaLevel2)
val administrativeAreaLevel2: String?

Expand All @@ -40,11 +46,14 @@ interface IBasePhysicalPostalAddressDto {
val postalCode: String?

@get:Schema(description = PostalAddressDescription.city)
val city: String
val city: String?

@get:Schema(description = PostalAddressDescription.district)
val district: String?

// OpenAPI description for complex field does not work!
val street: IBaseStreetDto?

@get:Schema(description = PostalAddressDescription.companyPostalCode)
val companyPostalCode: String?

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*******************************************************************************
* Copyright (c) 2021,2023 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/

package org.eclipse.tractusx.bpdm.common.dto

import io.swagger.v3.oas.annotations.media.Schema
import org.eclipse.tractusx.bpdm.common.dto.openapidescription.StreetDescription

interface IBaseStreetDto {

@get:Schema(description = StreetDescription.name)
val name: String?

@get:Schema(description = StreetDescription.houseNumber)
val houseNumber: String?

@get:Schema(description = StreetDescription.milestone)
val milestone: String?

@get:Schema(description = StreetDescription.direction)
val direction: String?
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*******************************************************************************
* Copyright (c) 2021,2023 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/

package org.eclipse.tractusx.bpdm.common.dto

import io.swagger.v3.oas.annotations.media.Schema
import org.eclipse.tractusx.bpdm.common.dto.openapidescription.StreetDescription

interface IStreetDetailedDto : IBaseStreetDto {

@get:Schema(description = StreetDescription.namePrefix)
val namePrefix: String?

@get:Schema(description = StreetDescription.additionalNamePrefix)
val additionalNamePrefix: String?

@get:Schema(description = StreetDescription.nameSuffix)
val nameSuffix: String?

@get:Schema(description = StreetDescription.additionalNameSuffix)
val additionalNameSuffix: String?
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@ data class PhysicalPostalAddressDto(

override val geographicCoordinates: GeoCoordinateDto?,

@get:Schema(description = PostalAddressDescription.country)
val country: CountryCode,
override val country: CountryCode,

@get:Schema(description = PostalAddressDescription.administrativeAreaLevel1)
val administrativeAreaLevel1: String?,
override val administrativeAreaLevel1: String?,

override val administrativeAreaLevel2: String?,

Expand All @@ -47,8 +45,7 @@ data class PhysicalPostalAddressDto(

override val district: String?,

// OpenAPI description for complex field does not work!
val street: StreetDto?,
override val street: StreetDto?,

override val companyPostalCode: String?,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,9 @@ import org.eclipse.tractusx.bpdm.common.dto.openapidescription.StreetDescription
@Schema(description = StreetDescription.header)
data class StreetDto(

@get:Schema(description = StreetDescription.name)
val name: String? = null,
override val name: String? = null,
override val houseNumber: String? = null,
override val milestone: String? = null,
override val direction: String? = null

@get:Schema(description = StreetDescription.houseNumber)
val houseNumber: String? = null,

@get:Schema(description = StreetDescription.milestone)
val milestone: String? = null,

@get:Schema(description = StreetDescription.direction)
val direction: String? = null
)
) : IBaseStreetDto
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ data class AlternativePostalAddressVerboseDto(
override val geographicCoordinates: GeoCoordinateDto?,

// OpenAPI description for complex field does not work!
val country: TypeKeyNameVerboseDto<CountryCode>,
override val country: TypeKeyNameVerboseDto<CountryCode>,

// OpenAPI description for complex field does not work!
val administrativeAreaLevel1: RegionDto?,
override val administrativeAreaLevel1: RegionDto?,

override val postalCode: String?,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ data class PhysicalPostalAddressVerboseDto(
override val geographicCoordinates: GeoCoordinateDto?,

// OpenAPI description for complex field does not work!
val country: TypeKeyNameVerboseDto<CountryCode>,
override val country: TypeKeyNameVerboseDto<CountryCode>,

// OpenAPI description for complex field does not work!
val administrativeAreaLevel1: RegionDto?,
override val administrativeAreaLevel1: RegionDto?,

override val administrativeAreaLevel2: String?,

Expand All @@ -51,8 +51,7 @@ data class PhysicalPostalAddressVerboseDto(

override val district: String?,

// OpenAPI description for complex field does not work!
val street: StreetDto?,
override val street: StreetDto?,

override val companyPostalCode: String?,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,15 @@
package org.eclipse.tractusx.bpdm.gate.api.model

import io.swagger.v3.oas.annotations.media.Schema
import org.eclipse.tractusx.bpdm.common.dto.AddressType
import org.eclipse.tractusx.bpdm.common.dto.AlternativePostalAddressDto
import org.eclipse.tractusx.bpdm.common.dto.openapidescription.LogisticAddressDescription
import org.eclipse.tractusx.bpdm.gate.api.model.openapidescription.BusinessPartnerAddressDescription
import org.eclipse.tractusx.bpdm.common.dto.IBaseBusinessPartnerPostalAddressDto

@Schema(description = "Postal address of a input business partner", requiredProperties = ["physicalPostalAddress"])
data class BusinessPartnerPostalAddressInputDto(

@get:Schema( description = BusinessPartnerAddressDescription.addressType)
val addressType: AddressType?,
override val addressType: AddressType?,
override val physicalPostalAddress: PhysicalPostalAddressGateDto,
override val alternativePostalAddress: AlternativePostalAddressDto? = null

// TODO OpenAPI description for complex field does not work!!
@get:Schema(description = LogisticAddressDescription.physicalPostalAddress)
val physicalPostalAddress: PhysicalPostalAddressGateDto,

// TODO OpenAPI description for complex field does not work!!
@get:Schema(description = LogisticAddressDescription.alternativePostalAddress)
val alternativePostalAddress: AlternativePostalAddressDto? = null
)
) : IBaseBusinessPartnerPostalAddressDto
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,15 @@
package org.eclipse.tractusx.bpdm.gate.api.model

import io.swagger.v3.oas.annotations.media.Schema
import org.eclipse.tractusx.bpdm.common.dto.AddressType
import org.eclipse.tractusx.bpdm.common.dto.AlternativePostalAddressDto
import org.eclipse.tractusx.bpdm.common.dto.openapidescription.LogisticAddressDescription
import org.eclipse.tractusx.bpdm.gate.api.model.openapidescription.BusinessPartnerAddressDescription
import org.eclipse.tractusx.bpdm.common.dto.IBaseBusinessPartnerPostalAddressDto

@Schema(description = "Postal address of a output business partner", requiredProperties = ["physicalPostalAddress"])
data class BusinessPartnerPostalAddressOutputDto(

@get:Schema(description = BusinessPartnerAddressDescription.addressType)
val addressType: AddressType,
override val addressType: AddressType,
override val physicalPostalAddress: PhysicalPostalAddressGateDto,
override val alternativePostalAddress: AlternativePostalAddressDto? = null

// TODO OpenAPI description for complex field does not work!!
@get:Schema(description = LogisticAddressDescription.physicalPostalAddress)
val physicalPostalAddress: PhysicalPostalAddressGateDto,

// TODO OpenAPI description for complex field does not work!!
@get:Schema(description = LogisticAddressDescription.alternativePostalAddress)
val alternativePostalAddress: AlternativePostalAddressDto? = null
)
) : IBaseBusinessPartnerPostalAddressDto
Loading