Skip to content

Commit

Permalink
Updated to phive 10 and phive-rules 3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
phax committed Sep 17, 2024
1 parent 298e785 commit 6df4599
Show file tree
Hide file tree
Showing 29 changed files with 75 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import com.helger.commons.state.ESuccess;
import com.helger.commons.state.ETriState;
import com.helger.commons.string.StringHelper;
import com.helger.diver.api.version.VESID;
import com.helger.diver.api.coord.DVRCoordinate;
import com.helger.peppol.reporting.api.PeppolReportingHelper;
import com.helger.peppol.reporting.api.PeppolReportingItem;
import com.helger.peppol.reporting.api.backend.PeppolReportingBackend;
Expand Down Expand Up @@ -281,7 +281,7 @@ public static StandardBusinessDocument createSBDH (@Nonnull final IParticipantId
*/
private static void _validatePayload (@Nonnull final Element aPayloadElement,
@Nullable final IValidationExecutorSetRegistry <IValidationSourceXML> aRegistry,
@Nullable final VESID aVESID,
@Nullable final DVRCoordinate aVESID,
@Nullable final IPhase4PeppolValidationResultHandler aValidationResultHandler) throws Phase4PeppolException
{
// Client side validation
Expand Down Expand Up @@ -1063,7 +1063,7 @@ public static class Builder extends AbstractPeppolUserMessageBuilder <Builder>
private Consumer <byte []> m_aSBDBytesConsumer;

private IValidationExecutorSetRegistry <IValidationSourceXML> m_aVESRegistry;
private VESID m_aVESID;
private DVRCoordinate m_aVESID;
private IPhase4PeppolValidationResultHandler m_aValidationResultHandler;

/**
Expand Down Expand Up @@ -1289,14 +1289,14 @@ public Builder validationRegistry (@Nullable final IValidationExecutorSetRegistr
*
* @param aVESID
* The Validation Execution Set ID as in
* <code>PeppolValidation2023_11.VID_OPENPEPPOL_INVOICE_UBL_V3</code>.
* <code>PeppolValidation2024_05.VID_OPENPEPPOL_INVOICE_UBL_V3</code>.
* May be <code>null</code>.
* @return this for chaining
* @see #validationConfiguration(VESID,
* @see #validationConfiguration(DVRCoordinate,
* IPhase4PeppolValidationResultHandler)
*/
@Nonnull
public Builder validationConfiguration (@Nullable final VESID aVESID)
public Builder validationConfiguration (@Nullable final DVRCoordinate aVESID)
{
final IPhase4PeppolValidationResultHandler aHdl = aVESID == null ? null
: new Phase4PeppolValidatonResultHandler ();
Expand All @@ -1311,15 +1311,15 @@ public Builder validationConfiguration (@Nullable final VESID aVESID)
*
* @param aVESID
* The Validation Execution Set ID as in
* <code>PeppolValidation2023_11.VID_OPENPEPPOL_INVOICE_UBL_V3</code>.
* <code>PeppolValidation2024_05.VID_OPENPEPPOL_INVOICE_UBL_V3</code>.
* May be <code>null</code>.
* @param aValidationResultHandler
* The validation result handler for positive and negative response
* handling. May be <code>null</code>.
* @return this for chaining
*/
@Nonnull
public Builder validationConfiguration (@Nullable final VESID aVESID,
public Builder validationConfiguration (@Nullable final DVRCoordinate aVESID,
@Nullable final IPhase4PeppolValidationResultHandler aValidationResultHandler)
{
m_aVESID = aVESID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@
import com.helger.commons.ValueEnforcer;
import com.helger.commons.annotation.ReturnsMutableCopy;
import com.helger.commons.annotation.ReturnsMutableObject;
import com.helger.diver.api.version.VESID;
import com.helger.diver.api.coord.DVRCoordinate;
import com.helger.phive.api.execute.ValidationExecutionManager;
import com.helger.phive.api.executorset.IValidationExecutorSet;
import com.helger.phive.api.executorset.IValidationExecutorSetRegistry;
import com.helger.phive.api.executorset.ValidationExecutorSetRegistry;
import com.helger.phive.api.result.ValidationResultList;
import com.helger.phive.api.validity.IValidityDeterminator;
import com.helger.phive.peppol.PeppolValidation;
import com.helger.phive.xml.source.IValidationSourceXML;
import com.helger.phive.xml.source.ValidationSourceXML;
Expand Down Expand Up @@ -84,20 +85,20 @@ public static ValidationExecutorSetRegistry <IValidationSourceXML> createDefault
* @param aXML
* The XML element to be validated. May not be <code>null</code>.
* @param aVESID
* The {@link VESID} to be used. Must be contained in the default
* registry. May not be <code>null</code>.
* The {@link DVRCoordinate} to be used. Must be contained in the
* default registry. May not be <code>null</code>.
* @param aValidationResultHandler
* The validation result handler to be used. May not be
* <code>null</code>.
* @throws Phase4PeppolException
* In case e.g. the validation failed. This usually implies, that the
* document will NOT be send out.
* @see #validateOutgoingBusinessDocument(Element,
* IValidationExecutorSetRegistry, VESID,
* IValidationExecutorSetRegistry, DVRCoordinate,
* IPhase4PeppolValidationResultHandler)
*/
public static void validateOutgoingBusinessDocument (@Nonnull final Element aXML,
@Nonnull final VESID aVESID,
@Nonnull final DVRCoordinate aVESID,
@Nonnull final IPhase4PeppolValidationResultHandler aValidationResultHandler) throws Phase4PeppolException
{
validateOutgoingBusinessDocument (aXML, VES_REGISTRY, aVESID, aValidationResultHandler);
Expand All @@ -112,8 +113,8 @@ public static void validateOutgoingBusinessDocument (@Nonnull final Element aXML
* @param aVESRegistry
* The VES registry the VESID is looked up in.
* @param aVESID
* The {@link VESID} to be used. Must be contained in the provided
* registry. May not be <code>null</code>.
* The {@link DVRCoordinate} to be used. Must be contained in the
* provided registry. May not be <code>null</code>.
* @param aValidationResultHandler
* The validation result handler to be used. May not be
* <code>null</code>.
Expand All @@ -124,7 +125,7 @@ public static void validateOutgoingBusinessDocument (@Nonnull final Element aXML
*/
public static void validateOutgoingBusinessDocument (@Nonnull final Element aXML,
@Nonnull final IValidationExecutorSetRegistry <IValidationSourceXML> aVESRegistry,
@Nonnull final VESID aVESID,
@Nonnull final DVRCoordinate aVESID,
@Nonnull final IPhase4PeppolValidationResultHandler aValidationResultHandler) throws Phase4PeppolException
{
ValueEnforcer.notNull (aXML, "XMLElement");
Expand All @@ -136,8 +137,10 @@ public static void validateOutgoingBusinessDocument (@Nonnull final Element aXML
if (aVES == null)
throw new Phase4PeppolException ("The validation executor set ID " + aVESID.getAsSingleID () + " is unknown!");

final ValidationResultList aValidationResult = ValidationExecutionManager.executeValidation (aVES,
ValidationSourceXML.create (null, aXML));
final ValidationResultList aValidationResult = ValidationExecutionManager.executeValidation (IValidityDeterminator.createDefault (),
aVES,
ValidationSourceXML.create (null,
aXML));
if (aValidationResult.containsAtLeastOneError ())
{
aValidationResultHandler.onValidationErrors (aValidationResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import com.helger.phase4.dump.AS4OutgoingDumperFileBased;
import com.helger.phase4.sender.AbstractAS4UserMessageBuilder.ESimpleUserMessageSendResult;
import com.helger.phive.api.result.ValidationResultList;
import com.helger.phive.peppol.PeppolValidation2023_11;
import com.helger.phive.peppol.PeppolValidation2024_05;
import com.helger.photon.io.WebFileIO;
import com.helger.servlet.mock.MockServletContext;
import com.helger.smpclient.peppol.SMPClientReadOnly;
Expand Down Expand Up @@ -80,7 +80,7 @@ public static void main (final String [] args)
.smpClient (new SMPClientReadOnly (Phase4PeppolSender.URL_PROVIDER,
aReceiverID,
ESML.DIGIT_TEST))
.validationConfiguration (PeppolValidation2023_11.VID_OPENPEPPOL_INVOICE_UBL_V3,
.validationConfiguration (PeppolValidation2024_05.VID_OPENPEPPOL_INVOICE_UBL_V3,
new Phase4PeppolValidatonResultHandler ()
{
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import com.helger.phase4.dump.AS4OutgoingDumperFileBased;
import com.helger.phase4.http.HttpRetrySettings;
import com.helger.phase4.sender.AbstractAS4UserMessageBuilder.ESimpleUserMessageSendResult;
import com.helger.phive.peppol.PeppolValidation2023_11;
import com.helger.phive.peppol.PeppolValidation2024_05;
import com.helger.security.certificate.CertificateHelper;
import com.helger.servlet.mock.MockServletContext;
import com.helger.web.scope.mgr.WebScopeManager;
Expand Down Expand Up @@ -106,7 +106,7 @@ public static void main (final String [] args)
"njEO\r\n" +
"-----END CERTIFICATE-----\r\n"),
"https://www.zweikommadrei.de/as4")
.validationConfiguration (PeppolValidation2023_11.VID_OPENPEPPOL_INVOICE_UBL_V3,
.validationConfiguration (PeppolValidation2024_05.VID_OPENPEPPOL_INVOICE_UBL_V3,
new Phase4PeppolValidatonResultHandler ())
.sendMessageAndCheckForReceipt ();
LOGGER.info ("Peppol send result: " + eResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import com.helger.phase4.crypto.AS4CryptoFactoryInMemoryKeyStore;
import com.helger.phase4.crypto.IAS4CryptoFactory;
import com.helger.phase4.sender.AbstractAS4UserMessageBuilder.ESimpleUserMessageSendResult;
import com.helger.phive.peppol.PeppolValidation2023_11;
import com.helger.phive.peppol.PeppolValidation2024_05;
import com.helger.security.keystore.EKeyStoreType;
import com.helger.security.keystore.KeyStoreHelper;
import com.helger.servlet.mock.MockServletContext;
Expand Down Expand Up @@ -81,7 +81,7 @@ public static void main (final String [] args)
.smpClient (new SMPClientReadOnly (Phase4PeppolSender.URL_PROVIDER,
aReceiverID,
ESML.DIGIT_TEST))
.validationConfiguration (PeppolValidation2023_11.VID_OPENPEPPOL_INVOICE_UBL_V3,
.validationConfiguration (PeppolValidation2024_05.VID_OPENPEPPOL_INVOICE_UBL_V3,
new Phase4PeppolValidatonResultHandler ())
.cryptoFactory (aInMemoryCryptoFactory)
.sendMessageAndCheckForReceipt ();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import com.helger.peppol.sml.ESML;
import com.helger.peppolid.IParticipantIdentifier;
import com.helger.phase4.sender.AbstractAS4UserMessageBuilder.ESimpleUserMessageSendResult;
import com.helger.phive.peppol.PeppolValidation2023_11;
import com.helger.phive.peppol.PeppolValidation2024_05;
import com.helger.servlet.mock.MockServletContext;
import com.helger.smpclient.peppol.SMPClientReadOnly;
import com.helger.web.scope.mgr.WebScopeManager;
Expand Down Expand Up @@ -67,7 +67,7 @@ public static void main (final String [] args)
.smpClient (new SMPClientReadOnly (Phase4PeppolSender.URL_PROVIDER,
aReceiverID,
ESML.DIGIT_TEST))
.validationConfiguration (PeppolValidation2023_11.VID_OPENPEPPOL_INVOICE_UBL_V3,
.validationConfiguration (PeppolValidation2024_05.VID_OPENPEPPOL_INVOICE_UBL_V3,
new Phase4PeppolValidatonResultHandler ())
.sendMessageAndCheckForReceipt ();
LOGGER.info ("Peppol send result: " + eResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import com.helger.phase4.peppol.Phase4PeppolSender;
import com.helger.phase4.peppol.Phase4PeppolValidatonResultHandler;
import com.helger.phase4.sender.AbstractAS4UserMessageBuilder.ESimpleUserMessageSendResult;
import com.helger.phive.peppol.PeppolValidation2023_11;
import com.helger.phive.peppol.PeppolValidation2024_05;
import com.helger.security.certificate.CertificateHelper;
import com.helger.servlet.mock.MockServletContext;
import com.helger.web.scope.mgr.WebScopeManager;
Expand Down Expand Up @@ -106,7 +106,7 @@ public static void main (final String [] args)
"-----END CERTIFICATE-----\r\n"),
"https://albertpatron.com/as4/as4")
.rawResponseConsumer (new AS4RawResponseConsumerWriteToFile ())
.validationConfiguration (PeppolValidation2023_11.VID_OPENPEPPOL_INVOICE_UBL_V3,
.validationConfiguration (PeppolValidation2024_05.VID_OPENPEPPOL_INVOICE_UBL_V3,
new Phase4PeppolValidatonResultHandler ())
.sendMessageAndCheckForReceipt ();
LOGGER.info ("Peppol send result: " + eResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import com.helger.phase4.peppol.Phase4PeppolSender;
import com.helger.phase4.peppol.Phase4PeppolValidatonResultHandler;
import com.helger.phase4.sender.AbstractAS4UserMessageBuilder.ESimpleUserMessageSendResult;
import com.helger.phive.peppol.PeppolValidation2023_11;
import com.helger.phive.peppol.PeppolValidation2024_05;
import com.helger.servlet.mock.MockServletContext;
import com.helger.smpclient.peppol.SMPClientReadOnly;
import com.helger.web.scope.mgr.WebScopeManager;
Expand Down Expand Up @@ -91,7 +91,7 @@ public void onAS4Message (final AbstractAS4Message <?> aMsg)
aReceiverID,
ESML.DIGIT_TEST))
.rawResponseConsumer (new AS4RawResponseConsumerWriteToFile ())
.validationConfiguration (PeppolValidation2023_11.VID_OPENPEPPOL_INVOICE_UBL_V3,
.validationConfiguration (PeppolValidation2024_05.VID_OPENPEPPOL_INVOICE_UBL_V3,
new Phase4PeppolValidatonResultHandler ())
.buildMessageCallback (aBuildMessageCallback)
.sendMessageAndCheckForReceipt ();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import com.helger.phase4.peppol.Phase4PeppolSender;
import com.helger.phase4.peppol.Phase4PeppolValidatonResultHandler;
import com.helger.phase4.sender.AbstractAS4UserMessageBuilder.ESimpleUserMessageSendResult;
import com.helger.phive.peppol.PeppolValidation2023_11;
import com.helger.phive.peppol.PeppolValidation2024_05;
import com.helger.servlet.mock.MockServletContext;
import com.helger.smpclient.peppol.SMPClientReadOnly;
import com.helger.web.scope.mgr.WebScopeManager;
Expand Down Expand Up @@ -95,7 +95,7 @@ public void onAS4Message (final AbstractAS4Message <?> aMsg)
aReceiverID,
ESML.DIGIT_TEST))
.rawResponseConsumer (new AS4RawResponseConsumerWriteToFile ())
.validationConfiguration (PeppolValidation2023_11.VID_OPENPEPPOL_INVOICE_UBL_V3,
.validationConfiguration (PeppolValidation2024_05.VID_OPENPEPPOL_INVOICE_UBL_V3,
new Phase4PeppolValidatonResultHandler ())
.buildMessageCallback (aBuildMessageCallback)
.sendMessageAndCheckForReceipt ();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import com.helger.phase4.peppol.Phase4PeppolSender;
import com.helger.phase4.peppol.Phase4PeppolValidatonResultHandler;
import com.helger.phase4.sender.AbstractAS4UserMessageBuilder.ESimpleUserMessageSendResult;
import com.helger.phive.peppol.PeppolValidation2023_11;
import com.helger.phive.peppol.PeppolValidation2024_05;
import com.helger.servlet.mock.MockServletContext;
import com.helger.smpclient.peppol.SMPClientReadOnly;
import com.helger.web.scope.mgr.WebScopeManager;
Expand Down Expand Up @@ -92,7 +92,7 @@ public void onAS4Message (final AbstractAS4Message <?> aMsg)
aReceiverID,
ESML.DIGIT_TEST))
.rawResponseConsumer (new AS4RawResponseConsumerWriteToFile ())
.validationConfiguration (PeppolValidation2023_11.VID_OPENPEPPOL_INVOICE_UBL_V3,
.validationConfiguration (PeppolValidation2024_05.VID_OPENPEPPOL_INVOICE_UBL_V3,
new Phase4PeppolValidatonResultHandler ())
.buildMessageCallback (aBuildMessageCallback)
.sendMessageAndCheckForReceipt ();
Expand Down
Loading

0 comments on commit 6df4599

Please sign in to comment.