Skip to content

Commit

Permalink
feat(generic bp model): DTO model changes - improved OpenAPI descript…
Browse files Browse the repository at this point in the history
…ion & error handling
  • Loading branch information
martinfkaeser committed Sep 21, 2023
1 parent 93f6df6 commit e9f06af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ interface IBaseBusinessPartnerDto {
@get:Schema(description = "Abbreviated name or shorthand.")
val shortName: String?

@get:ArraySchema(arraySchema = Schema(description = "The list of identifiers of the business partner. Sorted and duplicates are removed."))
@get:ArraySchema(arraySchema = Schema(description = "The list of identifiers of the business partner. Sorted and duplicates removed by the service."))
val identifiers: Collection<BusinessPartnerIdentifierDto>

@get:Schema(description = "Technical key of the legal form.")
val legalForm: String?

@get:ArraySchema(arraySchema = Schema(description = "The list of (temporary) states of the business partner. Sorted and duplicates are removed."))
@get:ArraySchema(arraySchema = Schema(description = "The list of (temporary) states of the business partner. Sorted and duplicates removed by the service."))
val states: Collection<BusinessPartnerStateDto>

@get:ArraySchema(arraySchema = Schema(description = "The list of classifications of the business partner, such as a specific industry. Sorted and duplicates are removed."))
@get:ArraySchema(arraySchema = Schema(description = "The list of classifications of the business partner, such as a specific industry. Sorted and duplicates removed by the service."))
val classifications: Collection<ClassificationDto>

@get:ArraySchema(arraySchema = Schema(description = "Roles this business partner takes in relation to the sharing member. Sorted and duplicates are removed."))
@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(name = "isOwner", description = "True if the sharing member declares itself as the owner of the business partner.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package org.eclipse.tractusx.bpdm.gate.service
import org.eclipse.tractusx.bpdm.common.dto.AlternativePostalAddressDto
import org.eclipse.tractusx.bpdm.common.dto.ClassificationDto
import org.eclipse.tractusx.bpdm.common.dto.GeoCoordinateDto
import org.eclipse.tractusx.bpdm.common.exception.BpdmNullMappingException
import org.eclipse.tractusx.bpdm.common.model.StageType
import org.eclipse.tractusx.bpdm.common.util.replace
import org.eclipse.tractusx.bpdm.gate.api.model.*
Expand Down Expand Up @@ -70,9 +71,11 @@ class BusinessPartnerMappings {
roles = entity.roles,
postalAddress = toPostalAddressOutputDto(entity.postalAddress),
isOwner = entity.isOwner,
bpnL = entity.bpnL ?: throw NullPointerException("bpnL is null"),
bpnL = entity.bpnL
?: throw BpdmNullMappingException(BusinessPartner::class, BusinessPartnerOutputDto::class, BusinessPartner::bpnL, entity.externalId),
bpnS = entity.bpnS,
bpnA = entity.bpnA ?: throw NullPointerException("bpnA is null"),
bpnA = entity.bpnA
?: throw BpdmNullMappingException(BusinessPartner::class, BusinessPartnerOutputDto::class, BusinessPartner::bpnA, entity.externalId),
createdAt = entity.createdAt,
updatedAt = entity.updatedAt
)
Expand Down

0 comments on commit e9f06af

Please sign in to comment.