Class TransmissionRequestBuilder
- java.lang.Object
-
- network.oxalis.ng.outbound.transmission.TransmissionRequestBuilder
-
public class TransmissionRequestBuilder extends Object
- Author:
- steinar, thore Date: 04.11.13 Time: 10:04, erlend
-
-
Constructor Summary
Constructors Constructor Description TransmissionRequestBuilder(network.oxalis.ng.api.transformer.ContentDetector contentDetector, network.oxalis.ng.api.lookup.LookupService lookupService, network.oxalis.ng.api.tag.TagGenerator tagGenerator, network.oxalis.ng.api.header.HeaderParser headerParser, io.opentelemetry.api.trace.Tracer tracer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description network.oxalis.ng.api.outbound.TransmissionRequestbuild()Builds the actualTransmissionRequest.TransmissionRequestBuilderc1CountryIdentifier(network.oxalis.vefa.peppol.common.model.C1CountryIdentifier c1CountryIdentifier)protected PeppolStandardBusinessHeadercreateEffectiveHeader(PeppolStandardBusinessHeader parsed, PeppolStandardBusinessHeader supplied)Merges the supplied header fields with the SBDH parsed or derived from the payload thus allowing the caller to explicitly override whatever has been supplied in the payload.TransmissionRequestBuilderdocumentType(network.oxalis.vefa.peppol.common.model.DocumentTypeIdentifier documentTypeIdentifier)protected List<String>findRestricedHeadersThatWillBeOverridden(PeppolStandardBusinessHeader parsed, PeppolStandardBusinessHeader supplied)Returns a list of "restricted" header names that will be overridden when calling #createEffectiveHeader The restricted header names are SenderId, RecipientId, DocumentTypeIdentifier and ProfileTypeIdentifier Compares values that exist both as parsed and supplied headers.protected PeppolStandardBusinessHeadergetEffectiveStandardBusinessHeader()network.oxalis.vefa.peppol.common.model.EndpointgetEndpoint()protected InputStreamgetPayload()TransmissionRequestBuilderinstanceId(InstanceId instanceId)booleanisOverrideAllowed()TransmissionRequestBuildermlsToIdentifier(network.oxalis.vefa.peppol.common.model.MlsToIdentifier mlsToIdentifier)TransmissionRequestBuildermlsTypeIdentifier(network.oxalis.vefa.peppol.common.model.MlsTypeIdentifier mlsTypeIdentifier)TransmissionRequestBuilderoverrideAs4Endpoint(network.oxalis.vefa.peppol.common.model.Endpoint endpoint)Overrides the endpoint URL and the AS4 System identifier for the AS4 protocol.TransmissionRequestBuilderpayLoad(InputStream inputStream)Supplies the builder with the contents of the message to be sent.TransmissionRequestBuilderprocessType(network.oxalis.vefa.peppol.common.model.ProcessIdentifier processTypeId)TransmissionRequestBuilderreceiver(network.oxalis.vefa.peppol.common.model.ParticipantIdentifier receiverId)voidreset()protected voidsavePayLoad(InputStream inputStream)TransmissionRequestBuildersender(network.oxalis.vefa.peppol.common.model.ParticipantIdentifier senderId)voidsetTransmissionBuilderOverride(boolean transmissionBuilderOverride)For testing purposes onlyTransmissionRequestBuildertag(network.oxalis.ng.api.tag.Tag tag)
-
-
-
Constructor Detail
-
TransmissionRequestBuilder
@Inject public TransmissionRequestBuilder(network.oxalis.ng.api.transformer.ContentDetector contentDetector, network.oxalis.ng.api.lookup.LookupService lookupService, network.oxalis.ng.api.tag.TagGenerator tagGenerator, network.oxalis.ng.api.header.HeaderParser headerParser, io.opentelemetry.api.trace.Tracer tracer)
-
-
Method Detail
-
reset
public void reset()
-
payLoad
public TransmissionRequestBuilder payLoad(InputStream inputStream)
Supplies the builder with the contents of the message to be sent.
-
overrideAs4Endpoint
public TransmissionRequestBuilder overrideAs4Endpoint(network.oxalis.vefa.peppol.common.model.Endpoint endpoint)
Overrides the endpoint URL and the AS4 System identifier for the AS4 protocol. You had better know what you are doing :-)
-
receiver
public TransmissionRequestBuilder receiver(network.oxalis.vefa.peppol.common.model.ParticipantIdentifier receiverId)
-
sender
public TransmissionRequestBuilder sender(network.oxalis.vefa.peppol.common.model.ParticipantIdentifier senderId)
-
documentType
public TransmissionRequestBuilder documentType(network.oxalis.vefa.peppol.common.model.DocumentTypeIdentifier documentTypeIdentifier)
-
processType
public TransmissionRequestBuilder processType(network.oxalis.vefa.peppol.common.model.ProcessIdentifier processTypeId)
-
c1CountryIdentifier
public TransmissionRequestBuilder c1CountryIdentifier(network.oxalis.vefa.peppol.common.model.C1CountryIdentifier c1CountryIdentifier)
-
mlsToIdentifier
public TransmissionRequestBuilder mlsToIdentifier(network.oxalis.vefa.peppol.common.model.MlsToIdentifier mlsToIdentifier)
-
mlsTypeIdentifier
public TransmissionRequestBuilder mlsTypeIdentifier(network.oxalis.vefa.peppol.common.model.MlsTypeIdentifier mlsTypeIdentifier)
-
instanceId
public TransmissionRequestBuilder instanceId(InstanceId instanceId)
-
tag
public TransmissionRequestBuilder tag(network.oxalis.ng.api.tag.Tag tag)
-
build
public network.oxalis.ng.api.outbound.TransmissionRequest build() throws network.oxalis.ng.api.lang.OxalisTransmissionException, network.oxalis.ng.api.lang.OxalisContentExceptionBuilds the actualTransmissionRequest.The
PeppolStandardBusinessHeaderis built as following:- If the payload contains an SBHD, allow override if global "overrideAllowed" flag is set, otherwise use the one parsed
- If the payload does not contain an SBDH, parseOld payload to determine some of the SBDH attributes and allow override if global "overrideAllowed" flag is set.
- Returns:
- Prepared transmission request.
- Throws:
network.oxalis.ng.api.lang.OxalisTransmissionExceptionnetwork.oxalis.ng.api.lang.OxalisContentException
-
createEffectiveHeader
protected PeppolStandardBusinessHeader createEffectiveHeader(PeppolStandardBusinessHeader parsed, PeppolStandardBusinessHeader supplied)
Merges the supplied header fields with the SBDH parsed or derived from the payload thus allowing the caller to explicitly override whatever has been supplied in the payload.- Parameters:
parsed- the PeppolStandardBusinessHeader parsed from the payloadsupplied- the header fields supplied by the caller- Returns:
- the merged and effective headers
-
findRestricedHeadersThatWillBeOverridden
protected List<String> findRestricedHeadersThatWillBeOverridden(PeppolStandardBusinessHeader parsed, PeppolStandardBusinessHeader supplied)
Returns a list of "restricted" header names that will be overridden when calling #createEffectiveHeader The restricted header names are SenderId, RecipientId, DocumentTypeIdentifier and ProfileTypeIdentifier Compares values that exist both as parsed and supplied headers. Ignores values that only exists in one of them (that allows for sending new and unknown document types)
-
getEffectiveStandardBusinessHeader
protected PeppolStandardBusinessHeader getEffectiveStandardBusinessHeader()
-
savePayLoad
protected void savePayLoad(InputStream inputStream)
-
getPayload
protected InputStream getPayload()
-
getEndpoint
public network.oxalis.vefa.peppol.common.model.Endpoint getEndpoint()
-
isOverrideAllowed
public boolean isOverrideAllowed()
-
setTransmissionBuilderOverride
public void setTransmissionBuilderOverride(boolean transmissionBuilderOverride)
For testing purposes only
-
-