diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/OrchestratorMappings.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/OrchestratorMappings.kt index d30da1851..98d4b6a37 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/OrchestratorMappings.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/OrchestratorMappings.kt @@ -184,15 +184,15 @@ class OrchestratorMappings( } ?: BpnReference.empty private fun getOwnerBpnL(entity: BusinessPartnerDb): String? { - return if (entity.sharingState.tenantBpnl != null) { - entity.sharingState.tenantBpnl - }else if (entity.isOwnCompanyData) { - bpnConfigProperties.ownerBpnL - } - else { - logger.warn { "Owner BPNL property is not configured" } - null - } + //only determine owner BPNL if it is own company data + if(!entity.isOwnCompanyData) return null + + return entity.sharingState.tenantBpnl + ?: bpnConfigProperties.ownerBpnL.takeIf { it.isNotBlank() } + ?: run { + logger.warn { "Owner BPNL can't be determined for owned company data" } + null + } }