Package org.frankframework.batch
Class ResultWriter
java.lang.Object
org.frankframework.batch.AbstractResultHandler
org.frankframework.batch.ResultWriter
- All Implemented Interfaces:
IResultHandler,FrankElement,HasApplicationContext,HasName,IConfigurable,IScopeProvider,IWithParameters,NameAware,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
- Direct Known Subclasses:
Result2Filewriter,Result2LobWriterBase,Result2StringWriter
Baseclass for resulthandlers that write the transformed record to a writer.
- Since:
- 4.7
- Author:
- Gerrit van Brakel
-
Field Summary
Fields inherited from class org.frankframework.batch.AbstractResultHandler
log, paramList -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcloseBlock(PipeLineSession session, String streamId, String blockName, Map<String, Object> blocks) voidcloseDocument(PipeLineSession session, String streamId) voidcloseRecordType(PipeLineSession session, String streamId) protected abstract WritercreateWriter(PipeLineSession session, String streamId) finalizeResult(PipeLineSession session, String streamId, boolean error) Called when all records in the original file are handled.protected WritergetWriter(PipeLineSession session, String streamId, boolean create) voidhandleResult(PipeLineSession session, String streamId, String recordKey, String result) write a result record.voidvoidopenDocument(PipeLineSession session, String streamId) Called once, before the first record of a stream is presented to handleResult.voidopenRecordType(PipeLineSession session, String streamId) protected StringreplacePattern(String target, String blockName) voidsetBlockNamePattern(String pattern) string that is replaced by name of block or name of stream in above stringsvoidsetOnCloseBlock(String line) string that is written after the end of each logical block, as defined in the flowvoidsetOnCloseDocument(String line) string that is written after all data of results is writtenvoidsetOnOpenBlock(String line) string that is written before the start of each logical block, as defined in the flowvoidsetOnOpenDocument(String line) string that is written before any data of results is writtenprotected voidMethods inherited from class org.frankframework.batch.AbstractResultHandler
addParameter, close, configure, getParameterList, hasPrefix, isDefault, open, setBlockByRecordType, setDefault, setName, setPipe, setPrefix, setSuffixMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationContextAware
setApplicationContextMethods inherited from interface org.frankframework.core.FrankElement
addConfigWarningMethods inherited from interface org.frankframework.core.HasApplicationContext
getApplicationContext, getConfigurationClassLoaderMethods inherited from interface org.frankframework.batch.IResultHandler
isBlockByRecordType
-
Constructor Details
-
ResultWriter
public ResultWriter()
-
-
Method Details
-
createWriter
- Throws:
Exception
-
openDocument
Description copied from interface:IResultHandlerCalled once, before the first record of a stream is presented to handleResult.- Specified by:
openDocumentin interfaceIResultHandler- Overrides:
openDocumentin classAbstractResultHandler- Parameters:
session- current PipeLineSessionstreamId- identification of the original file/stream/message- Throws:
Exception
-
closeDocument
- Specified by:
closeDocumentin interfaceIResultHandler- Overrides:
closeDocumentin classAbstractResultHandler
-
finalizeResult
public String finalizeResult(PipeLineSession session, String streamId, boolean error) throws Exception Description copied from interface:IResultHandlerCalled when all records in the original file are handled.- Parameters:
session- current PipeLineSessionstreamId- identification of the original file/stream/message containing the untransformed records- Returns:
- the name or names of the output files
- Throws:
Exception
-
handleResult
public void handleResult(PipeLineSession session, String streamId, String recordKey, String result) throws Exception Description copied from interface:IResultHandlerwrite a result record.- Parameters:
session- current PipeLineSessionstreamId- identification of the original file/stream/message containing the untransformed recordsrecordKey- key of the record (describes the record type)result- transformed record- Throws:
Exception
-
writeNewLine
- Throws:
IOException
-
openRecordType
- Parameters:
session- current PipeLineSessionstreamId- identification of the original file/stream/message containing the untransformed records- Throws:
Exception
-
closeRecordType
- Parameters:
session- current PipeLineSessionstreamId- identification of the original file/stream/message containing the untransformed records- Throws:
Exception
-
replacePattern
-
openBlock
public void openBlock(PipeLineSession session, String streamId, String blockName, Map<String, Object> blocks) throws Exception- Throws:
Exception
-
closeBlock
public void closeBlock(PipeLineSession session, String streamId, String blockName, Map<String, Object> blocks) throws Exception- Throws:
Exception
-
getWriter
protected Writer getWriter(PipeLineSession session, String streamId, boolean create) throws Exception - Throws:
Exception
-
setOnOpenDocument
string that is written before any data of results is written- Default value
- <document name="#name#">
-
setOnCloseDocument
string that is written after all data of results is written- Default value
- </document>
-
setOnOpenBlock
string that is written before the start of each logical block, as defined in the flow- Default value
- <#name#>
-
setOnCloseBlock
string that is written after the end of each logical block, as defined in the flow- Default value
- </#name#>
-
setBlockNamePattern
string that is replaced by name of block or name of stream in above strings- Default value
- #name#
-