Class BaseFixLenOutboundGenerator
java.lang.Object
com.onenetwork.platform.integ.fixlen.BaseFixLenOutboundGenerator
- All Implemented Interfaces:
ModelOutboundGenerator
- Direct Known Subclasses:
BaseNetChangeFixLenOutboundGenerator
,BaseSysIdFixLenOutboundGenerator
public abstract class BaseFixLenOutboundGenerator extends java.lang.Object implements ModelOutboundGenerator
Base class for implementing an Outbound Interface which generates a Fixed Length file
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
generate(ModelOutboundProcessingContext)
and populatePrimaryRefTransDetailsOnMessageDetail(MessageDetail, FixLenRow, PlatformUserContext)
to generate the FixLenRows and to set the primaryRefTransDetails on MessageDetail.
If the caller wants to support NetChange-based outbound, they should
extend BaseNetChangeFixLenOutboundGenerator
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
metadataFileName
protected java.lang.String
moduleOrEptPrefix
-
Constructor Summary
Constructors Constructor Description BaseFixLenOutboundGenerator(java.lang.String moduleOrEptPrefix, java.lang.String metadataFileName)
This constructor is used to set moduleOrEptPrefix and metadataFileName fields which are used for loading the XML rule file. -
Method Summary
Modifier and Type Method Description protected FixLenRow
createFixLenRow()
This method is invoked from the implementing generator for creating a fixLenFileRow.MessageDetail
createMessageDetailEntry(java.lang.String recordIdentifier, java.lang.String error, java.lang.String primaryRefTransNo, java.lang.String modelType, java.lang.String rawData, Message message, java.util.List<MessageDetail> messageDetails, PlatformUserContext context)
This method creates a messageDetail JAXB for the parameters passed.void
generate(ModelOutboundProcessingContext processingContext)
Callback from the Outbound framework to generate the outbound message.protected abstract java.util.List<FixLenRow>
generateRows(java.util.List<? extends Model> modelList)
Your implementation should convert the given Models into Listand return the result. abstract void
populatePrimaryRefTransDetailsOnMessageDetail(MessageDetail messageDetail, FixLenRow fileRow, PlatformUserContext context)
This method must be overridden by subclass generator for setting the primary transaction reference number and modelType on MessageDetail.
-
Field Details
-
moduleOrEptPrefix
protected java.lang.String moduleOrEptPrefix -
metadataFileName
protected java.lang.String metadataFileName
-
-
Constructor Details
-
BaseFixLenOutboundGenerator
public BaseFixLenOutboundGenerator(java.lang.String moduleOrEptPrefix, java.lang.String metadataFileName)This constructor is used to set moduleOrEptPrefix and metadataFileName fields which are used for loading the XML rule file.- When overriding from a module: If we need to use a metadata file called Order.xml within PlatformTestModule, place the file within the "com.onenetwork.platformtestmodule.integ.fixlen.rules" package and call this constructor from the implementing generator's constructor as super("PTA","Order.xml");
- When overriding from an EPT: Pass the EPT name for moduleOrEptName. For example, if you have an ept named "MyEnt" then place the XML rule file in package "com.onenetwork.myent.integ.fixlen.rules" and call this constructor from the implementing generator's constructor as - super("EPT.MyEnt","Order.xml"); to get the FixLenDef object from the XML rule file within the ept "EPT.MyEnt"
- Parameters:
moduleOrEptPrefix
- module prefix (e.g. ZBKS or EPT.MyEnt)metadataFileName
- this xml file should be in the "integ.fixlen.rules" subpackage of your module or EPT's base java package
-
-
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
-
generateRows
protected abstract java.util.List<FixLenRow> generateRows(java.util.List<? extends Model> modelList)Your implementation should convert the given Models into Listand return the result. - Parameters:
modelList
- Models to be converted to FixLenRows- Returns:
- List
fixLenRows derived from the given models
-
populatePrimaryRefTransDetailsOnMessageDetail
public abstract void populatePrimaryRefTransDetailsOnMessageDetail(MessageDetail messageDetail, FixLenRow fileRow, PlatformUserContext context)This method must be overridden by subclass generator for setting the primary transaction reference number and modelType on MessageDetail. This facilitates searching of FixLenRows by transaction reference numbers from the Message detail report page.- Parameters:
fileRow
- FixLenRowcontext
- PlatformUserContext
-
createMessageDetailEntry
public MessageDetail createMessageDetailEntry(java.lang.String recordIdentifier, java.lang.String error, java.lang.String primaryRefTransNo, java.lang.String modelType, java.lang.String rawData, Message message, java.util.List<MessageDetail> messageDetails, PlatformUserContext context) throws java.lang.ExceptionThis method creates a messageDetail JAXB for the parameters passed. This can be overrriden by the implementing generator if needed- Parameters:
recordIdentifier
- RecordIdentifier for MessageDetailerror
- ErrorMessage if presentprimaryRefTransNo
- primaryIdentificationNumber for MessageDetailmodelType
- modelTyperawData
- rawData for the recordmessage
- inputMessagemessageDetails
- Listcontext
- userContext- Returns:
- MessageDetail
- Throws:
java.lang.Exception
-
createFixLenRow
This method is invoked from the implementing generator for creating a fixLenFileRow. A row is created with all its field having null values. The implementing processor can use FixLenRow addField method for setting the field values.- Returns:
- FixLenRow fixLenRow
-