aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-12-05 09:16:36 +0100
committerChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-12-05 09:16:36 +0100
commitcf90865ce21f246a0358fd291324f511c5ed6e90 (patch)
treea8f03882f78d9f7fb38f645db38feeada294d0b4
parent641ba9c97e251020e934a2e2b23638b770907495 (diff)
downloadmoa-zs-cf90865ce21f246a0358fd291324f511c5ed6e90.tar.gz
moa-zs-cf90865ce21f246a0358fd291324f511c5ed6e90.tar.bz2
moa-zs-cf90865ce21f246a0358fd291324f511c5ed6e90.zip
Fix Missing Parameters in ERVDeliveryConfirmed Notification
- mzs Schema Change: Introduce new type mzs:ERVConfirmedDelivery (which is a mzs:MessageType extension) and replace mzs:DeliveryNotification/msg:ERVConfirmedDelivery with mzs:ERVConfirmedDelivery. Reason: Necessary to provide all parameters to sender application (AppDeliveryID, DeliverySystem, ZSDeliveryID, a.o.). - Adapt Msg2MzsConverter accordingly.
-rw-r--r--src/main/java/at/gv/egiz/moazs/scheme/Msg2MzsConverter.java21
-rw-r--r--src/main/resources/mzs/app2mzs.xsd12
2 files changed, 30 insertions, 3 deletions
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 f7d14cd..1390986 100644
--- a/src/main/java/at/gv/egiz/moazs/scheme/Msg2MzsConverter.java
+++ b/src/main/java/at/gv/egiz/moazs/scheme/Msg2MzsConverter.java
@@ -24,6 +24,7 @@ package at.gv.egiz.moazs.scheme;
import at.gv.zustellung.app2mzs.xsd.DeliveryNotificationType;
import at.gv.zustellung.app2mzs.xsd.*;
import at.gv.zustellung.msg.xsd.*;
+import at.gv.zustellung.msg.xsd.ERVConfirmedDeliveryType;
import org.springframework.stereotype.Component;
import javax.xml.bind.JAXBElement;
@@ -34,6 +35,7 @@ import static at.gv.egiz.moazs.MoaZSException.moaZSException;
import static at.gv.zustellung.app2mzs.xsd.DeliveryNotificationType.AdditionalFormat.additionalFormatBuilder;
import static at.gv.zustellung.app2mzs.xsd.DeliveryNotificationType.deliveryNotificationTypeBuilder;
import static at.gv.zustellung.app2mzs.xsd.DeliveryResponseType.deliveryResponseTypeBuilder;
+import static at.gv.zustellung.app2mzs.xsd.ERVConfirmedDeliveryType.ERVConfirmedDeliveryTypeBuilder;
import static at.gv.zustellung.app2mzs.xsd.ErrorType.errorTypeBuilder;
import static at.gv.zustellung.app2mzs.xsd.PartialSuccessType.partialSuccessTypeBuilder;
import static at.gv.zustellung.app2mzs.xsd.SuccessType.successTypeBuilder;
@@ -120,8 +122,8 @@ public class Msg2MzsConverter {
builder.withError(extractError(msgNotification, error, signedNotification))
.withNotificationsPerformed(error.getNotificationsPerformed());
} else if(answer.getValue() instanceof ERVConfirmedDeliveryType) {
- ERVConfirmedDeliveryType ervConfirmed = (ERVConfirmedDeliveryType) answer.getValue();
- builder.withERVConfirmedDelivery(ervConfirmed);
+ var ervConfirmed = (ERVConfirmedDeliveryType) answer.getValue();
+ builder.withERVConfirmedDelivery(extractERVconfirmedDelivery(msgNotification, ervConfirmed, signedNotification));
} else {
throw moaZSException(UNKNOWN_ANSWER_ERROR_MSG);
}
@@ -159,6 +161,21 @@ public class Msg2MzsConverter {
.build();
}
+ private at.gv.zustellung.app2mzs.xsd.ERVConfirmedDeliveryType extractERVconfirmedDelivery(
+ at.gv.zustellung.msg.xsd.DeliveryNotificationType msgNotification,
+ ERVConfirmedDeliveryType ervConfirmed,Optional<byte[]> signedNotification) {
+
+ return ERVConfirmedDeliveryTypeBuilder()
+ .withAppDeliveryID(msgNotification.getAppDeliveryID())
+ .withDeliverySystem(msgNotification.getDeliverySystem())
+ .withZSDeliveryID(msgNotification.getZSDeliveryID())
+ .withGZ(msgNotification.getGZ())
+ .withSignedDeliveryRequestStatus(signedNotification.orElse(null))
+ .withERVConfirmedDelivery(ervConfirmed)
+ .build();
+ }
+
+
private List<DeliveryNotificationType.AdditionalFormat> convert(
List<at.gv.zustellung.msg.xsd.DeliveryNotificationType.AdditionalFormat> additionalFormat) {
return additionalFormat.stream()
diff --git a/src/main/resources/mzs/app2mzs.xsd b/src/main/resources/mzs/app2mzs.xsd
index 6a4ffda..4b22a63 100644
--- a/src/main/resources/mzs/app2mzs.xsd
+++ b/src/main/resources/mzs/app2mzs.xsd
@@ -169,7 +169,7 @@
<xs:choice>
<xs:element ref="Success"/>
<xs:element ref="Error"/>
- <xs:element ref="msg:ERVConfirmedDelivery"/>
+ <xs:element ref="ERVConfirmedDelivery"/>
</xs:choice>
<xs:element ref="msg:SenderDetails"/>
<xs:element ref="msg:ReceiverDetails"/>
@@ -245,6 +245,16 @@
</xs:extension>
</xs:complexContent>
</xs:complexType>
+ <xs:element name="ERVConfirmedDelivery" type="ERVConfirmedDeliveryType" />
+ <xs:complexType name="ERVConfirmedDeliveryType">
+ <xs:complexContent>
+ <xs:extension base="MessageType">
+ <xs:sequence>
+ <xs:element ref="msg:ERVConfirmedDelivery"/>
+ </xs:sequence>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
<xs:complexType name="MessageType">
<xs:annotation>
<xs:documentation>abstract message type</xs:documentation>