Class Phase4PeppolSender.PeppolUserMessageBuilder

java.lang.Object
com.helger.phase4.sender.AbstractAS4MessageBuilder<Phase4PeppolSender.PeppolUserMessageBuilder>
com.helger.phase4.sender.AbstractAS4UserMessageBuilder<Phase4PeppolSender.PeppolUserMessageBuilder>
com.helger.phase4.sender.AbstractAS4UserMessageBuilderMIMEPayload<Phase4PeppolSender.PeppolUserMessageBuilder>
All Implemented Interfaces:
com.helger.base.trait.IGenericImplTrait<Phase4PeppolSender.PeppolUserMessageBuilder>
Enclosing class:
Phase4PeppolSender

@NotThreadSafe public static class Phase4PeppolSender.PeppolUserMessageBuilder extends Phase4PeppolSender.AbstractPeppolUserMessageBuilder<Phase4PeppolSender.PeppolUserMessageBuilder>
The builder class for sending AS4 messages using Peppol specifics. Use AbstractAS4MessageBuilder.sendMessage() or AbstractAS4UserMessageBuilder.sendMessageAndCheckForReceipt() to trigger the main transmission.
This builder class assumes, that only the payload (e.g. the Invoice) is present, and that both validation and SBDH creation happens inside.
Since:
0.9.4
Author:
Philip Helger
  • Constructor Details

  • Method Details

    • sbdhInstanceIdentifier

      public @NonNull Phase4PeppolSender.PeppolUserMessageBuilder sbdhInstanceIdentifier(@Nullable String sSBDHInstanceIdentifier)
      Set the SBDH instance identifier. If none is provided, a random ID is used. Usually this must NOT be set. In case of a retry, the same Instance Identifier should be used. Also an MLR should always refer to the Instance Identifier of the original transmission.
      Parameters:
      sSBDHInstanceIdentifier - The SBDH instance identifier to be used. May be null.
      Returns:
      this for chaining
    • sbdhStandard

      public @NonNull Phase4PeppolSender.PeppolUserMessageBuilder sbdhStandard(@Nullable String sSBDHStandard)
      Set the SBDH document standard. If none is provided, the value is extracted from the business document root element. This is specifically needed for non-XML payloads.
      Parameters:
      sSBDHStandard - The SBDH document standard to be used. May be null.
      Returns:
      this for chaining
      Since:
      3.1.0
    • sbdhTypeVersion

      public @NonNull Phase4PeppolSender.PeppolUserMessageBuilder sbdhTypeVersion(@Nullable String sSBDHTypeVersion)
      Set the SBDH document identification type version. If none is provided, the value is extracted from the document type identifier. This is specifically needed for non-XML payloads.
      Parameters:
      sSBDHTypeVersion - The SBDH document identification type version to be used. May be null.
      Returns:
      this for chaining
      Since:
      0.13.0
    • sbdhType

      public @NonNull Phase4PeppolSender.PeppolUserMessageBuilder sbdhType(@Nullable String sSBDHType)
      Set the SBDH document identification type. If none is provided, the value is extracted from the business document root element. This is specifically needed for non-XML payloads.
      Parameters:
      sSBDHType - The SBDH document identification type to be used. May be null.
      Returns:
      this for chaining
      Since:
      3.1.0
    • mlsTo

      public @NonNull Phase4PeppolSender.PeppolUserMessageBuilder mlsTo(@Nullable com.helger.peppolid.IParticipantIdentifier aMLSTo)
      Set the optional MLS_TO value of the Peppol SBDH providing the MLS receiver.
      Parameters:
      aMLSTo - The optional participant identifier. May be null.
      Returns:
      this for chaining
      Since:
      3.1.1
    • mlsType

      public @NonNull Phase4PeppolSender.PeppolUserMessageBuilder mlsType(@Nullable com.helger.peppol.sbdh.EPeppolMLSType eMLSType)
      Set the optional MLS_TYPE value of the Peppol SBDH providing the MLS orchestration.
      Parameters:
      eMLSType - The optional MLS type. May be null.
      Returns:
      this for chaining
      Since:
      3.1.1
    • payload

      public @NonNull Phase4PeppolSender.PeppolUserMessageBuilder payload(@NonNull Element aPayloadElement)
      Set the payload element to be used, if it is available as a parsed DOM element. Internally the DOM element will be cloned before sending it out. If this method is called, it overwrites any other explicitly set payload.
      Parameters:
      aPayloadElement - The payload element to be used. They payload element MUST have a namespace URI. May not be null.
      Returns:
      this for chaining
    • payload

      public @NonNull Phase4PeppolSender.PeppolUserMessageBuilder payload(byte @NonNull [] aPayloadBytes)
      Set the XML payload to be used as a byte array. It will be parsed internally to a DOM element. Compared to payload(Element) the read DOM element will not be cloned internally, so this option is less memory intensive. If this method is called, it overwrites any other explicitly set payload.
      Parameters:
      aPayloadBytes - The payload bytes to be used. May not be null.
      Returns:
      this for chaining
    • payload

      public @NonNull Phase4PeppolSender.PeppolUserMessageBuilder payload(@NonNull com.helger.base.io.iface.IHasInputStream aPayloadHasIS)
      Set the XML payload to be used as an InputStream provider. It will be parsed internally to a DOM element. Compared to payload(Element) the read DOM element will not be cloned internally, so this option is less memory intensive. If this method is called, it overwrites any other explicitly set payload.
      Parameters:
      aPayloadHasIS - The payload input stream provider to be used. May not be null.
      Returns:
      this for chaining
    • payloadBinaryContent

      public @NonNull Phase4PeppolSender.PeppolUserMessageBuilder payloadBinaryContent(byte @NonNull [] aBinaryPayload, @NonNull com.helger.mime.IMimeType aMimeType, @Nullable Charset aCharset)
      Use the provided byte array as the binary (non-XML) content of the Peppol SBDH message. Internally the data will be wrapped in a predefined "BinaryContent" element.
      Parameters:
      aBinaryPayload - The bytes to be wrapped. May not be null.
      aMimeType - The MIME type to use. May not be null.
      aCharset - The character set to be used, if the MIME type is text based. May be null.
      Returns:
      this for chaining
      Since:
      0.12.1
    • payloadTextContent

      public @NonNull Phase4PeppolSender.PeppolUserMessageBuilder payloadTextContent(@NonNull String sTextPayload, @NonNull com.helger.mime.IMimeType aMimeType)
      Use the provided byte array as the text (non-XML) content of the Peppol SBDH message. Internally the data will be wrapped in a predefined "TextContent" element.
      Parameters:
      sTextPayload - The text to be wrapped. May not be null.
      aMimeType - The MIME type to use. May not be null.
      Returns:
      this for chaining
      Since:
      0.12.1
    • sbdDocumentConsumer

      public @NonNull Phase4PeppolSender.PeppolUserMessageBuilder sbdDocumentConsumer(@Nullable Consumer<? super org.unece.cefact.namespaces.sbdh.StandardBusinessDocument> aSBDDocumentConsumer)
      Set an optional Consumer for the created StandardBusinessDocument (SBD).
      Parameters:
      aSBDDocumentConsumer - The consumer to be used. May be null.
      Returns:
      this for chaining
      Since:
      0.10.0
    • validationRegistry

      @Deprecated(forRemoval=true, since="4.4.3") public @NonNull Phase4PeppolSender.PeppolUserMessageBuilder validationRegistry(@Nullable com.helger.phive.api.executorset.IValidationExecutorSetRegistry<com.helger.phive.xml.source.IValidationSourceXML> aVESRegistry)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set a custom validation registry to use in VESID lookup. This may be needed if other Peppol formats like XRechnung or SimplerInvoicing should be send through this client. The same registry instance should be used for all sending operations to ensure that validation artefact caching works best.
      Parameters:
      aVESRegistry - The registry to use. May be null to indicate that the default registry (official Peppol artefacts only) should be used.
      Returns:
      this for chaining
      Since:
      0.10.1
    • validationConfiguration

      @Deprecated(forRemoval=true, since="4.4.3") public @NonNull Phase4PeppolSender.PeppolUserMessageBuilder validationConfiguration(@Nullable com.helger.diver.api.coord.DVRCoordinate aVESID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the client side validation to be used. If this method is not invoked, than it's the responsibility of the caller to validate the document prior to sending it. This method uses a default "do nothing validation result handler".
      Parameters:
      aVESID - The Validation Execution Set ID as in PeppolValidation2024_11.VID_OPENPEPPOL_INVOICE_UBL_V3. May be null.
      Returns:
      this for chaining
      See Also:
    • validationConfiguration

      @Deprecated(forRemoval=true, since="4.4.3") public @NonNull Phase4PeppolSender.PeppolUserMessageBuilder validationConfiguration(@Nullable com.helger.diver.api.coord.DVRCoordinate aVESID, @Nullable IPhase4PeppolValidationResultHandler aValidationResultHandler)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the client side validation to be used. If this method is not invoked, than it's the responsibility of the caller to validate the document prior to sending it. If the validation should happen internally, both the VESID AND the result handler must be set.
      Parameters:
      aVESID - The Validation Execution Set ID as in PeppolValidation2024_11.VID_OPENPEPPOL_INVOICE_UBL_V3. May be null.
      aValidationResultHandler - The validation result handler for positive and negative response handling. May be null.
      Returns:
      this for chaining
    • disableValidation

      @Deprecated(forRemoval=true, since="4.4.3") public @NonNull Phase4PeppolSender.PeppolUserMessageBuilder disableValidation()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Disable the validation for the outbound call.
      Returns:
      this for chaining
      Since:
      2.1.1
    • finishFields

      protected com.helger.base.state.ESuccess finishFields(@NonNull com.helger.phase4.util.AS4ResourceHelper aResHelper) throws com.helger.phase4.util.Phase4Exception
      Overrides:
      finishFields in class Phase4PeppolSender.AbstractPeppolUserMessageBuilder<Phase4PeppolSender.PeppolUserMessageBuilder>
      Throws:
      com.helger.phase4.util.Phase4Exception