aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/moazs/scheme
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/gv/egiz/moazs/scheme')
-rw-r--r--src/main/java/at/gv/egiz/moazs/scheme/MsgResponse.java7
-rw-r--r--src/main/java/at/gv/egiz/moazs/scheme/NotificationResponse.java9
-rw-r--r--src/main/java/at/gv/egiz/moazs/scheme/RequestStatusResponse.java10
3 files changed, 26 insertions, 0 deletions
diff --git a/src/main/java/at/gv/egiz/moazs/scheme/MsgResponse.java b/src/main/java/at/gv/egiz/moazs/scheme/MsgResponse.java
index 80e2059..5370448 100644
--- a/src/main/java/at/gv/egiz/moazs/scheme/MsgResponse.java
+++ b/src/main/java/at/gv/egiz/moazs/scheme/MsgResponse.java
@@ -3,6 +3,12 @@ package at.gv.egiz.moazs.scheme;
import at.gv.egiz.moazs.MoaZSException;
import at.gv.zustellung.msg.xsd.DeliveryAnswerType;
+import javax.xml.bind.JAXBElement;
+
+/**
+ * Represents responses to DeliveryRequests that were received from the msg service.
+ * @param <T> The type of the response.
+ */
public abstract class MsgResponse <T> {
protected String id;
@@ -20,6 +26,7 @@ public abstract class MsgResponse <T> {
}
public abstract T getResponse();
+ public abstract JAXBElement<T> getResponseAsJAXBElement();
public abstract String getAppDeliveryID();
public abstract String getZSDeliveryID();
public abstract DeliveryAnswerType getAnswer();
diff --git a/src/main/java/at/gv/egiz/moazs/scheme/NotificationResponse.java b/src/main/java/at/gv/egiz/moazs/scheme/NotificationResponse.java
index de1fd38..784d000 100644
--- a/src/main/java/at/gv/egiz/moazs/scheme/NotificationResponse.java
+++ b/src/main/java/at/gv/egiz/moazs/scheme/NotificationResponse.java
@@ -3,6 +3,9 @@ package at.gv.egiz.moazs.scheme;
import at.gv.egiz.moazs.MoaZSException;
import at.gv.zustellung.msg.xsd.DeliveryAnswerType;
import at.gv.zustellung.msg.xsd.DeliveryNotificationType;
+import at.gv.zustellung.msg.xsd.ObjectFactory;
+
+import javax.xml.bind.JAXBElement;
import static at.gv.zustellung.msg.xsd.DeliveryNotificationType.deliveryNotificationTypeBuilder;
@@ -10,6 +13,7 @@ public class NotificationResponse extends MsgResponse<DeliveryNotificationType>
private final DeliveryNotificationType notification;
private static final String ID_SUFFIX = ".NO";
+ private static final ObjectFactory factory = new ObjectFactory();
public NotificationResponse(DeliveryNotificationType notification) {
super.id = createResponseId(notification.getAppDeliveryID(), ID_SUFFIX);
@@ -26,6 +30,11 @@ public class NotificationResponse extends MsgResponse<DeliveryNotificationType>
}
@Override
+ public JAXBElement<DeliveryNotificationType> getResponseAsJAXBElement() {
+ return factory.createDeliveryNotification(notification);
+ }
+
+ @Override
public String getAppDeliveryID() {
return notification.getAppDeliveryID();
}
diff --git a/src/main/java/at/gv/egiz/moazs/scheme/RequestStatusResponse.java b/src/main/java/at/gv/egiz/moazs/scheme/RequestStatusResponse.java
index 0705698..3b4710b 100644
--- a/src/main/java/at/gv/egiz/moazs/scheme/RequestStatusResponse.java
+++ b/src/main/java/at/gv/egiz/moazs/scheme/RequestStatusResponse.java
@@ -4,6 +4,9 @@ import at.gv.egiz.moazs.MoaZSException;
import at.gv.zustellung.msg.xsd.DeliveryAnswerType;
import at.gv.zustellung.msg.xsd.DeliveryRequestStatusType;
import at.gv.zustellung.msg.xsd.ErrorInfoType;
+import at.gv.zustellung.msg.xsd.ObjectFactory;
+
+import javax.xml.bind.JAXBElement;
import static at.gv.egiz.moazs.util.NullCoalesce.coalesce;
import static at.gv.zustellung.msg.xsd.DeliveryRequestStatusType.Error.errorBuilder;
@@ -15,6 +18,8 @@ public class RequestStatusResponse extends MsgResponse<DeliveryRequestStatusType
private final DeliveryRequestStatusType status;
private final DeliveryAnswerType answer;
private static final String ID_SUFFIX = ".RS";
+ private static final ObjectFactory factory = new ObjectFactory();
+
public RequestStatusResponse(DeliveryRequestStatusType status) {
this.status = status;
@@ -32,6 +37,11 @@ public class RequestStatusResponse extends MsgResponse<DeliveryRequestStatusType
}
@Override
+ public JAXBElement<DeliveryRequestStatusType> getResponseAsJAXBElement() {
+ return factory.createDeliveryRequestStatus(status);
+ }
+
+ @Override
public String getAppDeliveryID() {
return answer.getAppDeliveryID();
}