From 66ac99abc796d94d3905dbd9b2feeaf7fd6fdba5 Mon Sep 17 00:00:00 2001 From: cezaralexandremorais Date: Mon, 4 Dec 2023 08:58:38 +0000 Subject: [PATCH] feat(): refactored injected services, changed fields to private --- .../bpdm/bridge/dummy/service/GateQueryService.kt | 4 ++-- .../bpdm/bridge/dummy/service/GateUpdateService.kt | 2 +- .../bpdm/bridge/dummy/service/PoolUpdateService.kt | 10 ++++++---- .../catenax/bpdm/bridge/dummy/service/SyncService.kt | 8 ++++---- .../orchestrator/service/GoldenRecordTaskService.kt | 6 +++--- .../service/GoldenRecordTaskStateMachine.kt | 2 +- .../tractusx/bpdm/pool/service/BpnIssuingService.kt | 6 +++--- .../bpdm/pool/service/BusinessPartnerSearchService.kt | 8 ++++---- .../bpdm/pool/service/GateDocumentationService.kt | 2 +- .../tractusx/bpdm/pool/service/MetadataService.kt | 8 ++++---- .../bpdm/pool/service/PartnerChangelogService.kt | 2 +- 11 files changed, 30 insertions(+), 28 deletions(-) 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 6c07954ec..dd7d23bb8 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 @@ -34,8 +34,8 @@ import java.time.Instant @Service class GateQueryService( - val gateClient: GateClient, - val bridgeConfigProperties: BridgeConfigProperties + private val gateClient: GateClient, + private val bridgeConfigProperties: BridgeConfigProperties ) { private val logger = KotlinLogging.logger { } 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 b87cfb239..294b30dbb 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 @@ -36,7 +36,7 @@ import java.time.LocalDateTime @Service class GateUpdateService( - val gateClient: GateClient + private val gateClient: GateClient ) { private val logger = KotlinLogging.logger { } 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 133b8c9dd..e3be3e397 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 @@ -24,6 +24,7 @@ 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.client.GateClient 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.* @@ -31,8 +32,9 @@ import org.springframework.stereotype.Service @Service class PoolUpdateService( - val gateQueryService: GateQueryService, - val poolClient: PoolApiClient + private val gateQueryService: GateQueryService, + private val poolClient: PoolApiClient, + private val gateClient: GateClient ) { private val logger = KotlinLogging.logger { } @@ -160,14 +162,14 @@ class PoolUpdateService( private fun isSiteMainAddress(it: GateAddressInfo): Boolean { - val mainAdressExternalId = it.siteExternalId?.let { it1 -> gateQueryService.gateClient.sites.getSiteByExternalId(it1).mainAddress.externalId } + val mainAdressExternalId = it.siteExternalId?.let { it1 -> gateClient.sites.getSiteByExternalId(it1).mainAddress.externalId } return it.externalId == mainAdressExternalId } private fun isLegalAddress(it: GateAddressInfo): Boolean { val legalAdressExternalId = - it.legalEntityExternalId?.let { it1 -> gateQueryService.gateClient.legalEntities.getLegalEntityByExternalId(it1).legalAddress.externalId } + it.legalEntityExternalId?.let { it1 -> gateClient.legalEntities.getLegalEntityByExternalId(it1).legalAddress.externalId } return it.externalId == legalAdressExternalId } 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 66cac386c..589edf11d 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 @@ -27,10 +27,10 @@ import java.time.Instant @Service class SyncService( - val gateQueryService: GateQueryService, - val poolUpdateService: PoolUpdateService, - val gateUpdateService: GateUpdateService, - val syncRecordService: SyncRecordService + private val gateQueryService: GateQueryService, + private val poolUpdateService: PoolUpdateService, + private val gateUpdateService: GateUpdateService, + private val syncRecordService: SyncRecordService ) { private val logger = KotlinLogging.logger { } diff --git a/bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/service/GoldenRecordTaskService.kt b/bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/service/GoldenRecordTaskService.kt index b7f955226..054c326d4 100644 --- a/bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/service/GoldenRecordTaskService.kt +++ b/bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/service/GoldenRecordTaskService.kt @@ -33,9 +33,9 @@ import java.util.* @Service class GoldenRecordTaskService( - val taskStorage: GoldenRecordTaskStorage, - val goldenRecordTaskStateMachine: GoldenRecordTaskStateMachine, - val taskConfigProperties: TaskConfigProperties + private val taskStorage: GoldenRecordTaskStorage, + private val goldenRecordTaskStateMachine: GoldenRecordTaskStateMachine, + private val taskConfigProperties: TaskConfigProperties ) { private val logger = KotlinLogging.logger { } diff --git a/bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/service/GoldenRecordTaskStateMachine.kt b/bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/service/GoldenRecordTaskStateMachine.kt index 7d759a202..173204888 100644 --- a/bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/service/GoldenRecordTaskStateMachine.kt +++ b/bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/service/GoldenRecordTaskStateMachine.kt @@ -30,7 +30,7 @@ import java.time.Instant @Service class GoldenRecordTaskStateMachine( - val taskConfigProperties: TaskConfigProperties + private val taskConfigProperties: TaskConfigProperties ) { private val logger = KotlinLogging.logger { } 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 e03bcd35f..d7e39d469 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 @@ -38,9 +38,9 @@ class BpnIssuingService( ) { private val logger = KotlinLogging.logger { } - val bpnlPrefix = "${bpnConfigProperties.id}${bpnConfigProperties.legalEntityChar}" - val bpnsPrefix = "${bpnConfigProperties.id}${bpnConfigProperties.siteChar}" - val bpnAPrefix = "${bpnConfigProperties.id}${bpnConfigProperties.addressChar}" + private val bpnlPrefix = "${bpnConfigProperties.id}${bpnConfigProperties.legalEntityChar}" + private val bpnsPrefix = "${bpnConfigProperties.id}${bpnConfigProperties.siteChar}" + private val bpnAPrefix = "${bpnConfigProperties.id}${bpnConfigProperties.addressChar}" @Transactional fun issueLegalEntityBpns(count: Int): List { diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerSearchService.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerSearchService.kt index 8c3a437da..d0b485f60 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerSearchService.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerSearchService.kt @@ -45,10 +45,10 @@ import org.springframework.stereotype.Service class BusinessPartnerSearchService( private val legalEntityRepository: LegalEntityRepository, private val businessPartnerFetchService: BusinessPartnerFetchService, - val addressService: AddressService, - val siteService: SiteService, - val logisticAddressRepository: LogisticAddressRepository, - val siteRepository: SiteRepository, + private val addressService: AddressService, + private val siteService: SiteService, + private val logisticAddressRepository: LogisticAddressRepository, + private val siteRepository: SiteRepository, ): SearchService { private val logger = KotlinLogging.logger { } diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/GateDocumentationService.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/GateDocumentationService.kt index 560529eb3..3224ff8b8 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/GateDocumentationService.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/GateDocumentationService.kt @@ -29,7 +29,7 @@ import org.springframework.stereotype.Service */ @Service class GateDocumentationService( - val entityManager: EntityManager + private val entityManager: EntityManager ) { fun getMermaidPoolPersistence(): String { 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 53e72cd3f..4191c0b67 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 @@ -47,10 +47,10 @@ import org.springframework.transaction.annotation.Transactional */ @Service class MetadataService( - val identifierTypeRepository: IdentifierTypeRepository, - val legalFormRepository: LegalFormRepository, - val fieldQualityRuleRepository: FieldQualityRuleRepository, - val regionRepository: RegionRepository + private val identifierTypeRepository: IdentifierTypeRepository, + private val legalFormRepository: LegalFormRepository, + private val fieldQualityRuleRepository: FieldQualityRuleRepository, + private val regionRepository: RegionRepository ) { private val logger = KotlinLogging.logger { } 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 caca5b663..99da4a6b1 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 @@ -44,7 +44,7 @@ import java.time.Instant */ @Service class PartnerChangelogService( - val partnerChangelogEntryRepository: PartnerChangelogEntryRepository, + private val partnerChangelogEntryRepository: PartnerChangelogEntryRepository, ) { private val logger = KotlinLogging.logger { }