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 TypeMethodDescriptionvoid
closeBlock
(PipeLineSession session, String streamId, String blockName, Map<String, Object> blocks) void
closeDocument
(PipeLineSession session, String streamId) void
closeRecordType
(PipeLineSession session, String streamId) protected abstract Writer
createWriter
(PipeLineSession session, String streamId) finalizeResult
(PipeLineSession session, String streamId, boolean error) Called when all records in the original file are handled.protected Writer
getWriter
(PipeLineSession session, String streamId, boolean create) void
handleResult
(PipeLineSession session, String streamId, String recordKey, String result) write a result record.void
void
openDocument
(PipeLineSession session, String streamId) Called once, before the first record of a stream is presented to handleResult.void
openRecordType
(PipeLineSession session, String streamId) protected String
replacePattern
(String target, String blockName) void
setBlockNamePattern
(String pattern) string that is replaced by name of block or name of stream in above stringsvoid
setOnCloseBlock
(String line) string that is written after the end of each logical block, as defined in the flowvoid
setOnCloseDocument
(String line) string that is written after all data of results is writtenvoid
setOnOpenBlock
(String line) string that is written before the start of each logical block, as defined in the flowvoid
setOnOpenDocument
(String line) string that is written before any data of results is writtenprotected void
Methods inherited from class org.frankframework.batch.AbstractResultHandler
addParameter, close, configure, getParameterList, hasPrefix, isDefault, open, setBlockByRecordType, setDefault, setName, setPipe, setPrefix, setSuffix
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.context.ApplicationContextAware
setApplicationContext
Methods inherited from interface org.frankframework.core.HasApplicationContext
getApplicationContext, getConfigurationClassLoader
Methods inherited from interface org.frankframework.batch.IResultHandler
isBlockByRecordType
-
Constructor Details
-
ResultWriter
public ResultWriter()
-
-
Method Details
-
createWriter
- Throws:
Exception
-
openDocument
Description copied from interface:IResultHandler
Called once, before the first record of a stream is presented to handleResult.- Specified by:
openDocument
in interfaceIResultHandler
- Overrides:
openDocument
in classAbstractResultHandler
- Parameters:
session
- current PipeLineSessionstreamId
- identification of the original file/stream/message- Throws:
Exception
-
closeDocument
- Specified by:
closeDocument
in interfaceIResultHandler
- Overrides:
closeDocument
in classAbstractResultHandler
-
finalizeResult
public String finalizeResult(PipeLineSession session, String streamId, boolean error) throws Exception Description copied from interface:IResultHandler
Called 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:IResultHandler
write 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#
-