From ac3cc8a6a46211d333a7b9a5514082ce70319e89 Mon Sep 17 00:00:00 2001 From: kunyao-cofinity-x <138508171+kunyao-cofinity-x@users.noreply.github.com> Date: Tue, 2 Jul 2024 15:22:15 +0200 Subject: [PATCH] # This is a combination of 8 commits. # This is the 1st commit message: feat: Adding extend error states # This is the commit message #2: feat: Adding logic to TaskResolutionService handling conditions # This is the commit message #3: feat(bpdm-gate): Extend error states # This is the commit message #4: feat(bpdm-gate): Extend error code with description # This is the commit message #5: feat(bpdm-gate): Extend error code with description. Extend error code to DB schema # This is the commit message #6: Revert "feat(bpdm-gate): Extend error code with description. Extend error code to DB schema" This reverts commit ff2863d07c51ab7ef0fbeec9f0816b4ac89e992e. # This is the commit message #7: feat(bpdm-gate): Extend error code with description. Extend error code to DB schema # This is the commit message #8: feat: Adding extend error states --- .../bpdm/gate/api/exception/GateErrorCodes.kt | 20 +++++++++++++++++ .../bpdm/gate/api/model/SharingStateType.kt | 15 ++++++++++++- .../orchestrator/api/model/ResultState.kt | 15 ++++++++++++- .../orchestrator/api/model/TaskErrorType.kt | 22 ++++++++++++++++++- .../db/migration/V6_1_0_0__create_tables.sql | 2 +- 5 files changed, 70 insertions(+), 4 deletions(-) diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/exception/GateErrorCodes.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/exception/GateErrorCodes.kt index b49ca962f..62af17c1e 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/exception/GateErrorCodes.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/exception/GateErrorCodes.kt @@ -19,6 +19,8 @@ package org.eclipse.tractusx.bpdm.gate.api.exception +import io.swagger.v3.oas.annotations.media.Schema + /** * For every combination of possible errors a separate enum class is defined extending this marker interface. * We need separate enum classes in order to get the correct error codes for each endpoint in the Swagger schema. @@ -30,6 +32,24 @@ enum class BusinessPartnerSharingError : ErrorCode { SharingTimeout, BpnNotInPool, MissingTaskID, + + @Schema(description = "The provided record contains natural person information. ") + NaturalPersonError, + + @Schema(description = "The provided record can not be matched to a legal entity or an address.") + BpnErrorNotFound, + + @Schema(description = "The provided record can not link to a clear legal entity.") + BpnErrorTooManyOptions, + + @Schema(description = "The provided record does not fulfill mandatory validation rules. ") + MandatoryFieldValidationFailed, + + @Schema(description = "The provided record is part of a country that is not allowed to be processed by the GR process (example: Brazil).") + BlacklistCountryPresent, + + @Schema(description = "The provided record contains unalloyed special characters. ") + UnknownSpecialCharacters } enum class ChangeLogOutputError : ErrorCode { diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/SharingStateType.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/SharingStateType.kt index dbecddd6e..1a55c8107 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/SharingStateType.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/SharingStateType.kt @@ -24,5 +24,18 @@ enum class SharingStateType { Success, Error, Initial, - Ready + Ready, + NaturalPersonError, + BpnErrorMissingParent, + BpnErrorNotFound, + BpnErrorTooManyOptions, + MandatoryFieldValidationFailed, + BlacklistCountryPresent, + InvalidSpecialCharacters, + MandatoryFieldMissing, + BpnlChanged, + UnclearEntity, + UnknownSpecialCharacters, + MatchBasedOnProvidedNameOrIdentifier, + None } \ No newline at end of file diff --git a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/ResultState.kt b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/ResultState.kt index 8344adae0..3d191420a 100644 --- a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/ResultState.kt +++ b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/ResultState.kt @@ -22,5 +22,18 @@ package org.eclipse.tractusx.orchestrator.api.model enum class ResultState { Pending, Success, - Error + Error, + NaturalPersonError, + BpnErrorMissingParent, + BpnErrorNotFound, + BpnErrorTooManyOptions, + MandatoryFieldValidationFailed, + BlacklistCountryPresent, + InvalidSpecialCharacters, + MandatoryFieldMissing, + BpnlChanged, + UnclearEntity, + UnknownSpecialCharacters, + MatchBasedOnProvidedNameOrIdentifier, + None } \ No newline at end of file diff --git a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/TaskErrorType.kt b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/TaskErrorType.kt index 7f18c36a9..8b627e1f4 100644 --- a/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/TaskErrorType.kt +++ b/bpdm-orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/TaskErrorType.kt @@ -19,7 +19,27 @@ package org.eclipse.tractusx.orchestrator.api.model +import io.swagger.v3.oas.annotations.media.Schema + enum class TaskErrorType { Timeout, - Unspecified + Unspecified, + + @Schema(description = "The provided record contains natural person information. ") + NaturalPersonError, + + @Schema(description = "The provided record can not be matched to a legal entity or an address.") + BpnErrorNotFound, + + @Schema(description = "The provided record can not link to a clear legal entity.") + BpnErrorTooManyOptions, + + @Schema(description = "The provided record does not fulfill mandatory validation rules. ") + MandatoryFieldValidationFailed, + + @Schema(description = "The provided record is part of a country that is not allowed to be processed by the GR process (example: Brazil).") + BlacklistCountryPresent, + + @Schema(description = "The provided record contains unalloyed special characters. ") + UnknownSpecialCharacters } \ No newline at end of file diff --git a/bpdm-orchestrator/src/main/resources/db/migration/V6_1_0_0__create_tables.sql b/bpdm-orchestrator/src/main/resources/db/migration/V6_1_0_0__create_tables.sql index 0538b9b96..8e7ff49df 100644 --- a/bpdm-orchestrator/src/main/resources/db/migration/V6_1_0_0__create_tables.sql +++ b/bpdm-orchestrator/src/main/resources/db/migration/V6_1_0_0__create_tables.sql @@ -178,7 +178,7 @@ create table golden_record_tasks ( create table task_errors ( task_id bigint not null, description varchar(255) not null, - type varchar(255) not null check (type in ('Timeout', 'Unspecified')) + type varchar(255) not null check (type in ('Timeout', 'Unspecified', 'NaturalPersonError', 'BpnErrorNotFound', 'BpnErrorTooManyOptions','MandatoryFieldValidationFailed', 'BlacklistCountryPresent', 'UnknownSpecialCharacters')) ); create table gate_records (