diff --git a/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/config/BridgeAuthProperties.kt b/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/config/BridgeAuthProperties.kt deleted file mode 100644 index 2915a8dba..000000000 --- a/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/config/BridgeAuthProperties.kt +++ /dev/null @@ -1,32 +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 com.catenax.bpdm.bridge.dummy.config - -import org.springframework.boot.context.properties.ConfigurationProperties -import org.springframework.context.annotation.Configuration - -@Configuration -@ConfigurationProperties(prefix = "bpdm.bridge") -class BridgeAuthProperties { - var syncAuthorities: List = listOf() - - val syncAuthority: String - get() = syncAuthorities.joinToString(", ") { "ROLE_$it" } -} \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/AddressSaas.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/AddressSaas.kt deleted file mode 100644 index b21b4ae66..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/AddressSaas.kt +++ /dev/null @@ -1,40 +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.common.dto.saas - -data class AddressSaas( - val id: String? = "0", - val externalId: String? = null, - val saasId: String? = null, - val version: AddressVersionSaas? = null, - val identifyingName: WrappedValueSaas? = null, - val careOf: WrappedValueSaas? = null, - val contexts: Collection = emptyList(), - val country: CountrySaas? = null, - val administrativeAreas: Collection = emptyList(), - val postCodes: Collection = emptyList(), - val localities: Collection = emptyList(), - val thoroughfares: Collection = emptyList(), - val premises: Collection = emptyList(), - val postalDeliveryPoints: Collection = emptyList(), - val geographicCoordinates: GeoCoordinatesSaas? = null, - val types: Collection = emptyList(), - val metadataSaas: AddressMetadataSaas? = null -) diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/AdministrativeAreaSaas.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/AdministrativeAreaSaas.kt deleted file mode 100644 index 9d4f23410..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/AdministrativeAreaSaas.kt +++ /dev/null @@ -1,33 +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.common.dto.saas - -import org.eclipse.tractusx.bpdm.common.model.SaasAdministrativeAreaType -import org.eclipse.tractusx.bpdm.common.model.toSaasTypeDto - -data class AdministrativeAreaSaas( - override val value: String? = null, - val shortName: String? = null, - override val type: TypeKeyNameUrlSaas? = null, - val language: LanguageSaas? = null -) : TypeValueSaas { - constructor(value: String, saasType : SaasAdministrativeAreaType, language: LanguageSaas? = null): - this(value = value, type = saasType.toSaasTypeDto(), language = language) -} diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/AugmentedBusinessPartnerResponseSaas.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/AugmentedBusinessPartnerResponseSaas.kt deleted file mode 100644 index 75f3aba96..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/AugmentedBusinessPartnerResponseSaas.kt +++ /dev/null @@ -1,24 +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.common.dto.saas - -class AugmentedBusinessPartnerResponseSaas( - val augmentedBusinessPartner: BusinessPartnerSaas? = null -) \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/BusinessPartnerSaas.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/BusinessPartnerSaas.kt deleted file mode 100644 index 35c4015b7..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/BusinessPartnerSaas.kt +++ /dev/null @@ -1,43 +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.common.dto.saas - -import java.time.LocalDateTime - -data class BusinessPartnerSaas( - val id: String? = null, - val createdAt: LocalDateTime? = null, - val lastModifiedAt: LocalDateTime? = null, - val externalId: String? = null, - val dataSource: String? = null, - val disclosed: Boolean? = false, - val updateMonitoring: Boolean? = false, - val metadata: BusinessPartnerMetadataSaas? = null, - val record: String? = null, - val names: Collection = emptyList(), - val legalForm: LegalFormSaas? = null, - val identifiers: Collection = emptyList(), - val categories: Collection = emptyList(), - val status: BusinessPartnerStatusSaas? = null, - val profile: PartnerProfileSaas? = null, - val relations: Collection = emptyList(), - val types: Collection = emptyList(), - val addresses: Collection = emptyList(), -) \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/FetchBatchRecord.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/FetchBatchRecord.kt deleted file mode 100644 index 02dff5d0a..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/FetchBatchRecord.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.common.dto.saas - -data class FetchBatchRecord( - val saasId: String, - val businessPartner: BusinessPartnerSaas -) diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/FetchResponse.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/FetchResponse.kt deleted file mode 100644 index cb4f9ec8c..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/FetchResponse.kt +++ /dev/null @@ -1,31 +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.common.dto.saas - -data class FetchResponse( - val businessPartner: BusinessPartnerSaas? = null, - val message: String? = null, - val status: Status -) { - enum class Status { - OK, - NOT_FOUND - } -} \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/LocalitySaas.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/LocalitySaas.kt deleted file mode 100644 index 864619f78..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/LocalitySaas.kt +++ /dev/null @@ -1,33 +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.common.dto.saas - -import org.eclipse.tractusx.bpdm.common.model.SaasLocalityType -import org.eclipse.tractusx.bpdm.common.model.toSaasTypeDto - -data class LocalitySaas( - override val type: TypeKeyNameUrlSaas? = null, - val shortName: String? = null, - override val value: String? = null, - val language: LanguageSaas? = null -) : TypeValueSaas { - constructor(saasValue: String, saasType: SaasLocalityType, saasLanguage: LanguageSaas?) - : this(value = saasValue, type = saasType.toSaasTypeDto(), language = saasLanguage) -} diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/PartnerProfileSaas.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/PartnerProfileSaas.kt deleted file mode 100644 index dfb5e49d3..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/PartnerProfileSaas.kt +++ /dev/null @@ -1,28 +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.common.dto.saas - -data class PartnerProfileSaas( - val minorityIndicator: WrappedValueSaas? = null, - val classifications: Collection = emptyList(), - val phoneNumbers: Collection = emptyList(), - val websites: Collection = emptyList(), - val contactEmails: Collection = emptyList() -) diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/PostCodeSaas.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/PostCodeSaas.kt deleted file mode 100644 index 0c7def1ba..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/PostCodeSaas.kt +++ /dev/null @@ -1,31 +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.common.dto.saas - -import org.eclipse.tractusx.bpdm.common.model.SaasPostCodeType -import org.eclipse.tractusx.bpdm.common.model.toSaasTypeDto - -data class PostCodeSaas( - override val value: String? = null, - override val type: TypeKeyNameUrlSaas? = null -) : TypeValueSaas { - constructor(saasValue: String, saasType: SaasPostCodeType) - : this(value = saasValue, type = saasType.toSaasTypeDto()) -} \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/PostalDeliveryPointSaas.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/PostalDeliveryPointSaas.kt deleted file mode 100644 index 62e97ef22..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/PostalDeliveryPointSaas.kt +++ /dev/null @@ -1,34 +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.common.dto.saas - -import org.eclipse.tractusx.bpdm.common.model.SaasPostalDeliveryPointType -import org.eclipse.tractusx.bpdm.common.model.toSaasTypeDto - -data class PostalDeliveryPointSaas( - override val type: TypeKeyNameUrlSaas? = null, - val shortName: String? = null, - val number: String? = null, - override val value: String? = null, - val language: LanguageSaas? = null -) : TypeValueSaas { - constructor(saasValue: String, saasType: SaasPostalDeliveryPointType, saasLanguage: LanguageSaas?) - : this(value = saasValue, type = saasType.toSaasTypeDto(), language = saasLanguage) -} \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/PremiseSaas.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/PremiseSaas.kt deleted file mode 100644 index b5fb0e427..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/PremiseSaas.kt +++ /dev/null @@ -1,35 +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.common.dto.saas - -import org.eclipse.tractusx.bpdm.common.model.SaasPremiseType -import org.eclipse.tractusx.bpdm.common.model.toSaasTypeDto - -data class PremiseSaas( - override val type: TypeKeyNameUrlSaas? = null, - val shortName: String? = null, - val number: String? = null, - override val value: String? = null, - val language: LanguageSaas? = null -) : TypeValueSaas { - constructor(saasValue: String, saasType: SaasPremiseType, saasLanguage: LanguageSaas?) - : this(value = saasValue, type = saasType.toSaasTypeDto(), language = saasLanguage) { - } -} \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/ThoroughfareSaas.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/ThoroughfareSaas.kt deleted file mode 100644 index 7cd3d0901..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/ThoroughfareSaas.kt +++ /dev/null @@ -1,50 +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.common.dto.saas - -import org.eclipse.tractusx.bpdm.common.model.SaasThoroughfareType -import org.eclipse.tractusx.bpdm.common.model.toSaasTypeDto - -data class ThoroughfareSaas( - override var type: TypeKeyNameUrlSaas? = null, - val shortName: String? = null, - val number: String? = null, - override val value: String? = null, - val name: String? = null, - val direction: String? = null, - var language: LanguageSaas? = null -) : TypeValueSaas { - constructor( - value: String? = null, - name: String? = null, - direction: String? = null, - number: String? = null, - saasType: SaasThoroughfareType, - language: LanguageSaas? - ) : this( - value = value, - name = name, - direction = direction, - number = number, - type = saasType.toSaasTypeDto(), - language = language - ) - -} diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/UpsertFailure.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/UpsertFailure.kt deleted file mode 100644 index 2c5d5a2d1..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/UpsertFailure.kt +++ /dev/null @@ -1,26 +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.common.dto.saas - -data class UpsertFailure( - val externalId: String? = null, - val id: String? = null, - val message: String? = null -) diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/UpsertRelationsFailureSaas.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/UpsertRelationsFailureSaas.kt deleted file mode 100644 index 912e75a5a..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/UpsertRelationsFailureSaas.kt +++ /dev/null @@ -1,26 +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.common.dto.saas - -data class UpsertRelationsFailureSaas( - val endNodeExternalId: String? = null, - val message: String? = null, - val startNodeExternalId: String? = null -) \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/UpsertRelationsRequestSaas.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/UpsertRelationsRequestSaas.kt deleted file mode 100644 index addb9f1c6..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/UpsertRelationsRequestSaas.kt +++ /dev/null @@ -1,24 +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.common.dto.saas - -data class UpsertRelationsRequestSaas( - val relations: Collection = emptyList() -) diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/UpsertRelationsResponseSaas.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/UpsertRelationsResponseSaas.kt deleted file mode 100644 index 0afdd2991..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/UpsertRelationsResponseSaas.kt +++ /dev/null @@ -1,28 +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.common.dto.saas - -data class UpsertRelationsResponseSaas( - val failures: Collection = emptyList(), - val numberOfFailed: Int, - val numberOfInserts: Int, - val numberOfProvidedRelations: Int, - val numberOfUpdates: Int -) \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/UpsertRequest.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/UpsertRequest.kt deleted file mode 100644 index 24897381b..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/UpsertRequest.kt +++ /dev/null @@ -1,37 +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.common.dto.saas - -data class UpsertRequest( - val datasource: String, - val businessPartners: Collection, - val featuresOn: Collection = emptyList(), - val featuresOff: Collection = emptyList() -) { - enum class SaasFeatures { - UPSERT_BY_EXTERNAL_ID, - API_ERROR_ON_FAILURES, - LAB_USE_QUEUES, - ENABLE_PRECURATION, - TRANSFORM_RECORD, - ENABLE_SETTINGS, - ENABLE_ASYNC - } -} diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/UpsertResponse.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/UpsertResponse.kt deleted file mode 100644 index d71e10ddb..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/UpsertResponse.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.common.dto.saas - -data class UpsertResponse( - val failures: Collection = emptyList(), - val featuresOn: Collection, - val numberOfAccepted: Int, - val numberOfFailed: Int -) diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/WebsiteSaas.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/WebsiteSaas.kt deleted file mode 100644 index 45e4edbeb..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/WebsiteSaas.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.common.dto.saas - -data class WebsiteSaas( - val url: String? = null, - val type: TypeKeyNameUrlSaas? = null -) diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/WrappedValueSaas.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/WrappedValueSaas.kt deleted file mode 100644 index 18aed98ba..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/saas/WrappedValueSaas.kt +++ /dev/null @@ -1,24 +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.common.dto.saas - -data class WrappedValueSaas( - val value: String? = null -) diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/model/SaasAddressType.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/model/SaasAddressType.kt deleted file mode 100644 index d428a2342..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/model/SaasAddressType.kt +++ /dev/null @@ -1,46 +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.common.model - -enum class SaasAddressType(private val typeName: String) : SaasType, HasDefaultValue { - - LEGAL_ALTERNATIVE("Alternative Legal Address"), - BRANCH_OFFICE("Branch Office Address"), - HEADQUARTER("Headquarter Address"), - LEGAL("Legal Address"), - LOCAL_ADDRESS("Local Address"), - REGISTERED("Registered Address"), - REGISTERED_AGENT_MAIL("Registered Agent Mail Address"), - REGISTERED_AGENT_PHYSICAL("Registered Agent Registered Address"), - VAT_REGISTERED("VAT Registered Address "), - UNSPECIFIC("Unspecific Address Type "); - - override fun getTechnicalKey(): String { - return name - } - - override fun getTypeName(): String { - return typeName - } - - override fun getDefault(): SaasAddressType { - return UNSPECIFIC - } -} \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/model/SaasAdministrativeAreaType.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/model/SaasAdministrativeAreaType.kt deleted file mode 100644 index c37105e15..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/model/SaasAdministrativeAreaType.kt +++ /dev/null @@ -1,38 +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.common.model - -enum class SaasAdministrativeAreaType(private val areaName: String) : SaasType, HasDefaultValue { - COUNTY("County"), - REGION("Region"), - OTHER("Other"); - - override fun getTechnicalKey(): String { - return name - } - - override fun getTypeName(): String { - return areaName - } - - override fun getDefault(): SaasAdministrativeAreaType { - return OTHER - } -} \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/model/SaasLocalityType.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/model/SaasLocalityType.kt deleted file mode 100644 index a4312ef61..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/model/SaasLocalityType.kt +++ /dev/null @@ -1,41 +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.common.model - -enum class SaasLocalityType(private val typeName: String) : SaasType, HasDefaultValue { - BLOCK("Block"), - CITY("City"), - DISTRICT("District"), - OTHER("Other"), - POST_OFFICE_CITY("Post Office City"), - QUARTER("Quarter"); - - override fun getTechnicalKey(): String { - return name - } - - override fun getTypeName(): String { - return typeName - } - - override fun getDefault(): SaasLocalityType { - return OTHER - } -} \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/model/SaasPostCodeType.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/model/SaasPostCodeType.kt deleted file mode 100644 index 82e8dcae2..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/model/SaasPostCodeType.kt +++ /dev/null @@ -1,40 +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.common.model - -enum class SaasPostCodeType(private val codeName: String) : SaasType, HasDefaultValue { - CEDEX("Courrier d’Entreprise à Distribution Exceptionnelle"), - LARGE_MAIL_USER("Large mail user"), - OTHER("Other type"), - POST_BOX("Post Box"), - REGULAR("Regular"); - - override fun getTechnicalKey(): String { - return name - } - - override fun getTypeName(): String { - return codeName - } - - override fun getDefault(): SaasPostCodeType { - return OTHER - } -} \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/model/SaasPostalDeliveryPointType.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/model/SaasPostalDeliveryPointType.kt deleted file mode 100644 index 406165ef9..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/model/SaasPostalDeliveryPointType.kt +++ /dev/null @@ -1,35 +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.common.model - -enum class SaasPostalDeliveryPointType(private val typeName: String) : SaasType { - INTERURBAN_DELIVERY_POINT("Interurban Delivery Point"), - MAIL_STATION("Mail Station"), - MAILBOX("Mailbox"), - POST_OFFICE_BOX("Post Office Box"); - - override fun getTechnicalKey(): String { - return name - } - - override fun getTypeName(): String { - return typeName - } -} \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/model/SaasPremiseType.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/model/SaasPremiseType.kt deleted file mode 100644 index d7a26627f..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/model/SaasPremiseType.kt +++ /dev/null @@ -1,43 +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.common.model - -enum class SaasPremiseType(private val typeName: String) : SaasType, HasDefaultValue { - BUILDING("Building"), - OTHER("Other type"), - LEVEL("Level"), - HARBOUR("Harbour"), - ROOM("Room"), - SUITE("Suite"), - UNIT("Unit"), - WAREHOUSE("Warehouse"); - - override fun getTechnicalKey(): String { - return name - } - - override fun getTypeName(): String { - return typeName - } - - override fun getDefault(): SaasPremiseType { - return OTHER - } -} \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/model/SaasThoroughfareType.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/model/SaasThoroughfareType.kt deleted file mode 100644 index 826053e7e..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/model/SaasThoroughfareType.kt +++ /dev/null @@ -1,40 +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.common.model - -enum class SaasThoroughfareType(private val typeName: String) : SaasType, HasDefaultValue { - INDUSTRIAL_ZONE("An industrial zone"), - OTHER("Other type"), - RIVER("River"), - SQUARE("Square"), - STREET("Street"); - - override fun getTechnicalKey(): String { - return name - } - - override fun getTypeName(): String { - return typeName - } - - override fun getDefault(): SaasThoroughfareType { - return OTHER - } -} \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/model/SaasType.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/model/SaasType.kt deleted file mode 100644 index a46e72b1d..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/model/SaasType.kt +++ /dev/null @@ -1,38 +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.common.model - -import org.eclipse.tractusx.bpdm.common.dto.saas.TypeKeyNameUrlSaas - -/** - * Our representation of a SaaS enum type which consists of a technical key (enum name) and name. - * It can be converted to SaaS's internal DTO TypeKeyNameUrlSaas. - */ -interface SaasType : NamedType { - fun getTechnicalKey(): String -} - -fun SaasType.toSaasTypeDto() = - TypeKeyNameUrlSaas(technicalKey = getTechnicalKey(), name = getTypeName()) - -inline fun TypeKeyNameUrlSaas.toSaasType(): T? - where T : Enum, T : SaasType { - return technicalKey?.let { enumValueOf(it) } -} diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasAddressToDtoMapping.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasAddressToDtoMapping.kt deleted file mode 100644 index a9003411e..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasAddressToDtoMapping.kt +++ /dev/null @@ -1,131 +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.common.service - -import com.neovisionaries.i18n.CountryCode -import org.eclipse.tractusx.bpdm.common.dto.GeoCoordinateDto -import org.eclipse.tractusx.bpdm.common.dto.saas.AddressSaas -import org.eclipse.tractusx.bpdm.common.dto.saas.TypeValueSaas -import org.eclipse.tractusx.bpdm.common.model.* - -class SaasAddressToDtoMapping(private val address: AddressSaas) { - - private fun findType(values: Collection, enumType: SaasType): T? { - return values.find { it.type?.technicalKey == enumType.getTechnicalKey() } - } - - fun geoCoordinates(): GeoCoordinateDto? { - return when { - (address.geographicCoordinates?.longitude != null) && (address.geographicCoordinates.latitude != null) -> - GeoCoordinateDto(address.geographicCoordinates.longitude, address.geographicCoordinates.latitude, null) - - else -> null - } - } - - fun countryCode(): CountryCode? { - return address.country?.shortName - } - - fun adminAreaLevel1(): String? { - val adminArea = findType(address.administrativeAreas, SaasAdministrativeAreaType.REGION) - return adminArea?.value - } - - fun adminAreaLevel2(): String? { - val adminArea = findType(address.administrativeAreas, SaasAdministrativeAreaType.COUNTY) - return adminArea?.value - } - - fun postcode(): String? { - val postcode = findType(address.postCodes, SaasPostCodeType.REGULAR) - return postcode?.value - } - - fun city(): String? { - val locality = findType(address.localities, SaasLocalityType.CITY) - return locality?.value - } - - fun district(): String? { - val locality = findType(address.localities, SaasLocalityType.DISTRICT) - return locality?.value - } - - fun quarter(): String? { - val locality = findType(address.localities, SaasLocalityType.QUARTER) - return locality?.value - } - - fun streetName(): String? { - val thoroughfare = findType(address.thoroughfares, SaasThoroughfareType.STREET) - return thoroughfare?.name - } - - fun streetHouseNumber(): String? { - val thoroughfare = findType(address.thoroughfares, SaasThoroughfareType.STREET) - return thoroughfare?.number - } - - fun streetMilestone(): String? { - val thoroughfare = findType(address.thoroughfares, SaasThoroughfareType.STREET) - return thoroughfare?.shortName - } - - fun streetDirection(): String? { - val thoroughfare = findType(address.thoroughfares, SaasThoroughfareType.STREET) - return thoroughfare?.direction - } - - fun companyPostCode(): String? { - val postcode = findType(address.postCodes, SaasPostCodeType.LARGE_MAIL_USER) - return postcode?.value - } - - fun industrialZone(): String? { - val thoroughfare = findType(address.thoroughfares, SaasThoroughfareType.INDUSTRIAL_ZONE) - return thoroughfare?.name - } - - fun building(): String? { - val premise = findType(address.premises, SaasPremiseType.BUILDING) - return premise?.value - } - - fun floor(): String? { - val premise = findType(address.premises, SaasPremiseType.LEVEL) - return premise?.value - } - - fun door(): String? { - val premise = findType(address.premises, SaasPremiseType.ROOM) - return premise?.value - } - - fun deliveryServiceTypePrivateBag(): String? { - val postalDeliveryPoint = findType(address.postalDeliveryPoints, SaasPostalDeliveryPointType.MAILBOX) - return postalDeliveryPoint?.value - } - - fun deliveryServiceTypePoBox(): String? { - val postalDeliveryPoint = findType(address.postalDeliveryPoints, SaasPostalDeliveryPointType.POST_OFFICE_BOX) - return postalDeliveryPoint?.value - } -} \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasAddressesMapping.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasAddressesMapping.kt deleted file mode 100644 index a67dbb871..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasAddressesMapping.kt +++ /dev/null @@ -1,40 +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.common.service - -import org.eclipse.tractusx.bpdm.common.dto.saas.AddressSaas -import org.eclipse.tractusx.bpdm.common.model.SaasAddressType - -class SaasAddressesMapping(val addresses: Collection) { - - fun saasAlternativeAddressMapping(): SaasAddressToDtoMapping? { - val address = addresses.find { address -> - address.types.any { it.technicalKey == SaasAddressType.LEGAL_ALTERNATIVE.getTechnicalKey() } - } - return address?.let { SaasAddressToDtoMapping(it) } - } - - fun saasPhysicalAddressMapping(): SaasAddressToDtoMapping? { - val address = addresses.find { address -> - address.types.any { it.technicalKey == SaasAddressType.LEGAL.getTechnicalKey() } - } - return address?.let { SaasAddressToDtoMapping(it) } - } -} \ No newline at end of file diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasMappings.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasMappings.kt deleted file mode 100644 index 317fecbdf..000000000 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/SaasMappings.kt +++ /dev/null @@ -1,304 +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.common.service - -import com.neovisionaries.i18n.LanguageCode -import mu.KotlinLogging -import org.eclipse.tractusx.bpdm.common.dto.* -import org.eclipse.tractusx.bpdm.common.dto.saas.* -import org.eclipse.tractusx.bpdm.common.exception.BpdmMappingException -import org.eclipse.tractusx.bpdm.common.exception.BpdmNullMappingException -import org.eclipse.tractusx.bpdm.common.model.BusinessStateType -import org.eclipse.tractusx.bpdm.common.model.DeliveryServiceType -import org.eclipse.tractusx.bpdm.common.model.HasDefaultValue - -object SaasMappings { - - private val logger = KotlinLogging.logger { } - - const val BPN_TECHNICAL_KEY = "CX_BPN" - - fun findBpn(identifiers: Collection): String? { - return identifiers.find { it.type?.technicalKey == BPN_TECHNICAL_KEY }?.value - } - - private fun toReference(type: TypeKeyNameUrlSaas?): String { - return type!!.technicalKey!! - } - - fun toOptionalReference(legalForm: LegalFormSaas?): String? { - return legalForm?.technicalKey - } - - private inline fun toType(type: TypeKeyNameUrlSaas): T where T : Enum { - return enumValueOf(type.technicalKey!!) - } - - inline fun technicalKeyToType(technicalKey: String?): T where T : Enum, T : HasDefaultValue { - val allValues = enumValues() - val foundValue = if (technicalKey != null) allValues.map { it.name }.find { technicalKey == it } else null - return if (foundValue != null) enumValueOf(foundValue) else allValues.first().getDefault() - } - - fun toLanguageCode(language: LanguageSaas?): LanguageCode { - return language?.technicalKey ?: LanguageCode.undefined - } - - inline fun toTypeOrDefault(type: TypeKeyNameSaas?): T where T : Enum, T : HasDefaultValue { - return technicalKeyToType(type?.technicalKey) - } - - fun BusinessPartnerSaas.toLegalEntityDto(): LegalEntityDto { - val legalName = toNameDto() - ?: throw BpdmMappingException(this::class, LegalEntityDto::class, "No legal name", externalId ?: "Unknown") - return LegalEntityDto( - identifiers = identifiers.filter { it.type?.technicalKey != BPN_TECHNICAL_KEY }.map { toLegalEntityIdentifierDto(it) }, - legalShortName = legalName.shortName, - legalForm = toOptionalReference(legalForm), - states = toLegalEntityStatesDtos(status), - classifications = toDto(profile), - ) - } - - fun BusinessPartnerSaas.toSiteDto(): SiteDto { - val name = toNameDto() - ?: throw BpdmMappingException(this::class, SiteDto::class, "No name", externalId ?: "Unknown") - return SiteDto( - name = name.value, - states = toSiteStatesDtos(status), - // TODO Known issue: For now the main address is not a separate business partner in SaaS, therefore its properties name, states, identifiers are missing! - mainAddress = convertSaasAdressesToLogisticAddressDto(addresses, id) - ) - } - - fun BusinessPartnerSaas.toLogisticAddressDto(): LogisticAddressDto { - // partial LogisticAddressDto is enriched with info from BusinessPartnerSaas - return convertSaasAdressesToLogisticAddressDto(addresses, id) - .copy( - name = toNameDto()?.value, - states = toAddressStatesDtos(status), - identifiers = identifiers.filter { it.type?.technicalKey != BPN_TECHNICAL_KEY }.map { toAddressIdentifierDto(it) } - ) - } - - private fun BusinessPartnerSaas.toNameDto(): SassNameDto? { - if (names.size > 1) { - logger.warn { "Business Partner with ID $externalId has more than one name" } - } - return names.map { SassNameDto(it) } - .firstOrNull() - } - - fun toLegalEntityIdentifierDto(identifier: IdentifierSaas): LegalEntityIdentifierDto { - return LegalEntityIdentifierDto( - value = identifier.value ?: throw BpdmNullMappingException(IdentifierSaas::class, LegalEntityIdentifierDto::class, IdentifierSaas::value), - type = toReference(identifier.type), - issuingBody = identifier.issuingBody?.name - ) - } - - fun toAddressIdentifierDto(identifier: IdentifierSaas): AddressIdentifierDto { - return AddressIdentifierDto( - value = identifier.value ?: throw BpdmNullMappingException(IdentifierSaas::class, AddressIdentifierDto::class, IdentifierSaas::value), - type = toReference(identifier.type) - ) - } - - fun toLegalEntityStatesDtos(status: BusinessPartnerStatusSaas?): Collection = - listOfNotNull( - status?.type?.let { - LegalEntityStateDto( - officialDenotation = status.officialDenotation, - validFrom = status.validFrom, - validTo = status.validUntil, - type = toType(status.type) - ) - } - ) - - fun toSiteStatesDtos(status: BusinessPartnerStatusSaas?): Collection = - listOfNotNull( - status?.type?.let { - SiteStateDto( - description = status.officialDenotation, - validFrom = status.validFrom, - validTo = status.validUntil, - type = BusinessStateType.valueOf(status.type.technicalKey!!) - ) - } - ) - - fun toAddressStatesDtos(status: BusinessPartnerStatusSaas?): Collection = - listOfNotNull( - status?.type?.let { - AddressStateDto( - description = status.officialDenotation, - validFrom = status.validFrom, - validTo = status.validUntil, - type = toType(status.type) - ) - } - ) - - fun toDto(profile: PartnerProfileSaas?): Collection { - return profile?.classifications?.mapNotNull { toDto(it) } ?: emptyList() - } - - fun toDto(classification: ClassificationSaas): ClassificationDto? { - return classification.type?.let { - ClassificationDto( - value = classification.value, - code = classification.code, - type = toType(it) - ) - } - } - - /** - * For now a legal/main address is not represented as a full-fledged business partner like a regular address, but as a sub-address of its - * leading business partner (LE or site). - * - * This entails some limitations for legal/main addresses compared to regular addresses: - * - name, states, identifiers are missing in SaaS - * - a generated BPN-A can't be returned back to the Gate - */ - fun convertSaasAdressesToLogisticAddressDto(addresses: Collection, id: String?): LogisticAddressDto { - val mapping = SaasAddressesMapping(addresses) - val physicalAddressMapping = mapping.saasPhysicalAddressMapping() - ?: throw BpdmMappingException(AddressSaas::class, LogisticAddressDto::class, "No valid legal address", id ?: "Unknown") - val alternativeAddressMapping = mapping.saasAlternativeAddressMapping() - - // info for name, states, identifiers is contained in BusinessPartnerSaas and can't be filled in here - return LogisticAddressDto( - name = null, - states = emptyList(), - identifiers = emptyList(), - physicalPostalAddress = toPhysicalAddress(physicalAddressMapping, id), - alternativePostalAddress = alternativeAddressMapping?.let { toAlternativeAddress(it, id) }, - ) - } - - fun toPhysicalAddress(map: SaasAddressToDtoMapping, id: String?): PhysicalPostalAddressDto { - val city = map.city() - val country = map.countryCode() - if (city == null || country == null) { - throw BpdmMappingException(AddressSaas::class, LogisticAddressDto::class, "No valid physical address", id ?: "Unknown") - } - - return PhysicalPostalAddressDto( - basePhysicalAddress = BasePhysicalAddressDto( - companyPostalCode = map.companyPostCode(), - industrialZone = map.industrialZone(), - building = map.building(), - floor = map.floor(), - door = map.door(), - ), - areaPart = AreaDistrictDto( - administrativeAreaLevel1 = map.adminAreaLevel1(), - administrativeAreaLevel2 = map.adminAreaLevel2(), - administrativeAreaLevel3 = null, - district = map.district(), - ), - street = toStreetDto(map), - baseAddress = BasePostalAddressDto( - geographicCoordinates = map.geoCoordinates(), - city = city, - country = country, - postalCode = map.postcode(), - ) - ) - } - - fun toAlternativeAddress(map: SaasAddressToDtoMapping, id: String?): AlternativePostalAddressDto { - val city = map.city() - val country = map.countryCode() - if (city == null || country == null) { - throw BpdmMappingException(AddressSaas::class, LogisticAddressDto::class, "No valid alternativ address", id ?: "Unknown") - } - - val poBoxValue = map.deliveryServiceTypePoBox() - val privateBagValue = map.deliveryServiceTypePrivateBag() - - val (deliveryServiceType, deliveryServiceNumber) = when { - poBoxValue != null -> Pair(DeliveryServiceType.PO_BOX, poBoxValue) - privateBagValue != null -> Pair(DeliveryServiceType.PRIVATE_BAG, privateBagValue) - else -> throw BpdmMappingException(AddressSaas::class, LogisticAddressDto::class, "No valid alternativ address", id ?: "Unknown") - } - - return AlternativePostalAddressDto( - deliveryServiceNumber = deliveryServiceNumber, - deliveryServiceType = deliveryServiceType, - deliveryServiceQualifier = null, - areaPart = AreaDistrictAlternativDto( - administrativeAreaLevel1 = map.adminAreaLevel1() - ), - baseAddress = BasePostalAddressDto( - geographicCoordinates = map.geoCoordinates(), - city = city, - country = country, - postalCode = map.postcode(), - ) - ) - } - - private fun toStreetDto(map: SaasAddressToDtoMapping): StreetDto? { - if (map.streetName() == null) { - return null - } - return StreetDto( - name = map.streetName(), - houseNumber = map.streetHouseNumber(), - milestone = map.streetMilestone(), - direction = map.streetDirection() - ) - } - - - fun toDto(version: AddressVersionSaas?): AddressVersionDto { - return AddressVersionDto(toTypeOrDefault(version?.characterSet), toLanguageCode(version?.language)) - } - - - fun toDto(geoCoords: GeoCoordinatesSaas): GeoCoordinateDto? { - return if (geoCoords.latitude != null && geoCoords.longitude != null) GeoCoordinateDto(geoCoords.longitude, geoCoords.latitude, null) else null - } - - fun toRelationToDelete(relation: RelationSaas): DeleteRelationsRequestSaas.RelationToDeleteSaas { - return DeleteRelationsRequestSaas.RelationToDeleteSaas( - startNode = DeleteRelationsRequestSaas.RelationNodeToDeleteSaas( - dataSourceId = relation.startNodeDataSource, - externalId = relation.startNode - ), - endNode = DeleteRelationsRequestSaas.RelationNodeToDeleteSaas( - dataSourceId = relation.endNodeDataSource, - externalId = relation.endNode - ) - ) - } - - private data class SassNameDto( - val value: String, - val shortName: String? - ) { - constructor(nameSass: NameSaas) : - this(value = nameSass.value, shortName = nameSass.shortName) - } - -} \ No newline at end of file