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 Summary
Fields Modifier and Type Field Description protected boolean
allowMultipleIDocPerPayload
protected java.lang.String
idocFormat
protected com.onenetwork.platform.data.model.impl.ModelType
modelType
protected java.lang.String
transactionSetIdentifier
-
Constructor Summary
Constructors Modifier Constructor Description protected
BaseIDocOutboundGenerator(com.onenetwork.platform.data.model.impl.ModelType modelType, java.lang.String transactionSetIdentifier)
Construct BaseIDocOutboundGenerator generator for the specified model typeprotected
BaseIDocOutboundGenerator(com.onenetwork.platform.data.model.impl.ModelType modelType, java.lang.String transactionSetIdentifier, boolean allowMultipleIDocPerPayload)
Construct BaseIDocOutboundGenerator generator for the specified model type -
Method Summary
Modifier and Type Method Description void
generate(ModelOutboundProcessingContext processingContext)
Callback from the Outbound framework to generate the outbound message.protected void
generateMultipleIDocPerPayload(java.util.List<IDoc> iDocs, IDocMapper mapper, EDIMessagingContext ediMessagingContext, ModelOutboundProcessingContext processingContext)
Generates one single payload containing multiple IDoc'sprotected void
generateSingleIDocPerPayload(java.util.List<IDoc> iDocs, IDocMapper mapper, EDIMessagingContext ediMessagingContext, ModelOutboundProcessingContext processingContext)
Generates separate payload for each IDocprotected EDIMessagingContext
getEDIMessagingContext(PlatformUserContext pltUserContext)
Build a new EDIMessagingContext from the given user context, used to get the outbound mapper.protected IDocMapper
getOutboundMapper(EDIMessagingContext ediMessagingContext, ModelOutboundProcessingContext processingContext)
Method to get the IDocMapper to be used to form the outbound IDoc.abstract java.lang.Long
getReceiverOrganizationId(ModelOutboundProcessingContext processingContext)
Returns the receiver Organization value derived from the processing context.abstract java.lang.Long
getSenderOrganizationId(ModelOutboundProcessingContext processingContext)
Returns the sender Organization value derived from the processing context.
-
Field Details
-
modelType
protected com.onenetwork.platform.data.model.impl.ModelType modelType -
idocFormat
protected java.lang.String idocFormat -
transactionSetIdentifier
protected java.lang.String transactionSetIdentifier -
allowMultipleIDocPerPayload
protected boolean allowMultipleIDocPerPayload
-
-
Constructor Details
-
BaseIDocOutboundGenerator
protected BaseIDocOutboundGenerator(com.onenetwork.platform.data.model.impl.ModelType modelType, java.lang.String transactionSetIdentifier)Construct BaseIDocOutboundGenerator generator for the specified model typeFor 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 flagallowMultipleIDocPerPayload
to true.- Parameters:
modelType
- model type for which IDoc needs to be generatedtransactionSetIdentifier
- 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 typeFor 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 generatedtransactionSetIdentifier
- transactionSetIdentifier to identify which type of IDoc needs to be generatedallowMultipleIDocPerPayload
- - 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
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 interfaceModelOutboundGenerator
- 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.ExceptionGenerates separate payload for each IDocCan be controlled by setting
allowMultipleIDocPerPayload
- Parameters:
iDocs
- the list of IDocs to be sent as separate payloadsmapper
- used to populateRefTransInfo on EMQediMessagingContext
- current Edi context for outbound generatedprocessingContext
- 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.ExceptionGenerates one single payload containing multiple IDoc'sCan be controlled by setting
allowMultipleIDocPerPayload
- Parameters:
iDocs
- the list of IDocs to be sent within one payloadmapper
- used to populateRefTransInfo on EMQediMessagingContext
- current Edi context for outbound generatedprocessingContext
- 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
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 contextprocessingContext
- current outbound processing context- Returns:
- outbound IDocMapper
-