From 231e972a8e4323d7df5b051f59c24b7886fe63ad Mon Sep 17 00:00:00 2001 From: Philip Helger Date: Tue, 19 Nov 2024 20:35:57 +0100 Subject: [PATCH] Added the missing getter and setter for the IAS4SignalMessageValidationResultHandler; #220 --- .../sender/AbstractAS4PullRequestBuilder.java | 29 +++++++++++++++++++ .../sender/AbstractAS4UserMessageBuilder.java | 29 +++++++++++++++++++ .../MainPhase4PeppolSenderHelger.java | 4 +++ 3 files changed, 62 insertions(+) diff --git a/phase4-lib/src/main/java/com/helger/phase4/sender/AbstractAS4PullRequestBuilder.java b/phase4-lib/src/main/java/com/helger/phase4/sender/AbstractAS4PullRequestBuilder.java index e1f9da932..9a9c3bf85 100644 --- a/phase4-lib/src/main/java/com/helger/phase4/sender/AbstractAS4PullRequestBuilder.java +++ b/phase4-lib/src/main/java/com/helger/phase4/sender/AbstractAS4PullRequestBuilder.java @@ -247,6 +247,35 @@ public final IMPLTYPE signalMsgConsumer (@Nullable final IAS4SignalMessageConsum return thisAsT (); } + /** + * @return The optional Ebms3 Signal Message validation result handled. May be + * null. + * @since 3.0.1 + */ + @Nullable + public final IAS4SignalMessageValidationResultHandler signalMsgValidationResultHdl () + { + return m_aSignalMsgValidationResultHdl; + } + + /** + * Set an optional Ebms3 Signal Message validation result handler. This + * handler is invoked, after the synchronous signal message references were + * evaluated. This handler cannot modify any message flow - it is an + * informational callback only. + * + * @param aSignalMsgValidationResultHdl + * The optional signal message consumer. May be null. + * @return this for chaining + * @since 3.0.1 + */ + @Nonnull + public final IMPLTYPE signalMsgValidationResultHdl (@Nullable final IAS4SignalMessageValidationResultHandler aSignalMsgValidationResultHdl) + { + m_aSignalMsgValidationResultHdl = aSignalMsgValidationResultHdl; + return thisAsT (); + } + @Override @Nonnull @OverridingMethodsMustInvokeSuper diff --git a/phase4-lib/src/main/java/com/helger/phase4/sender/AbstractAS4UserMessageBuilder.java b/phase4-lib/src/main/java/com/helger/phase4/sender/AbstractAS4UserMessageBuilder.java index 229fe2ed0..06c604fc0 100644 --- a/phase4-lib/src/main/java/com/helger/phase4/sender/AbstractAS4UserMessageBuilder.java +++ b/phase4-lib/src/main/java/com/helger/phase4/sender/AbstractAS4UserMessageBuilder.java @@ -732,6 +732,35 @@ public final IMPLTYPE signalMsgConsumer (@Nullable final IAS4SignalMessageConsum return thisAsT (); } + /** + * @return The optional Ebms3 Signal Message validation result handled. May be + * null. + * @since 3.0.1 + */ + @Nullable + public final IAS4SignalMessageValidationResultHandler signalMsgValidationResultHdl () + { + return m_aSignalMsgValidationResultHdl; + } + + /** + * Set an optional Ebms3 Signal Message validation result handler. This + * handler is invoked, after the synchronous signal message references were + * evaluated. This handler cannot modify any message flow - it is an + * informational callback only. + * + * @param aSignalMsgValidationResultHdl + * The optional signal message consumer. May be null. + * @return this for chaining + * @since 3.0.1 + */ + @Nonnull + public final IMPLTYPE signalMsgValidationResultHdl (@Nullable final IAS4SignalMessageValidationResultHandler aSignalMsgValidationResultHdl) + { + m_aSignalMsgValidationResultHdl = aSignalMsgValidationResultHdl; + return thisAsT (); + } + @Override @Nonnull @OverridingMethodsMustInvokeSuper diff --git a/phase4-peppol-client/src/test/java/com/helger/phase4/peppol/receivers/MainPhase4PeppolSenderHelger.java b/phase4-peppol-client/src/test/java/com/helger/phase4/peppol/receivers/MainPhase4PeppolSenderHelger.java index 90446df8a..52efe05f1 100644 --- a/phase4-peppol-client/src/test/java/com/helger/phase4/peppol/receivers/MainPhase4PeppolSenderHelger.java +++ b/phase4-peppol-client/src/test/java/com/helger/phase4/peppol/receivers/MainPhase4PeppolSenderHelger.java @@ -35,6 +35,8 @@ import com.helger.phase4.peppol.Phase4PeppolValidatonResultHandler; import com.helger.phase4.sender.EAS4UserMessageSendResult; import com.helger.phase4.sender.IAS4RawResponseConsumer; +import com.helger.phase4.sender.IAS4SignalMessageValidationResultHandler; +import com.helger.phase4.sender.LoggingAS4SignalMsgValidationResultHandler; import com.helger.phive.peppol.PeppolValidation2024_05; import com.helger.servlet.mock.MockServletContext; import com.helger.smpclient.peppol.SMPClientReadOnly; @@ -79,6 +81,7 @@ public void onAS4Message (final AbstractAS4Message aMsg) LOGGER.info ("Response headers:"); x.getResponseHeaders ().forEachSingleHeader ( (k, v) -> LOGGER.info (" " + k + "=" + v), false); }; + final IAS4SignalMessageValidationResultHandler aSignalMsgValidationResultHdl = new LoggingAS4SignalMsgValidationResultHandler (); final PeppolUserMessageBuilder aBuilder = Phase4PeppolSender.builder () .documentTypeID (Phase4PeppolSender.IF.createDocumentTypeIdentifierWithDefaultScheme ("urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0::2.1")) .processID (Phase4PeppolSender.IF.createProcessIdentifierWithDefaultScheme ("urn:fdc:peppol.eu:2017:poacc:billing:01:1.0")) @@ -94,6 +97,7 @@ public void onAS4Message (final AbstractAS4Message aMsg) .validationConfiguration (PeppolValidation2024_05.VID_OPENPEPPOL_INVOICE_UBL_V3, new Phase4PeppolValidatonResultHandler ()) .buildMessageCallback (aBuildMessageCallback) + .signalMsgValidationResultHdl (aSignalMsgValidationResultHdl) .rawResponseConsumer (aRRC); final EAS4UserMessageSendResult eResult; eResult = aBuilder.sendMessageAndCheckForReceipt ();