diff --git a/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/GateQueryService.kt b/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/GateQueryService.kt index c9e57d313..f2899ce4e 100644 --- a/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/GateQueryService.kt +++ b/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/GateQueryService.kt @@ -24,9 +24,9 @@ import com.catenax.bpdm.bridge.dummy.dto.GateAddressInfo import com.catenax.bpdm.bridge.dummy.dto.GateLegalEntityInfo import com.catenax.bpdm.bridge.dummy.dto.GateSiteInfo import mu.KotlinLogging +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest import org.eclipse.tractusx.bpdm.gate.api.client.GateClient -import org.eclipse.tractusx.bpdm.gate.api.model.LsaType import org.eclipse.tractusx.bpdm.gate.api.model.request.ChangeLogSearchRequest import org.eclipse.tractusx.bpdm.gate.api.model.response.* import org.springframework.stereotype.Service @@ -40,7 +40,7 @@ class GateQueryService( private val logger = KotlinLogging.logger { } - fun getChangedExternalIdsByLsaType(modifiedAfter: Instant?): Map> { + fun getChangedExternalIdsByBusinessPartnerType(modifiedAfter: Instant?): Map> { var page = 0 var totalPages: Int val content = mutableListOf() @@ -61,16 +61,16 @@ class GateQueryService( .also { logger.info { "Changed entries in Gate since last sync: " + - "${it[LsaType.LEGAL_ENTITY]?.size ?: 0} legal entities, " + - "${it[LsaType.SITE]?.size ?: 0} sites, " + - "${it[LsaType.ADDRESS]?.size ?: 0} addresses" + "${it[BusinessPartnerType.LEGAL_ENTITY]?.size ?: 0} legal entities, " + + "${it[BusinessPartnerType.SITE]?.size ?: 0} sites, " + + "${it[BusinessPartnerType.ADDRESS]?.size ?: 0} addresses" } } } fun getLegalEntityInfos(externalIds: Set): Collection { val entries = getLegalEntitiesInput(externalIds) - val bpnByExternalId = getBpnByExternalId(LsaType.LEGAL_ENTITY, externalIds) + val bpnByExternalId = getBpnByExternalId(BusinessPartnerType.LEGAL_ENTITY, externalIds) return entries.map { GateLegalEntityInfo( @@ -85,7 +85,7 @@ class GateQueryService( fun getSiteInfos(externalIds: Set): Collection { val entries = getSitesInput(externalIds) - val bpnByExternalId = getBpnByExternalId(LsaType.SITE, externalIds) + val bpnByExternalId = getBpnByExternalId(BusinessPartnerType.SITE, externalIds) return entries.map { GateSiteInfo( @@ -100,7 +100,7 @@ class GateQueryService( fun getAddressInfos(externalIds: Set): Collection { val entries = getAddressesInput(externalIds) - val bpnByExternalId = getBpnByExternalId(LsaType.ADDRESS, externalIds) + val bpnByExternalId = getBpnByExternalId(BusinessPartnerType.ADDRESS, externalIds) return entries.map { GateAddressInfo( @@ -113,7 +113,7 @@ class GateQueryService( } } - fun getBpnByExternalId(lsaType: LsaType, externalIds: Set): Map { + fun getBpnByExternalId(businessPartnerType: BusinessPartnerType, externalIds: Set): Map { if (externalIds.isEmpty()) { return emptyMap() } @@ -124,7 +124,7 @@ class GateQueryService( do { val pageResponse = gateClient.sharingState().getSharingStates( - lsaType = lsaType, + businessPartnerType = businessPartnerType, externalIds = externalIds, paginationRequest = PaginationRequest(page, bridgeConfigProperties.queryPageSize) ) diff --git a/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/GateUpdateService.kt b/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/GateUpdateService.kt index ce681f28e..9d91c9d48 100644 --- a/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/GateUpdateService.kt +++ b/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/GateUpdateService.kt @@ -21,10 +21,10 @@ package com.catenax.bpdm.bridge.dummy.service import com.catenax.bpdm.bridge.dummy.dto.* import mu.KotlinLogging +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.common.dto.response.LogisticAddressVerboseDto import org.eclipse.tractusx.bpdm.gate.api.client.GateClient import org.eclipse.tractusx.bpdm.gate.api.exception.BusinessPartnerSharingError -import org.eclipse.tractusx.bpdm.gate.api.model.LsaType import org.eclipse.tractusx.bpdm.gate.api.model.SharingStateType import org.eclipse.tractusx.bpdm.gate.api.model.request.AddressGateOutputRequest import org.eclipse.tractusx.bpdm.gate.api.model.request.LegalEntityGateOutputRequest @@ -56,7 +56,7 @@ class GateUpdateService( for (errorInfo in responseWrapper.errors) { val externalId = errorInfo.entityKey upsertSharingState( - buildErrorSharingStateDto(LsaType.LEGAL_ENTITY, externalId, null, errorInfo, true) + buildErrorSharingStateDto(BusinessPartnerType.LEGAL_ENTITY, externalId, null, errorInfo, true) ) } @@ -80,7 +80,7 @@ class GateUpdateService( val bpn = errorInfo.entityKey val externalId = externalIdByBpn[bpn] upsertSharingState( - buildErrorSharingStateDto(LsaType.LEGAL_ENTITY, externalId, bpn, errorInfo, false) + buildErrorSharingStateDto(BusinessPartnerType.LEGAL_ENTITY, externalId, bpn, errorInfo, false) ) } logger.info { "Sharing states for ${responseWrapper.entityCount} valid and ${responseWrapper.errorCount} invalid modified legal entities were updated in the Gate" } @@ -100,7 +100,7 @@ class GateUpdateService( for (errorInfo in responseWrapper.errors) { val externalId = errorInfo.entityKey upsertSharingState( - buildErrorSharingStateDto(LsaType.SITE, externalId, null, errorInfo, true) + buildErrorSharingStateDto(BusinessPartnerType.SITE, externalId, null, errorInfo, true) ) } logger.info { "Sharing states for ${responseWrapper.entityCount} valid and ${responseWrapper.errorCount} invalid new sites were updated in the Gate" } @@ -123,7 +123,7 @@ class GateUpdateService( val bpn = errorInfo.entityKey val externalId = externalIdByBpn[bpn] upsertSharingState( - buildErrorSharingStateDto(LsaType.SITE, externalId, bpn, errorInfo, false) + buildErrorSharingStateDto(BusinessPartnerType.SITE, externalId, bpn, errorInfo, false) ) } logger.info { "Sharing states for ${responseWrapper.entityCount} valid and ${responseWrapper.errorCount} invalid modified sites were updated in the Gate" } @@ -143,7 +143,7 @@ class GateUpdateService( for (errorInfo in responseWrapper.errors) { val externalId = errorInfo.entityKey upsertSharingState( - buildErrorSharingStateDto(LsaType.ADDRESS, externalId, null, errorInfo, true) + buildErrorSharingStateDto(BusinessPartnerType.ADDRESS, externalId, null, errorInfo, true) ) } logger.info { "Sharing states for ${responseWrapper.entityCount} valid and ${responseWrapper.errorCount} invalid new addresses were updated in the Gate" } @@ -166,7 +166,7 @@ class GateUpdateService( val bpn = errorInfo.entityKey val externalId = externalIdByBpn[bpn] upsertSharingState( - buildErrorSharingStateDto(LsaType.ADDRESS, externalId, bpn, errorInfo, false) + buildErrorSharingStateDto(BusinessPartnerType.ADDRESS, externalId, bpn, errorInfo, false) ) } logger.info { "Sharing states for ${responseWrapper.entityCount} valid and ${responseWrapper.errorCount} invalid modified addresses were updated in the Gate" } @@ -217,13 +217,18 @@ class GateUpdateService( ) } - private fun buildSuccessSharingStateDto(lsaType: LsaType, externalId: String?, bpn: String, processStarted: Boolean): SharingStateDto? { + private fun buildSuccessSharingStateDto( + businessPartnerType: BusinessPartnerType, + externalId: String?, + bpn: String, + processStarted: Boolean + ): SharingStateDto? { if (externalId == null) { logger.warn { "Encountered externalId=null in Pool response for $bpn, can't update the Gate sharing state" } return null } return SharingStateDto( - lsaType = lsaType, + businessPartnerType = businessPartnerType, externalId = externalId, sharingStateType = SharingStateType.Success, bpn = bpn, @@ -232,7 +237,7 @@ class GateUpdateService( } private fun buildErrorSharingStateDto( - lsaType: LsaType, + businessPartnerType: BusinessPartnerType, externalId: String?, bpn: String?, errorInfo: ErrorInfo<*>, @@ -243,7 +248,7 @@ class GateUpdateService( return null } return SharingStateDto( - lsaType = lsaType, + businessPartnerType = businessPartnerType, externalId = externalId, sharingStateType = SharingStateType.Error, bpn = bpn, diff --git a/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/PoolUpdateService.kt b/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/PoolUpdateService.kt index 58d2fe675..87286f987 100644 --- a/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/PoolUpdateService.kt +++ b/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/PoolUpdateService.kt @@ -21,9 +21,9 @@ package com.catenax.bpdm.bridge.dummy.service import com.catenax.bpdm.bridge.dummy.dto.* import mu.KotlinLogging +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.common.dto.LogisticAddressDto import org.eclipse.tractusx.bpdm.common.dto.SiteDto -import org.eclipse.tractusx.bpdm.gate.api.model.LsaType import org.eclipse.tractusx.bpdm.pool.api.client.PoolApiClient import org.eclipse.tractusx.bpdm.pool.api.model.request.* import org.eclipse.tractusx.bpdm.pool.api.model.response.* @@ -68,7 +68,7 @@ class PoolUpdateService( fun createSitesInPool(entriesToCreate: Collection): SitePartnerCreateResponseWrapper { val leParentBpnByExternalId = entriesToCreate .map { it.legalEntityExternalId } - .let { gateQueryService.getBpnByExternalId(LsaType.LEGAL_ENTITY, it.toSet()) } + .let { gateQueryService.getBpnByExternalId(BusinessPartnerType.LEGAL_ENTITY, it.toSet()) } val createRequests = entriesToCreate.mapNotNull { entry -> leParentBpnByExternalId[entry.legalEntityExternalId] ?.let { leParentBpn -> @@ -113,7 +113,7 @@ class PoolUpdateService( fun createAddressesInPool(entriesToCreate: Collection): AddressPartnerCreateResponseWrapper { val leParentBpnByExternalId = entriesToCreate .mapNotNull { it.legalEntityExternalId } - .let { gateQueryService.getBpnByExternalId(LsaType.LEGAL_ENTITY, it.toSet()) } + .let { gateQueryService.getBpnByExternalId(BusinessPartnerType.LEGAL_ENTITY, it.toSet()) } val leParentsCreateRequests = entriesToCreate.mapNotNull { entry -> leParentBpnByExternalId[entry.legalEntityExternalId] ?.let { leParentBpn -> @@ -127,7 +127,7 @@ class PoolUpdateService( val siteParentBpnByExternalId = entriesToCreate .mapNotNull { it.siteExternalId } - .let { gateQueryService.getBpnByExternalId(LsaType.SITE, it.toSet()) } + .let { gateQueryService.getBpnByExternalId(BusinessPartnerType.SITE, it.toSet()) } val siteParentsCreateRequests = entriesToCreate.mapNotNull { entry -> siteParentBpnByExternalId[entry.siteExternalId] ?.let { siteParentBpn -> diff --git a/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/SyncService.kt b/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/SyncService.kt index 41fc3ac6f..66cac386c 100644 --- a/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/SyncService.kt +++ b/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/SyncService.kt @@ -21,7 +21,7 @@ package com.catenax.bpdm.bridge.dummy.service import com.catenax.bpdm.bridge.dummy.entity.SyncType import mu.KotlinLogging -import org.eclipse.tractusx.bpdm.gate.api.model.LsaType +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.springframework.stereotype.Service import java.time.Instant @@ -35,7 +35,7 @@ class SyncService( private val logger = KotlinLogging.logger { } - // TODO For improved robustness we should maybe persistently track all sync entries (status) by LSAType/externalID. + // TODO For improved robustness we should maybe persistently track all sync entries (status) by businessPartnerType/externalID. fun sync() { logger.info("Bridge sync started...") @@ -53,11 +53,11 @@ class SyncService( private fun syncInternal(modifiedAfter: Instant) { // Check changelog entries from Gate (after last sync time) - val externalIdsByType = gateQueryService.getChangedExternalIdsByLsaType(modifiedAfter) + val externalIdsByType = gateQueryService.getChangedExternalIdsByBusinessPartnerType(modifiedAfter) - externalIdsByType[LsaType.LEGAL_ENTITY]?.let { syncLegalEntities(it) } - externalIdsByType[LsaType.SITE]?.let { syncSites(it) } - externalIdsByType[LsaType.ADDRESS]?.let { syncAddresses(it) } + externalIdsByType[BusinessPartnerType.LEGAL_ENTITY]?.let { syncLegalEntities(it) } + externalIdsByType[BusinessPartnerType.SITE]?.let { syncSites(it) } + externalIdsByType[BusinessPartnerType.ADDRESS]?.let { syncAddresses(it) } } private fun syncLegalEntities(externalIdsRequested: Set) { diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LsaType.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/BusinessPartnerType.kt similarity index 92% rename from bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LsaType.kt rename to bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/BusinessPartnerType.kt index 0fcd358aa..3b1c339d6 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LsaType.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/BusinessPartnerType.kt @@ -17,9 +17,9 @@ * SPDX-License-Identifier: Apache-2.0 ******************************************************************************/ -package org.eclipse.tractusx.bpdm.gate.api.model +package org.eclipse.tractusx.bpdm.common.dto -enum class LsaType { +enum class BusinessPartnerType { LEGAL_ENTITY, SITE, ADDRESS diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/IdentifierLsaType.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/IdentifierBusinessPartnerType.kt similarity index 96% rename from bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/IdentifierLsaType.kt rename to bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/IdentifierBusinessPartnerType.kt index cebf0a9ca..c184746e9 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/IdentifierLsaType.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/IdentifierBusinessPartnerType.kt @@ -21,7 +21,7 @@ package org.eclipse.tractusx.bpdm.common.dto import io.swagger.v3.oas.annotations.media.Schema @Schema(description = "Specifies if an identifier type is valid for legal entities (L) or addresses (A). Sites (S) are not supported.") -enum class IdentifierLsaType { +enum class IdentifierBusinessPartnerType { LEGAL_ENTITY, ADDRESS } diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/IdentifierTypeDto.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/IdentifierTypeDto.kt index 260656901..29e10ce4b 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/IdentifierTypeDto.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/IdentifierTypeDto.kt @@ -23,11 +23,12 @@ import io.swagger.v3.oas.annotations.media.Schema @Schema(name = "IdentifierTypeDto", description = "Identifier type definition for legal entity or address") data class IdentifierTypeDto( - @get:Schema(description = "Unique key (in combination with lsaType) to be used as reference") + + @get:Schema(description = "Unique key (in combination with businessPartnerType) to be used as reference") val technicalKey: String, @get:Schema(description = "Specifies if this identifier type is valid for legal entities (L) or addresses (A)") - val lsaType: IdentifierLsaType, + val businessPartnerType: IdentifierBusinessPartnerType, @get:Schema(description = "Full name") val name: String, diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/GateSharingStateApi.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/GateSharingStateApi.kt index 742b77cbd..93394bd3b 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/GateSharingStateApi.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/GateSharingStateApi.kt @@ -25,9 +25,9 @@ import io.swagger.v3.oas.annotations.media.Content import io.swagger.v3.oas.annotations.responses.ApiResponse import io.swagger.v3.oas.annotations.responses.ApiResponses import jakarta.validation.Valid +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest import org.eclipse.tractusx.bpdm.common.dto.response.PageDto -import org.eclipse.tractusx.bpdm.gate.api.model.LsaType import org.eclipse.tractusx.bpdm.gate.api.model.response.SharingStateDto import org.springdoc.core.annotations.ParameterObject import org.springframework.http.MediaType @@ -52,7 +52,7 @@ interface GateSharingStateApi { @GetExchange fun getSharingStates( @ParameterObject @Valid paginationRequest: PaginationRequest, - @Parameter(description = "LSA Type") @RequestParam(required = false) lsaType: LsaType?, + @Parameter(description = "Business partner type") @RequestParam(required = false) businessPartnerType: BusinessPartnerType?, @Parameter(description = "External identifiers") @RequestParam(required = false) externalIds: Collection? ): PageDto diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/OptionalLsaType.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/OptionalLsaType.kt deleted file mode 100644 index 690c06273..000000000 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/OptionalLsaType.kt +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * 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.gate.api.model - -enum class OptionalLsaType { - LegalEntity, - Site, - Address, - None -} \ No newline at end of file diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/request/ChangeLogSearchRequest.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/request/ChangeLogSearchRequest.kt index f8b283543..e0482b8d5 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/request/ChangeLogSearchRequest.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/request/ChangeLogSearchRequest.kt @@ -20,7 +20,7 @@ package org.eclipse.tractusx.bpdm.gate.api.model.request import io.swagger.v3.oas.annotations.Parameter -import org.eclipse.tractusx.bpdm.gate.api.model.LsaType +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import java.time.Instant data class ChangeLogSearchRequest( @@ -32,5 +32,5 @@ data class ChangeLogSearchRequest( val externalIds: Set = emptySet(), @field:Parameter(description = "Lsa-Types of business partners for which to search changelog entries. Ignored if empty", required = false) - val lsaTypes: Set = emptySet() + val businessPartnerType: Set = emptySet() ) diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/ChangelogGateDto.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/ChangelogGateDto.kt index 5a215edd6..ab4019bd5 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/ChangelogGateDto.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/ChangelogGateDto.kt @@ -20,7 +20,7 @@ package org.eclipse.tractusx.bpdm.gate.api.model.response import io.swagger.v3.oas.annotations.media.Schema -import org.eclipse.tractusx.bpdm.gate.api.model.LsaType +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import java.time.Instant @Schema(name = "ChangelogGateDto", description = "Changelog entry for a business partner") @@ -28,7 +28,7 @@ data class ChangelogGateDto( @Schema(description = "External ID of the changelog entry") val externalId: String, @Schema(description = "The type of the change") - val businessPartnerType: LsaType, + val businessPartnerType: BusinessPartnerType, @Schema(description = "The timestamp of the operation") val modifiedAt: Instant ) diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/SharingStateDto.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/SharingStateDto.kt index d649ce085..fe3a5ae4d 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/SharingStateDto.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/SharingStateDto.kt @@ -20,8 +20,8 @@ package org.eclipse.tractusx.bpdm.gate.api.model.response import io.swagger.v3.oas.annotations.media.Schema +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.gate.api.exception.BusinessPartnerSharingError -import org.eclipse.tractusx.bpdm.gate.api.model.LsaType import org.eclipse.tractusx.bpdm.gate.api.model.SharingStateType import java.time.LocalDateTime @@ -30,7 +30,7 @@ import java.time.LocalDateTime ) data class SharingStateDto( @get:Schema(description = "LSA Type") - val lsaType: LsaType, + val businessPartnerType: BusinessPartnerType, @get:Schema(description = "External identifier") val externalId: String, diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/ChangelogController.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/ChangelogController.kt index 240438cf7..32daa6425 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/ChangelogController.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/ChangelogController.kt @@ -42,7 +42,7 @@ class ChangelogController( ): PageChangeLogDto { return changelogService.getChangeLogEntries( searchRequest.externalIds, - searchRequest.lsaTypes, + searchRequest.businessPartnerType, searchRequest.fromTime, OutputInputEnum.Input, paginationRequest.page, @@ -57,7 +57,7 @@ class ChangelogController( ): PageChangeLogDto { return changelogService.getChangeLogEntries( searchRequest.externalIds, - searchRequest.lsaTypes, + searchRequest.businessPartnerType, searchRequest.fromTime, OutputInputEnum.Output, paginationRequest.page, diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/SharingStateController.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/SharingStateController.kt index 3ca3314a4..3c56a84f5 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/SharingStateController.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/SharingStateController.kt @@ -20,10 +20,10 @@ package org.eclipse.tractusx.bpdm.gate.controller import mu.KotlinLogging +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest import org.eclipse.tractusx.bpdm.common.dto.response.PageDto import org.eclipse.tractusx.bpdm.gate.api.GateSharingStateApi -import org.eclipse.tractusx.bpdm.gate.api.model.LsaType import org.eclipse.tractusx.bpdm.gate.api.model.response.SharingStateDto import org.eclipse.tractusx.bpdm.gate.service.SharingStateService import org.springframework.security.access.prepost.PreAuthorize @@ -36,8 +36,12 @@ class SharingStateController( private val logger = KotlinLogging.logger { } @PreAuthorize("hasAuthority(@gateSecurityConfigProperties.getReadCompanyOutputDataAsRole())") - override fun getSharingStates(paginationRequest: PaginationRequest, lsaType: LsaType?, externalIds: Collection?): PageDto { - return sharingStateService.findSharingStates(paginationRequest, lsaType, externalIds) + override fun getSharingStates( + paginationRequest: PaginationRequest, + businessPartnerType: BusinessPartnerType?, + externalIds: Collection? + ): PageDto { + return sharingStateService.findSharingStates(paginationRequest, businessPartnerType, externalIds) } @PreAuthorize("hasAuthority(@gateSecurityConfigProperties.getChangeCompanyOutputDataAsRole())") diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/ChangelogEntry.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/ChangelogEntry.kt index 3d8bb350e..1282b3ca1 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/ChangelogEntry.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/ChangelogEntry.kt @@ -20,9 +20,9 @@ package org.eclipse.tractusx.bpdm.gate.entity import jakarta.persistence.* +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.common.model.BaseEntity import org.eclipse.tractusx.bpdm.common.model.OutputInputEnum -import org.eclipse.tractusx.bpdm.gate.api.model.LsaType @Entity @@ -33,13 +33,12 @@ class ChangelogEntry( val externalId: String, @Enumerated(EnumType.STRING) @Column(name = "business_partner_type", nullable = false, updatable = false) - val businessPartnerType: LsaType, + val businessPartnerType: BusinessPartnerType, @Column(name = "data_type") @Enumerated(EnumType.STRING) var dataType: OutputInputEnum - ) : BaseEntity() diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/SharingState.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/SharingState.kt index 32f9cd298..a29e2a374 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/SharingState.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/entity/SharingState.kt @@ -20,9 +20,9 @@ package org.eclipse.tractusx.bpdm.gate.entity import jakarta.persistence.* +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.common.model.BaseEntity import org.eclipse.tractusx.bpdm.gate.api.exception.BusinessPartnerSharingError -import org.eclipse.tractusx.bpdm.gate.api.model.LsaType import org.eclipse.tractusx.bpdm.gate.api.model.SharingStateType import java.time.LocalDateTime @@ -35,8 +35,8 @@ class SharingState( var externalId: String, @Enumerated(EnumType.STRING) - @Column(name = "lsa_type", nullable = false) - var lsaType: LsaType, + @Column(name = "business_partner_type", nullable = false) + var businessPartnerType: BusinessPartnerType, @Enumerated(EnumType.STRING) @Column(name = "sharing_state_type", nullable = false) diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/repository/ChangelogRepository.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/repository/ChangelogRepository.kt index 86e7eebaa..36afbb050 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/repository/ChangelogRepository.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/repository/ChangelogRepository.kt @@ -19,8 +19,8 @@ package org.eclipse.tractusx.bpdm.gate.repository +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.common.model.OutputInputEnum -import org.eclipse.tractusx.bpdm.gate.api.model.LsaType import org.eclipse.tractusx.bpdm.gate.entity.ChangelogEntry import org.springframework.data.jpa.domain.Specification import org.springframework.data.jpa.repository.JpaRepository @@ -40,7 +40,7 @@ interface ChangelogRepository : JpaRepository, JpaSpecific Specification { root, _, _ -> externalIds?.let { if(externalIds.isNotEmpty()) - root.get(ChangelogEntry::externalId.name).`in`(externalIds.map { externalId -> externalId }) + root.get(ChangelogEntry::externalId.name).`in`(externalIds) else null } @@ -57,13 +57,13 @@ interface ChangelogRepository : JpaRepository, JpaSpecific } /** - * Restrict to entries for the LsaType; ignore if empty + * Restrict to entries for the BusinessPartnerType; ignore if empty */ - fun byLsaTypes(lsaTypes: Set?) = + fun byBusinessPartnerTypes(businessPartnerTypes: Set?) = Specification { root, _, builder -> - lsaTypes?.let { - if(lsaTypes.isNotEmpty()) - root.get(ChangelogEntry::businessPartnerType.name).`in`(lsaTypes.map { lsaType -> lsaType }) + businessPartnerTypes?.let { + if (businessPartnerTypes.isNotEmpty()) + root.get(ChangelogEntry::businessPartnerType.name).`in`(businessPartnerTypes) else null } diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/repository/SharingStateRepository.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/repository/SharingStateRepository.kt index b5e2025f7..cb178ee61 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/repository/SharingStateRepository.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/repository/SharingStateRepository.kt @@ -19,7 +19,7 @@ package org.eclipse.tractusx.bpdm.gate.repository -import org.eclipse.tractusx.bpdm.gate.api.model.LsaType +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.gate.entity.SharingState import org.springframework.data.jpa.domain.Specification import org.springframework.data.jpa.repository.JpaSpecificationExecutor @@ -40,16 +40,16 @@ interface SharingStateRepository : PagingAndSortingRepository { root, _, builder -> - lsaType?.let { - builder.equal(root.get(SharingState::lsaType.name), lsaType) + businessPartnerType?.let { + builder.equal(root.get(SharingState::businessPartnerType.name), businessPartnerType) } } } - fun findByExternalIdAndLsaType(externalId: String, businessPartnerType: LsaType): SharingState? + fun findByExternalIdAndBusinessPartnerType(externalId: String, businessPartnerType: BusinessPartnerType): SharingState? } \ No newline at end of file diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/AddressService.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/AddressService.kt index cc496d08f..4ef3eab35 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/AddressService.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/AddressService.kt @@ -20,10 +20,10 @@ package org.eclipse.tractusx.bpdm.gate.service import mu.KotlinLogging +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.common.dto.response.PageDto import org.eclipse.tractusx.bpdm.common.exception.BpdmNotFoundException import org.eclipse.tractusx.bpdm.common.model.OutputInputEnum -import org.eclipse.tractusx.bpdm.gate.api.model.LsaType import org.eclipse.tractusx.bpdm.gate.api.model.request.AddressGateInputRequest import org.eclipse.tractusx.bpdm.gate.api.model.request.AddressGateOutputRequest import org.eclipse.tractusx.bpdm.gate.api.model.response.AddressGateInputDto @@ -113,7 +113,7 @@ class AddressService( // create changelog entry if all goes well from saasClient addresses.forEach { address -> - changelogRepository.save(ChangelogEntry(address.externalId, LsaType.ADDRESS, OutputInputEnum.Input)) + changelogRepository.save(ChangelogEntry(address.externalId, BusinessPartnerType.ADDRESS, OutputInputEnum.Input)) } addressPersistenceService.persistAddressBP(addresses, OutputInputEnum.Input) @@ -126,7 +126,7 @@ class AddressService( // create changelog entry if all goes well from saasClient addresses.forEach { address -> - changelogRepository.save(ChangelogEntry(address.externalId, LsaType.ADDRESS, OutputInputEnum.Output)) + changelogRepository.save(ChangelogEntry(address.externalId, BusinessPartnerType.ADDRESS, OutputInputEnum.Output)) } addressPersistenceService.persistOutputAddressBP(addresses, OutputInputEnum.Output) diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ChangelogService.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ChangelogService.kt index be6a7d2f0..41edfe47b 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ChangelogService.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ChangelogService.kt @@ -19,16 +19,16 @@ package org.eclipse.tractusx.bpdm.gate.service +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.common.model.OutputInputEnum import org.eclipse.tractusx.bpdm.gate.api.exception.ChangeLogOutputError -import org.eclipse.tractusx.bpdm.gate.api.model.LsaType import org.eclipse.tractusx.bpdm.gate.api.model.response.ChangelogGateDto import org.eclipse.tractusx.bpdm.gate.api.model.response.ErrorInfo import org.eclipse.tractusx.bpdm.gate.api.model.response.PageChangeLogDto import org.eclipse.tractusx.bpdm.gate.repository.ChangelogRepository +import org.eclipse.tractusx.bpdm.gate.repository.ChangelogRepository.Specs.byBusinessPartnerTypes import org.eclipse.tractusx.bpdm.gate.repository.ChangelogRepository.Specs.byCreatedAtGreaterThan import org.eclipse.tractusx.bpdm.gate.repository.ChangelogRepository.Specs.byExternalIdsIn -import org.eclipse.tractusx.bpdm.gate.repository.ChangelogRepository.Specs.byLsaTypes import org.eclipse.tractusx.bpdm.gate.repository.ChangelogRepository.Specs.byOutputInputEnum import org.springframework.data.domain.PageRequest import org.springframework.data.jpa.domain.Specification @@ -40,7 +40,7 @@ class ChangelogService(private val changelogRepository: ChangelogRepository) { fun getChangeLogEntries( externalIds: Set?, - lsaTypes: Set?, + businessPartnerTypes: Set?, createdAt: Instant?, outputInputEnum: OutputInputEnum?, page: Int, @@ -52,7 +52,7 @@ class ChangelogService(private val changelogRepository: ChangelogRepository) { val spec = Specification.allOf( byExternalIdsIn(externalIds = nonNullExternalIds), byCreatedAtGreaterThan(createdAt = createdAt), - byLsaTypes(lsaTypes), + byBusinessPartnerTypes(businessPartnerTypes), byOutputInputEnum(outputInputEnum) ) diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/LegalEntityPersistenceService.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/LegalEntityPersistenceService.kt index 832ab6487..9047f5bfd 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/LegalEntityPersistenceService.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/LegalEntityPersistenceService.kt @@ -20,10 +20,10 @@ package org.eclipse.tractusx.bpdm.gate.service +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.common.exception.BpdmNotFoundException import org.eclipse.tractusx.bpdm.common.model.OutputInputEnum import org.eclipse.tractusx.bpdm.common.util.replace -import org.eclipse.tractusx.bpdm.gate.api.model.LsaType import org.eclipse.tractusx.bpdm.gate.api.model.SharingStateType import org.eclipse.tractusx.bpdm.gate.api.model.request.LegalEntityGateInputRequest import org.eclipse.tractusx.bpdm.gate.api.model.request.LegalEntityGateOutputRequest @@ -77,8 +77,8 @@ class LegalEntityPersistenceService( //Creates Changelog For both Legal Entity and Logistic Address when they are created or updated private fun saveChangelog(externalId: String, outputInputEnum: OutputInputEnum) { - changelogRepository.save(ChangelogEntry(getMainAddressForLegalEntityExternalId(externalId), LsaType.ADDRESS, outputInputEnum)) - changelogRepository.save(ChangelogEntry(externalId, LsaType.LEGAL_ENTITY, outputInputEnum)) + changelogRepository.save(ChangelogEntry(getMainAddressForLegalEntityExternalId(externalId), BusinessPartnerType.ADDRESS, outputInputEnum)) + changelogRepository.save(ChangelogEntry(externalId, BusinessPartnerType.LEGAL_ENTITY, outputInputEnum)) } private fun updateLegalEntity( 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 a3f553c78..80ea49d1c 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 @@ -501,32 +501,32 @@ fun LegalEntity.toLegalEntityGateOutputResponse(legalEntity: LegalEntity): Legal fun AddressGateInputRequest.toSharingStateDTO():SharingStateDto { - return SharingStateDto(LsaType.ADDRESS,externalId) + return SharingStateDto(BusinessPartnerType.ADDRESS, externalId) } fun SiteGateInputRequest.toSharingStateDTO():SharingStateDto { - return SharingStateDto(LsaType.SITE,externalId) + return SharingStateDto(BusinessPartnerType.SITE, externalId) } fun LegalEntityGateInputRequest.toSharingStateDTO():SharingStateDto { - return SharingStateDto(LsaType.LEGAL_ENTITY,externalId) + return SharingStateDto(BusinessPartnerType.LEGAL_ENTITY, externalId) } fun AddressGateOutputRequest.toSharingStateDTO(sharingStateType: SharingStateType):SharingStateDto { - return SharingStateDto(LsaType.ADDRESS,externalId, sharingStateType = sharingStateType, bpn = bpn) + return SharingStateDto(BusinessPartnerType.ADDRESS, externalId, sharingStateType = sharingStateType, bpn = bpn) } fun SiteGateOutputRequest.toSharingStateDTO(sharingStateType: SharingStateType):SharingStateDto { - return SharingStateDto(LsaType.SITE,externalId, sharingStateType = sharingStateType,bpn = bpn) + return SharingStateDto(BusinessPartnerType.SITE, externalId, sharingStateType = sharingStateType, bpn = bpn) } fun LegalEntityGateOutputRequest.toSharingStateDTO(sharingStateType: SharingStateType):SharingStateDto { - return SharingStateDto(LsaType.LEGAL_ENTITY,externalId, sharingStateType = sharingStateType,bpn = bpn) + return SharingStateDto(BusinessPartnerType.LEGAL_ENTITY, externalId, sharingStateType = sharingStateType, bpn = bpn) } diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SharingStateService.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SharingStateService.kt index 1033d2634..a02a961fe 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SharingStateService.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SharingStateService.kt @@ -19,14 +19,14 @@ package org.eclipse.tractusx.bpdm.gate.service +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest import org.eclipse.tractusx.bpdm.common.dto.response.PageDto -import org.eclipse.tractusx.bpdm.gate.api.model.LsaType import org.eclipse.tractusx.bpdm.gate.api.model.response.SharingStateDto import org.eclipse.tractusx.bpdm.gate.entity.SharingState import org.eclipse.tractusx.bpdm.gate.repository.SharingStateRepository +import org.eclipse.tractusx.bpdm.gate.repository.SharingStateRepository.Specs.byBusinessPartnerType import org.eclipse.tractusx.bpdm.gate.repository.SharingStateRepository.Specs.byExternalIdsIn -import org.eclipse.tractusx.bpdm.gate.repository.SharingStateRepository.Specs.byLsaType import org.springframework.data.domain.PageRequest import org.springframework.data.jpa.domain.Specification import org.springframework.stereotype.Service @@ -36,7 +36,7 @@ class SharingStateService(private val stateRepository: SharingStateRepository) { fun upsertSharingState(request: SharingStateDto) { - val sharingState = this.stateRepository.findByExternalIdAndLsaType(request.externalId, request.lsaType) + val sharingState = this.stateRepository.findByExternalIdAndBusinessPartnerType(request.externalId, request.businessPartnerType) if (sharingState == null) { insertSharingState(request) } else { @@ -49,7 +49,7 @@ class SharingStateService(private val stateRepository: SharingStateRepository) { this.stateRepository.save( SharingState( externalId = dto.externalId, - lsaType = dto.lsaType, + businessPartnerType = dto.businessPartnerType, sharingStateType = dto.sharingStateType, sharingErrorCode = dto.sharingErrorCode, sharingErrorMessage = dto.sharingErrorMessage, @@ -72,16 +72,20 @@ class SharingStateService(private val stateRepository: SharingStateRepository) { this.stateRepository.save(entity) } - fun findSharingStates(paginationRequest: PaginationRequest, lsaType: LsaType?, externalIds: Collection?): PageDto { + fun findSharingStates( + paginationRequest: PaginationRequest, + businessPartnerType: BusinessPartnerType?, + externalIds: Collection? + ): PageDto { - val spec = Specification.allOf(byLsaType(lsaType), byExternalIdsIn(externalIds)) + val spec = Specification.allOf(byBusinessPartnerType(businessPartnerType), byExternalIdsIn(externalIds)) val pageRequest = PageRequest.of(paginationRequest.page, paginationRequest.size) val page = stateRepository.findAll(spec, pageRequest) return page.toDto(page.content.map { SharingStateDto( externalId = it.externalId, - lsaType = it.lsaType, + businessPartnerType = it.businessPartnerType, sharingStateType = it.sharingStateType, sharingErrorCode = it.sharingErrorCode, sharingErrorMessage = it.sharingErrorMessage, diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SitePersistenceService.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SitePersistenceService.kt index 4d49bde8c..83eaccc74 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SitePersistenceService.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SitePersistenceService.kt @@ -19,10 +19,10 @@ package org.eclipse.tractusx.bpdm.gate.service +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.common.exception.BpdmNotFoundException import org.eclipse.tractusx.bpdm.common.model.OutputInputEnum import org.eclipse.tractusx.bpdm.common.util.replace -import org.eclipse.tractusx.bpdm.gate.api.model.LsaType import org.eclipse.tractusx.bpdm.gate.api.model.SharingStateType import org.eclipse.tractusx.bpdm.gate.api.model.request.SiteGateInputRequest import org.eclipse.tractusx.bpdm.gate.api.model.request.SiteGateOutputRequest @@ -75,8 +75,8 @@ class SitePersistenceService( //Creates Changelog For both Site and Logistic Address when they are created or updated private fun saveChangelog(externalId: String, outputInputEnum: OutputInputEnum) { - changelogRepository.save(ChangelogEntry(getMainAddressForSiteExternalId(externalId), LsaType.ADDRESS, outputInputEnum)) - changelogRepository.save(ChangelogEntry(externalId, LsaType.SITE, outputInputEnum)) + changelogRepository.save(ChangelogEntry(getMainAddressForSiteExternalId(externalId), BusinessPartnerType.ADDRESS, outputInputEnum)) + changelogRepository.save(ChangelogEntry(externalId, BusinessPartnerType.SITE, outputInputEnum)) } private fun getAddressRecord(externalId: String, datatype: OutputInputEnum): LogisticAddress { diff --git a/bpdm-gate/src/main/resources/db/migration/V4_0_0_11__rename_lsatype.sql b/bpdm-gate/src/main/resources/db/migration/V4_0_0_11__rename_lsatype.sql new file mode 100644 index 000000000..d82226e71 --- /dev/null +++ b/bpdm-gate/src/main/resources/db/migration/V4_0_0_11__rename_lsatype.sql @@ -0,0 +1,4 @@ +alter table sharing_states + rename column lsa_type to business_partner_type; + +alter index uc_sharing_states_externalid_lsa_type rename to uc_sharing_states_externalid_business_partner_type; diff --git a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/ChangeLogControllerIT.kt b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/ChangeLogControllerIT.kt index 4936526a7..2184f963f 100644 --- a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/ChangeLogControllerIT.kt +++ b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/ChangeLogControllerIT.kt @@ -52,9 +52,9 @@ import org.eclipse.tractusx.bpdm.gate.api.model.response.ChangelogGateDto import org.eclipse.tractusx.bpdm.gate.api.model.response.ErrorInfo import org.eclipse.tractusx.bpdm.gate.entity.ChangelogEntry import org.eclipse.tractusx.bpdm.gate.util.* -import org.eclipse.tractusx.bpdm.gate.util.CommonValues.lsaTypeParam -import org.eclipse.tractusx.bpdm.gate.util.CommonValues.lsaTypeParamLegalEntity -import org.eclipse.tractusx.bpdm.gate.util.CommonValues.lsaTypeParamNotFound +import org.eclipse.tractusx.bpdm.gate.util.CommonValues.businessPartnerTypeParamAddress +import org.eclipse.tractusx.bpdm.gate.util.CommonValues.businessPartnerTypeParamLegalEntity +import org.eclipse.tractusx.bpdm.gate.util.CommonValues.businessPartnerTypeParamNotFound import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension @@ -104,7 +104,7 @@ internal class ChangeLogControllerIT @Autowired constructor( assertRecursively(searchResult.content) .ignoringFieldsMatchingRegexes(".*${ChangelogGateDto::modifiedAt.name}") - .isEqualTo(listOf(ChangelogGateDto(CommonValues.externalIdAddress1, lsaTypeParam, instant))) + .isEqualTo(listOf(ChangelogGateDto(CommonValues.externalIdAddress1, businessPartnerTypeParamAddress, instant))) } @@ -157,39 +157,39 @@ internal class ChangeLogControllerIT @Autowired constructor( assertRecursively(searchResult.content).ignoringFieldsMatchingRegexes(".*${ChangelogGateDto::modifiedAt.name}") - .isEqualTo(listOf(ChangelogGateDto(CommonValues.externalIdAddress1, lsaTypeParam, instant))) + .isEqualTo(listOf(ChangelogGateDto(CommonValues.externalIdAddress1, businessPartnerTypeParamAddress, instant))) } /** - * Given a lsaType a changeLog exists in database - * When getting changeLog by lsaType + * Given a businessPartnerType a changeLog exists in database + * When getting changeLog by businessPartnerType * Then changeLog mapped to the catena data model should be returned */ @Test - fun `get changeLog by lsaType`() { + fun `get changeLog by businessPartnerType`() { - val searchRequest = ChangeLogSearchRequest(lsaTypes = setOf(lsaTypeParam)) + val searchRequest = ChangeLogSearchRequest(businessPartnerType = setOf(businessPartnerTypeParamAddress)) val searchResult = gateClient.changelog().getInputChangelog(PaginationRequest(), searchRequest) assertRecursively(searchResult.content).ignoringFieldsMatchingRegexes(".*${ChangelogGateDto::modifiedAt.name}") .isEqualTo( listOf( - ChangelogGateDto(CommonValues.legalEntityAddressId, lsaTypeParam, instant), - ChangelogGateDto(CommonValues.externalIdAddress1, lsaTypeParam, instant) + ChangelogGateDto(CommonValues.legalEntityAddressId, businessPartnerTypeParamAddress, instant), + ChangelogGateDto(CommonValues.externalIdAddress1, businessPartnerTypeParamAddress, instant) ) ) } /** - * Given lsaType does not exist in database - * When getting changeLog by lsaType + * Given businessPartnerType does not exist in database + * When getting changeLog by businessPartnerType * Then changeLog mapped to the catena data model should not be returned */ @Test - fun `get changeLog by lsaType not found`() { - val searchRequest = ChangeLogSearchRequest(lsaTypes = setOf(lsaTypeParamNotFound)) + fun `get changeLog by businessPartnerType not found`() { + val searchRequest = ChangeLogSearchRequest(businessPartnerType = setOf(businessPartnerTypeParamNotFound)) val searchResult = gateClient.changelog().getInputChangelog(PaginationRequest(), searchRequest) @@ -198,21 +198,21 @@ internal class ChangeLogControllerIT @Autowired constructor( } /** - * Given lsaType and timestamp a changeLog exist in database - * When getting changeLog by lsaType and timestamp + * Given businessPartnerType and timestamp a changeLog exist in database + * When getting changeLog by businessPartnerType and timestamp * Then changeLog mapped to the catena data model should be returned */ @Test - fun `get changeLog by lsaType and timeStamp`() { - val searchRequest = ChangeLogSearchRequest(lsaTypes = setOf(lsaTypeParam), fromTime = instant) + fun `get changeLog by businessPartnerType and timeStamp`() { + val searchRequest = ChangeLogSearchRequest(businessPartnerType = setOf(businessPartnerTypeParamAddress), fromTime = instant) val searchResult = gateClient.changelog().getInputChangelog(PaginationRequest(), searchRequest) assertRecursively(searchResult.content).ignoringFieldsMatchingRegexes(".*${ChangelogGateDto::modifiedAt.name}") .isEqualTo( listOf( - ChangelogGateDto(CommonValues.legalEntityAddressId, lsaTypeParam, instant), - ChangelogGateDto(CommonValues.externalIdAddress1, lsaTypeParam, instant) + ChangelogGateDto(CommonValues.legalEntityAddressId, businessPartnerTypeParamAddress, instant), + ChangelogGateDto(CommonValues.externalIdAddress1, businessPartnerTypeParamAddress, instant) ) ) } @@ -225,16 +225,16 @@ internal class ChangeLogControllerIT @Autowired constructor( @Test fun `get changeLog from timeStamp`() { - val searchRequest = ChangeLogSearchRequest(lsaTypes = emptySet(), fromTime = instant) + val searchRequest = ChangeLogSearchRequest(businessPartnerType = emptySet(), fromTime = instant) val searchResult = gateClient.changelog().getInputChangelog(paginationRequest = PaginationRequest(), searchRequest) assertRecursively(searchResult.content).ignoringFieldsMatchingRegexes(".*${ChangelogGateDto::modifiedAt.name}") .isEqualTo( listOf( - ChangelogGateDto(CommonValues.legalEntityAddressId, lsaTypeParam, instant), - ChangelogGateDto(CommonValues.externalId1, lsaTypeParamLegalEntity, instant), - ChangelogGateDto(CommonValues.externalIdAddress1, lsaTypeParam, instant) + ChangelogGateDto(CommonValues.legalEntityAddressId, businessPartnerTypeParamAddress, instant), + ChangelogGateDto(CommonValues.externalId1, businessPartnerTypeParamLegalEntity, instant), + ChangelogGateDto(CommonValues.externalIdAddress1, businessPartnerTypeParamAddress, instant) ) ) } diff --git a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/SharingStateControllerIT.kt b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/SharingStateControllerIT.kt index a30156622..fe5fb7c33 100644 --- a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/SharingStateControllerIT.kt +++ b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/SharingStateControllerIT.kt @@ -20,11 +20,11 @@ package org.eclipse.tractusx.bpdm.gate.controller import org.assertj.core.api.Assertions.assertThat +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest import org.eclipse.tractusx.bpdm.gate.api.client.GateClient import org.eclipse.tractusx.bpdm.gate.api.exception.BusinessPartnerSharingError import org.eclipse.tractusx.bpdm.gate.api.exception.BusinessPartnerSharingError.* -import org.eclipse.tractusx.bpdm.gate.api.model.LsaType import org.eclipse.tractusx.bpdm.gate.api.model.SharingStateType import org.eclipse.tractusx.bpdm.gate.api.model.response.SharingStateDto import org.eclipse.tractusx.bpdm.gate.util.DbTestHelpers @@ -54,36 +54,36 @@ class SharingStateControllerIT @Autowired constructor( @Test fun `insert and get sharing states `() { - val stateAddress = insertSharingStateSuccess(LsaType.ADDRESS, externalId = "exIdAddress") - val stateSite = insertSharingStateSuccess(LsaType.SITE, externalId = "exIdSite") - val stateLegalEntity1 = insertSharingStateSuccess(LsaType.LEGAL_ENTITY, externalId = "exIdEntity1") - val stateLegalEntity2 = insertSharingStateSuccess(LsaType.LEGAL_ENTITY, externalId = "exIdEntity2") - insertSharingStateSuccess(LsaType.ADDRESS, externalId = "exIdMultiple") - insertSharingStateSuccess(LsaType.SITE, externalId = "exIdMultiple") - insertSharingStateSuccess(LsaType.LEGAL_ENTITY, externalId = "exIdMultiple") + val stateAddress = insertSharingStateSuccess(BusinessPartnerType.ADDRESS, externalId = "exIdAddress") + val stateSite = insertSharingStateSuccess(BusinessPartnerType.SITE, externalId = "exIdSite") + val stateLegalEntity1 = insertSharingStateSuccess(BusinessPartnerType.LEGAL_ENTITY, externalId = "exIdEntity1") + val stateLegalEntity2 = insertSharingStateSuccess(BusinessPartnerType.LEGAL_ENTITY, externalId = "exIdEntity2") + insertSharingStateSuccess(BusinessPartnerType.ADDRESS, externalId = "exIdMultiple") + insertSharingStateSuccess(BusinessPartnerType.SITE, externalId = "exIdMultiple") + insertSharingStateSuccess(BusinessPartnerType.LEGAL_ENTITY, externalId = "exIdMultiple") - val searchAddressById = readSharingStates(LsaType.ADDRESS, "exIdAddress") + val searchAddressById = readSharingStates(BusinessPartnerType.ADDRESS, "exIdAddress") assertThat(searchAddressById).hasSize(1) assertThat(searchAddressById.first()).isEqualTo(stateAddress) - val searchSitesById = readSharingStates(LsaType.SITE, "exIdSite") + val searchSitesById = readSharingStates(BusinessPartnerType.SITE, "exIdSite") assertThat(searchSitesById).hasSize(1) assertThat(searchSitesById.first()).isEqualTo(stateSite) - val searchAddressWrongId = readSharingStates(LsaType.ADDRESS, "exIdEntity") + val searchAddressWrongId = readSharingStates(BusinessPartnerType.ADDRESS, "exIdEntity") assertThat(searchAddressWrongId).hasSize(0) - val searchEntityMultiple = readSharingStates(LsaType.LEGAL_ENTITY, "exIdEntity1", "exIdEntity2") + val searchEntityMultiple = readSharingStates(BusinessPartnerType.LEGAL_ENTITY, "exIdEntity1", "exIdEntity2") assertThat(searchEntityMultiple).hasSize(2) - val searchEntitySingle = readSharingStates(LsaType.LEGAL_ENTITY, "exIdEntity2") + val searchEntitySingle = readSharingStates(BusinessPartnerType.LEGAL_ENTITY, "exIdEntity2") assertThat(searchEntitySingle).hasSize(1) assertThat(searchEntitySingle.first()).isEqualTo(stateLegalEntity2) val searchAll = readSharingStates(null) assertThat(searchAll).hasSize(7) - val searchEntityAllLegalEntities = readSharingStates(LsaType.LEGAL_ENTITY) + val searchEntityAllLegalEntities = readSharingStates(BusinessPartnerType.LEGAL_ENTITY) assertThat(searchEntityAllLegalEntities).hasSize(3) assertThat(searchEntityAllLegalEntities).extracting(SharingStateDto::externalId.name) .contains(stateLegalEntity1.externalId, stateLegalEntity2.externalId, "exIdMultiple") @@ -98,11 +98,11 @@ class SharingStateControllerIT @Autowired constructor( @Test fun `insert and get sharing states with error code`() { - val stateAddress1 = insertSharingStateError(LsaType.ADDRESS, externalId = "exIdAddress1", errorCode = SharingTimeout) - insertSharingStateError(LsaType.ADDRESS, externalId = "exIdAddress2", errorCode = SharingProcessError) - insertSharingStateError(LsaType.ADDRESS, externalId = "exIdAddress3", errorCode = BpnNotInPool) + val stateAddress1 = insertSharingStateError(BusinessPartnerType.ADDRESS, externalId = "exIdAddress1", errorCode = SharingTimeout) + insertSharingStateError(BusinessPartnerType.ADDRESS, externalId = "exIdAddress2", errorCode = SharingProcessError) + insertSharingStateError(BusinessPartnerType.ADDRESS, externalId = "exIdAddress3", errorCode = BpnNotInPool) - val searchAddress = readSharingStates(LsaType.ADDRESS, "exIdAddress1") + val searchAddress = readSharingStates(BusinessPartnerType.ADDRESS, "exIdAddress1") assertThat(searchAddress).hasSize(1) assertThat(searchAddress.first()).isEqualTo(stateAddress1) } @@ -110,11 +110,11 @@ class SharingStateControllerIT @Autowired constructor( @Test fun `insert and update states`() { - val stateAddress1 = insertSharingStateError(LsaType.ADDRESS, externalId = "exIdAddress1", errorCode = SharingTimeout) - insertSharingStateError(LsaType.ADDRESS, externalId = "exIdAddress2", errorCode = SharingProcessError) - insertSharingStateError(LsaType.ADDRESS, externalId = "exIdAddress3", errorCode = BpnNotInPool) + val stateAddress1 = insertSharingStateError(BusinessPartnerType.ADDRESS, externalId = "exIdAddress1", errorCode = SharingTimeout) + insertSharingStateError(BusinessPartnerType.ADDRESS, externalId = "exIdAddress2", errorCode = SharingProcessError) + insertSharingStateError(BusinessPartnerType.ADDRESS, externalId = "exIdAddress3", errorCode = BpnNotInPool) - val searchAddress = readSharingStates(LsaType.ADDRESS, "exIdAddress1") + val searchAddress = readSharingStates(BusinessPartnerType.ADDRESS, "exIdAddress1") assertThat(searchAddress).hasSize(1) assertThat(searchAddress.first()).isEqualTo(stateAddress1) @@ -128,7 +128,7 @@ class SharingStateControllerIT @Autowired constructor( gateClient.sharingState().upsertSharingState(updatedAddress1) - val readUpdatedAddress = readSharingStates(LsaType.ADDRESS, "exIdAddress1") + val readUpdatedAddress = readSharingStates(BusinessPartnerType.ADDRESS, "exIdAddress1") assertThat(readUpdatedAddress).hasSize(1) assertThat(readUpdatedAddress.first()).isEqualTo(updatedAddress1) } @@ -138,11 +138,11 @@ class SharingStateControllerIT @Autowired constructor( val startTime = LocalDateTime.now().withNano(0) val stateAddress1 = insertSharingStateSuccess( - lsaType = LsaType.ADDRESS, externalId = "exIdAddress1", + businessPartnerType = BusinessPartnerType.ADDRESS, externalId = "exIdAddress1", sharingProcessStarted = startTime ) - val readInsertedAddress = readSharingStates(LsaType.ADDRESS, "exIdAddress1") + val readInsertedAddress = readSharingStates(BusinessPartnerType.ADDRESS, "exIdAddress1") assertThat(readInsertedAddress.first().sharingProcessStarted).isEqualTo(startTime) val updatedWithEmpyStarted = stateAddress1.copy( @@ -152,7 +152,7 @@ class SharingStateControllerIT @Autowired constructor( ) gateClient.sharingState().upsertSharingState(updatedWithEmpyStarted) - val readUpdatedAddress = readSharingStates(LsaType.ADDRESS, "exIdAddress1") + val readUpdatedAddress = readSharingStates(BusinessPartnerType.ADDRESS, "exIdAddress1") assertThat(readUpdatedAddress.first().sharingStateType).isEqualTo(SharingStateType.Error) assertThat(readUpdatedAddress.first().sharingProcessStarted).isEqualTo(startTime).describedAs("Update with null - sharingProcessStarted not changed ") assertThat(readUpdatedAddress.first().sharingErrorMessage).isEqualTo("Changed") @@ -162,10 +162,10 @@ class SharingStateControllerIT @Autowired constructor( /** * Insert Sharing State only with required fields filled */ - fun insertSharingStateSuccess(lsaType: LsaType, externalId: String, sharingProcessStarted: LocalDateTime? = null): SharingStateDto { + fun insertSharingStateSuccess(businessPartnerType: BusinessPartnerType, externalId: String, sharingProcessStarted: LocalDateTime? = null): SharingStateDto { val newState = SharingStateDto( - lsaType = lsaType, + businessPartnerType = businessPartnerType, externalId = externalId, sharingStateType = SharingStateType.Success, sharingErrorCode = null, @@ -180,24 +180,24 @@ class SharingStateControllerIT @Autowired constructor( /** * Insert Sharing State with all Fields Field */ - fun insertSharingStateError(lsaType: LsaType, externalId: String, errorCode: BusinessPartnerSharingError): SharingStateDto { + fun insertSharingStateError(businessPartnerType: BusinessPartnerType, externalId: String, errorCode: BusinessPartnerSharingError): SharingStateDto { val newState = SharingStateDto( - lsaType = lsaType, + businessPartnerType = businessPartnerType, externalId = externalId, sharingStateType = SharingStateType.Error, sharingErrorCode = errorCode, sharingProcessStarted = LocalDateTime.now().withNano(0), - sharingErrorMessage = "Error in $lsaType with external id $externalId", + sharingErrorMessage = "Error in $businessPartnerType with external id $externalId", bpn = "BPN" + externalId ) gateClient.sharingState().upsertSharingState(newState) return newState } - fun readSharingStates(lsaType: LsaType?, vararg externalIds: String): Collection { + fun readSharingStates(businessPartnerType: BusinessPartnerType?, vararg externalIds: String): Collection { - return gateClient.sharingState().getSharingStates(PaginationRequest(), lsaType, externalIds.asList()).content + return gateClient.sharingState().getSharingStates(PaginationRequest(), businessPartnerType, externalIds.asList()).content } 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 6ac7e37c7..eacce7a22 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 @@ -21,13 +21,12 @@ package org.eclipse.tractusx.bpdm.gate.util import com.neovisionaries.i18n.CountryCode import com.neovisionaries.i18n.LanguageCode +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.common.dto.response.RegionDto 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.NameType -import org.eclipse.tractusx.bpdm.gate.api.model.LsaType -import org.eclipse.tractusx.bpdm.gate.api.model.OptionalLsaType import java.time.Instant import java.time.LocalDateTime @@ -44,10 +43,9 @@ object CommonValues { const val externalId4 = "external-4" const val externalId5 = "external-5" - val lsaTypeParam = LsaType.ADDRESS - val lsaTypeParamLegalEntity = LsaType.LEGAL_ENTITY - val lsaTypeParamNotFound = LsaType.SITE - val lsaNone = OptionalLsaType.None + val businessPartnerTypeParamAddress = BusinessPartnerType.ADDRESS + val businessPartnerTypeParamLegalEntity = BusinessPartnerType.LEGAL_ENTITY + val businessPartnerTypeParamNotFound = BusinessPartnerType.SITE const val externalIdSite1 = "site-external-1" const val externalIdSite2 = "site-external-2" diff --git a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/PoolMetadataApi.kt b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/PoolMetadataApi.kt index d74273566..cae636a4e 100644 --- a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/PoolMetadataApi.kt +++ b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/PoolMetadataApi.kt @@ -26,7 +26,7 @@ import io.swagger.v3.oas.annotations.media.Content import io.swagger.v3.oas.annotations.responses.ApiResponse import io.swagger.v3.oas.annotations.responses.ApiResponses import org.eclipse.tractusx.bpdm.common.dto.FieldQualityRuleDto -import org.eclipse.tractusx.bpdm.common.dto.IdentifierLsaType +import org.eclipse.tractusx.bpdm.common.dto.IdentifierBusinessPartnerType import org.eclipse.tractusx.bpdm.common.dto.IdentifierTypeDto import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest import org.eclipse.tractusx.bpdm.common.dto.response.LegalFormDto @@ -48,7 +48,7 @@ interface PoolMetadataApi { companion object DescriptionObject { const val technicalKeyDisclaimer = - "The technical key can be freely chosen but needs to be unique for the lsaType as it is used as reference by the business partner records. " + + "The technical key can be freely chosen but needs to be unique for the businessPartnerType as it is used as reference by the business partner records. " + "A recommendation for technical keys: They should be short, descriptive and " + "use a restricted common character set in order to ensure compatibility with older systems." } @@ -71,7 +71,7 @@ interface PoolMetadataApi { fun createIdentifierType(@RequestBody identifierType: IdentifierTypeDto): IdentifierTypeDto @Operation( - summary = "Get page of identifier types filtered by lsaType and (optionally) country (specified by its ISO 3166-1 alpha-2 country code)", + summary = "Get page of identifier types filtered by businessPartnerType and (optionally) country (specified by its ISO 3166-1 alpha-2 country code)", description = "Lists all matching identifier types including validity details in a paginated result" ) @ApiResponses( @@ -84,7 +84,7 @@ interface PoolMetadataApi { @GetExchange("/identifier-types") fun getIdentifierTypes( @ParameterObject paginationRequest: PaginationRequest, - @Parameter lsaType: IdentifierLsaType, + @Parameter businessPartnerType: IdentifierBusinessPartnerType, @Parameter country: CountryCode? ): PageDto diff --git a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/ChangelogSubject.kt b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/ChangelogSubject.kt deleted file mode 100644 index 004d72939..000000000 --- a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/ChangelogSubject.kt +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * 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.pool.api.model -enum class ChangelogSubject { - LEGAL_ENTITY, - ADDRESS, - SITE -} \ No newline at end of file diff --git a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/request/ChangelogSearchRequest.kt b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/request/ChangelogSearchRequest.kt index fdabfb0e0..c3d4aa90c 100644 --- a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/request/ChangelogSearchRequest.kt +++ b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/request/ChangelogSearchRequest.kt @@ -20,7 +20,7 @@ package org.eclipse.tractusx.bpdm.pool.api.model.request import io.swagger.v3.oas.annotations.media.Schema -import org.eclipse.tractusx.bpdm.pool.api.model.ChangelogSubject +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import java.time.Instant @@ -28,8 +28,10 @@ import java.time.Instant data class ChangelogSearchRequest( @Schema(description = "Changelog entries should be created after this time", example = "2023-03-20T10:23:28.194Z") val fromTime: Instant? = null, + @Schema(description = "Only show changelog entries for business partners with the given BPNs. Empty means no restriction.") val bpns: Set? = null, + @Schema(description = "Only show changelog entries for business partners with the given LSA types. Empty means no restriction.") - val lsaTypes: Set? = null + val businessPartnerTypes: Set? = null ) diff --git a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/request/IdentifiersSearchRequest.kt b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/request/IdentifiersSearchRequest.kt index d4bc43cad..c0ae08883 100644 --- a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/request/IdentifiersSearchRequest.kt +++ b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/request/IdentifiersSearchRequest.kt @@ -20,12 +20,13 @@ package org.eclipse.tractusx.bpdm.pool.api.model.request import io.swagger.v3.oas.annotations.media.Schema -import org.eclipse.tractusx.bpdm.common.dto.IdentifierLsaType +import org.eclipse.tractusx.bpdm.common.dto.IdentifierBusinessPartnerType @Schema(name = "IdentifiersSearchRequest", description = "Contains identifiers to search legal entities by") data class IdentifiersSearchRequest( + @Schema(description = "Legal entities (L) or addresses (A)") - val lsaType: IdentifierLsaType, + val businessPartnerType: IdentifierBusinessPartnerType, @Schema(description = "Technical key of the type to which the identifiers belongs to") val idType: String, diff --git a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/ChangelogEntryVerboseDto.kt b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/ChangelogEntryVerboseDto.kt index e1986226b..132df0103 100644 --- a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/ChangelogEntryVerboseDto.kt +++ b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/ChangelogEntryVerboseDto.kt @@ -20,7 +20,7 @@ package org.eclipse.tractusx.bpdm.pool.api.model.response import io.swagger.v3.oas.annotations.media.Schema -import org.eclipse.tractusx.bpdm.pool.api.model.ChangelogSubject +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.pool.api.model.ChangelogType import java.time.Instant @@ -37,5 +37,5 @@ data class ChangelogEntryVerboseDto( val timestamp: Instant, @Schema(description = "The type of the business partner this change refers to") - val lsaType: ChangelogSubject + val businessPartnerType: BusinessPartnerType ) diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/OpenSearchSyncPageService.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/OpenSearchSyncPageService.kt index 6758da36e..3a69f1228 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/OpenSearchSyncPageService.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/component/opensearch/impl/service/OpenSearchSyncPageService.kt @@ -20,7 +20,7 @@ package org.eclipse.tractusx.bpdm.pool.component.opensearch.impl.service import mu.KotlinLogging -import org.eclipse.tractusx.bpdm.pool.api.model.ChangelogSubject +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.pool.component.opensearch.impl.doc.AddressPartnerDoc import org.eclipse.tractusx.bpdm.pool.component.opensearch.impl.repository.AddressPartnerDocRepository import org.eclipse.tractusx.bpdm.pool.component.opensearch.impl.repository.LegalEntityDocRepository @@ -48,10 +48,15 @@ class OpenSearchSyncPageService( fun exportPartnersToOpenSearch(fromTime: Instant, pageIndex: Int, pageSize: Int): Page { logger.debug { "Export page $pageIndex" } val changelogEntriesPage = - changelogService.getChangelogEntriesCreatedAfter(fromTime, listOf(ChangelogSubject.LEGAL_ENTITY, ChangelogSubject.ADDRESS), pageIndex, pageSize) - val changelogEntriesBySubject = changelogEntriesPage.groupBy { it.changelogSubject } + changelogService.getChangelogEntriesCreatedAfter( + fromTime, + listOf(BusinessPartnerType.LEGAL_ENTITY, BusinessPartnerType.ADDRESS), + pageIndex, + pageSize + ) + val changelogEntriesBySubject = changelogEntriesPage.groupBy { it.businessPartnerType } - val legalEntityBpns = changelogEntriesBySubject[ChangelogSubject.LEGAL_ENTITY]?.map { it.bpn }?.toSet() + val legalEntityBpns = changelogEntriesBySubject[BusinessPartnerType.LEGAL_ENTITY]?.map { it.bpn }?.toSet() if (!legalEntityBpns.isNullOrEmpty()) { val legalEntitiesToExport = legalEntityRepository.findDistinctByBpnIn(legalEntityBpns) logger.debug { "Exporting ${legalEntitiesToExport.size} legal entity records" } @@ -59,7 +64,7 @@ class OpenSearchSyncPageService( legalEntityDocRepository.saveAll(partnerDocs) } - val addressBpns = changelogEntriesBySubject[ChangelogSubject.ADDRESS]?.map { it.bpn }?.toSet() + val addressBpns = changelogEntriesBySubject[BusinessPartnerType.ADDRESS]?.map { it.bpn }?.toSet() if (!addressBpns.isNullOrEmpty()) { val addressesToExport = logisticAddressRepository.findDistinctByBpnIn(addressBpns) logger.debug { "Exporting ${addressesToExport.size} address records" } diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/controller/BpnController.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/controller/BpnController.kt index 1aa1d006e..379c4ed79 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/controller/BpnController.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/controller/BpnController.kt @@ -41,7 +41,7 @@ class BpnController( if (request.idValues.size > controllerConfigProperties.searchRequestLimit) { return ResponseEntity(HttpStatus.BAD_REQUEST) } - val bpnIdentifierMappings = businessPartnerFetchService.findBpnsByIdentifiers(request.idType, request.lsaType, request.idValues) + val bpnIdentifierMappings = businessPartnerFetchService.findBpnsByIdentifiers(request.idType, request.businessPartnerType, request.idValues) return ResponseEntity(bpnIdentifierMappings, HttpStatus.OK) } } diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/controller/ChangelogController.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/controller/ChangelogController.kt index 945b4261c..2d60e13a4 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/controller/ChangelogController.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/controller/ChangelogController.kt @@ -50,7 +50,7 @@ class ChangelogController( return partnerChangelogService.getChangeLogEntries( changelogSearchRequest.bpns, - changelogSearchRequest.lsaTypes, + changelogSearchRequest.businessPartnerTypes, changelogSearchRequest.fromTime, paginationRequest.page, paginationRequest.size diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/controller/MetadataController.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/controller/MetadataController.kt index 04e35d987..31d7270aa 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/controller/MetadataController.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/controller/MetadataController.kt @@ -21,7 +21,7 @@ package org.eclipse.tractusx.bpdm.pool.controller import com.neovisionaries.i18n.CountryCode import org.eclipse.tractusx.bpdm.common.dto.FieldQualityRuleDto -import org.eclipse.tractusx.bpdm.common.dto.IdentifierLsaType +import org.eclipse.tractusx.bpdm.common.dto.IdentifierBusinessPartnerType import org.eclipse.tractusx.bpdm.common.dto.IdentifierTypeDto import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest import org.eclipse.tractusx.bpdm.common.dto.response.LegalFormDto @@ -47,8 +47,12 @@ class MetadataController( } @PreAuthorize("hasAuthority(@poolSecurityConfigProperties.getReadMetaDataAsRole())") - override fun getIdentifierTypes(paginationRequest: PaginationRequest, lsaType: IdentifierLsaType, country: CountryCode?): PageDto { - return metadataService.getIdentifierTypes(PageRequest.of(paginationRequest.page, paginationRequest.size), lsaType, country) + override fun getIdentifierTypes( + paginationRequest: PaginationRequest, + businessPartnerType: IdentifierBusinessPartnerType, + country: CountryCode? + ): PageDto { + return metadataService.getIdentifierTypes(PageRequest.of(paginationRequest.page, paginationRequest.size), businessPartnerType, country) } @PreAuthorize("hasAuthority(@poolSecurityConfigProperties.getChangeMetaDataAsRole())") diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/dto/ChangelogEntryVerboseDto.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/dto/ChangelogEntryVerboseDto.kt index d748110d6..5bf698231 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/dto/ChangelogEntryVerboseDto.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/dto/ChangelogEntryVerboseDto.kt @@ -19,11 +19,11 @@ package org.eclipse.tractusx.bpdm.pool.dto -import org.eclipse.tractusx.bpdm.pool.api.model.ChangelogSubject +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.pool.api.model.ChangelogType data class ChangelogEntryVerboseDto( val bpn: String, val changelogType: ChangelogType, - val changelogSubject: ChangelogSubject + val businessPartnerType: BusinessPartnerType ) \ No newline at end of file diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/entity/IdentifierType.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/entity/IdentifierType.kt index a8feb8a09..6317ac6ed 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/entity/IdentifierType.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/entity/IdentifierType.kt @@ -20,24 +20,24 @@ package org.eclipse.tractusx.bpdm.pool.entity import jakarta.persistence.* -import org.eclipse.tractusx.bpdm.common.dto.IdentifierLsaType +import org.eclipse.tractusx.bpdm.common.dto.IdentifierBusinessPartnerType import org.eclipse.tractusx.bpdm.common.model.BaseEntity @Entity @Table( name = "identifier_types", uniqueConstraints = [UniqueConstraint( - name = "uc_identifier_types_technical_key_lsa_type", - columnNames = ["technical_key", "lsa_type"] + name = "uc_identifier_types_technical_key_business_partner_type", + columnNames = ["technical_key", "business_partner_type"] )] ) class IdentifierType( @Column(name = "technical_key", nullable = false) val technicalKey: String, - @Column(name = "lsa_type", nullable = false) + @Column(name = "business_partner_type", nullable = false) @Enumerated(EnumType.STRING) - val lsaType: IdentifierLsaType, + val businessPartnerType: IdentifierBusinessPartnerType, @Column(name = "name", nullable = false) val name: String, diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/entity/PartnerChangelogEntry.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/entity/PartnerChangelogEntry.kt index 3503f9228..aec7bf271 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/entity/PartnerChangelogEntry.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/entity/PartnerChangelogEntry.kt @@ -20,8 +20,8 @@ package org.eclipse.tractusx.bpdm.pool.entity import jakarta.persistence.* +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.common.model.BaseEntity -import org.eclipse.tractusx.bpdm.pool.api.model.ChangelogSubject import org.eclipse.tractusx.bpdm.pool.api.model.ChangelogType @Entity @@ -32,10 +32,8 @@ class PartnerChangelogEntry( val changelogType: ChangelogType, @Column(name = "bpn", nullable = false, updatable = false) val bpn: String, + @Enumerated(EnumType.STRING) - @Column(name = "changelog_subject", nullable = false, updatable = false) - val changelogSubject: ChangelogSubject + @Column(name = "business_partner_type", nullable = false, updatable = false) + val businessPartnerType: BusinessPartnerType ) : BaseEntity() - - - diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/repository/IdentifierTypeRepository.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/repository/IdentifierTypeRepository.kt index ae1186039..a8b5bcfdd 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/repository/IdentifierTypeRepository.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/repository/IdentifierTypeRepository.kt @@ -20,7 +20,7 @@ package org.eclipse.tractusx.bpdm.pool.repository import com.neovisionaries.i18n.CountryCode -import org.eclipse.tractusx.bpdm.common.dto.IdentifierLsaType +import org.eclipse.tractusx.bpdm.common.dto.IdentifierBusinessPartnerType import org.eclipse.tractusx.bpdm.pool.entity.IdentifierType import org.eclipse.tractusx.bpdm.pool.entity.IdentifierTypeDetail import org.springframework.data.jpa.domain.Specification @@ -32,9 +32,9 @@ interface IdentifierTypeRepository : PagingAndSortingRepository, CrudRepository, JpaSpecificationExecutor { object Specs { - fun byLsaType(lsaType: IdentifierLsaType) = + fun byBusinessPartnerType(businessPartnerType: IdentifierBusinessPartnerType) = Specification { root, _, builder -> - builder.equal(root.get(IdentifierType::lsaType.name), lsaType) + builder.equal(root.get(IdentifierType::businessPartnerType.name), businessPartnerType) } fun byCountry(countryCode: CountryCode?) = @@ -63,6 +63,6 @@ interface IdentifierTypeRepository : } } - fun findByLsaTypeAndTechnicalKey(lsaType: IdentifierLsaType, key: String): IdentifierType? - fun findByLsaTypeAndTechnicalKeyIn(lsaType: IdentifierLsaType, technicalKeys: Set): Set + fun findByBusinessPartnerTypeAndTechnicalKey(businessPartnerType: IdentifierBusinessPartnerType, key: String): IdentifierType? + fun findByBusinessPartnerTypeAndTechnicalKeyIn(businessPartnerType: IdentifierBusinessPartnerType, technicalKeys: Set): Set } \ No newline at end of file diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/repository/PartnerChangelogEntryRepository.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/repository/PartnerChangelogEntryRepository.kt index c913ddc77..4450a9ef4 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/repository/PartnerChangelogEntryRepository.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/repository/PartnerChangelogEntryRepository.kt @@ -19,7 +19,7 @@ package org.eclipse.tractusx.bpdm.pool.repository -import org.eclipse.tractusx.bpdm.pool.api.model.ChangelogSubject +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.pool.entity.PartnerChangelogEntry import org.springframework.data.domain.Page import org.springframework.data.domain.Pageable @@ -56,20 +56,20 @@ interface PartnerChangelogEntryRepository : JpaRepository?) = + fun byBusinessPartnerTypesIn(businessPartnerTypes: Set?) = Specification { root, _, _ -> - lsaTypes?.let { - if(lsaTypes.isNotEmpty()) - root.get(PartnerChangelogEntry::changelogSubject.name).`in`(lsaTypes.map { type -> type }) + businessPartnerTypes?.let { + if (businessPartnerTypes.isNotEmpty()) + root.get(PartnerChangelogEntry::businessPartnerType.name).`in`(businessPartnerTypes) else null } } } - fun findByCreatedAtAfterAndChangelogSubjectIn( + fun findByCreatedAtAfterAndBusinessPartnerTypeIn( createdAt: Instant, - changelogSubject: Collection, + businessPartnerType: Collection, pageable: Pageable ): Page } \ No newline at end of file diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BpnIssuingService.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BpnIssuingService.kt index e666a9881..0711392db 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BpnIssuingService.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BpnIssuingService.kt @@ -20,7 +20,7 @@ package org.eclipse.tractusx.bpdm.pool.service import mu.KotlinLogging -import org.eclipse.tractusx.bpdm.pool.api.model.ChangelogSubject +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.pool.config.BpnConfigProperties import org.eclipse.tractusx.bpdm.pool.entity.ConfigurationEntry import org.eclipse.tractusx.bpdm.pool.exception.BpnInvalidCounterValueException @@ -57,12 +57,12 @@ class BpnIssuingService( return issueBpns(count, bpnConfigProperties.siteChar, bpnConfigProperties.counterKeySites) } - fun translateToLsaType(bpn: String): ChangelogSubject?{ - return with(bpn){ - when{ - startsWith(bpnlPrefix) -> ChangelogSubject.LEGAL_ENTITY - startsWith(bpnsPrefix) -> ChangelogSubject.SITE - startsWith(bpnAPrefix) -> ChangelogSubject.ADDRESS + fun translateToBusinessPartnerType(bpn: String): BusinessPartnerType? { + return with(bpn) { + when { + startsWith(bpnlPrefix) -> BusinessPartnerType.LEGAL_ENTITY + startsWith(bpnsPrefix) -> BusinessPartnerType.SITE + startsWith(bpnAPrefix) -> BusinessPartnerType.ADDRESS else -> null } } 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 2bae09efb..da94ef1f1 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 @@ -22,7 +22,6 @@ package org.eclipse.tractusx.bpdm.pool.service import mu.KotlinLogging import org.eclipse.tractusx.bpdm.common.dto.* import org.eclipse.tractusx.bpdm.common.exception.BpdmNotFoundException -import org.eclipse.tractusx.bpdm.pool.api.model.ChangelogSubject import org.eclipse.tractusx.bpdm.pool.api.model.ChangelogType import org.eclipse.tractusx.bpdm.pool.api.model.request.* import org.eclipse.tractusx.bpdm.pool.api.model.response.* @@ -83,12 +82,12 @@ class BusinessPartnerBuildService( val legalEntities = requestsByLegalEntities.keys - changelogService.createChangelogEntries(legalEntities.map { ChangelogEntryVerboseDto(it.bpn, ChangelogType.CREATE, ChangelogSubject.LEGAL_ENTITY) }) + changelogService.createChangelogEntries(legalEntities.map { ChangelogEntryVerboseDto(it.bpn, ChangelogType.CREATE, BusinessPartnerType.LEGAL_ENTITY) }) changelogService.createChangelogEntries(legalEntities.map { ChangelogEntryVerboseDto( it.legalAddress.bpn, ChangelogType.CREATE, - ChangelogSubject.ADDRESS + BusinessPartnerType.ADDRESS ) }) @@ -127,8 +126,8 @@ class BusinessPartnerBuildService( val sites = requestsBySites.keys - changelogService.createChangelogEntries(sites.map { ChangelogEntryVerboseDto(it.bpn, ChangelogType.CREATE, ChangelogSubject.SITE) }) - changelogService.createChangelogEntries(sites.map { ChangelogEntryVerboseDto(it.mainAddress.bpn, ChangelogType.CREATE, ChangelogSubject.ADDRESS) }) + changelogService.createChangelogEntries(sites.map { ChangelogEntryVerboseDto(it.bpn, ChangelogType.CREATE, BusinessPartnerType.SITE) }) + changelogService.createChangelogEntries(sites.map { ChangelogEntryVerboseDto(it.mainAddress.bpn, ChangelogType.CREATE, BusinessPartnerType.ADDRESS) }) siteRepository.saveAll(sites) @@ -145,8 +144,11 @@ class BusinessPartnerBuildService( val errors = errorsByRequest.flatMap { it.value } val validRequests = requests.filterNot { errorsByRequest.containsKey(it) } - fun isLegalEntityRequest(request: AddressPartnerCreateRequest) = bpnIssuingService.translateToLsaType(request.bpnParent) == ChangelogSubject.LEGAL_ENTITY - fun isSiteRequest(request: AddressPartnerCreateRequest) = bpnIssuingService.translateToLsaType(request.bpnParent) == ChangelogSubject.SITE + fun isLegalEntityRequest(request: AddressPartnerCreateRequest) = + bpnIssuingService.translateToBusinessPartnerType(request.bpnParent) == BusinessPartnerType.LEGAL_ENTITY + + fun isSiteRequest(request: AddressPartnerCreateRequest) = + bpnIssuingService.translateToBusinessPartnerType(request.bpnParent) == BusinessPartnerType.SITE val legalEntityRequests = validRequests.filter { isLegalEntityRequest(it) } val siteRequests = validRequests.filter { isSiteRequest(it) } @@ -160,7 +162,7 @@ class BusinessPartnerBuildService( ChangelogEntryVerboseDto( it.address.bpna, ChangelogType.CREATE, - ChangelogSubject.ADDRESS + BusinessPartnerType.ADDRESS ) }) @@ -185,12 +187,12 @@ class BusinessPartnerBuildService( val legalEntities = legalEntityRepository.findDistinctByBpnIn(bpnsToFetch) businessPartnerFetchService.fetchDependenciesWithLegalAddress(legalEntities) - changelogService.createChangelogEntries(legalEntities.map { ChangelogEntryVerboseDto(it.bpn, ChangelogType.UPDATE, ChangelogSubject.LEGAL_ENTITY) }) + changelogService.createChangelogEntries(legalEntities.map { ChangelogEntryVerboseDto(it.bpn, ChangelogType.UPDATE, BusinessPartnerType.LEGAL_ENTITY) }) changelogService.createChangelogEntries(legalEntities.map { ChangelogEntryVerboseDto( it.legalAddress.bpn, ChangelogType.UPDATE, - ChangelogSubject.ADDRESS + BusinessPartnerType.ADDRESS ) }) @@ -220,11 +222,11 @@ class BusinessPartnerBuildService( val bpnsToFetch = validRequests.map { it.bpns } val sites = siteRepository.findDistinctByBpnIn(bpnsToFetch) - changelogService.createChangelogEntries(sites.map { ChangelogEntryVerboseDto(it.bpn, ChangelogType.UPDATE, ChangelogSubject.SITE) }) - changelogService.createChangelogEntries(sites.map { ChangelogEntryVerboseDto(it.mainAddress.bpn, ChangelogType.UPDATE, ChangelogSubject.ADDRESS) }) + changelogService.createChangelogEntries(sites.map { ChangelogEntryVerboseDto(it.bpn, ChangelogType.UPDATE, BusinessPartnerType.SITE) }) + changelogService.createChangelogEntries(sites.map { ChangelogEntryVerboseDto(it.mainAddress.bpn, ChangelogType.UPDATE, BusinessPartnerType.ADDRESS) }) val requestByBpnMap = validRequests.associateBy { it.bpns } - val updatedSites = sites.map { + val updatedSites = sites.map { val request = requestByBpnMap[it.bpn]!! updateSite(it, request.site) updateLogisticAddress(it.mainAddress, request.site.mainAddress, addressMetadataMap) @@ -246,7 +248,7 @@ class BusinessPartnerBuildService( val addresses = logisticAddressRepository.findDistinctByBpnIn(validRequests.map { it.bpna }) val metadataMap = metadataService.getMetadata(validRequests.map { it.address }).toMapping() - changelogService.createChangelogEntries(addresses.map { ChangelogEntryVerboseDto(it.bpn, ChangelogType.UPDATE, ChangelogSubject.ADDRESS) }) + changelogService.createChangelogEntries(addresses.map { ChangelogEntryVerboseDto(it.bpn, ChangelogType.UPDATE, BusinessPartnerType.ADDRESS) }) val requestsByBpn = validRequests.associateBy { it.bpna } val updatedAddresses = addresses.map{ address -> diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerFetchService.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerFetchService.kt index dcc50b8f6..dd685b741 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerFetchService.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerFetchService.kt @@ -19,7 +19,7 @@ package org.eclipse.tractusx.bpdm.pool.service -import org.eclipse.tractusx.bpdm.common.dto.IdentifierLsaType +import org.eclipse.tractusx.bpdm.common.dto.IdentifierBusinessPartnerType import org.eclipse.tractusx.bpdm.common.dto.response.PoolLegalEntityVerboseDto import org.eclipse.tractusx.bpdm.common.exception.BpdmNotFoundException import org.eclipse.tractusx.bpdm.pool.api.model.response.BpnIdentifierMappingDto @@ -81,11 +81,15 @@ class BusinessPartnerFetchService( * Find bpn to identifier value mappings by [idValues] of [identifierTypeKey] */ @Transactional - fun findBpnsByIdentifiers(identifierTypeKey: String, lsaType: IdentifierLsaType, idValues: Collection): Set { - val identifierType = findIdentifierTypeOrThrow(identifierTypeKey, lsaType) - return when (lsaType) { - IdentifierLsaType.LEGAL_ENTITY -> legalEntityIdentifierRepository.findBpnsByIdentifierTypeAndValues(identifierType, idValues) - IdentifierLsaType.ADDRESS -> addressIdentifierRepository.findBpnsByIdentifierTypeAndValues(identifierType, idValues) + fun findBpnsByIdentifiers( + identifierTypeKey: String, + businessPartnerType: IdentifierBusinessPartnerType, + idValues: Collection + ): Set { + val identifierType = findIdentifierTypeOrThrow(identifierTypeKey, businessPartnerType) + return when (businessPartnerType) { + IdentifierBusinessPartnerType.LEGAL_ENTITY -> legalEntityIdentifierRepository.findBpnsByIdentifierTypeAndValues(identifierType, idValues) + IdentifierBusinessPartnerType.ADDRESS -> addressIdentifierRepository.findBpnsByIdentifierTypeAndValues(identifierType, idValues) } } @@ -124,13 +128,13 @@ class BusinessPartnerFetchService( } fun findLegalEntityOrThrow(identifierTypeKey: String, identifierValue: String): LegalEntity { - val identifierType = findIdentifierTypeOrThrow(identifierTypeKey, IdentifierLsaType.LEGAL_ENTITY) + val identifierType = findIdentifierTypeOrThrow(identifierTypeKey, IdentifierBusinessPartnerType.LEGAL_ENTITY) return legalEntityRepository.findByIdentifierTypeAndValueIgnoreCase(identifierType, identifierValue) ?: throw BpdmNotFoundException("Identifier Value", identifierValue) } - private fun findIdentifierTypeOrThrow(identifierTypeKey: String, lsaType: IdentifierLsaType) = - identifierTypeRepository.findByLsaTypeAndTechnicalKey(lsaType, identifierTypeKey) - ?: throw BpdmNotFoundException(IdentifierType::class, "$identifierTypeKey/$lsaType") + private fun findIdentifierTypeOrThrow(identifierTypeKey: String, businessPartnerType: IdentifierBusinessPartnerType) = + identifierTypeRepository.findByBusinessPartnerTypeAndTechnicalKey(businessPartnerType, identifierTypeKey) + ?: throw BpdmNotFoundException(IdentifierType::class, "$identifierTypeKey/$businessPartnerType") } \ No newline at end of file diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/MetadataService.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/MetadataService.kt index 592e3b5c3..8d4fe4df9 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/MetadataService.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/MetadataService.kt @@ -54,13 +54,13 @@ class MetadataService( @Transactional fun createIdentifierType(type: IdentifierTypeDto): IdentifierTypeDto { - if (identifierTypeRepository.findByLsaTypeAndTechnicalKey(type.lsaType, type.technicalKey) != null) - throw BpdmAlreadyExists(IdentifierType::class.simpleName!!, "${type.technicalKey}/${type.lsaType}") + if (identifierTypeRepository.findByBusinessPartnerTypeAndTechnicalKey(type.businessPartnerType, type.technicalKey) != null) + throw BpdmAlreadyExists(IdentifierType::class.simpleName!!, "${type.technicalKey}/${type.businessPartnerType}") - logger.info { "Create new Identifier-Type with key ${type.technicalKey}, lsaType ${type.lsaType} and name ${type.name}" } + logger.info { "Create new Identifier-Type with key ${type.technicalKey}, businessPartnerType ${type.businessPartnerType} and name ${type.name}" } val entity = IdentifierType( technicalKey = type.technicalKey, - lsaType = type.lsaType, + businessPartnerType = type.businessPartnerType, name = type.name ) entity.details.addAll( @@ -69,9 +69,13 @@ class MetadataService( return identifierTypeRepository.save(entity).toDto() } - fun getIdentifierTypes(pageRequest: Pageable, lsaType: IdentifierLsaType, country: CountryCode? = null): PageDto { + fun getIdentifierTypes( + pageRequest: Pageable, + businessPartnerType: IdentifierBusinessPartnerType, + country: CountryCode? = null + ): PageDto { val spec = Specification.allOf( - IdentifierTypeRepository.Specs.byLsaType(lsaType), + IdentifierTypeRepository.Specs.byBusinessPartnerType(businessPartnerType), IdentifierTypeRepository.Specs.byCountry(country) ) val page = identifierTypeRepository.findAll(spec, pageRequest) @@ -137,7 +141,7 @@ class MetadataService( fun getMetadata(requests: Collection): LegalEntityMetadataDto { val idTypeKeys = requests.flatMap { it.identifiers }.map { it.type }.toSet() - val idTypes = identifierTypeRepository.findByLsaTypeAndTechnicalKeyIn(IdentifierLsaType.LEGAL_ENTITY, idTypeKeys) + val idTypes = identifierTypeRepository.findByBusinessPartnerTypeAndTechnicalKeyIn(IdentifierBusinessPartnerType.LEGAL_ENTITY, idTypeKeys) val legalFormKeys = requests.mapNotNull { it.legalForm }.toSet() val legalForms = legalFormRepository.findByTechnicalKeyIn(legalFormKeys) @@ -147,7 +151,7 @@ class MetadataService( fun getMetadata(requests: Collection): AddressMetadataDto { val idTypeKeys = requests.flatMap { it.identifiers }.map { it.type }.toSet() - val idTypes = identifierTypeRepository.findByLsaTypeAndTechnicalKeyIn(IdentifierLsaType.ADDRESS, idTypeKeys) + val idTypes = identifierTypeRepository.findByBusinessPartnerTypeAndTechnicalKeyIn(IdentifierBusinessPartnerType.ADDRESS, idTypeKeys) val regionKeys = requests.mapNotNull { it.physicalPostalAddress.areaPart.administrativeAreaLevel1 } .plus(requests.mapNotNull { it.alternativePostalAddress?.areaPart?.administrativeAreaLevel1 }) diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/PartnerChangelogService.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/PartnerChangelogService.kt index 833246c06..162c57f80 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/PartnerChangelogService.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/PartnerChangelogService.kt @@ -20,13 +20,13 @@ package org.eclipse.tractusx.bpdm.pool.service import mu.KotlinLogging +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.common.dto.response.PageDto -import org.eclipse.tractusx.bpdm.pool.api.model.ChangelogSubject import org.eclipse.tractusx.bpdm.pool.dto.ChangelogEntryVerboseDto import org.eclipse.tractusx.bpdm.pool.entity.PartnerChangelogEntry import org.eclipse.tractusx.bpdm.pool.repository.PartnerChangelogEntryRepository import org.eclipse.tractusx.bpdm.pool.repository.PartnerChangelogEntryRepository.Specs.byBpnsIn -import org.eclipse.tractusx.bpdm.pool.repository.PartnerChangelogEntryRepository.Specs.byLsaTypesIn +import org.eclipse.tractusx.bpdm.pool.repository.PartnerChangelogEntryRepository.Specs.byBusinessPartnerTypesIn import org.eclipse.tractusx.bpdm.pool.repository.PartnerChangelogEntryRepository.Specs.byUpdatedGreaterThan import org.springframework.data.domain.Page import org.springframework.data.domain.PageRequest @@ -57,31 +57,31 @@ class PartnerChangelogService( fun getChangelogEntriesCreatedAfter( fromTime: Instant, - changelogSubjectsFilter: Collection = ChangelogSubject.values().asList(), + businessPartnerTypesFilters: Collection = BusinessPartnerType.values().asList(), pageIndex: Int, pageSize: Int ): Page { - return partnerChangelogEntryRepository.findByCreatedAtAfterAndChangelogSubjectIn( + return partnerChangelogEntryRepository.findByCreatedAtAfterAndBusinessPartnerTypeIn( fromTime, - changelogSubjectsFilter, + businessPartnerTypesFilters, PageRequest.of(pageIndex, pageSize, Sort.by(PartnerChangelogEntry::createdAt.name).ascending()) ) } fun getChangeLogEntries( bpns: Set?, - lsaTypes: Set?, + businessPartnerTypes: Set?, fromTime: Instant?, pageIndex: Int, pageSize: Int ): PageDto { - val spec = Specification.allOf(byBpnsIn(bpns), byLsaTypesIn(lsaTypes), byUpdatedGreaterThan(fromTime)) + val spec = Specification.allOf(byBpnsIn(bpns), byBusinessPartnerTypesIn(businessPartnerTypes), byUpdatedGreaterThan(fromTime)) val pageRequest = PageRequest.of(pageIndex, pageSize, Sort.by(PartnerChangelogEntry::updatedAt.name).ascending()) val page = partnerChangelogEntryRepository.findAll(spec, pageRequest) return page.toDto(page.content.map { it.toDto() }) } private fun ChangelogEntryVerboseDto.toEntity(): PartnerChangelogEntry { - return PartnerChangelogEntry(this.changelogType, this.bpn, this.changelogSubject) + return PartnerChangelogEntry(this.changelogType, this.bpn, this.businessPartnerType) } } \ No newline at end of file diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/RequestValidationService.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/RequestValidationService.kt index 1f28fe907..9fafbc850 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/RequestValidationService.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/RequestValidationService.kt @@ -19,9 +19,9 @@ package org.eclipse.tractusx.bpdm.pool.service +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.common.dto.LegalEntityDto import org.eclipse.tractusx.bpdm.common.dto.LogisticAddressDto -import org.eclipse.tractusx.bpdm.pool.api.model.ChangelogSubject import org.eclipse.tractusx.bpdm.pool.api.model.request.* import org.eclipse.tractusx.bpdm.pool.api.model.response.* import org.eclipse.tractusx.bpdm.pool.dto.AddressMetadataDto @@ -182,13 +182,13 @@ class RequestValidationService( val mainAddressRequests = requests.map { it.address } val addressMetadata = metadataService.getMetadata(mainAddressRequests).toKeys() - val requestsWithParentType = requests.map { Pair(it, bpnIssuingService.translateToLsaType(it.bpnParent)) } + val requestsWithParentType = requests.map { Pair(it, bpnIssuingService.translateToBusinessPartnerType(it.bpnParent)) } val requestsByParentType = requestsWithParentType.groupBy({ it.second }, { it.first }) - val legalEntityParentBpns = requestsByParentType[ChangelogSubject.LEGAL_ENTITY]?.map { it.bpnParent } ?: emptyList() + val legalEntityParentBpns = requestsByParentType[BusinessPartnerType.LEGAL_ENTITY]?.map { it.bpnParent } ?: emptyList() val existingLegalEntities = legalEntityRepository.findDistinctByBpnIn(legalEntityParentBpns).map { it.bpn }.toSet() - val siteParentBpns = requestsByParentType[ChangelogSubject.SITE]?.map { it.bpnParent } ?: emptyList() + val siteParentBpns = requestsByParentType[BusinessPartnerType.SITE]?.map { it.bpnParent } ?: emptyList() val existingSites = siteRepository.findDistinctByBpnIn(siteParentBpns).map { it.bpn }.toSet() return requestsWithParentType.flatMap { (request, type) -> @@ -328,20 +328,20 @@ class RequestValidationService( private fun validateAddressParent( request: AddressPartnerCreateRequest, - type: ChangelogSubject?, + type: BusinessPartnerType?, existingLegalEntities: Set, existingSites: Set ) : Collection> { return when (type) { - ChangelogSubject.LEGAL_ENTITY -> validateParentBpnExists( + BusinessPartnerType.LEGAL_ENTITY -> validateParentBpnExists( request.bpnParent, request.index, existingLegalEntities, AddressCreateError.LegalEntityNotFound ) - ChangelogSubject.SITE -> validateParentBpnExists(request.bpnParent, request.index, existingSites, AddressCreateError.SiteNotFound) + BusinessPartnerType.SITE -> validateParentBpnExists(request.bpnParent, request.index, existingSites, AddressCreateError.SiteNotFound) else -> listOf(ErrorInfo(AddressCreateError.BpnNotValid, "Parent '${request.bpnParent}' is not a valid BPNL/BPNS", request.index)) } } 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 b15d26e12..1f56fc749 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 @@ -97,7 +97,7 @@ fun IdentifierType.toTypeKeyNameDto(): TypeKeyNameVerboseDto { } fun IdentifierType.toDto(): IdentifierTypeDto { - return IdentifierTypeDto(technicalKey, lsaType, name, + return IdentifierTypeDto(technicalKey, businessPartnerType, name, details.map { IdentifierTypeDetailDto(it.countryCode, it.mandatory) }) } @@ -281,7 +281,7 @@ fun SyncRecord.toDto(): SyncDto { } fun PartnerChangelogEntry.toDto(): ChangelogEntryVerboseDto { - return ChangelogEntryVerboseDto(bpn, changelogType, createdAt, changelogSubject) + return ChangelogEntryVerboseDto(bpn, changelogType, createdAt, businessPartnerType) } fun Region.toDto(): RegionDto { diff --git a/bpdm-pool/src/main/resources/db/migration/V4_0_0_6__rename_lsatype.sql b/bpdm-pool/src/main/resources/db/migration/V4_0_0_6__rename_lsatype.sql new file mode 100644 index 000000000..4bca84bad --- /dev/null +++ b/bpdm-pool/src/main/resources/db/migration/V4_0_0_6__rename_lsatype.sql @@ -0,0 +1,5 @@ +alter table identifier_types + rename column lsa_type to business_partner_type; + +alter table identifier_types + rename constraint uc_identifier_types_technical_key_lsa_type to uc_identifier_types_technical_key_business_partner_type; diff --git a/bpdm-pool/src/main/resources/db/migration/V4_0_0_7__rename_changelogsubject.sql b/bpdm-pool/src/main/resources/db/migration/V4_0_0_7__rename_changelogsubject.sql new file mode 100644 index 000000000..fcbed11c3 --- /dev/null +++ b/bpdm-pool/src/main/resources/db/migration/V4_0_0_7__rename_changelogsubject.sql @@ -0,0 +1,2 @@ +alter table partner_changelog_entries + rename column changelog_subject to business_partner_type; diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/BpnControllerIT.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/BpnControllerIT.kt index 14eb5ade5..59c7f3761 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/BpnControllerIT.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/BpnControllerIT.kt @@ -22,7 +22,7 @@ package org.eclipse.tractusx.bpdm.pool.controller import com.github.tomakehurst.wiremock.core.WireMockConfiguration import com.github.tomakehurst.wiremock.junit5.WireMockExtension import org.assertj.core.api.Assertions.assertThat -import org.eclipse.tractusx.bpdm.common.dto.IdentifierLsaType +import org.eclipse.tractusx.bpdm.common.dto.IdentifierBusinessPartnerType import org.eclipse.tractusx.bpdm.common.dto.LegalEntityIdentifierDto import org.eclipse.tractusx.bpdm.pool.Application import org.eclipse.tractusx.bpdm.pool.api.client.PoolClientImpl @@ -96,7 +96,7 @@ class BpnControllerIT @Autowired constructor( @Test fun `find bpns by identifiers, all found`() { val identifiersSearchRequest = - IdentifiersSearchRequest(IdentifierLsaType.LEGAL_ENTITY, identifierType, listOf(identifierValue1, identifierValue2)) + IdentifiersSearchRequest(IdentifierBusinessPartnerType.LEGAL_ENTITY, identifierType, listOf(identifierValue1, identifierValue2)) val bpnIdentifierMappings = poolClient.bpns().findBpnsByIdentifiers(identifiersSearchRequest).body @@ -111,7 +111,7 @@ class BpnControllerIT @Autowired constructor( @Test fun `find bpns by identifiers, only some found`() { val identifiersSearchRequest = - IdentifiersSearchRequest(IdentifierLsaType.LEGAL_ENTITY, identifierType, listOf(identifierValue1, "someNonexistentSaasId")) + IdentifiersSearchRequest(IdentifierBusinessPartnerType.LEGAL_ENTITY, identifierType, listOf(identifierValue1, "someNonexistentSaasId")) val bpnIdentifierMappings = poolClient.bpns().findBpnsByIdentifiers(identifiersSearchRequest).body @@ -126,7 +126,7 @@ class BpnControllerIT @Autowired constructor( @Test fun `find bpns by identifiers, bpn request limit exceeded`() { val identifiersSearchRequest = - IdentifiersSearchRequest(IdentifierLsaType.LEGAL_ENTITY, identifierType, listOf(identifierValue1, identifierValue2, identifierValue3)) + IdentifiersSearchRequest(IdentifierBusinessPartnerType.LEGAL_ENTITY, identifierType, listOf(identifierValue1, identifierValue2, identifierValue3)) testHelpers.`find bpns by identifiers, bpn request limit exceeded`(identifiersSearchRequest) } @@ -139,7 +139,7 @@ class BpnControllerIT @Autowired constructor( @Test fun `find bpns by nonexistent identifier type`() { val identifiersSearchRequest = - IdentifiersSearchRequest(IdentifierLsaType.LEGAL_ENTITY, "NONEXISTENT_IDENTIFIER_TYPE", listOf(identifierValue1)) + IdentifiersSearchRequest(IdentifierBusinessPartnerType.LEGAL_ENTITY, "NONEXISTENT_IDENTIFIER_TYPE", listOf(identifierValue1)) testHelpers.`find bpns by nonexistent identifier type`(identifiersSearchRequest) } diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/ChangelogControllerIT.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/ChangelogControllerIT.kt index ce24ee86b..f3c260e63 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/ChangelogControllerIT.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/ChangelogControllerIT.kt @@ -20,11 +20,11 @@ package org.eclipse.tractusx.bpdm.pool.controller import org.assertj.core.api.Assertions +import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest import org.eclipse.tractusx.bpdm.common.dto.response.PageDto import org.eclipse.tractusx.bpdm.pool.Application import org.eclipse.tractusx.bpdm.pool.api.client.PoolClientImpl -import org.eclipse.tractusx.bpdm.pool.api.model.ChangelogSubject import org.eclipse.tractusx.bpdm.pool.api.model.ChangelogType import org.eclipse.tractusx.bpdm.pool.api.model.request.ChangelogSearchRequest import org.eclipse.tractusx.bpdm.pool.api.model.response.ChangelogEntryVerboseDto @@ -89,14 +89,14 @@ class ChangelogControllerIT @Autowired constructor( //Log entry for the created legal entities and their legal addresses should be there val expectedChangelogEntries = listOf( - ChangelogEntryVerboseDto(bpnL1, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY), - ChangelogEntryVerboseDto(bpnL2, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY), - ChangelogEntryVerboseDto(bpnA1, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), - ChangelogEntryVerboseDto(bpnA2, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), - ChangelogEntryVerboseDto(bpnL1, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY), - ChangelogEntryVerboseDto(bpnL2, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY), - ChangelogEntryVerboseDto(bpnA1, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.ADDRESS), - ChangelogEntryVerboseDto(bpnA2, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.ADDRESS) + ChangelogEntryVerboseDto(bpnL1, ChangelogType.CREATE, timeAfterUpdate, BusinessPartnerType.LEGAL_ENTITY), + ChangelogEntryVerboseDto(bpnL2, ChangelogType.CREATE, timeAfterUpdate, BusinessPartnerType.LEGAL_ENTITY), + ChangelogEntryVerboseDto(bpnA1, ChangelogType.CREATE, timeAfterUpdate, BusinessPartnerType.ADDRESS), + ChangelogEntryVerboseDto(bpnA2, ChangelogType.CREATE, timeAfterUpdate, BusinessPartnerType.ADDRESS), + ChangelogEntryVerboseDto(bpnL1, ChangelogType.UPDATE, timeAfterUpdate, BusinessPartnerType.LEGAL_ENTITY), + ChangelogEntryVerboseDto(bpnL2, ChangelogType.UPDATE, timeAfterUpdate, BusinessPartnerType.LEGAL_ENTITY), + ChangelogEntryVerboseDto(bpnA1, ChangelogType.UPDATE, timeAfterUpdate, BusinessPartnerType.ADDRESS), + ChangelogEntryVerboseDto(bpnA2, ChangelogType.UPDATE, timeAfterUpdate, BusinessPartnerType.ADDRESS) ) val expectedChangelog = PageDto(expectedChangelogEntries.size.toLong(), 1, 0, expectedChangelogEntries.size, expectedChangelogEntries) @@ -148,16 +148,16 @@ class ChangelogControllerIT @Autowired constructor( //Log entry for the created sites and their main address should be there val expectedChangelogEntries = listOf( - ChangelogEntryVerboseDto(bpnL, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY), - ChangelogEntryVerboseDto(bpnS1, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.SITE), - ChangelogEntryVerboseDto(bpnS2, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.SITE), - ChangelogEntryVerboseDto(bpnLegalAddress, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), - ChangelogEntryVerboseDto(bpnMainAddress1, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), - ChangelogEntryVerboseDto(bpnMainAddress2, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), - ChangelogEntryVerboseDto(bpnS1, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.SITE), - ChangelogEntryVerboseDto(bpnS2, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.SITE), - ChangelogEntryVerboseDto(bpnMainAddress1, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.ADDRESS), - ChangelogEntryVerboseDto(bpnMainAddress2, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.ADDRESS) + ChangelogEntryVerboseDto(bpnL, ChangelogType.CREATE, timeAfterUpdate, BusinessPartnerType.LEGAL_ENTITY), + ChangelogEntryVerboseDto(bpnS1, ChangelogType.CREATE, timeAfterUpdate, BusinessPartnerType.SITE), + ChangelogEntryVerboseDto(bpnS2, ChangelogType.CREATE, timeAfterUpdate, BusinessPartnerType.SITE), + ChangelogEntryVerboseDto(bpnLegalAddress, ChangelogType.CREATE, timeAfterUpdate, BusinessPartnerType.ADDRESS), + ChangelogEntryVerboseDto(bpnMainAddress1, ChangelogType.CREATE, timeAfterUpdate, BusinessPartnerType.ADDRESS), + ChangelogEntryVerboseDto(bpnMainAddress2, ChangelogType.CREATE, timeAfterUpdate, BusinessPartnerType.ADDRESS), + ChangelogEntryVerboseDto(bpnS1, ChangelogType.UPDATE, timeAfterUpdate, BusinessPartnerType.SITE), + ChangelogEntryVerboseDto(bpnS2, ChangelogType.UPDATE, timeAfterUpdate, BusinessPartnerType.SITE), + ChangelogEntryVerboseDto(bpnMainAddress1, ChangelogType.UPDATE, timeAfterUpdate, BusinessPartnerType.ADDRESS), + ChangelogEntryVerboseDto(bpnMainAddress2, ChangelogType.UPDATE, timeAfterUpdate, BusinessPartnerType.ADDRESS) ) val expectedChangelog = PageDto(expectedChangelogEntries.size.toLong(), 1, 0, expectedChangelogEntries.size, expectedChangelogEntries) @@ -207,14 +207,14 @@ class ChangelogControllerIT @Autowired constructor( //Log entry for the created addresses including legal and main address val expectedChangelogEntries = listOf( - ChangelogEntryVerboseDto(bpnL, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY), - ChangelogEntryVerboseDto(bpnS1, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.SITE), - ChangelogEntryVerboseDto(bpnLegalAddress, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), - ChangelogEntryVerboseDto(bpnMainAddress, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), - ChangelogEntryVerboseDto(bpnA1, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), - ChangelogEntryVerboseDto(bpnA2, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), - ChangelogEntryVerboseDto(bpnA1, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.ADDRESS), - ChangelogEntryVerboseDto(bpnA2, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.ADDRESS) + ChangelogEntryVerboseDto(bpnL, ChangelogType.CREATE, timeAfterUpdate, BusinessPartnerType.LEGAL_ENTITY), + ChangelogEntryVerboseDto(bpnS1, ChangelogType.CREATE, timeAfterUpdate, BusinessPartnerType.SITE), + ChangelogEntryVerboseDto(bpnLegalAddress, ChangelogType.CREATE, timeAfterUpdate, BusinessPartnerType.ADDRESS), + ChangelogEntryVerboseDto(bpnMainAddress, ChangelogType.CREATE, timeAfterUpdate, BusinessPartnerType.ADDRESS), + ChangelogEntryVerboseDto(bpnA1, ChangelogType.CREATE, timeAfterUpdate, BusinessPartnerType.ADDRESS), + ChangelogEntryVerboseDto(bpnA2, ChangelogType.CREATE, timeAfterUpdate, BusinessPartnerType.ADDRESS), + ChangelogEntryVerboseDto(bpnA1, ChangelogType.UPDATE, timeAfterUpdate, BusinessPartnerType.ADDRESS), + ChangelogEntryVerboseDto(bpnA2, ChangelogType.UPDATE, timeAfterUpdate, BusinessPartnerType.ADDRESS) ) @@ -254,12 +254,12 @@ class ChangelogControllerIT @Autowired constructor( val timeAfterUpdate = Instant.now() val expectedEntriesFirstPage = listOf( - ChangelogEntryVerboseDto(bpnL1, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY), - ChangelogEntryVerboseDto(bpnL2, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY) + ChangelogEntryVerboseDto(bpnL1, ChangelogType.CREATE, timeAfterUpdate, BusinessPartnerType.LEGAL_ENTITY), + ChangelogEntryVerboseDto(bpnL2, ChangelogType.CREATE, timeAfterUpdate, BusinessPartnerType.LEGAL_ENTITY) ) val expectedEntriesSecondPage = listOf( - ChangelogEntryVerboseDto(bpnL3, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY) + ChangelogEntryVerboseDto(bpnL3, ChangelogType.CREATE, timeAfterUpdate, BusinessPartnerType.LEGAL_ENTITY) ) val expectedFirstPage = PageDto(3, 2, 0, expectedEntriesFirstPage.size, expectedEntriesFirstPage) @@ -267,12 +267,12 @@ class ChangelogControllerIT @Autowired constructor( val actualFirstPage = poolClient.changelogs().getChangelogEntries( - ChangelogSearchRequest(lsaTypes = setOf(ChangelogSubject.LEGAL_ENTITY)), + ChangelogSearchRequest(businessPartnerTypes = setOf(BusinessPartnerType.LEGAL_ENTITY)), PaginationRequest(page = 0, size = 2) ) val actualSecondPage = poolClient.changelogs().getChangelogEntries( - ChangelogSearchRequest(lsaTypes = setOf(ChangelogSubject.LEGAL_ENTITY)), + ChangelogSearchRequest(businessPartnerTypes = setOf(BusinessPartnerType.LEGAL_ENTITY)), PaginationRequest(page = 1, size = 2) ) @@ -307,16 +307,16 @@ class ChangelogControllerIT @Autowired constructor( val timeAfterUpdate = Instant.now() val expectedLegalEntityEntries = listOf( - ChangelogEntryVerboseDto(bpnL, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY) + ChangelogEntryVerboseDto(bpnL, ChangelogType.CREATE, timeAfterUpdate, BusinessPartnerType.LEGAL_ENTITY) ) val expectedSiteEntries = listOf( - ChangelogEntryVerboseDto(bpnS, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.SITE) + ChangelogEntryVerboseDto(bpnS, ChangelogType.CREATE, timeAfterUpdate, BusinessPartnerType.SITE) ) val expectedAddressEntries = listOf( - ChangelogEntryVerboseDto(bpnLegalAddress, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), - ChangelogEntryVerboseDto(bpnMainAddress, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS) + ChangelogEntryVerboseDto(bpnLegalAddress, ChangelogType.CREATE, timeAfterUpdate, BusinessPartnerType.ADDRESS), + ChangelogEntryVerboseDto(bpnMainAddress, ChangelogType.CREATE, timeAfterUpdate, BusinessPartnerType.ADDRESS) ) val expectedLegalEntitiesPage = @@ -326,15 +326,15 @@ class ChangelogControllerIT @Autowired constructor( val actualLegalEntityPage = poolClient.changelogs().getChangelogEntries( - ChangelogSearchRequest(lsaTypes = setOf(ChangelogSubject.LEGAL_ENTITY)), + ChangelogSearchRequest(businessPartnerTypes = setOf(BusinessPartnerType.LEGAL_ENTITY)), PaginationRequest() ) val actualSitePage = poolClient.changelogs().getChangelogEntries( - ChangelogSearchRequest(lsaTypes = setOf(ChangelogSubject.SITE)), + ChangelogSearchRequest(businessPartnerTypes = setOf(BusinessPartnerType.SITE)), PaginationRequest() ) val actualAddressPage = poolClient.changelogs().getChangelogEntries( - ChangelogSearchRequest(lsaTypes = setOf(ChangelogSubject.ADDRESS)), + ChangelogSearchRequest(businessPartnerTypes = setOf(BusinessPartnerType.ADDRESS)), PaginationRequest() ) @@ -368,8 +368,8 @@ class ChangelogControllerIT @Autowired constructor( //Log entry for the created legal entities and their legal addresses should be there val expectedChangelogEntries = listOf( - ChangelogEntryVerboseDto(bpnL1, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY), - ChangelogEntryVerboseDto(bpnL2, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY) + ChangelogEntryVerboseDto(bpnL1, ChangelogType.CREATE, timeAfterUpdate, BusinessPartnerType.LEGAL_ENTITY), + ChangelogEntryVerboseDto(bpnL2, ChangelogType.CREATE, timeAfterUpdate, BusinessPartnerType.LEGAL_ENTITY) ) val expectedChangelog = PageDto(expectedChangelogEntries.size.toLong(), 1, 0, expectedChangelogEntries.size, expectedChangelogEntries) @@ -413,14 +413,14 @@ class ChangelogControllerIT @Autowired constructor( //Log entry for the created legal entities and their legal addresses should be there val expectedChangelogEntries = listOf( - ChangelogEntryVerboseDto(bpnL1, ChangelogType.CREATE, timeAfterSecondInsert, ChangelogSubject.LEGAL_ENTITY), - ChangelogEntryVerboseDto(bpnL2, ChangelogType.CREATE, timeAfterSecondInsert, ChangelogSubject.LEGAL_ENTITY) + ChangelogEntryVerboseDto(bpnL1, ChangelogType.CREATE, timeAfterSecondInsert, BusinessPartnerType.LEGAL_ENTITY), + ChangelogEntryVerboseDto(bpnL2, ChangelogType.CREATE, timeAfterSecondInsert, BusinessPartnerType.LEGAL_ENTITY) ) val expectedChangelog = PageDto(expectedChangelogEntries.size.toLong(), 1, 0, expectedChangelogEntries.size, expectedChangelogEntries) val actualChangelog = poolClient.changelogs().getChangelogEntries( - ChangelogSearchRequest(fromTime = timeAfterFirstInsert, lsaTypes = setOf(ChangelogSubject.LEGAL_ENTITY)), + ChangelogSearchRequest(fromTime = timeAfterFirstInsert, businessPartnerTypes = setOf(BusinessPartnerType.LEGAL_ENTITY)), PaginationRequest() ) diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/MetadataControllerIT.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/MetadataControllerIT.kt index 0e55766a2..d9b50add6 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/MetadataControllerIT.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/MetadataControllerIT.kt @@ -22,7 +22,7 @@ package org.eclipse.tractusx.bpdm.pool.controller import com.neovisionaries.i18n.CountryCode import com.neovisionaries.i18n.CountryCode.* import org.assertj.core.api.Assertions.assertThat -import org.eclipse.tractusx.bpdm.common.dto.IdentifierLsaType +import org.eclipse.tractusx.bpdm.common.dto.IdentifierBusinessPartnerType import org.eclipse.tractusx.bpdm.common.dto.IdentifierTypeDto import org.eclipse.tractusx.bpdm.common.dto.QualityLevel import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest @@ -91,7 +91,7 @@ class MetadataControllerIT @Autowired constructor( // getMetadata>(client, page, size, EndpointValues.CATENA_METADATA_IDENTIFIER_TYPE_PATH) client.invokeGetEndpoint( EndpointValues.CATENA_METADATA_IDENTIFIER_TYPE_PATH, - Pair("lsaType", IdentifierLsaType.LEGAL_ENTITY.name), + Pair("businessPartnerType", IdentifierBusinessPartnerType.LEGAL_ENTITY.name), Pair(PaginationRequest::page.name, page.toString()), Pair(PaginationRequest::size.name, size.toString()) ) @@ -312,21 +312,21 @@ class MetadataControllerIT @Autowired constructor( fun getValidIdentifiersForCountry() { val identifierType1 = IdentifierType( technicalKey = CommonValues.identifierTypeTechnicalKey1, - lsaType = IdentifierLsaType.LEGAL_ENTITY, + businessPartnerType = IdentifierBusinessPartnerType.LEGAL_ENTITY, name = CommonValues.identifierTypeName1, ) identifierType1.details.add(IdentifierTypeDetail(identifierType1, null, true)) val identifierType2 = IdentifierType( technicalKey = CommonValues.identifierTypeTechnicalKey2, - lsaType = IdentifierLsaType.LEGAL_ENTITY, + businessPartnerType = IdentifierBusinessPartnerType.LEGAL_ENTITY, name = CommonValues.identifierTypeName2 ) identifierType2.details.add(IdentifierTypeDetail(identifierType2, CountryCode.UK, false)) val identifierType3 = IdentifierType( technicalKey = CommonValues.identifierTypeTechnicalKey3, - lsaType = IdentifierLsaType.LEGAL_ENTITY, + businessPartnerType = IdentifierBusinessPartnerType.LEGAL_ENTITY, name = CommonValues.identifierTypeName3 ) identifierType3.details.add(IdentifierTypeDetail(identifierType3, CountryCode.PL, false)) @@ -342,7 +342,7 @@ class MetadataControllerIT @Autowired constructor( val result = webTestClient.invokeGetEndpoint>( EndpointValues.CATENA_METADATA_IDENTIFIER_TYPE_PATH, - Pair("lsaType", IdentifierLsaType.LEGAL_ENTITY.name), + Pair("businessPartnerType", IdentifierBusinessPartnerType.LEGAL_ENTITY.name), Pair("country", CountryCode.PL.alpha2) ) 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 037d4738a..8f3b29fb0 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 @@ -29,9 +29,12 @@ object RequestValues { val identifierType2 = TypeKeyNameVerboseDto(CommonValues.identifierTypeTechnicalKey2, CommonValues.identifierTypeName2) val identifierType3 = TypeKeyNameVerboseDto(CommonValues.identifierTypeTechnicalKey3, CommonValues.identifierTypeName3) - val identifierTypeDto1 = IdentifierTypeDto(CommonValues.identifierTypeTechnicalKey1, IdentifierLsaType.LEGAL_ENTITY, CommonValues.identifierTypeName1) - val identifierTypeDto2 = IdentifierTypeDto(CommonValues.identifierTypeTechnicalKey2, IdentifierLsaType.LEGAL_ENTITY, CommonValues.identifierTypeName2) - val identifierTypeDto3 = IdentifierTypeDto(CommonValues.identifierTypeTechnicalKey3, IdentifierLsaType.LEGAL_ENTITY, CommonValues.identifierTypeName3) + val identifierTypeDto1 = + IdentifierTypeDto(CommonValues.identifierTypeTechnicalKey1, IdentifierBusinessPartnerType.LEGAL_ENTITY, CommonValues.identifierTypeName1) + val identifierTypeDto2 = + IdentifierTypeDto(CommonValues.identifierTypeTechnicalKey2, IdentifierBusinessPartnerType.LEGAL_ENTITY, CommonValues.identifierTypeName2) + val identifierTypeDto3 = + IdentifierTypeDto(CommonValues.identifierTypeTechnicalKey3, IdentifierBusinessPartnerType.LEGAL_ENTITY, CommonValues.identifierTypeName3) val identifier1 = LegalEntityIdentifierDto( value = CommonValues.identifierValue1, diff --git a/docs/api/gate.json b/docs/api/gate.json index 4f4936ef6..5eaab185f 100644 --- a/docs/api/gate.json +++ b/docs/api/gate.json @@ -44,7 +44,7 @@ } }, { - "name": "lsaType", + "name": "businessPartnerType", "in": "query", "description": "LSA Type", "required": false, diff --git a/docs/api/gate.yaml b/docs/api/gate.yaml index cc3acbaf8..52f73a283 100644 --- a/docs/api/gate.yaml +++ b/docs/api/gate.yaml @@ -31,7 +31,7 @@ paths: minimum: 0 type: string default: '10' - - name: lsaType + - name: businessPartnerType in: query description: LSA Type required: false diff --git a/docs/postman/BPDM Gate.postman_collection.json b/docs/postman/BPDM Gate.postman_collection.json index d9e0ffb73..35f37aed7 100644 --- a/docs/postman/BPDM Gate.postman_collection.json +++ b/docs/postman/BPDM Gate.postman_collection.json @@ -21,7 +21,7 @@ } ], "url": { - "raw": "{{Gate-Host}}/api/catena/sharing-state?page=0&size=10&lsaType=LEGAL_ENTITY", + "raw": "{{Gate-Host}}/api/catena/sharing-state?page=0&size=10&businessPartnerType=LEGAL_ENTITY", "host": [ "{{Gate-Host}}" ], @@ -40,7 +40,7 @@ "value": "10" }, { - "key": "lsaType", + "key": "businessPartnerType", "value": "LEGAL_ENTITY" }, { @@ -60,7 +60,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"lsaType\": \"LEGAL_ENTITY\",\n \"externalId\": \"string\",\n \"sharingStateType\": \"Pending\",\n \"sharingErrorCode\": \"SharingProcessError\",\n \"sharingErrorMessage\": \"string\",\n \"bpn\": \"string\",\n \"sharingProcessStarted\": \"2023-06-05T06:56:40.785Z\"\n}", + "raw": "{\n \"businessPartnerType\": \"LEGAL_ENTITY\",\n \"externalId\": \"string\",\n \"sharingStateType\": \"Pending\",\n \"sharingErrorCode\": \"SharingProcessError\",\n \"sharingErrorMessage\": \"string\",\n \"bpn\": \"string\",\n \"sharingProcessStarted\": \"2023-06-05T06:56:40.785Z\"\n}", "options": { "raw": { "language": "json" @@ -641,7 +641,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"fromTime\": \"2020-12-16T05:54:48.942Z\",\n \"externalIds\": [\n \"12044444\"\n ],\n \"lsaTypes\": [\n \"LEGAL_ENTITY\"\n ]\n}", + "raw": "{\n \"fromTime\": \"2020-12-16T05:54:48.942Z\",\n \"externalIds\": [\n \"12044444\"\n ],\n \"businessPartnerTypes\": [\n \"LEGAL_ENTITY\"\n ]\n}", "options": { "raw": { "language": "json" @@ -681,7 +681,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"fromTime\": \"2020-12-16T05:54:48.942Z\",\n \"externalIds\": [\n \"12044444\"\n ],\n \"lsaTypes\": [\n \"LEGAL_ENTITY\"\n ]\n}", + "raw": "{\n \"fromTime\": \"2020-12-16T05:54:48.942Z\",\n \"externalIds\": [\n \"12044444\"\n ],\n \"businessPartnerTypes\": [\n \"LEGAL_ENTITY\"\n ]\n}", "options": { "raw": { "language": "json" diff --git a/docs/postman/BPDM Pool.postman_collection.json b/docs/postman/BPDM Pool.postman_collection.json index 10236e71e..57332f4c5 100644 --- a/docs/postman/BPDM Pool.postman_collection.json +++ b/docs/postman/BPDM Pool.postman_collection.json @@ -72,7 +72,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{Pool-Host}}/api/catena/identifier-types?page=0&size=100&lsaType=ADDRESS", + "raw": "{{Pool-Host}}/api/catena/identifier-types?page=0&size=100&businessPartnerType=ADDRESS", "host": [ "{{Pool-Host}}" ], @@ -91,7 +91,7 @@ "value": "100" }, { - "key": "lsaType", + "key": "businessPartnerType", "value": "ADDRESS" } ] @@ -106,7 +106,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"technicalKey\": \"CUSTOM_ID_ADD_TYPE\",\n \"lsaType\": \"ADDRESS\",\n \"name\": \"Custom Identifier Type of Address for Testing\",\n \"details\": [\n {\n \"country\": \"DE\",\n \"mandatory\": true\n }\n ]\n}", + "raw": "{\n \"technicalKey\": \"CUSTOM_ID_ADD_TYPE\",\n \"businessPartnerType\": \"ADDRESS\",\n \"name\": \"Custom Identifier Type of Address for Testing\",\n \"details\": [\n {\n \"country\": \"DE\",\n \"mandatory\": true\n }\n ]\n}", "options": { "raw": { "language": "json" @@ -876,7 +876,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"lsaType\": \"LEGAL_ENTITY\",\n \"idType\": \"CUSTOM_ID_TYPE\",\n \"idValues\": [\n \"123456789\"\n ]\n}", + "raw": "{\n \"businessPartnerType\": \"LEGAL_ENTITY\",\n \"idType\": \"CUSTOM_ID_TYPE\",\n \"idValues\": [\n \"123456789\"\n ]\n}", "options": { "raw": { "language": "json" @@ -910,7 +910,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"fromTime\": \"2023-03-21T09:00:25.298594Z\",\n \"bpns\": [\n \"BPNL000000000001\"\n ],\n \"lsaTypes\": [\n \"LEGAL_ENTITY\"\n ]\n}", + "raw": "{\n \"fromTime\": \"2023-03-21T09:00:25.298594Z\",\n \"bpns\": [\n \"BPNL000000000001\"\n ],\n \"businessPartnerTypes\": [\n \"LEGAL_ENTITY\"\n ]\n}", "options": { "raw": { "language": "json"