Package com.helger.phase4.peppol
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>
com.helger.phase4.peppol.Phase4PeppolSender.AbstractPeppolUserMessageBuilder<Phase4PeppolSender.PeppolUserMessageBuilder>
com.helger.phase4.peppol.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
This builder class assumes, that only the payload (e.g. the Invoice) is present, and that both validation and SBDH creation happens inside.
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
-
Field Summary
Fields inherited from class com.helger.phase4.peppol.Phase4PeppolSender.AbstractPeppolUserMessageBuilder
DEFAULT_CHECK_RECEIVER_AP_CERTIFICATE, DEFAULT_COMPRESS_PAYLOAD, m_aCAChecker, m_aDocTypeID, m_aEndpointDetailProvider, m_aPayloadMimeType, m_aProcessID, m_aReceiverID, m_aSenderID, m_bCompressPayload, m_sCountryC1, m_sPayloadContentIDFields inherited from class com.helger.phase4.sender.AbstractAS4UserMessageBuilderMIMEPayload
m_aPayloadFields inherited from class com.helger.phase4.sender.AbstractAS4UserMessageBuilder
m_aAttachments, m_aMessageProperties, m_aPMode, m_aSignalMsgConsumer, m_aSignalMsgValidationResultHdl, m_bForceMimeMessage, m_sAction, m_sAgreementRef, m_sAgreementType, m_sConversationID, m_sEndpointURL, m_sFromPartyID, m_sFromPartyIDType, m_sFromRole, m_sPModeID, m_sService, m_sServiceType, m_sToPartyID, m_sToPartyIDType, m_sToRoleFields inherited from class com.helger.phase4.sender.AbstractAS4MessageBuilder
DEFAULT_LOCALE, m_aBuildMessageCallback, m_aCryptoFactoryCrypt, m_aCryptoFactorySign, m_aCryptParams, m_aCustomHttpPoster, m_aDecryptParameterModifier, m_aHttpClientFactory, m_aHttpRetrySettings, m_aIncomingDumper, m_aLocale, m_aOutgoingDumper, m_aResponseConsumer, m_aRetryCallback, m_aSendingDateTime, m_aSendingDTConsumer, m_aSigningParams, m_eSoapVersion, m_sAS4ProfileID, m_sMessageID, m_sRefToMessageID -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new builder, with the defaults fromAbstractPeppolUserMessageBuilder() -
Method Summary
Modifier and TypeMethodDescriptionDeprecated, for removal: This API element is subject to removal in a future version.protected com.helger.base.state.ESuccessfinishFields(@NonNull com.helger.phase4.util.AS4ResourceHelper aResHelper) mlsTo(@Nullable com.helger.peppolid.IParticipantIdentifier aMLSTo) Set the optionalMLS_TOvalue of the Peppol SBDH providing the MLS receiver.mlsType(@Nullable com.helger.peppol.sbdh.EPeppolMLSType eMLSType) Set the optionalMLS_TYPEvalue of the Peppol SBDH providing the MLS orchestration.payload(byte @NonNull [] aPayloadBytes) Set the XML payload to be used as a byte array.payload(@NonNull com.helger.base.io.iface.IHasInputStream aPayloadHasIS) Set the XML payload to be used as an InputStream provider.Set the payload element to be used, if it is available as a parsed DOM element.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.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.sbdDocumentConsumer(@Nullable Consumer<? super org.unece.cefact.namespaces.sbdh.StandardBusinessDocument> aSBDDocumentConsumer) Set an optional Consumer for the created StandardBusinessDocument (SBD).sbdhInstanceIdentifier(@Nullable String sSBDHInstanceIdentifier) Set the SBDH instance identifier.sbdhStandard(@Nullable String sSBDHStandard) Set the SBDH document standard.Set the SBDH document identification type.sbdhTypeVersion(@Nullable String sSBDHTypeVersion) Set the SBDH document identification type version.validationConfiguration(@Nullable com.helger.diver.api.coord.DVRCoordinate aVESID) Deprecated, for removal: This API element is subject to removal in a future version.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.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.Methods inherited from class com.helger.phase4.peppol.Phase4PeppolSender.AbstractPeppolUserMessageBuilder
apCacheRevocationCheckResult, apRevocationCheckMode, apRevocationSoftFail, certificateConsumer, checkReceiverAPCertificate, compressPayload, countryC1, createAndStorePeppolReportingItemAfterSending, createPeppolReportingItemAfterSending, customizeBeforeSending, documentTypeID, documentTypeID, effectiveSendingDateTime, endpointDetailProvider, endpointURLConsumer, isEndpointDetailProviderUsable, isEveryRequiredFieldSet, payloadContentID, payloadMimeType, peppolAP_CAChecker, processID, processID, receiverEndpointDetails, receiverEndpointDetails, receiverParticipantID, senderParticipantID, senderPartyID, smpClient, technicalContactConsumerMethods inherited from class com.helger.phase4.sender.AbstractAS4UserMessageBuilderMIMEPayload
createMainAttachment, createOtherAttachment, mainSendMessage, payload, payload, payloadMethods inherited from class com.helger.phase4.sender.AbstractAS4UserMessageBuilder
action, action, addAttachment, addAttachment, addEbmsProperties, addMessageProperty, addMessageProperty, addMessageProperty, agreementRef, agreementRef, agreementType, agreementType, applyToUserMessage, attachment, attachment, attachments, attachments, attachments, conversationID, conversationID, endpointURL, endpointURL, forceMimeMessage, forceMimeMessage, fromPartyID, fromPartyID, fromPartyIDType, fromPartyIDType, fromRole, fromRole, getAllAttachments, getAllMessageProperties, messageProperties, messageProperties, messageProperties, messageProperty, messageProperty, messageProperty, pmode, pmode, pmodeID, pmodeID, receiverCertificate, receiverCertificateAlias, sendMessageAndCheckForReceipt, sendMessageAndCheckForReceipt, service, service, service, serviceType, signalMsgConsumer, signalMsgConsumer, signalMsgValidationResultHdl, signalMsgValidationResultHdl, toPartyID, toPartyID, toPartyIDType, toPartyIDType, toRole, toRoleMethods inherited from class com.helger.phase4.sender.AbstractAS4MessageBuilder
afterSuccessfulSending, as4ProfileID, as4ProfileID, buildMessageCallback, buildMessageCallback, cryptoFactory, cryptoFactoryCrypt, cryptoFactoryCrypt, cryptoFactorySign, cryptoFactorySign, cryptParams, customHttpPoster, customHttpPoster, decryptRequestDataModifier, decryptRequestDataModifier, httpClientFactory, httpClientFactory, httpClientFactory, httpRetrySettings, httpRetrySettings, incomingAttachmentFactory, incomingAttachmentFactory, incomingDumper, incomingDumper, incomingProfileSelector, incomingProfileSelector, locale, locale, messageID, messageID, outgoingDumper, outgoingDumper, pmodeResolver, pmodeResolver, rawResponseConsumer, rawResponseConsumer, refToMessageID, refToMessageID, retryCallback, retryCallback, senderInterrupt, senderInterrupt, sendingDateTime, sendingDateTime, sendingDateTimeConsumer, sendingDateTimeConsumer, sendMessage, signingParams, soapVersion, soapVersion, withCryptParams, withSigningParamsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.helger.base.trait.IGenericImplTrait
thisAsT
-
Constructor Details
-
PeppolUserMessageBuilder
public PeppolUserMessageBuilder()Create a new builder, with the defaults fromAbstractPeppolUserMessageBuilder()
-
-
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 benull.- 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 benull.- 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 benull.- Returns:
- this for chaining
- Since:
- 0.13.0
-
sbdhType
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 benull.- Returns:
- this for chaining
- Since:
- 3.1.0
-
mlsTo
public @NonNull Phase4PeppolSender.PeppolUserMessageBuilder mlsTo(@Nullable com.helger.peppolid.IParticipantIdentifier aMLSTo) Set the optionalMLS_TOvalue of the Peppol SBDH providing the MLS receiver.- Parameters:
aMLSTo- The optional participant identifier. May benull.- Returns:
- this for chaining
- Since:
- 3.1.1
-
mlsType
public @NonNull Phase4PeppolSender.PeppolUserMessageBuilder mlsType(@Nullable com.helger.peppol.sbdh.EPeppolMLSType eMLSType) Set the optionalMLS_TYPEvalue of the Peppol SBDH providing the MLS orchestration.- Parameters:
eMLSType- The optional MLS type. May benull.- 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 benull.- Returns:
- this for chaining
-
payload
Set the XML payload to be used as a byte array. It will be parsed internally to a DOM element. Compared topayload(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 benull.- 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 topayload(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 benull.- 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 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:
- 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 benull.aMimeType- The MIME type to use. May not benull.- 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 benull.- 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 benullto 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 inPeppolValidation2024_11.VID_OPENPEPPOL_INVOICE_UBL_V3. May benull.- 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 inPeppolValidation2024_11.VID_OPENPEPPOL_INVOICE_UBL_V3. May benull.aValidationResultHandler- The validation result handler for positive and negative response handling. May benull.- 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:
finishFieldsin classPhase4PeppolSender.AbstractPeppolUserMessageBuilder<Phase4PeppolSender.PeppolUserMessageBuilder>- Throws:
com.helger.phase4.util.Phase4Exception
-