From 962bf537d369e0bb8895128495cc6f94607871f0 Mon Sep 17 00:00:00 2001 From: SujitMBRDI Date: Fri, 20 Sep 2024 12:50:58 +0530 Subject: [PATCH] fix(bpdm-clearing): refactored legal name construction logic --- CHANGELOG.md | 1 + .../tractusx/bpdm/cleaning/service/CleaningServiceDummy.kt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index be4d124bb..7b9732f1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ For changes to the BPDM Helm charts please consult the [changelog](charts/bpdm/C - BPDM Cleaning Service Dummy: Improve duplication check to better distinguish between incoming business partners - Apps: Updated double precision data type for Geographic-data([#978](https://github.com/eclipse-tractusx/bpdm/issues/978)) - BPDM Gate: Improved error response by adding external id details and reduced csv columns by removing support for uncategorized fields in csv file for partner upload process([#700](https://github.com/eclipse-tractusx/sig-release/issues/700)) +- BPDM Cleaning Service Dummy: Added a null check for name parts to ensure proper whitespace handling when constructing the legal name from them. ## [6.1.0] - [2024-07-15] diff --git a/bpdm-cleaning-service-dummy/src/main/kotlin/org/eclipse/tractusx/bpdm/cleaning/service/CleaningServiceDummy.kt b/bpdm-cleaning-service-dummy/src/main/kotlin/org/eclipse/tractusx/bpdm/cleaning/service/CleaningServiceDummy.kt index d87a88aab..32e59bfa9 100644 --- a/bpdm-cleaning-service-dummy/src/main/kotlin/org/eclipse/tractusx/bpdm/cleaning/service/CleaningServiceDummy.kt +++ b/bpdm-cleaning-service-dummy/src/main/kotlin/org/eclipse/tractusx/bpdm/cleaning/service/CleaningServiceDummy.kt @@ -108,7 +108,7 @@ class CleaningServiceDummy( return with(businessPartner.legalEntity){ copy( bpnReference = bpnReference.toRequestIfNotBpn(businessPartner.legalEntityReference()), - legalName = legalName ?: businessPartner.uncategorized.nameParts.joinToString(" "), + legalName = legalName ?: businessPartner.uncategorized.nameParts.takeIf { it.isNotEmpty() }?.joinToString(" "), identifiers = identifiers.takeIf { it.isNotEmpty() } ?: businessPartner.uncategorized.identifiers, states = states.takeIf { it.isNotEmpty() } ?: businessPartner.uncategorized.states, confidenceCriteria = dummyConfidenceCriteria.copy(sharedByOwner = sharedByOwner),