Package com.helger.peppol.sbdh
Class PeppolSBDHData
java.lang.Object
com.helger.peppol.sbdh.PeppolSBDHData
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 Summary
ConstructorsConstructorDescriptionPeppolSBDHData(@NonNull com.helger.peppolid.factory.IIdentifierFactory aIdentifierFactory) Constructor -
Method Summary
Modifier and TypeMethodDescription@NonNull com.helger.typeconvert.collection.StringMapbooleanCheck if all additional attributes contain non-reserved names.booleanbooleanareAllFieldsSet(boolean bLogMissing) Check if all mandatory fields are set in the SBDH data.booleanareAllFieldsSet(@NonNull Consumer<String> aMissingFieldConsumer) Check if all mandatory fields are set in the SBDH data.static @NonNull @Nonempty Stringstatic @NonNull PeppolSBDHDatacreateUBL21(@NonNull Element aBusinessMessage, @NonNull com.helger.peppolid.factory.IIdentifierFactory aIdentifierFactory) Create a newPeppolSBDHDataobject for a business message assuming it is UBL 2.1.boolean@NonNull org.unece.cefact.namespaces.sbdh.StandardBusinessDocument@Nullable ElementGet the contained business message.@Nullable BinaryContentTypeParse the existing business message as a special Peppol "BinaryContent" element.@Nullable TextContentTypeParse the existing business message as a special Peppol SBDH "TextContent" element.@Nullable ElementGet the contained business message without cloning it.@Nullable StringGet the country code of C1.@Nullable com.helger.datetime.xml.XMLOffsetDateTimeThe date and time for when this envelope was created.@Nullable com.helger.peppolid.IDocumentTypeIdentifier@Nullable String@Nullable String@Nullable String@Nullable StringAn informative unique ID created by the issuer of the envelope.@Nullable StringGet the optional MLS addressee scheme (MLS_TO) as used in the Peppol MLS specification.@Nullable StringGet the optional MLS addressee value (MLS_TO) as used in the Peppol MLS specification.@Nullable EPeppolMLSTypeGet the optional MLS type (MLS_TYPE) as used in the Peppol MLS specification.@Nullable com.helger.peppolid.IProcessIdentifier@Nullable String@Nullable String@Nullable String@Nullable com.helger.peppolid.IParticipantIdentifier@Nullable String@Nullable String@Nullable String@Nullable com.helger.peppolid.IParticipantIdentifier@Nullable String@Nullable String@Nullable String@Nullable StringThe 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).@Nullable StringgetType()Message type - mandatory in SBDH.@Nullable StringThe 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).booleanCheck if a business message is present without having the need to explicitly callgetBusinessMessage()which returns a cloned node and is therefore an expensive operation.booleanCheck if the country code of C1 is present or not.booleaninthashCode()booleanbooleanCheck if the optional MLS addressee scheme (MLS_TO) is present or not.booleanCheck if the optional MLS addressee value (MLS_TO) is present or not.booleanCheck if the optional MLS type (MLS_TYPE) is present or not.booleanbooleanhasType()booleanbooleanstatic booleanisNonXMLSBDHPayload(@Nullable Element aBusinessMessage) Check if the provided SBDH payload element is a non-XML payload (like PDF or EDIFACT or X12).@NonNull PeppolSBDHDatasetBusinessMessage(@NonNull Element aBusinessMessage) Set the main business message that should be transmitted together with the SBDH.@NonNull PeppolSBDHDatasetBusinessMessageBinaryOnly(@org.jspecify.annotations.NonNull byte[] aBinaryPayload, @NonNull com.helger.mime.IMimeType aMimeType, @Nullable Charset aCharset) Set a business message with binary payload.@NonNull PeppolSBDHDatasetBusinessMessageNoClone(@NonNull Element aBusinessMessage) Set the main business message that should be transmitted together with the SBDH.@NonNull PeppolSBDHDatasetBusinessMessageTextOnly(@NonNull String sTextPayload, @NonNull com.helger.mime.IMimeType aMimeType) Set a business message with text payload.@NonNull PeppolSBDHDatasetCountryC1(@NonNull @Nonempty String sCountryC1) Set the country code of C1 to be used.@NonNull PeppolSBDHDatasetCreationDateAndTime(@NonNull com.helger.datetime.xml.XMLOffsetDateTime aCreationDateAndTime) Set the content of the fields that are mapped toStandardBusinessDocumentHeader/DocumentIdentification.@NonNull PeppolSBDHDatasetDocumentIdentification(@NonNull @Nonempty String sStandard, @NonNull @Nonempty String sTypeVersion, @NonNull @Nonempty String sType, @NonNull @Nonempty String sInstanceIdentifier, @NonNull com.helger.datetime.xml.XMLOffsetDateTime aCreationDateAndTime) Set the content of the fields that are mapped toStandardBusinessDocumentHeader/DocumentIdentification.@NonNull PeppolSBDHDatasetDocumentType(@NonNull com.helger.peppolid.IDocumentTypeIdentifier aDocTypeID) Set the document type identifier.@NonNull PeppolSBDHDatasetDocumentType(@NonNull @Nonempty String sScheme, @NonNull @Nonempty String sValue) Set the document type identifier.@NonNull PeppolSBDHDatasetDocumentTypeWithBusdoxDocidQns(@NonNull @Nonempty String sValue) Set the document type identifier using the default identifier scheme/authorityPeppolIdentifierHelper.DOCUMENT_TYPE_SCHEME_BUSDOX_DOCID_QNS.@NonNull PeppolSBDHDatasetDocumentTypeWithPeppolDoctypeWildcard(@NonNull @Nonempty String sValue) Set the document type identifier using the default identifier scheme/authorityPeppolIdentifierHelper.DOCUMENT_TYPE_SCHEME_PEPPOL_DOCTYPE_WILDCARD.@NonNull PeppolSBDHDatasetInstanceIdentifier(@NonNull @Nonempty String sInstanceIdentifier) Set the content of the fields that are mapped toStandardBusinessDocumentHeader/DocumentIdentification.@NonNull PeppolSBDHDatasetMLSToScheme(@Nullable String sMLSToScheme) Set the optional MLS addressee scheme (MLS_TO) to be used.@NonNull PeppolSBDHDatasetMLSToValue(@Nullable String sMLSToValue) Set the optional MLS addressee value (MLS_TO) to be used.@NonNull PeppolSBDHDatasetMLSType(@Nullable EPeppolMLSType eMLSType) Set the optional MLS type (MLS_TYPE) to be used.@NonNull PeppolSBDHDatasetProcess(@NonNull com.helger.peppolid.IProcessIdentifier aProcessID) Set the process identifier.@NonNull PeppolSBDHDatasetProcess(@NonNull @Nonempty String sScheme, @NonNull @Nonempty String sValue) Set the process identifier.@NonNull PeppolSBDHDatasetProcessWithDefaultScheme(@NonNull @Nonempty String sValue) Set the document type identifier using the default identifier scheme/authorityPeppolIdentifierHelper.DEFAULT_PROCESS_SCHEME.@NonNull PeppolSBDHDatasetReceiver(@NonNull com.helger.peppolid.IParticipantIdentifier aReceiverID) Set the receiver participant identifier.@NonNull PeppolSBDHDatasetReceiver(@NonNull @Nonempty String sScheme, @NonNull @Nonempty String sValue) Set the receiver participant identifier.@NonNull PeppolSBDHDatasetReceiverWithDefaultScheme(@NonNull @Nonempty String sValue) Set the receiver participant identifier value using the default identifier scheme/authorityPeppolIdentifierHelper.DEFAULT_PARTICIPANT_SCHEME.@NonNull PeppolSBDHDatasetSender(@NonNull com.helger.peppolid.IParticipantIdentifier aSenderID) Set the sender participant identifier.@NonNull PeppolSBDHDataSet the sender participant identifier.@NonNull PeppolSBDHDatasetSenderWithDefaultScheme(@NonNull @Nonempty String sValue) Set the sender participant identifier value using the default identifier scheme/authorityPeppolIdentifierHelper.DEFAULT_PARTICIPANT_SCHEME.@NonNull PeppolSBDHDatasetStandard(@NonNull @Nonempty String sStandard) Set the content of the fields that are mapped toStandardBusinessDocumentHeader/DocumentIdentification.@NonNull PeppolSBDHDataSet the content of the fields that are mapped toStandardBusinessDocumentHeader/DocumentIdentification.@NonNull PeppolSBDHDatasetTypeVersion(@NonNull @Nonempty String sTypeVersion) Set the content of the fields that are mapped toStandardBusinessDocumentHeader/DocumentIdentification.toString()
-
Constructor Details
-
PeppolSBDHData
public PeppolSBDHData(@NonNull com.helger.peppolid.factory.IIdentifierFactory aIdentifierFactory) Constructor- Parameters:
aIdentifierFactory- Identifier factory to be used. May not benull.
-
-
Method Details
-
getSenderScheme
- Returns:
- The sender participant identifier scheme. May be
nullif not initialized. This field is mapped toStandardBusinessDocumentHeader/Sender/Identifier/@Authority.
-
getSenderValue
- Returns:
- The sender participant identifier value. May be
nullif not initialized. This field is mapped toStandardBusinessDocumentHeader/Sender/Identifier/.
-
getSenderAsIdentifier
public @Nullable com.helger.peppolid.IParticipantIdentifier getSenderAsIdentifier()- Returns:
- The sender participant identifier as a participant identifier or
nullif certain information are missing or are invalid.
-
getSenderURIEncoded
- Returns:
- The URI encoded sender participant ID or
nullif both scheme and value arenull. - 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 alwaysPeppolIdentifierHelper.DEFAULT_PARTICIPANT_SCHEME. May neither benullnor empty. This field is mapped toStandardBusinessDocumentHeader/Sender/Identifier/@Authority.sValue- The sender identifier value. May neither benullnor empty. This field is mapped toStandardBusinessDocumentHeader/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 benull.- 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/authorityPeppolIdentifierHelper.DEFAULT_PARTICIPANT_SCHEME.- Parameters:
sValue- The sender identifier value. May neither benullnor empty. This field is mapped toStandardBusinessDocumentHeader/Sender/Identifier/.- Returns:
- this
-
getReceiverScheme
- Returns:
- The receiver participant identifier scheme. May be
nullif not initialized. This field is mapped toStandardBusinessDocumentHeader/Receiver/Identifier/@Authority.
-
getReceiverValue
- Returns:
- The receiver participant identifier value. May be
nullif not initialized. This field is mapped toStandardBusinessDocumentHeader/Receiver/Identifier/.
-
getReceiverAsIdentifier
public @Nullable com.helger.peppolid.IParticipantIdentifier getReceiverAsIdentifier()- Returns:
- The receiver participant identifier as a participant identifier or
nullif certain information are missing or are invalid.
-
getReceiverURIEncoded
- Returns:
- The URI encoded receiver participant ID or
nullif both scheme and value arenull. - 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 alwaysPeppolIdentifierHelper.DEFAULT_PARTICIPANT_SCHEME. May neither benullnor empty. This field is mapped toStandardBusinessDocumentHeader/Receiver/Identifier/@Authority.sValue- The receiver identifier value. May neither benullnor empty. This field is mapped toStandardBusinessDocumentHeader/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 benull.- 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/authorityPeppolIdentifierHelper.DEFAULT_PARTICIPANT_SCHEME.- Parameters:
sValue- The sender identifier value. May neither benullnor empty. This field is mapped toStandardBusinessDocumentHeader/Receiver/Identifier/.- Returns:
- this
-
getDocumentTypeScheme
- Returns:
- The document type identifier scheme. May be
nullif not initialized yet. This field is currently not mapped.
-
getDocumentTypeValue
- Returns:
- The document type identifier value. May be
nullif not initialized yet. This field is mapped toStandardBusinessDocumentHeader/BusinessScope/Scope[Type/text()="DOCUMENTID"]/InstanceIdentifier.
-
getDocumentTypeAsIdentifier
public @Nullable com.helger.peppolid.IDocumentTypeIdentifier getDocumentTypeAsIdentifier()- Returns:
- The document type identifier as an object or
nullif certain information are missing or are invalid.
-
getDocumentTypeURIEncoded
- Returns:
- The URI encoded document type ID or
nullif both scheme and value arenull. - 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 benullnor empty.sValue- The document type identifier value. May neither benullnor empty. This field is mapped toStandardBusinessDocumentHeader/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 benull.- 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/authorityPeppolIdentifierHelper.DOCUMENT_TYPE_SCHEME_BUSDOX_DOCID_QNS.- Parameters:
sValue- The document type identifier value. May neither benullnor empty. This field is mapped toStandardBusinessDocumentHeader/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/authorityPeppolIdentifierHelper.DOCUMENT_TYPE_SCHEME_PEPPOL_DOCTYPE_WILDCARD.- Parameters:
sValue- The document type identifier value. May neither benullnor empty. This field is mapped toStandardBusinessDocumentHeader/BusinessScope/Scope[Type/text()="DOCUMENTID"]/InstanceIdentifier.- Returns:
- this
- Since:
- 8.3.1
-
getProcessScheme
- Returns:
- The process identifier scheme. May be
nullif not initialized yet. This field is currently not mapped.
-
getProcessValue
- Returns:
- The process identifier value. May be
nullif not initialized yet. This field is mapped toStandardBusinessDocumentHeader/BusinessScope/Scope[Type/text()="PROCESSID"]/InstanceIdentifier.
-
getProcessAsIdentifier
public @Nullable com.helger.peppolid.IProcessIdentifier getProcessAsIdentifier()- Returns:
- The process identifier as an object or
nullif certain information are missing or are invalid.
-
getProcessURIEncoded
- Returns:
- The URI encoded process ID or
nullif both scheme and value arenull. - 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 benullnor empty.sValue- The process identifier. May neither benullnor empty. This field is mapped toStandardBusinessDocumentHeader/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 benull.- 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/authorityPeppolIdentifierHelper.DEFAULT_PROCESS_SCHEME.- Parameters:
sValue- The process identifier. May neither benullnor empty. This field is mapped toStandardBusinessDocumentHeader/BusinessScope/Scope[Type/text()="PROCESSID"]/InstanceIdentifier.- Returns:
- this
-
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:
trueif the country code of C1 is present,falseif not.- Since:
- 9.0.5
- See Also:
-
setCountryC1
Set the country code of C1 to be used.- Parameters:
sCountryC1- The country code of C1 to be used. May neither benullnor empty.- Returns:
- this for chaining
- Since:
- 9.0.5
- See Also:
-
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:
trueif the optional MLS addressee scheme (MLS_TO) is present,falseif not.- Since:
- 10.3.3
- See Also:
-
setMLSToScheme
Set the optional MLS addressee scheme (MLS_TO) to be used.- Parameters:
sMLSToScheme- The optional MLS addressee scheme (MLS_TO) to be used. May benull.- Returns:
- this for chaining
- Since:
- 10.3.3
- See Also:
-
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:
trueif the optional MLS addressee value (MLS_TO) is present,falseif not.- Since:
- 10.3.3
- See Also:
-
setMLSToValue
Set the optional MLS addressee value (MLS_TO) to be used.- Parameters:
sMLSToValue- The optional MLS addressee value (MLS_TO) to be used. May benull.- Returns:
- this for chaining
- Since:
- 10.3.3
- See Also:
-
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:
trueif the optional MLS type (MLS_TYPE) is present,falseif not.- Since:
- 10.3.3
- See Also:
-
setMLSType
Set the optional MLS type (MLS_TYPE) to be used.- Parameters:
eMLSType- The optional MLS type (MLS_TYPE) to be used. May benull.- 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 toStandardBusinessDocumentHeader/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 benull. This field is mapped toStandardBusinessDocumentHeader/DocumentIdentification/Standard.sTypeVersion- The version number of the enveloped business message (such as the value "2.1" for OASIS UBL 2.1). May not benull. This field is mapped toStandardBusinessDocumentHeader/DocumentIdentification/TypeVersion.sType- Message type - mandatory in SBDH. XML local element name of the root-element in the business message. May not benull. This field is mapped toStandardBusinessDocumentHeader/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 benull. This field is mapped toStandardBusinessDocumentHeader/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 benull. This field is mapped toStandardBusinessDocumentHeader/DocumentIdentification/CreationDateAndTime.- Returns:
- this
- See Also:
-
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 toStandardBusinessDocumentHeader/DocumentIdentification/Standard.- Returns:
- The standard value. May be
null.
-
hasStandard
public boolean hasStandard()- Returns:
trueif a standard is present,falseif not.- Since:
- 7.0.0
-
setStandard
Set the content of the fields that are mapped toStandardBusinessDocumentHeader/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 benull. This field is mapped toStandardBusinessDocumentHeader/DocumentIdentification/Standard.- Returns:
- this
- Since:
- 8.3.1
- See Also:
-
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 toStandardBusinessDocumentHeader/DocumentIdentification/TypeVersion.- Returns:
- The type version. May be
null.
-
hasTypeVersion
public boolean hasTypeVersion()- Returns:
trueif a type version is present,falseif not.- Since:
- 7.0.0
-
setTypeVersion
Set the content of the fields that are mapped toStandardBusinessDocumentHeader/DocumentIdentification.- Parameters:
sTypeVersion- The version number of the enveloped business message (such as the value "2.1" for OASIS UBL 2.1). May not benull. This field is mapped toStandardBusinessDocumentHeader/DocumentIdentification/TypeVersion.- Returns:
- this
- Since:
- 8.3.1
- See Also:
-
getType
Message type - mandatory in SBDH. XML local element name of the root-element in the business message. This field is mapped toStandardBusinessDocumentHeader/DocumentIdentification/Type.- Returns:
- Type value. May be
null.
-
hasType
public boolean hasType()- Returns:
trueif a type is present,falseif not.- Since:
- 7.0.0
-
setType
Set the content of the fields that are mapped toStandardBusinessDocumentHeader/DocumentIdentification.- Parameters:
sType- Message type - mandatory in SBDH. XML local element name of the root-element in the business message. May not benull. This field is mapped toStandardBusinessDocumentHeader/DocumentIdentification/Type.- Returns:
- this
- Since:
- 8.3.1
- See Also:
-
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 toStandardBusinessDocumentHeader/DocumentIdentification/InstanceIdentifier.- Returns:
- The instance identifier. May be
null.
-
hasInstanceIdentifier
public boolean hasInstanceIdentifier()- Returns:
trueif an instance identifier is present,falseif not.- Since:
- 7.0.0
-
setInstanceIdentifier
public @NonNull PeppolSBDHData setInstanceIdentifier(@Nonempty @NonNull @Nonempty String sInstanceIdentifier) Set the content of the fields that are mapped toStandardBusinessDocumentHeader/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 benull. This field is mapped toStandardBusinessDocumentHeader/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 toStandardBusinessDocumentHeader/DocumentIdentification/CreationDateAndTime.- Returns:
- The creation date time. May be
null.
-
hasCreationDateAndTime
public boolean hasCreationDateAndTime()- Returns:
trueif creation date and time is present,falseif 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 toStandardBusinessDocumentHeader/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 benull. This field is mapped toStandardBusinessDocumentHeader/DocumentIdentification/CreationDateAndTime.- Returns:
- this
- Since:
- 8.3.1
- See Also:
-
getBusinessMessage
Get the contained business message.- Returns:
nullif no business message is present. A clone (deep copy) of the business message otherwise.- See Also:
-
getBusinessMessageNoClone
Get the contained business message without cloning it.- Returns:
nullif no business message is present.- Since:
- 8.6.1
- See Also:
-
isNonXMLPayload
public boolean isNonXMLPayload()- Returns:
trueif the payload is to be considered non-XML,falseif 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 callgetBusinessMessage()which returns a cloned node and is therefore an expensive operation.- Returns:
trueif a business message is present,falseotherwise.
-
getBusinessMessageAsBinaryContent
Parse the existing business message as a special Peppol "BinaryContent" element.- Returns:
- The parsed payload as a Peppol SBDH "BinaryContent" or
nullif the existing Business Message is not a valid binary content. - Since:
- 8.2.4
- See Also:
-
getBusinessMessageAsTextContent
Parse the existing business message as a special Peppol SBDH "TextContent" element.- Returns:
- The parsed payload as a Peppol "TextContent" or
nullif the existing Business Message is not a valid text content. - Since:
- 8.2.4
- See Also:
-
setBusinessMessage
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 benull. 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
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 benull. 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 benull.aMimeType- The MIME type to use. May not benull.aCharset- The character set to be used, if the MIME type is text based. May benull.- 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 benull.aMimeType- The MIME type to use. May not benull.- 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-trueif log messages should be emitted,falseif not- Returns:
trueif all mandatory fields required for creating an SBDH are present,falseif at least one field is not set.
-
areAllFieldsSet
Check if all mandatory fields are set in the SBDH data.- Parameters:
aMissingFieldConsumer- The consumer to be invoked for each missing field. May not benull- Returns:
trueif all mandatory fields required for creating an SBDH are present,falseif at least one field is not set.- Since:
- 9.6.1
-
areAllFieldsSet
public boolean areAllFieldsSet()- Returns:
trueif all mandatory fields required for creating an SBDH are present,falseif at least one field is not set.
-
areAllAdditionalAttributesValid
public boolean areAllAdditionalAttributesValid()Check if all additional attributes contain non-reserved names.- Returns:
trueif 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
-
hashCode
public int hashCode() -
toString
-
isNonXMLSBDHPayload
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 forTextContentas well asBinaryContent.- Parameters:
aBusinessMessage- The SBDH payload element to check.- Returns:
trueif the payload is considered to be non-XML,falseif it is XML.- Since:
- 10.4.1
-
createRandomSBDHInstanceIdentifier
- Returns:
- A new random instance identifier. Never
nullnor empty. - Since:
- 12.3.11
-
createUBL21
public static @NonNull PeppolSBDHData createUBL21(@NonNull Element aBusinessMessage, @NonNull com.helger.peppolid.factory.IIdentifierFactory aIdentifierFactory) Create a newPeppolSBDHDataobject 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 benull.aIdentifierFactory- Identifier factory to be used. May not benull.- Returns:
- A pre-filled
PeppolSBDHDataobject with some information still missing. - Since:
- 8.3.1
- See Also:
-