Class BaseIDocOutboundGenerator

java.lang.Object
com.onenetwork.platform.integ.sap.BaseIDocOutboundGenerator
All Implemented Interfaces:
ModelOutboundGenerator
Direct Known Subclasses:
BaseNetChangeIDocOutboundGenerator

public abstract class BaseIDocOutboundGenerator
extends java.lang.Object
implements ModelOutboundGenerator
Base class for implementing an Outbound Interface which generates an IDoc using "model-based" input.

By default, this supports only Model-based outbound generation. If this is all that's required, the only thing the subclass needs to do is to provide a no-args constructor which internally provides all params to this class' constructor, and implement getSenderOrganizationId(ModelOutboundProcessingContext) and #getReceiverOrganizationId(OutboundProcessingContext) to identify the sendingOrg and receivingOrg to be used for EDIOutboundRouting of the IDoc.

If the caller wants to support NetChange-based outbound, they should extend BaseNetChangeIDocOutboundGenerator

  • Field Details

  • Constructor Details

    • BaseIDocOutboundGenerator

      protected BaseIDocOutboundGenerator​(com.onenetwork.platform.data.model.impl.ModelType modelType, java.lang.String transactionSetIdentifier)
      Construct BaseIDocOutboundGenerator generator for the specified model type

      For example, if you want to generate an IDoc file for an order, the ModelType would be Order (or perhaps SCC.EnhancedOrder).

      Using this constructor will result in one message per IDoc. Use BaseIDocOutboundGenerator(ModelType, String, boolean) if you need multiple IDoc's per message by setting the boolean flag allowMultipleIDocPerPayload to true.

      Parameters:
      modelType - model type for which IDoc needs to be generated
      transactionSetIdentifier - transactionSetIdentifier to identify which type of IDoc needs to be generated
    • BaseIDocOutboundGenerator

      protected BaseIDocOutboundGenerator​(com.onenetwork.platform.data.model.impl.ModelType modelType, java.lang.String transactionSetIdentifier, boolean allowMultipleIDocPerPayload)
      Construct BaseIDocOutboundGenerator generator for the specified model type

      For example, if you want to generate an IDoc file for an order, the ModelType would be Order (or perhaps SCC.EnhancedOrder).

      Parameters:
      modelType - model type for which IDoc needs to be generated
      transactionSetIdentifier - transactionSetIdentifier to identify which type of IDoc needs to be generated
      allowMultipleIDocPerPayload - - boolean flag when set to true generates multiple IDocs within the same payload. When false will generate each IDoc in a separate payload
  • Method Details

    • generate

      public void generate​(ModelOutboundProcessingContext processingContext)
      Description copied from interface: ModelOutboundGenerator
      Callback from the Outbound framework to generate the outbound message. Developer can read the data using models available in the ModelOutboundProcessingContext and write the data to the given OutputStream.
      Specified by:
      generate in interface ModelOutboundGenerator
      Parameters:
      processingContext - ModelOutboundProcessingContext context to generate outbound data
    • generateSingleIDocPerPayload

      protected void generateSingleIDocPerPayload​(java.util.List<IDoc> iDocs, IDocMapper mapper, EDIMessagingContext ediMessagingContext, ModelOutboundProcessingContext processingContext) throws java.lang.Exception
      Generates separate payload for each IDoc

      Can be controlled by setting allowMultipleIDocPerPayload

      Parameters:
      iDocs - the list of IDocs to be sent as separate payloads
      mapper - used to populateRefTransInfo on EMQ
      ediMessagingContext - current Edi context for outbound generated
      processingContext - the ModelOutboundProcessingContext that will be used to derive Sender/Receiver org and generate the payload
      Throws:
      java.lang.Exception
    • generateMultipleIDocPerPayload

      protected void generateMultipleIDocPerPayload​(java.util.List<IDoc> iDocs, IDocMapper mapper, EDIMessagingContext ediMessagingContext, ModelOutboundProcessingContext processingContext) throws java.lang.Exception
      Generates one single payload containing multiple IDoc's

      Can be controlled by setting allowMultipleIDocPerPayload

      Parameters:
      iDocs - the list of IDocs to be sent within one payload
      mapper - used to populateRefTransInfo on EMQ
      ediMessagingContext - current Edi context for outbound generated
      processingContext - the ModelOutboundProcessingContext that will be used to derive Sender/Receiver org and generate the payload
      Throws:
      java.lang.Exception
    • getSenderOrganizationId

      public abstract java.lang.Long getSenderOrganizationId​(ModelOutboundProcessingContext processingContext)
      Returns the sender Organization value derived from the processing context.
      Parameters:
      processingContext - context for processing the current IDoc
      Returns:
      org id
    • getReceiverOrganizationId

      public abstract java.lang.Long getReceiverOrganizationId​(ModelOutboundProcessingContext processingContext)
      Returns the receiver Organization value derived from the processing context.
      Parameters:
      processingContext - context for processing the current IDoc
      Returns:
      org id
    • getEDIMessagingContext

      protected EDIMessagingContext getEDIMessagingContext​(PlatformUserContext pltUserContext)
      Build a new EDIMessagingContext from the given user context, used to get the outbound mapper.
      Parameters:
      pltUserContext - user context
    • getOutboundMapper

      protected IDocMapper getOutboundMapper​(EDIMessagingContext ediMessagingContext, ModelOutboundProcessingContext processingContext)
      Method to get the IDocMapper to be used to form the outbound IDoc.
      Parameters:
      ediMessagingContext - current outbound messaging context
      processingContext - current outbound processing context
      Returns:
      outbound IDocMapper