Skip to content
Draft
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ For changes to the BPDM Helm charts please consult the [changelog](charts/bpdm/C
- BPDM: Add validity on business partner relation to the golden record process for legal entity relations [#1295](https://github.com/eclipse-tractusx/bpdm/issues/1295)
- BPDM Gate: Fix synchronization of golden records sometimes skipping updates [#1519](https://github.com/eclipse-tractusx/bpdm/issues/1519)
- BPDM: The Golden Record Process now automatically calculates the number of sharing members for the confidence criteria [#1464](https://github.com/eclipse-tractusx/sig-release/issues/1464)
- BPDM Pool: Add a business partner search endpoint [[#1382]](https://github.com/eclipse-tractusx/bpdm/issues/781)

### Changed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ object BusinessPartnerNonVerboseValues {
sortedSetOf(IdentifierTypeCategory.NBR)
)
val addressIdentifierTypeDto2 = addressIdentifierTypeDto1
val addressIdentifierTypeDto3 = addressIdentifierTypeDto1


val identifier1 = LegalEntityIdentifierDto(
value = BusinessPartnerVerboseValues.identifier1.value,
Expand Down Expand Up @@ -255,6 +257,35 @@ object BusinessPartnerNonVerboseValues {
index = BusinessPartnerVerboseValues.legalEntityUpsert3.index
)

val legalEntityCreate4 = LegalEntityPartnerCreateRequest(
legalEntity = LegalEntityDto(
legalName = BusinessPartnerVerboseValues.legalEntityUpsert4.legalEntity.legalName,
legalShortName = null,
legalForm = BusinessPartnerVerboseValues.legalForm3.technicalKey,
identifiers = listOf(identifier3),
states = listOf(leStatus3),
confidenceCriteria = BusinessPartnerVerboseValues.legalEntity3.legalEntity.confidenceCriteria,
isParticipantData = false
),
legalAddress = logisticAddress4,
index = BusinessPartnerVerboseValues.legalEntityUpsert4.index
)

val legalEntityCreateMultipleIdentifier = LegalEntityPartnerCreateRequest(
legalEntity = LegalEntityDto(
legalName = BusinessPartnerVerboseValues.legalEntityUpsertMultipleIdentifier.legalEntity.legalName,
legalShortName = null,
legalForm = BusinessPartnerVerboseValues.legalForm1.technicalKey,
identifiers = listOf(identifier1, identifier2),
states = listOf(leStatus1),
confidenceCriteria = BusinessPartnerVerboseValues.legalEntity1.legalEntity.confidenceCriteria,
isParticipantData = false
),
legalAddress = logisticAddress1,
index = BusinessPartnerVerboseValues.legalEntityUpsertMultipleIdentifier.index
)


val legalEntityUpdate1 = LegalEntityPartnerUpdateRequest(
bpnl = BusinessPartnerVerboseValues.legalEntityUpsert1.legalEntity.bpnl,
legalEntity = legalEntityCreate1.legalEntity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import org.eclipse.tractusx.bpdm.common.model.BusinessStateType
import org.eclipse.tractusx.bpdm.common.service.toDto
import org.eclipse.tractusx.bpdm.pool.api.model.*
import org.eclipse.tractusx.bpdm.pool.api.model.response.*
import org.eclipse.tractusx.bpdm.pool.api.model.StreetDto
import java.time.Instant
import java.time.LocalDateTime
import java.time.ZoneOffset
Expand Down Expand Up @@ -556,4 +557,47 @@ object BusinessPartnerVerboseValues {
),
index = "3"
)

val legalEntityUpsert4 = LegalEntityPartnerCreateVerboseDto(
legalEntity = LegalEntityVerboseDto(
bpnl = thirdBpnl,
legalName = "Müller Handels GmbH & Co. KG",
legalFormVerbose = legalForm3,
identifiers = listOf(LegalEntityIdentifierVerboseDto("An ID Value", identifierType3, "Official Z")),
states = listOf(leStatus3),
currentness = createdTime1.toInstant(ZoneOffset.UTC),
confidenceCriteria = confidenceCriteria3,
createdAt = Instant.now(),
updatedAt = Instant.now(),
isParticipantData = true
),
legalAddress = addressPartner3.copy(
bpnLegalEntity = legalEntity3.legalEntity.bpnl,
addressType = AddressType.LegalAddress
),
index = "4"
)

val legalEntityUpsertMultipleIdentifier = LegalEntityPartnerCreateVerboseDto(
legalEntity = LegalEntityVerboseDto(
bpnl = firstBpnL,
legalName = "Business Partner Name",
legalFormVerbose = legalForm1,
identifiers = listOf(
LegalEntityIdentifierVerboseDto("ID-XYZ", identifierType1, "Agency X"),
LegalEntityIdentifierVerboseDto("Another ID Value", identifierType2, "Body Y")
),
states = listOf(leStatus1),
currentness = createdTime1.toInstant(ZoneOffset.UTC),
confidenceCriteria = confidenceCriteria1,
isParticipantData = false,
createdAt = Instant.now(),
updatedAt = Instant.now()
),
legalAddress = addressPartner1.copy(
bpnLegalEntity = legalEntity1.legalEntity.bpnl,
),
index = "1"
)

}
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,6 @@ data class AddressComponentOutputDto(
override val physicalPostalAddress: PhysicalPostalAddressDto = PhysicalPostalAddressDto(),
override val alternativePostalAddress: AlternativePostalAddressDto? = null,
val confidenceCriteria: ConfidenceCriteriaDto,
override val states: Collection<BusinessPartnerStateDto> = emptyList()
override val states: Collection<BusinessPartnerStateDto> = emptyList(),
val identifiers: Collection<AddressIdentifierDto> = emptyList(),
) : IBaseAddressRepresentation
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,7 @@ object ApiCommons {
const val BPN_NAME = "Bpn Controller"
const val BPN_DESCRIPTION = "Support functionality for BPN operations"

const val BUSINESS_PARTNERS_NAME = "Business Partners Controller"
const val BUSINESS_PARTNERS_DESCRIPTION = "Look-up business partner"

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*******************************************************************************
* Copyright (c) 2021,2024 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.pool.api

import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.responses.ApiResponse
import io.swagger.v3.oas.annotations.responses.ApiResponses
import io.swagger.v3.oas.annotations.tags.Tag
import jakarta.validation.Valid
import org.eclipse.tractusx.bpdm.common.dto.PageDto
import org.eclipse.tractusx.bpdm.common.dto.PaginationRequest
import org.eclipse.tractusx.bpdm.common.util.CommonApiPathNames
import org.eclipse.tractusx.bpdm.pool.api.model.BusinessPartnerSearchFilterType
import org.eclipse.tractusx.bpdm.pool.api.model.request.LegalEntityPropertiesSearchRequest
import org.eclipse.tractusx.bpdm.pool.api.model.response.BusinessPartnerSearchResultDto
import org.springdoc.core.annotations.ParameterObject
import org.springframework.http.MediaType
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestParam

@RequestMapping(PoolBusinessPartnerApi.BUSINESS_PARTNERS_PATH, produces = [MediaType.APPLICATION_JSON_VALUE])
interface PoolBusinessPartnerApi {

companion object{
const val BUSINESS_PARTNERS_PATH = "${ApiCommons.BASE_PATH_V7}/business-partners"
}

@Operation(
summary = "Return business partners look-up result",
description = "Look-up the business partner data by parameters"
)
@ApiResponses(
value = [
ApiResponse(responseCode = "200", description = "Matching business partners"),
ApiResponse(responseCode = "400", description = "Invalid request (e.g., missing both ID and legalName)"),
]
)
@Tag(name = ApiCommons.BUSINESS_PARTNERS_NAME, description = ApiCommons.BUSINESS_PARTNERS_DESCRIPTION)
@PostMapping(CommonApiPathNames.SUBPATH_SEARCH)
fun searchBusinessPartners(
@RequestBody searchRequest: LegalEntityPropertiesSearchRequest,
@RequestParam searchResultFilter: Set<BusinessPartnerSearchFilterType>?,
@ParameterObject @Valid paginationRequest: PaginationRequest
): PageDto<BusinessPartnerSearchResultDto>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*******************************************************************************
* Copyright (c) 2021,2024 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.pool.api.client

import jakarta.validation.Valid
import org.eclipse.tractusx.bpdm.common.dto.PageDto
import org.eclipse.tractusx.bpdm.common.dto.PaginationRequest
import org.eclipse.tractusx.bpdm.pool.api.PoolBusinessPartnerApi
import org.eclipse.tractusx.bpdm.pool.api.model.BusinessPartnerSearchFilterType
import org.eclipse.tractusx.bpdm.pool.api.model.request.LegalEntityPropertiesSearchRequest
import org.eclipse.tractusx.bpdm.pool.api.model.response.BusinessPartnerSearchResultDto
import org.springdoc.core.annotations.ParameterObject
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.service.annotation.HttpExchange
import org.springframework.web.service.annotation.PostExchange

@HttpExchange(PoolBusinessPartnerApi.BUSINESS_PARTNERS_PATH)
interface BusinessPartnersApiClient: PoolBusinessPartnerApi {

@PostExchange(value ="/search")
override fun searchBusinessPartners(
@RequestBody searchRequest: LegalEntityPropertiesSearchRequest,
@RequestParam searchResultFilter: Set<BusinessPartnerSearchFilterType>?,
@ParameterObject @Valid paginationRequest: PaginationRequest
): PageDto<BusinessPartnerSearchResultDto>

}
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ interface PoolApiClient {
val members: MembersApiClient

val participants: DataSpaceParticipantsApiClient

val businessPartners: BusinessPartnersApiClient
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ class PoolClientImpl(

override val participants by lazy { createClient<DataSpaceParticipantsApiClient>() }

override val businessPartners by lazy { createClient<BusinessPartnersApiClient>() }

private inline fun <reified T> createClient() =
httpServiceProxyFactory.createClient(T::class.java)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*******************************************************************************
* Copyright (c) 2021,2024 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.pool.api.model

enum class BusinessPartnerSearchFilterType {
IncludeLegalEntities,
IncludeSites,
IncludeAdditionalAddresses
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,32 @@

package org.eclipse.tractusx.bpdm.pool.api.model.request

import com.neovisionaries.i18n.CountryCode
import io.swagger.v3.oas.annotations.Parameter
import io.swagger.v3.oas.annotations.media.Schema


@Schema(description = "Contains keywords used for searching in legal entity properties")
data class LegalEntityPropertiesSearchRequest(
@field:Parameter(description = "Filter legal entities by name")
val legalName: String?
) {
val legalName: String?,

@field:Parameter(description = "Filter business partners by CX-BPN.")
val bpn: String?,

@field:Parameter(description = "Filter business partners by street name.")
val streetName: String?,

@field:Parameter(description = "Filter business partners by zip code.")
val postalCode: String?,

@field:Parameter(description = "Filter business partners by city.")
val city: String?,

@field:Parameter(description = "Filter business partners by country code ISO 3166-1.")
val country: CountryCode?,

) {
companion object {
val EmptySearchRequest = LegalEntityPropertiesSearchRequest(null)
val EmptySearchRequest = LegalEntityPropertiesSearchRequest(null, null, null, null, null, null)
}
}
Loading
Loading