Class PeppolSBDHData

java.lang.Object
com.helger.peppol.sbdh.PeppolSBDHData

@NotThreadSafe public class PeppolSBDHData extends Object
This class contains all the Peppol data per SBDH document in a syntax neutral way. This class maps to the requirements of the Peppol Business Message Envelope 2.0 specification.
Since:
9.2.0 - was previously called "PeppolSBDHDocument"
Author:
Philip Helger
  • Constructor Details

    • PeppolSBDHData

      public PeppolSBDHData(@NonNull com.helger.peppolid.factory.IIdentifierFactory aIdentifierFactory)
      Constructor
      Parameters:
      aIdentifierFactory - Identifier factory to be used. May not be null.
  • Method Details

    • getSenderScheme

      public @Nullable String getSenderScheme()
      Returns:
      The sender participant identifier scheme. May be null if not initialized. This field is mapped to StandardBusinessDocumentHeader/Sender/Identifier/@Authority .
    • getSenderValue

      public @Nullable String getSenderValue()
      Returns:
      The sender participant identifier value. May be null if not initialized. This field is mapped to StandardBusinessDocumentHeader/Sender/Identifier/.
    • getSenderAsIdentifier

      public @Nullable com.helger.peppolid.IParticipantIdentifier getSenderAsIdentifier()
      Returns:
      The sender participant identifier as a participant identifier or null if certain information are missing or are invalid.
    • getSenderURIEncoded

      public @Nullable String getSenderURIEncoded()
      Returns:
      The URI encoded sender participant ID or null if both scheme and value are null.
      Since:
      12.3.11
    • setSender

      public @NonNull PeppolSBDHData setSender(@Nonempty @NonNull @Nonempty String sScheme, @Nonempty @NonNull @Nonempty String sValue)
      Set the sender participant identifier.
      Parameters:
      sScheme - The Peppol identifier scheme. This is usually always PeppolIdentifierHelper.DEFAULT_PARTICIPANT_SCHEME. May neither be null nor empty. This field is mapped to StandardBusinessDocumentHeader/Sender/Identifier/@Authority .
      sValue - The sender identifier value. May neither be null nor empty. This field is mapped to StandardBusinessDocumentHeader/Sender/Identifier/.
      Returns:
      this
    • setSender

      public @NonNull PeppolSBDHData setSender(@NonNull com.helger.peppolid.IParticipantIdentifier aSenderID)
      Set the sender participant identifier.
      Parameters:
      aSenderID - The participant identifier to use. May not be null.
      Returns:
      this
      Since:
      8.6.1
    • setSenderWithDefaultScheme

      public @NonNull PeppolSBDHData setSenderWithDefaultScheme(@Nonempty @NonNull @Nonempty String sValue)
      Set the sender participant identifier value using the default identifier scheme/authority PeppolIdentifierHelper.DEFAULT_PARTICIPANT_SCHEME.
      Parameters:
      sValue - The sender identifier value. May neither be null nor empty. This field is mapped to StandardBusinessDocumentHeader/Sender/Identifier/.
      Returns:
      this
    • getReceiverScheme

      public @Nullable String getReceiverScheme()
      Returns:
      The receiver participant identifier scheme. May be null if not initialized. This field is mapped to StandardBusinessDocumentHeader/Receiver/Identifier/@Authority .
    • getReceiverValue

      public @Nullable String getReceiverValue()
      Returns:
      The receiver participant identifier value. May be null if not initialized. This field is mapped to StandardBusinessDocumentHeader/Receiver/Identifier/.
    • getReceiverAsIdentifier

      public @Nullable com.helger.peppolid.IParticipantIdentifier getReceiverAsIdentifier()
      Returns:
      The receiver participant identifier as a participant identifier or null if certain information are missing or are invalid.
    • getReceiverURIEncoded

      public @Nullable String getReceiverURIEncoded()
      Returns:
      The URI encoded receiver participant ID or null if both scheme and value are null.
      Since:
      12.3.11
    • setReceiver

      public @NonNull PeppolSBDHData setReceiver(@Nonempty @NonNull @Nonempty String sScheme, @Nonempty @NonNull @Nonempty String sValue)
      Set the receiver participant identifier.
      Parameters:
      sScheme - The Peppol identifier scheme. This is usually always PeppolIdentifierHelper.DEFAULT_PARTICIPANT_SCHEME . May neither be null nor empty. This field is mapped to StandardBusinessDocumentHeader/Receiver/Identifier/@Authority .
      sValue - The receiver identifier value. May neither be null nor empty. This field is mapped to StandardBusinessDocumentHeader/Receiver/Identifier/.
      Returns:
      this
    • setReceiver

      public @NonNull PeppolSBDHData setReceiver(@NonNull com.helger.peppolid.IParticipantIdentifier aReceiverID)
      Set the receiver participant identifier.
      Parameters:
      aReceiverID - The participant identifier to use. May not be null.
      Returns:
      this
      Since:
      8.6.1
    • setReceiverWithDefaultScheme

      public @NonNull PeppolSBDHData setReceiverWithDefaultScheme(@Nonempty @NonNull @Nonempty String sValue)
      Set the receiver participant identifier value using the default identifier scheme/authority PeppolIdentifierHelper.DEFAULT_PARTICIPANT_SCHEME.
      Parameters:
      sValue - The sender identifier value. May neither be null nor empty. This field is mapped to StandardBusinessDocumentHeader/Receiver/Identifier/.
      Returns:
      this
    • getDocumentTypeScheme

      public @Nullable String getDocumentTypeScheme()
      Returns:
      The document type identifier scheme. May be null if not initialized yet. This field is currently not mapped.
    • getDocumentTypeValue

      public @Nullable String getDocumentTypeValue()
      Returns:
      The document type identifier value. May be null if not initialized yet. This field is mapped to StandardBusinessDocumentHeader/BusinessScope/Scope[Type/text()="DOCUMENTID"]/InstanceIdentifier .
    • getDocumentTypeAsIdentifier

      public @Nullable com.helger.peppolid.IDocumentTypeIdentifier getDocumentTypeAsIdentifier()
      Returns:
      The document type identifier as an object or null if certain information are missing or are invalid.
    • getDocumentTypeURIEncoded

      public @Nullable String getDocumentTypeURIEncoded()
      Returns:
      The URI encoded document type ID or null if both scheme and value are null.
      Since:
      12.3.11
    • setDocumentType

      public @NonNull PeppolSBDHData setDocumentType(@Nonempty @NonNull @Nonempty String sScheme, @Nonempty @NonNull @Nonempty String sValue)
      Set the document type identifier.
      Parameters:
      sScheme - The document type identifier scheme. May neither be null nor empty.
      sValue - The document type identifier value. May neither be null nor empty. This field is mapped to StandardBusinessDocumentHeader/BusinessScope/Scope[Type/text()="DOCUMENTID"]/InstanceIdentifier .
      Returns:
      this
    • setDocumentType

      public @NonNull PeppolSBDHData setDocumentType(@NonNull com.helger.peppolid.IDocumentTypeIdentifier aDocTypeID)
      Set the document type identifier.
      Parameters:
      aDocTypeID - The document type identifier to use. May not be null.
      Returns:
      this
      Since:
      8.6.1
    • setDocumentTypeWithBusdoxDocidQns

      public @NonNull PeppolSBDHData setDocumentTypeWithBusdoxDocidQns(@Nonempty @NonNull @Nonempty String sValue)
      Set the document type identifier using the default identifier scheme/authority PeppolIdentifierHelper.DOCUMENT_TYPE_SCHEME_BUSDOX_DOCID_QNS .
      Parameters:
      sValue - The document type identifier value. May neither be null nor empty. This field is mapped to StandardBusinessDocumentHeader/BusinessScope/Scope[Type/text()="DOCUMENTID"]/InstanceIdentifier .
      Returns:
      this
      Since:
      8.3.1
    • setDocumentTypeWithPeppolDoctypeWildcard

      public @NonNull PeppolSBDHData setDocumentTypeWithPeppolDoctypeWildcard(@Nonempty @NonNull @Nonempty String sValue)
      Set the document type identifier using the default identifier scheme/authority PeppolIdentifierHelper.DOCUMENT_TYPE_SCHEME_PEPPOL_DOCTYPE_WILDCARD .
      Parameters:
      sValue - The document type identifier value. May neither be null nor empty. This field is mapped to StandardBusinessDocumentHeader/BusinessScope/Scope[Type/text()="DOCUMENTID"]/InstanceIdentifier .
      Returns:
      this
      Since:
      8.3.1
    • getProcessScheme

      public @Nullable String getProcessScheme()
      Returns:
      The process identifier scheme. May be null if not initialized yet. This field is currently not mapped.
    • getProcessValue

      public @Nullable String getProcessValue()
      Returns:
      The process identifier value. May be null if not initialized yet. This field is mapped to StandardBusinessDocumentHeader/BusinessScope/Scope[Type/text()="PROCESSID"]/InstanceIdentifier .
    • getProcessAsIdentifier

      public @Nullable com.helger.peppolid.IProcessIdentifier getProcessAsIdentifier()
      Returns:
      The process identifier as an object or null if certain information are missing or are invalid.
    • getProcessURIEncoded

      public @Nullable String getProcessURIEncoded()
      Returns:
      The URI encoded process ID or null if both scheme and value are null.
      Since:
      12.3.11
    • setProcess

      public @NonNull PeppolSBDHData setProcess(@Nonempty @NonNull @Nonempty String sScheme, @Nonempty @NonNull @Nonempty String sValue)
      Set the process identifier.
      Parameters:
      sScheme - The process identifier scheme. May neither be null nor empty.
      sValue - The process identifier. May neither be null nor empty. This field is mapped to StandardBusinessDocumentHeader/BusinessScope/Scope[Type/text()="PROCESSID"]/InstanceIdentifier .
      Returns:
      this
    • setProcess

      public @NonNull PeppolSBDHData setProcess(@NonNull com.helger.peppolid.IProcessIdentifier aProcessID)
      Set the process identifier.
      Parameters:
      aProcessID - The process identifier to use. May not be null.
      Returns:
      this
      Since:
      8.6.1
    • setProcessWithDefaultScheme

      public @NonNull PeppolSBDHData setProcessWithDefaultScheme(@Nonempty @NonNull @Nonempty String sValue)
      Set the document type identifier using the default identifier scheme/authority PeppolIdentifierHelper.DEFAULT_PROCESS_SCHEME.
      Parameters:
      sValue - The process identifier. May neither be null nor empty. This field is mapped to StandardBusinessDocumentHeader/BusinessScope/Scope[Type/text()="PROCESSID"]/InstanceIdentifier .
      Returns:
      this
    • getCountryC1

      public @Nullable String getCountryC1()
      Get the country code of C1. This is a new mandatory field, introduced by the Peppol Business Message Envelope 2.0 specification. It is mapped inside the BusinessScope area.
      Returns:
      The country code of C1. May be null.
      Since:
      9.0.5
      See Also:
    • hasCountryC1

      public boolean hasCountryC1()
      Check if the country code of C1 is present or not.
      Returns:
      true if the country code of C1 is present, false if not.
      Since:
      9.0.5
      See Also:
    • setCountryC1

      public @NonNull PeppolSBDHData setCountryC1(@Nonempty @NonNull @Nonempty String sCountryC1)
      Set the country code of C1 to be used.
      Parameters:
      sCountryC1 - The country code of C1 to be used. May neither be null nor empty.
      Returns:
      this for chaining
      Since:
      9.0.5
      See Also:
    • getMLSToScheme

      public @Nullable String getMLSToScheme()
      Get the optional MLS addressee scheme (MLS_TO) as used in the Peppol MLS specification. It is mapped inside the BusinessScope area.
      Returns:
      The optional MLS addressee scheme (MLS_TO) to be used. May be null.
      Since:
      10.3.3
      See Also:
    • hasMLSToScheme

      public boolean hasMLSToScheme()
      Check if the optional MLS addressee scheme (MLS_TO) is present or not.
      Returns:
      true if the optional MLS addressee scheme (MLS_TO) is present, false if not.
      Since:
      10.3.3
      See Also:
    • setMLSToScheme

      public @NonNull PeppolSBDHData setMLSToScheme(@Nullable String sMLSToScheme)
      Set the optional MLS addressee scheme (MLS_TO) to be used.
      Parameters:
      sMLSToScheme - The optional MLS addressee scheme (MLS_TO) to be used. May be null.
      Returns:
      this for chaining
      Since:
      10.3.3
      See Also:
    • getMLSToValue

      public @Nullable String getMLSToValue()
      Get the optional MLS addressee value (MLS_TO) as used in the Peppol MLS specification. It is mapped inside the BusinessScope area.
      Returns:
      The optional MLS addressee value (MLS_TO) to be used. May be null.
      Since:
      10.3.3
      See Also:
    • hasMLSToValue

      public boolean hasMLSToValue()
      Check if the optional MLS addressee value (MLS_TO) is present or not.
      Returns:
      true if the optional MLS addressee value (MLS_TO) is present, false if not.
      Since:
      10.3.3
      See Also:
    • setMLSToValue

      public @NonNull PeppolSBDHData setMLSToValue(@Nullable String sMLSToValue)
      Set the optional MLS addressee value (MLS_TO) to be used.
      Parameters:
      sMLSToValue - The optional MLS addressee value (MLS_TO) to be used. May be null.
      Returns:
      this for chaining
      Since:
      10.3.3
      See Also:
    • getMLSType

      public @Nullable EPeppolMLSType getMLSType()
      Get the optional MLS type (MLS_TYPE) as used in the Peppol MLS specification. It is mapped inside the BusinessScope area.
      Returns:
      The optional MLS addressee to be used. May be null.
      Since:
      10.3.3
      See Also:
    • hasMLSType

      public boolean hasMLSType()
      Check if the optional MLS type (MLS_TYPE) is present or not.
      Returns:
      true if the optional MLS type (MLS_TYPE) is present, false if not.
      Since:
      10.3.3
      See Also:
    • setMLSType

      public @NonNull PeppolSBDHData setMLSType(@Nullable EPeppolMLSType eMLSType)
      Set the optional MLS type (MLS_TYPE) to be used.
      Parameters:
      eMLSType - The optional MLS type (MLS_TYPE) to be used. May be null.
      Returns:
      this for chaining
      Since:
      10.3.3
      See Also:
    • additionalAttributes

      @ReturnsMutableObject public @NonNull com.helger.typeconvert.collection.StringMap additionalAttributes()
      Returns:
      The mutable attribute map where all additional attributes according to Spec v1.1, chapter 1.6.1 were added.
      Since:
      6.1.4
    • setDocumentIdentification

      public @NonNull PeppolSBDHData setDocumentIdentification(@Nonempty @NonNull @Nonempty String sStandard, @Nonempty @NonNull @Nonempty String sTypeVersion, @Nonempty @NonNull @Nonempty String sType, @Nonempty @NonNull @Nonempty String sInstanceIdentifier, @NonNull com.helger.datetime.xml.XMLOffsetDateTime aCreationDateAndTime)
      Set the content of the fields that are mapped to StandardBusinessDocumentHeader/DocumentIdentification.
      Parameters:
      sStandard - The standard of the enveloped business message, normally described by use of the XML namespace of the business message root element (such as urn:oasis:names:specification: ubl:schema:xsd:Order-2). May not be null. This field is mapped to StandardBusinessDocumentHeader/DocumentIdentification/Standard .
      sTypeVersion - The version number of the enveloped business message (such as the value "2.1" for OASIS UBL 2.1). May not be null. This field is mapped to StandardBusinessDocumentHeader/DocumentIdentification/TypeVersion .
      sType - Message type - mandatory in SBDH. XML local element name of the root-element in the business message. May not be null. This field is mapped to StandardBusinessDocumentHeader/DocumentIdentification/Type .
      sInstanceIdentifier - An informative unique ID created by the issuer of the envelope. The InstanceIdentifier MUST be unique for each Business Message Envelope being created. This ID is not the same as the ID of the business message (such as the Invoice Number). It is not the same as a transmission Message ID generated by the application sending the message (as defined in AS4).
      The InstanceIdentifier MUST be globally unique and it is RECOMMENDED to use UUID (such as 118e3040-51d2-11e3-8f96-0800200c9a66). May not be null. This field is mapped to StandardBusinessDocumentHeader/DocumentIdentification/InstanceIdentifier .
      aCreationDateAndTime - The date and time for when this envelope was created. It is NOT necessarily the same as the issue date of the business document (such as the invoice) being enveloped. It is NOT necessarily the date time for transmission.
      The format of the value of this MUST include timezone information. May not be null. This field is mapped to StandardBusinessDocumentHeader/DocumentIdentification/CreationDateAndTime .
      Returns:
      this
      See Also:
    • getStandard

      public @Nullable String getStandard()
      The standard of the enveloped business message, normally described by use of the XML namespace of the business message root element (such as urn:oasis:names:specification:ubl:schema:xsd:Order-2). This field is mapped to StandardBusinessDocumentHeader/DocumentIdentification/Standard .
      Returns:
      The standard value. May be null.
    • hasStandard

      public boolean hasStandard()
      Returns:
      true if a standard is present, false if not.
      Since:
      7.0.0
    • setStandard

      public @NonNull PeppolSBDHData setStandard(@Nonempty @NonNull @Nonempty String sStandard)
      Set the content of the fields that are mapped to StandardBusinessDocumentHeader/DocumentIdentification.
      Parameters:
      sStandard - The standard of the enveloped business message, normally described by use of the XML namespace of the business message root element (such as urn:oasis:names:specification: ubl:schema:xsd:Order-2). May not be null. This field is mapped to StandardBusinessDocumentHeader/DocumentIdentification/Standard .
      Returns:
      this
      Since:
      8.3.1
      See Also:
    • getTypeVersion

      public @Nullable String getTypeVersion()
      The version number of the enveloped business message (such as the value "2.1" for OASIS UBL 2.1 or "2.2" for OASIS UBL 2.2). This field is mapped to StandardBusinessDocumentHeader/DocumentIdentification/TypeVersion .
      Returns:
      The type version. May be null.
    • hasTypeVersion

      public boolean hasTypeVersion()
      Returns:
      true if a type version is present, false if not.
      Since:
      7.0.0
    • setTypeVersion

      public @NonNull PeppolSBDHData setTypeVersion(@Nonempty @NonNull @Nonempty String sTypeVersion)
      Set the content of the fields that are mapped to StandardBusinessDocumentHeader/DocumentIdentification.
      Parameters:
      sTypeVersion - The version number of the enveloped business message (such as the value "2.1" for OASIS UBL 2.1). May not be null. This field is mapped to StandardBusinessDocumentHeader/DocumentIdentification/TypeVersion .
      Returns:
      this
      Since:
      8.3.1
      See Also:
    • getType

      public @Nullable String getType()
      Message type - mandatory in SBDH. XML local element name of the root-element in the business message. This field is mapped to StandardBusinessDocumentHeader/DocumentIdentification/Type.
      Returns:
      Type value. May be null.
    • hasType

      public boolean hasType()
      Returns:
      true if a type is present, false if not.
      Since:
      7.0.0
    • setType

      public @NonNull PeppolSBDHData setType(@Nonempty @NonNull @Nonempty String sType)
      Set the content of the fields that are mapped to StandardBusinessDocumentHeader/DocumentIdentification.
      Parameters:
      sType - Message type - mandatory in SBDH. XML local element name of the root-element in the business message. May not be null. This field is mapped to StandardBusinessDocumentHeader/DocumentIdentification/Type .
      Returns:
      this
      Since:
      8.3.1
      See Also:
    • getInstanceIdentifier

      public @Nullable String getInstanceIdentifier()
      An informative unique ID created by the issuer of the envelope. The InstanceIdentifier MUST be unique for each Business Message Envelope being created. This ID is not the same as the ID of the business message (such as the Invoice Number). It is not the same as a transmission Message ID generated by the application sending the message (as defined in AS2 or START).
      The InstanceIdentifier MUST be globally unique and it is RECOMMENDED to use UUID (such as 118e3040-51d2-11e3-8f96-0800200c9a66). This field is mapped to StandardBusinessDocumentHeader/DocumentIdentification/InstanceIdentifier .
      Returns:
      The instance identifier. May be null.
    • hasInstanceIdentifier

      public boolean hasInstanceIdentifier()
      Returns:
      true if an instance identifier is present, false if not.
      Since:
      7.0.0
    • setInstanceIdentifier

      public @NonNull PeppolSBDHData setInstanceIdentifier(@Nonempty @NonNull @Nonempty String sInstanceIdentifier)
      Set the content of the fields that are mapped to StandardBusinessDocumentHeader/DocumentIdentification.
      Parameters:
      sInstanceIdentifier - An informative unique ID created by the issuer of the envelope. The InstanceIdentifier MUST be unique for each Business Message Envelope being created. This ID is not the same as the ID of the business message (such as the Invoice Number). It is not the same as a transmission Message ID generated by the application sending the message (as defined in AS4).
      The InstanceIdentifier MUST be globally unique and it is RECOMMENDED to use UUID (such as 118e3040-51d2-11e3-8f96-0800200c9a66). May not be null. This field is mapped to StandardBusinessDocumentHeader/DocumentIdentification/InstanceIdentifier .
      Returns:
      this
      Since:
      8.3.1
      See Also:
    • getCreationDateAndTime

      public @Nullable com.helger.datetime.xml.XMLOffsetDateTime getCreationDateAndTime()
      The date and time for when this envelope was created. It is NOT necessarily the same as the issue date of the business document (such as the invoice) being enveloped. It is NOT necessarily the date time for transmission.
      The format of the value of this MUST include timezone information. This field is mapped to StandardBusinessDocumentHeader/DocumentIdentification/CreationDateAndTime .
      Returns:
      The creation date time. May be null.
    • hasCreationDateAndTime

      public boolean hasCreationDateAndTime()
      Returns:
      true if creation date and time is present, false if not.
      Since:
      7.0.0
    • setCreationDateAndTime

      public @NonNull PeppolSBDHData setCreationDateAndTime(@NonNull com.helger.datetime.xml.XMLOffsetDateTime aCreationDateAndTime)
      Set the content of the fields that are mapped to StandardBusinessDocumentHeader/DocumentIdentification.
      Parameters:
      aCreationDateAndTime - The date and time for when this envelope was created. It is NOT necessarily the same as the issue date of the business document (such as the invoice) being enveloped. It is NOT necessarily the date time for transmission.
      The format of the value of this MUST include timezone information. May not be null. This field is mapped to StandardBusinessDocumentHeader/DocumentIdentification/CreationDateAndTime .
      Returns:
      this
      Since:
      8.3.1
      See Also:
    • getBusinessMessage

      @ReturnsMutableCopy public @Nullable Element getBusinessMessage()
      Get the contained business message.
      Returns:
      null if no business message is present. A clone (deep copy) of the business message otherwise.
      See Also:
    • getBusinessMessageNoClone

      @ReturnsMutableObject public @Nullable Element getBusinessMessageNoClone()
      Get the contained business message without cloning it.
      Returns:
      null if no business message is present.
      Since:
      8.6.1
      See Also:
    • isNonXMLPayload

      public boolean isNonXMLPayload()
      Returns:
      true if the payload is to be considered non-XML, false if it is not present or XML.
      Since:
      10.4.1
      See Also:
    • hasBusinessMessage

      public boolean hasBusinessMessage()
      Check if a business message is present without having the need to explicitly call getBusinessMessage() which returns a cloned node and is therefore an expensive operation.
      Returns:
      true if a business message is present, false otherwise.
    • getBusinessMessageAsBinaryContent

      public @Nullable BinaryContentType getBusinessMessageAsBinaryContent()
      Parse the existing business message as a special Peppol "BinaryContent" element.
      Returns:
      The parsed payload as a Peppol SBDH "BinaryContent" or null if the existing Business Message is not a valid binary content.
      Since:
      8.2.4
      See Also:
    • getBusinessMessageAsTextContent

      public @Nullable TextContentType getBusinessMessageAsTextContent()
      Parse the existing business message as a special Peppol SBDH "TextContent" element.
      Returns:
      The parsed payload as a Peppol "TextContent" or null if the existing Business Message is not a valid text content.
      Since:
      8.2.4
      See Also:
    • setBusinessMessage

      public @NonNull PeppolSBDHData setBusinessMessage(@NonNull Element aBusinessMessage)
      Set the main business message that should be transmitted together with the SBDH. The DOM element is cloned internally to avoid outside modification
      Parameters:
      aBusinessMessage - The business message to be set. May not be null. Internally the passed element is cloned, so that further modifications outside of this method have no impact on the business message inside this object.
      Returns:
      this
      See Also:
    • setBusinessMessageNoClone

      public @NonNull PeppolSBDHData setBusinessMessageNoClone(@NonNull Element aBusinessMessage)
      Set the main business message that should be transmitted together with the SBDH. The DOM element is not cloned / copied internally.
      Parameters:
      aBusinessMessage - The business message to be set. May not be null. Internally the passed element is cloned, so that further modifications outside of this method have no impact on the business message inside this object.
      Returns:
      this
      Since:
      8.8.1
      See Also:
    • setBusinessMessageBinaryOnly

      public @NonNull PeppolSBDHData setBusinessMessageBinaryOnly(@org.jspecify.annotations.NonNull byte[] aBinaryPayload, @NonNull com.helger.mime.IMimeType aMimeType, @Nullable Charset aCharset)
      Set a business message with binary payload. Based on the Peppol SBDH v1.2 binary payload specification. This is wrapper for creating the Peppol SBDH "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:
      6.2.4
      See Also:
    • setBusinessMessageTextOnly

      public @NonNull PeppolSBDHData setBusinessMessageTextOnly(@NonNull String sTextPayload, @NonNull com.helger.mime.IMimeType aMimeType)
      Set a business message with text payload. Based on the Peppol SBDH v1.2 text payload specification. Note: the character set of the wrapped text must be identical to the character set of the SBDH surrounding it. In case the payload requires a specific character set, it is suggested to use the binary message. This is wrapper for creating the Peppol SBDH "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:
      6.2.4
      See Also:
    • areAllFieldsSet

      public boolean areAllFieldsSet(boolean bLogMissing)
      Check if all mandatory fields are set in the SBDH data.
      Parameters:
      bLogMissing - true if log messages should be emitted, false if not
      Returns:
      true if all mandatory fields required for creating an SBDH are present, false if at least one field is not set.
    • areAllFieldsSet

      public boolean areAllFieldsSet(@NonNull Consumer<String> aMissingFieldConsumer)
      Check if all mandatory fields are set in the SBDH data.
      Parameters:
      aMissingFieldConsumer - The consumer to be invoked for each missing field. May not be null
      Returns:
      true if all mandatory fields required for creating an SBDH are present, false if at least one field is not set.
      Since:
      9.6.1
    • areAllFieldsSet

      public boolean areAllFieldsSet()
      Returns:
      true if all mandatory fields required for creating an SBDH are present, false if at least one field is not set.
    • areAllAdditionalAttributesValid

      public boolean areAllAdditionalAttributesValid()
      Check if all additional attributes contain non-reserved names.
      Returns:
      true if no additional attributes are present or if all additional attributes contain valid names.
    • getAsStandardBusinessDocument

      public @NonNull org.unece.cefact.namespaces.sbdh.StandardBusinessDocument getAsStandardBusinessDocument()
      Returns:
      A generic JAXB SBD document of this data. Never null.
      Since:
      9.2.0
      See Also:
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isNonXMLSBDHPayload

      public static boolean isNonXMLSBDHPayload(@Nullable Element aBusinessMessage)
      Check if the provided SBDH payload element is a non-XML payload (like PDF or EDIFACT or X12). The easiest way to check this, is to check for the specific predefined payload elements for TextContent as well as BinaryContent.
      Parameters:
      aBusinessMessage - The SBDH payload element to check.
      Returns:
      true if the payload is considered to be non-XML, false if it is XML.
      Since:
      10.4.1
    • createRandomSBDHInstanceIdentifier

      @Nonempty public static @NonNull @Nonempty String createRandomSBDHInstanceIdentifier()
      Returns:
      A new random instance identifier. Never null nor empty.
      Since:
      12.3.11
    • createUBL21

      public static @NonNull PeppolSBDHData createUBL21(@NonNull Element aBusinessMessage, @NonNull com.helger.peppolid.factory.IIdentifierFactory aIdentifierFactory)
      Create a new PeppolSBDHData object for a business message assuming it is UBL 2.1. The resulting object has all required fields set, except for:
      • sender ID
      • receiver ID
      • document type ID
      • and process ID
      Parameters:
      aBusinessMessage - The XML business message. May not be null.
      aIdentifierFactory - Identifier factory to be used. May not be null.
      Returns:
      A pre-filled PeppolSBDHData object with some information still missing.
      Since:
      8.3.1
      See Also: