Class TransmissionRequestBuilder


  • public class TransmissionRequestBuilder
    extends Object
    Author:
    steinar, thore Date: 04.11.13 Time: 10:04, erlend
    • Constructor Detail

      • TransmissionRequestBuilder

        @Inject
        public TransmissionRequestBuilder​(network.oxalis.api.transformer.ContentDetector contentDetector,
                                          network.oxalis.api.lookup.LookupService lookupService,
                                          network.oxalis.api.tag.TagGenerator tagGenerator,
                                          network.oxalis.api.header.HeaderParser headerParser,
                                          io.opentracing.Tracer tracer)
    • Method Detail

      • reset

        public void reset()
      • overrideAs2Endpoint

        public TransmissionRequestBuilder overrideAs2Endpoint​(network.oxalis.vefa.peppol.common.model.Endpoint endpoint)
        Overrides the endpoint URL and the AS2 System identifier for the AS2 protocol. You had better know what you are doing :-)
      • receiver

        public TransmissionRequestBuilder receiver​(network.oxalis.vefa.peppol.common.model.ParticipantIdentifier receiverId)
      • documentType

        public TransmissionRequestBuilder documentType​(network.oxalis.vefa.peppol.common.model.DocumentTypeIdentifier documentTypeIdentifier)
      • processType

        public TransmissionRequestBuilder processType​(network.oxalis.vefa.peppol.common.model.ProcessIdentifier processTypeId)
      • build

        public network.oxalis.api.outbound.TransmissionRequest build​(io.opentracing.Span root)
                                                              throws network.oxalis.api.lang.OxalisTransmissionException,
                                                                     network.oxalis.api.lang.OxalisContentException
        Throws:
        network.oxalis.api.lang.OxalisTransmissionException
        network.oxalis.api.lang.OxalisContentException
      • build

        public network.oxalis.api.outbound.TransmissionRequest build()
                                                              throws network.oxalis.api.lang.OxalisTransmissionException,
                                                                     network.oxalis.api.lang.OxalisContentException
        Builds the actual TransmissionRequest.

        The PeppolStandardBusinessHeader is built as following:

        1. If the payload contains an SBHD, allow override if global "overrideAllowed" flag is set, otherwise use the one parsed
        2. 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.api.lang.OxalisTransmissionException
        network.oxalis.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 payload
        supplied - 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)
      • savePayLoad

        protected void savePayLoad​(InputStream inputStream)
      • getEndpoint

        public network.oxalis.vefa.peppol.common.model.Endpoint getEndpoint()
      • isOverrideAllowed

        public boolean isOverrideAllowed()
      • setTransmissionBuilderOverride

        public void setTransmissionBuilderOverride​(boolean transmissionBuilderOverride)
        For testing purposes only