Skip to content

Commit

Permalink
Merge pull request #667 from catenax-ng/fix/refactor_injected_services
Browse files Browse the repository at this point in the history
feat(): refactored injected services, changed fields to private
  • Loading branch information
nicoprow authored Dec 7, 2023
2 parents 7dfd498 + 66ac99a commit 6bf6fb3
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import java.time.LocalDateTime

@Service
class GateUpdateService(
val gateClient: GateClient
private val gateClient: GateClient
) {

private val logger = KotlinLogging.logger { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,17 @@ 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.*
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 { }
Expand Down Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import java.time.Instant

@Service
class GoldenRecordTaskStateMachine(
val taskConfigProperties: TaskConfigProperties
private val taskConfigProperties: TaskConfigProperties
) {

private val logger = KotlinLogging.logger { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import org.springframework.stereotype.Service
*/
@Service
class GateDocumentationService(
val entityManager: EntityManager
private val entityManager: EntityManager
) {

fun getMermaidPoolPersistence(): String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import java.time.Instant
*/
@Service
class PartnerChangelogService(
val partnerChangelogEntryRepository: PartnerChangelogEntryRepository,
private val partnerChangelogEntryRepository: PartnerChangelogEntryRepository,
) {
private val logger = KotlinLogging.logger { }

Expand Down

0 comments on commit 6bf6fb3

Please sign in to comment.