From ee8c694c12850b27144a664c948c3b84398ead6f Mon Sep 17 00:00:00 2001 From: Christof Rabensteiner Date: Thu, 3 Oct 2019 16:09:47 +0200 Subject: Update zusemsg and zusetnvz to Newest Version & Accommodate Changes Upgrade zusemsg 2.2.0 to 2.2.007: - msg:RelayedViaERV - Change from boolean to complex type (ervcode). - Move from msg:DeliveryRequestStatusType/Success into msg:DeliveryRequestStatusType, which affects Success, Error, and PartialSuccess. - Was removed from DeliveryNotificationType. - Change msg:DeliveryNotification/Answer from list to singleton. - Change msg:DeliveryRequestStatusType/PartialSuccess is to type AnswerType. - msg:DeliveryRequestStatusType and msg:DeliveryNotificationType receive the attribute ID (for signature referencing). - Add new optional element msg:AustrianAdressesOnly (IndicatorType) to DeliveryRequestType/Receiver/(choice sequence). - Add new optional element ClearingProfilID to DeliveryRequestType/Sender. - Add new element ERVConfirmedDelivery, which subsitutes msg:Answer and extends msg:AbstractOperation - Has element ErvCode (also new token256 type). - Has element ERVDeliveryTimestamp. - Add new optional element TargetIdentification of type p:IdentificationType to msg:DeliveryNotification/User/ as optional element. - Add new enumeration "System" to msg:DeliveryNotification/User/Role. - Rename type AustrianLanguageType from "AustrianEthicMinorityLanguageType" to "AustrianLanguageType" and add "DE" as value. - msg:Tags were unbounded, now they are limited to 20. - VersionNumberType: Patch version can have three digits. Upgrade zusetnvz 2.2.0 to 2.2.006: - Add StandardMimeTypeList to tnvz:QueryPersonResponse and tnvz:QueryAdressabilityResponse. - Add AllStandardMimeTypes (indicator) to tnvz:PersonResult/Success. - Add optional msg:MetadataList to tnvz:PersonQueryType/Metadata tnvz:AddressabilityQueryType/Metadata. - Move tnvz:AustrianAdressesOnly to msg namespace. Carry zusemsg changes into app2mzs interface: - Switch namespace of AustrianAdressesOnly from tnvz to msg. - Add new optional element ClearingProfilID to mzs:DeliveryRequestType/Sender; Reason: Element was added to zusemsg 2.2.007. - Add new choice in mzs:DeliveryNotification to forward new answer type msg:ERVConfirmedDelivery to the app. - Move msg:RelayedViaERV from SuccessType into MessageType (now it's available to all types that derive from MessageType). Accommodate zusemsg/tnvz changes in code base: - TNVZHelper: Consider StandardMimeTypeList when assessing if DeliveryRequest/mimetypes overlap with TNVZ's Accepted Mimetypes. - Msg2MzsConverter: - Put getRelayedViaERV() into all DeliveryStatusRequest replies. - Honor that Notification/Answer is Singleton instead of List. - Handle case were DeliveryNotification/Answer is of type ERVConfirmedDeliveryType. - Remove RelayedViaERV from DeliveryNotification as this element is not available anymore. - NotificationResponse: Honor that Notification/Answer is Singleton instead of List. Fix all testcases and sample soap messages to comply with schema changes. --- .../at/gv/egiz/moazs/scheme/Msg2MzsConverter.java | 36 ++++++++-------------- 1 file changed, 13 insertions(+), 23 deletions(-) (limited to 'src/main/java/at/gv/egiz/moazs/scheme/Msg2MzsConverter.java') diff --git a/src/main/java/at/gv/egiz/moazs/scheme/Msg2MzsConverter.java b/src/main/java/at/gv/egiz/moazs/scheme/Msg2MzsConverter.java index 65b6425..cabb128 100644 --- a/src/main/java/at/gv/egiz/moazs/scheme/Msg2MzsConverter.java +++ b/src/main/java/at/gv/egiz/moazs/scheme/Msg2MzsConverter.java @@ -24,53 +24,48 @@ import static java.util.stream.Collectors.toList; @Component public class Msg2MzsConverter { - private static final Logger log = LoggerFactory.getLogger(Msg2MzsConverter.class); - - private static final String ANSWERS_MISSING_ERROR_MSG = "msg:DeliveryNotification contains no msg:Answer elements" + - " and cannot be converted to mzs:DeliveryNotification."; private static final String UNKNOWN_ANSWER_ERROR_MSG = "msg:DeliveryNotification/msg:Answer is of unknown type" + " and cannot be converted."; - private static final String TOO_MANY_ANSWERS_MSG = "msg:DeliveryNotification contains more msg:Answer elements than" + - " expected. All answers except the first one will be ignored."; public DeliveryResponseType convert(DeliveryRequestStatusType status, Optional signedStatus) { var responseBuilder = deliveryResponseTypeBuilder(); if (status.getError() != null) { - responseBuilder.withError(convert(status.getError(), signedStatus)); + responseBuilder.withError(convert(status.getError(), signedStatus, status.getRelayedViaERV())); } else if (status.getSuccess() != null) { - responseBuilder.withSuccess(convert(status.getSuccess(), signedStatus)); + responseBuilder.withSuccess(convert(status.getSuccess(), signedStatus, status.getRelayedViaERV())); } else { - responseBuilder.withPartialSuccess(convert(status.getPartialSuccess(), signedStatus)); + responseBuilder.withPartialSuccess(convert(status.getPartialSuccess(), signedStatus, status.getRelayedViaERV())); } return responseBuilder.build(); } - private SuccessType convert(DeliveryRequestStatusType.Success success, Optional signedStatus) { + private SuccessType convert(DeliveryRequestStatusType.Success success, Optional signedStatus, RelayedViaERV relayed) { return successTypeBuilder() .withAppDeliveryID(success.getAppDeliveryID()) .withDeliverySystem(success.getDeliverySystem()) .withGZ(success.getGZ()) .withZSDeliveryID(success.getZSDeliveryID()) .withSignedDeliveryRequestStatus(signedStatus.orElse(null)) - .withRelayedViaERV(success.isRelayedViaERV()) + .withRelayedViaERV(relayed) .withDeliveryTimestamp(success.getDeliveryTimestamp()) .build(); } - private PartialSuccessType convert(DeliveryAnswerType answer, Optional signedStatus) { + private PartialSuccessType convert(DeliveryAnswerType answer, Optional signedStatus, RelayedViaERV relayed) { return partialSuccessTypeBuilder() .withAppDeliveryID(answer.getAppDeliveryID()) .withDeliverySystem(answer.getDeliverySystem()) .withGZ(answer.getGZ()) .withZSDeliveryID(answer.getZSDeliveryID()) + .withRelayedViaERV(relayed) .withSignedDeliveryRequestStatus(signedStatus.orElse(null)) .build(); } - private ErrorType convert(DeliveryRequestStatusType.Error error, Optional signedStatus) { + private ErrorType convert(DeliveryRequestStatusType.Error error, Optional signedStatus, RelayedViaERV relayed) { var builder = errorTypeBuilder() .withAppDeliveryID(error.getAppDeliveryID()) .withDeliverySystem(error.getDeliverySystem()) @@ -78,6 +73,7 @@ public class Msg2MzsConverter { .withZSDeliveryID(error.getZSDeliveryID()) .withSignedDeliveryRequestStatus(signedStatus.orElse(null)) .withPreAdviceNoteSent(error.getPreAdviceNoteSent()) + .withRelayedViaERV(relayed) .withCode(new BigInteger(error.getErrorInfo().getCode())); if(error.getErrorInfo().getText() != null) builder.withText(error.getErrorInfo().getText()); @@ -90,15 +86,7 @@ public class Msg2MzsConverter { var builder = deliveryNotificationTypeBuilder(); - if (msgNotification.getAnswer().isEmpty()) { - throw moaZSException(ANSWERS_MISSING_ERROR_MSG); - } - - if (msgNotification.getAnswer().size() > 1) { - log.warn(TOO_MANY_ANSWERS_MSG); - } - - JAXBElement answer = msgNotification.getAnswer().get(0); + JAXBElement answer = msgNotification.getAnswer(); if(answer.getValue() instanceof AcceptedType) { var accepted = (AcceptedType) answer.getValue(); @@ -108,6 +96,9 @@ public class Msg2MzsConverter { var error = (DeliveryErrorType) answer.getValue(); builder.withError(extractError(msgNotification, error, signedNotification)) .withNotificationsPerformed(error.getNotificationsPerformed()); + } else if(answer.getValue() instanceof ERVConfirmedDeliveryType) { + ERVConfirmedDeliveryType ervConfirmed = (ERVConfirmedDeliveryType) answer.getValue(); + builder.withERVConfirmedDelivery(ervConfirmed); } else { throw moaZSException(UNKNOWN_ANSWER_ERROR_MSG); } @@ -141,7 +132,6 @@ public class Msg2MzsConverter { .withZSDeliveryID(msgNotification.getZSDeliveryID()) .withGZ(msgNotification.getGZ()) .withSignedDeliveryRequestStatus(signedNotification.orElse(null)) - .withRelayedViaERV(msgNotification.isRelayedViaERV()) .withDeliveryTimestamp(msgNotification.getTimestamp()) .build(); } -- cgit v1.2.3