From d2532ed422f2cb20f3314018870e295b3f9e33c8 Mon Sep 17 00:00:00 2001 From: Niels Desmet Date: Wed, 11 Sep 2024 14:47:22 +0200 Subject: [PATCH 1/3] feat: include MagdaServiceIdentification information in UitzonderingenSectionInResponseExceptions --- .../vip/magda/client/ConnectorMagdaClient.java | 4 ++-- .../magda/client/LenientConnectorMagdaClient.java | 2 +- .../vip/magda/client/MagdaServiceIdentification.java | 9 ++++++++- .../MagdaClientGiveEnrollmentHistoryService.java | 2 +- .../UitzonderingenSectionInResponseException.java | 12 ++++++++++-- .../vip/magda/client/MagdaConnectorImpl.java | 2 +- 6 files changed, 23 insertions(+), 8 deletions(-) diff --git a/interfaces/src/main/java/be/vlaanderen/vip/magda/client/ConnectorMagdaClient.java b/interfaces/src/main/java/be/vlaanderen/vip/magda/client/ConnectorMagdaClient.java index fceccccb..cda4cadc 100644 --- a/interfaces/src/main/java/be/vlaanderen/vip/magda/client/ConnectorMagdaClient.java +++ b/interfaces/src/main/java/be/vlaanderen/vip/magda/client/ConnectorMagdaClient.java @@ -19,10 +19,10 @@ public ConnectorMagdaClient(MagdaConnector connector) { @Override protected void validateMagdaResponse(MagdaResponse response, MagdaRequest request) throws MagdaClientException { if(!response.getUitzonderingEntries().isEmpty()) { - throw new MagdaClientException("Level 2 exception occurred while calling magda service", new UitzonderingenSectionInResponseException(request.getSubject(), response.getUitzonderingEntries(), request.getCorrelationId(), response.getRequestId())); + throw new MagdaClientException("Level 2 exception occurred while calling magda service", new UitzonderingenSectionInResponseException(request.getSubject(), response.getUitzonderingEntries(), request.magdaServiceIdentification(), request.getCorrelationId(), response.getRequestId())); } if(!response.getResponseUitzonderingEntries().isEmpty() && haveAtLeastOneFout(response.getResponseUitzonderingEntries())) { - throw new MagdaClientException("Level 3 exception occurred while calling magda service", new UitzonderingenSectionInResponseException(request.getSubject(), response.getResponseUitzonderingEntries(), request.getCorrelationId(), response.getRequestId())); + throw new MagdaClientException("Level 3 exception occurred while calling magda service", new UitzonderingenSectionInResponseException(request.getSubject(), response.getResponseUitzonderingEntries(), request.magdaServiceIdentification(), request.getCorrelationId(), response.getRequestId())); } } diff --git a/interfaces/src/main/java/be/vlaanderen/vip/magda/client/LenientConnectorMagdaClient.java b/interfaces/src/main/java/be/vlaanderen/vip/magda/client/LenientConnectorMagdaClient.java index 5dfc0db8..5932e952 100644 --- a/interfaces/src/main/java/be/vlaanderen/vip/magda/client/LenientConnectorMagdaClient.java +++ b/interfaces/src/main/java/be/vlaanderen/vip/magda/client/LenientConnectorMagdaClient.java @@ -14,7 +14,7 @@ public LenientConnectorMagdaClient(MagdaConnector connector) { @Override protected void validateMagdaResponse(MagdaResponse response, MagdaRequest request) throws MagdaClientException { if(!response.getUitzonderingEntries().isEmpty()) { - throw new MagdaClientException("Level 2 exception occurred while calling magda service", new UitzonderingenSectionInResponseException(request.getSubject(), response.getUitzonderingEntries(), request.getCorrelationId(), response.getRequestId())); + throw new MagdaClientException("Level 2 exception occurred while calling magda service", new UitzonderingenSectionInResponseException(request.getSubject(), response.getUitzonderingEntries(), request.magdaServiceIdentification(), request.getCorrelationId(), response.getRequestId())); } } } diff --git a/interfaces/src/main/java/be/vlaanderen/vip/magda/client/MagdaServiceIdentification.java b/interfaces/src/main/java/be/vlaanderen/vip/magda/client/MagdaServiceIdentification.java index 78d17dbc..2eabce34 100644 --- a/interfaces/src/main/java/be/vlaanderen/vip/magda/client/MagdaServiceIdentification.java +++ b/interfaces/src/main/java/be/vlaanderen/vip/magda/client/MagdaServiceIdentification.java @@ -5,6 +5,9 @@ import lombok.Getter; import lombok.ToString; +import java.io.Serial; +import java.io.Serializable; + /** * An identifier of a specific service provided by MAGDA, which comprises a name and a version. */ @@ -12,7 +15,11 @@ @EqualsAndHashCode @ToString @AllArgsConstructor -public class MagdaServiceIdentification { +public class MagdaServiceIdentification implements Serializable { + + @Serial + private static final long serialVersionUID = 5966457937074564979L; + private String name; private String version; } diff --git a/interfaces/src/main/java/be/vlaanderen/vip/magda/client/domain/giveenrollmenthistory/MagdaClientGiveEnrollmentHistoryService.java b/interfaces/src/main/java/be/vlaanderen/vip/magda/client/domain/giveenrollmenthistory/MagdaClientGiveEnrollmentHistoryService.java index ae37d094..fb680e91 100644 --- a/interfaces/src/main/java/be/vlaanderen/vip/magda/client/domain/giveenrollmenthistory/MagdaClientGiveEnrollmentHistoryService.java +++ b/interfaces/src/main/java/be/vlaanderen/vip/magda/client/domain/giveenrollmenthistory/MagdaClientGiveEnrollmentHistoryService.java @@ -49,7 +49,7 @@ private void validateResponse(MagdaResponse response, GeefHistoriekInschrijvingR if(response.getResponseUitzonderingEntries().stream().anyMatch(x -> x.getUitzonderingType().equals(UitzonderingType.FOUT) && !"30101".equals(x.getIdentification()))) { - throw new MagdaClientException("Level 3 exception occurred while calling magda service", new UitzonderingenSectionInResponseException(request.getSubject(), response.getResponseUitzonderingEntries(), request.getCorrelationId(), response.getRequestId())); + throw new MagdaClientException("Level 3 exception occurred while calling magda service", new UitzonderingenSectionInResponseException(request.getSubject(), response.getResponseUitzonderingEntries(), request.magdaServiceIdentification(), request.getCorrelationId(), response.getRequestId())); } } } diff --git a/interfaces/src/main/java/be/vlaanderen/vip/magda/exception/UitzonderingenSectionInResponseException.java b/interfaces/src/main/java/be/vlaanderen/vip/magda/exception/UitzonderingenSectionInResponseException.java index b4c2d2af..1fb10b0f 100644 --- a/interfaces/src/main/java/be/vlaanderen/vip/magda/exception/UitzonderingenSectionInResponseException.java +++ b/interfaces/src/main/java/be/vlaanderen/vip/magda/exception/UitzonderingenSectionInResponseException.java @@ -1,5 +1,6 @@ package be.vlaanderen.vip.magda.exception; +import be.vlaanderen.vip.magda.client.MagdaServiceIdentification; import be.vlaanderen.vip.magda.client.diensten.subject.SubjectIdentificationNumber; import be.vlaanderen.vip.magda.legallogging.model.UitzonderingEntry; import lombok.Getter; @@ -20,10 +21,17 @@ public class UitzonderingenSectionInResponseException extends ServerException { private final SubjectIdentificationNumber subject; private final transient List uitzonderingEntries; + private final MagdaServiceIdentification magdaServiceIdentification; - public UitzonderingenSectionInResponseException(SubjectIdentificationNumber subject, List uitzonderingEntries, UUID correlationID, UUID requestID) { + public UitzonderingenSectionInResponseException(SubjectIdentificationNumber subject, List uitzonderingEntries, MagdaServiceIdentification magdaServiceIdentification, UUID correlationID, UUID requestID) { super("Backend error '" + uitzonderingEntries.get(0).toString() + "'", correlationID, requestID); this.subject = subject; this.uitzonderingEntries = uitzonderingEntries; + this.magdaServiceIdentification = magdaServiceIdentification; + } + + @Deprecated(forRemoval = true) + public UitzonderingenSectionInResponseException(SubjectIdentificationNumber subject, List uitzonderingEntries, UUID correlationID, UUID requestID) { + this(subject, uitzonderingEntries, null, correlationID, requestID); } -} +} \ No newline at end of file diff --git a/magdaconnector/src/main/java/be/vlaanderen/vip/magda/client/MagdaConnectorImpl.java b/magdaconnector/src/main/java/be/vlaanderen/vip/magda/client/MagdaConnectorImpl.java index 2af1809e..6d5d3aaf 100644 --- a/magdaconnector/src/main/java/be/vlaanderen/vip/magda/client/MagdaConnectorImpl.java +++ b/magdaconnector/src/main/java/be/vlaanderen/vip/magda/client/MagdaConnectorImpl.java @@ -77,7 +77,7 @@ public MagdaResponse send(MagdaRequest magdaRequest, UUID requestId) throws Serv .log("Result of request to MAGDA service with reference [{}] ({} ms): {}", requestId, duration.toMillis(), uitzonderingenMessage1); if(!antwoord.isHasContents() && antwoordUitzonderingen.isEmpty() && uitzonderingen.isEmpty()) { - throw new UitzonderingenSectionInResponseException(magdaRequest.getSubject(), getLevel1UitzonderingEntry(response), magdaRequest.getCorrelationId(), requestId); + throw new UitzonderingenSectionInResponseException(magdaRequest.getSubject(), getLevel1UitzonderingEntry(response), magdaRequest.magdaServiceIdentification(), magdaRequest.getCorrelationId(), requestId); } return antwoord; From 3d15f594d6f41e27a3ab63a5352a70b57f09fd48 Mon Sep 17 00:00:00 2001 From: bitbucket-pipelines Date: Fri, 20 Sep 2024 07:41:38 +0000 Subject: [PATCH 2/3] Update for next development version --- common/pom.xml | 2 +- interfaces/pom.xml | 2 +- magdaconnector/pom.xml | 2 +- magdamock-starter/pom.xml | 2 +- magdamock/pom.xml | 2 +- magdaservice/pom.xml | 2 +- pom.xml | 2 +- signing/pom.xml | 2 +- tester/pom.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/common/pom.xml b/common/pom.xml index a2e24d24..156b04a8 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ magda be.vlaanderen.vip.mock - 2.49.0 + 2.50.0-SNAPSHOT 4.0.0 diff --git a/interfaces/pom.xml b/interfaces/pom.xml index 546073c1..843d76b3 100644 --- a/interfaces/pom.xml +++ b/interfaces/pom.xml @@ -5,7 +5,7 @@ magda be.vlaanderen.vip.mock - 2.49.0 + 2.50.0-SNAPSHOT 4.0.0 diff --git a/magdaconnector/pom.xml b/magdaconnector/pom.xml index 6a56ea43..529e72bb 100644 --- a/magdaconnector/pom.xml +++ b/magdaconnector/pom.xml @@ -5,7 +5,7 @@ magda be.vlaanderen.vip.mock - 2.49.0 + 2.50.0-SNAPSHOT 4.0.0 diff --git a/magdamock-starter/pom.xml b/magdamock-starter/pom.xml index bbcdeec9..3a48df76 100644 --- a/magdamock-starter/pom.xml +++ b/magdamock-starter/pom.xml @@ -8,7 +8,7 @@ magda be.vlaanderen.vip.mock - 2.49.0 + 2.50.0-SNAPSHOT magdamock-starter diff --git a/magdamock/pom.xml b/magdamock/pom.xml index 353ce631..08005cd3 100644 --- a/magdamock/pom.xml +++ b/magdamock/pom.xml @@ -3,7 +3,7 @@ magda be.vlaanderen.vip.mock - 2.49.0 + 2.50.0-SNAPSHOT 4.0.0 diff --git a/magdaservice/pom.xml b/magdaservice/pom.xml index 4c2f8824..bc8a6ed4 100644 --- a/magdaservice/pom.xml +++ b/magdaservice/pom.xml @@ -5,7 +5,7 @@ magda be.vlaanderen.vip.mock - 2.49.0 + 2.50.0-SNAPSHOT 4.0.0 diff --git a/pom.xml b/pom.xml index 0da493fa..e5beb0b1 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ be.vlaanderen.vip.mock magda - 2.49.0 + 2.50.0-SNAPSHOT magdaservice MAGDA diensten Mock voor afnemers diff --git a/signing/pom.xml b/signing/pom.xml index ff798c96..9a4a2f27 100644 --- a/signing/pom.xml +++ b/signing/pom.xml @@ -5,7 +5,7 @@ magda be.vlaanderen.vip.mock - 2.49.0 + 2.50.0-SNAPSHOT 4.0.0 diff --git a/tester/pom.xml b/tester/pom.xml index 2d8c6fc4..b45cc251 100644 --- a/tester/pom.xml +++ b/tester/pom.xml @@ -5,7 +5,7 @@ magda be.vlaanderen.vip.mock - 2.49.0 + 2.50.0-SNAPSHOT 4.0.0 From 066999e51b47716759e52ac3cf53d065800070e8 Mon Sep 17 00:00:00 2001 From: bitbucket-pipelines Date: Mon, 23 Sep 2024 13:25:21 +0000 Subject: [PATCH 3/3] Update versions for release --- common/pom.xml | 2 +- interfaces/pom.xml | 2 +- magdaconnector/pom.xml | 2 +- magdamock-starter/pom.xml | 2 +- magdamock/pom.xml | 2 +- magdaservice/pom.xml | 2 +- pom.xml | 2 +- signing/pom.xml | 2 +- tester/pom.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/common/pom.xml b/common/pom.xml index 156b04a8..e1fa0c4a 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ magda be.vlaanderen.vip.mock - 2.50.0-SNAPSHOT + 2.50.0 4.0.0 diff --git a/interfaces/pom.xml b/interfaces/pom.xml index 843d76b3..d72bd951 100644 --- a/interfaces/pom.xml +++ b/interfaces/pom.xml @@ -5,7 +5,7 @@ magda be.vlaanderen.vip.mock - 2.50.0-SNAPSHOT + 2.50.0 4.0.0 diff --git a/magdaconnector/pom.xml b/magdaconnector/pom.xml index 529e72bb..f33dca44 100644 --- a/magdaconnector/pom.xml +++ b/magdaconnector/pom.xml @@ -5,7 +5,7 @@ magda be.vlaanderen.vip.mock - 2.50.0-SNAPSHOT + 2.50.0 4.0.0 diff --git a/magdamock-starter/pom.xml b/magdamock-starter/pom.xml index 3a48df76..78edec4e 100644 --- a/magdamock-starter/pom.xml +++ b/magdamock-starter/pom.xml @@ -8,7 +8,7 @@ magda be.vlaanderen.vip.mock - 2.50.0-SNAPSHOT + 2.50.0 magdamock-starter diff --git a/magdamock/pom.xml b/magdamock/pom.xml index 08005cd3..34bb8274 100644 --- a/magdamock/pom.xml +++ b/magdamock/pom.xml @@ -3,7 +3,7 @@ magda be.vlaanderen.vip.mock - 2.50.0-SNAPSHOT + 2.50.0 4.0.0 diff --git a/magdaservice/pom.xml b/magdaservice/pom.xml index bc8a6ed4..1d38781f 100644 --- a/magdaservice/pom.xml +++ b/magdaservice/pom.xml @@ -5,7 +5,7 @@ magda be.vlaanderen.vip.mock - 2.50.0-SNAPSHOT + 2.50.0 4.0.0 diff --git a/pom.xml b/pom.xml index e5beb0b1..e2ae3101 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ be.vlaanderen.vip.mock magda - 2.50.0-SNAPSHOT + 2.50.0 magdaservice MAGDA diensten Mock voor afnemers diff --git a/signing/pom.xml b/signing/pom.xml index 9a4a2f27..cad02b75 100644 --- a/signing/pom.xml +++ b/signing/pom.xml @@ -5,7 +5,7 @@ magda be.vlaanderen.vip.mock - 2.50.0-SNAPSHOT + 2.50.0 4.0.0 diff --git a/tester/pom.xml b/tester/pom.xml index b45cc251..b0bbe4b2 100644 --- a/tester/pom.xml +++ b/tester/pom.xml @@ -5,7 +5,7 @@ magda be.vlaanderen.vip.mock - 2.50.0-SNAPSHOT + 2.50.0 4.0.0