aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/gv/egiz/moazs/backend/DeliveryRequestBackend.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/main/java/at/gv/egiz/moazs/backend/DeliveryRequestBackend.java b/src/main/java/at/gv/egiz/moazs/backend/DeliveryRequestBackend.java
index 46b0c2c..178e26c 100644
--- a/src/main/java/at/gv/egiz/moazs/backend/DeliveryRequestBackend.java
+++ b/src/main/java/at/gv/egiz/moazs/backend/DeliveryRequestBackend.java
@@ -5,6 +5,7 @@ import at.gv.egiz.moazs.MoaZSException;
import at.gv.egiz.moazs.client.ClientFactory;
import at.gv.egiz.moazs.client.TnvzHelper;
import at.gv.egiz.moazs.repository.DeliveryRepository;
+import at.gv.egiz.moazs.scheme.Marshaller;
import at.gv.egiz.moazs.scheme.Mzs2MsgConverter;
import at.gv.egiz.moazs.scheme.RequestStatusResponse;
import at.gv.zustellung.app2mzs.xsd.DeliveryRequestType;
@@ -37,12 +38,22 @@ public class DeliveryRequestBackend implements Consumer<String> {
private static final String BINARY_RESPONSE_MISSING_ERROR_MSG =
"Binary DeliveryRequestStatus for AppDeliveryID=%s is not in repository. " ;
+ private static final at.gv.zustellung.app2mzs.xsd.ObjectFactory mzsOF = new at.gv.zustellung.app2mzs.xsd.ObjectFactory();
+ private static final at.gv.zustellung.msg.xsd.ObjectFactory msgOF = new at.gv.zustellung.msg.xsd.ObjectFactory();
+
+ @Autowired(required = false)
+ private Marshaller mzsMarshaller;
+
+ @Autowired(required = false)
+ private Marshaller msgMarshaller;
+
private final DeliveryRepository repository;
private final TnvzHelper tnvzHelper;
private final Mzs2MsgConverter converter;
private final ClientFactory clientFactory;
private final Consumer<byte[]> signatureVerifier;
+
@Autowired
public DeliveryRequestBackend(DeliveryRepository repository,
TnvzHelper tnvzHelper,
@@ -72,14 +83,19 @@ public class DeliveryRequestBackend implements Consumer<String> {
var fallbackAnswerBuilder = errorBuilder().withAppDeliveryID(appDeliveryID);
try {
+
+ log.trace("Fetch mzs:DeliveryRequest wiht AppDeliveryID={} from repository.", appDeliveryID);
var mzsRequest = repository.retrieveDeliveryRequest(appDeliveryID).orElseThrow(
() -> moaZSException(format(DELIVERY_REQUEST_MISSING_ERROR_MSG, appDeliveryID)));
+ traceMzsRequest(mzsRequest);
fallbackAnswerBuilder.withDeliverySystem(mzsRequest.getConfig().getMSGClient().getURL());
var msgRequest = buildMsgRequest(mzsRequest);
+ traceMsgRequest(msgRequest);
var msgClientParams = mzsRequest.getConfig().getMSGClient();
App2ZusePort client = clientFactory.create(msgClientParams, App2ZusePort.class);
status = client.delivery(msgRequest);
+ traceMsgResponse(status);
var response = new RequestStatusResponse(status);
@@ -113,6 +129,7 @@ public class DeliveryRequestBackend implements Consumer<String> {
private at.gv.zustellung.msg.xsd.DeliveryRequestType buildMsgRequest(DeliveryRequestType mzsRequest) throws MoaZSException {
if (mzsRequest.getConfig().isPerformQueryPersonRequest()) {
+ log.trace("Perform QueryPersonRequest. ");
var tnvzClientParams = mzsRequest.getConfig().getTNVZClient();
TNVZServicePort tvnzPort = clientFactory.create(tnvzClientParams, TNVZServicePort.class);
var identification = tnvzHelper.performQueryPersonRequest(mzsRequest, tvnzPort);
@@ -122,4 +139,23 @@ public class DeliveryRequestBackend implements Consumer<String> {
}
}
+ private void traceMzsRequest(DeliveryRequestType mzsRequest) {
+ if (log.isTraceEnabled() && mzsMarshaller != null) {
+ log.trace("mzs:DeliveryRequest: {}", mzsMarshaller.marshallXml(mzsOF.createDeliveryRequest(mzsRequest)));
+ }
+ }
+
+ private void traceMsgRequest(at.gv.zustellung.msg.xsd.DeliveryRequestType msgRequest) {
+ if (log.isTraceEnabled() && msgMarshaller != null) {
+ log.trace("msg:DeliveryRequest: {}", msgMarshaller.marshallXml(msgOF.createDeliveryRequest(msgRequest)));
+ }
+ }
+
+ private void traceMsgResponse(DeliveryRequestStatusType status) {
+ if (log.isTraceEnabled() && msgMarshaller != null) {
+ log.trace("msg:DeliveryResponse: {}", msgMarshaller.marshallXml(msgOF.createDeliveryResponse(status)));
+ }
+ }
+
+
}