com.taleo.integration.client.customstep.csv
Class BaseHeaderFooterPostStep

java.lang.Object
  extended by com.taleo.integration.client.step.BaseStep
      extended by com.taleo.integration.client.step.BaseCustomStep
          extended by com.taleo.integration.client.customstep.BaseCustomStep
              extended by com.taleo.integration.client.customstep.csv.BaseCustomCsvStep
                  extended by com.taleo.integration.client.customstep.csv.BaseCustomCsvPostStep
                      extended by com.taleo.integration.client.customstep.csv.BaseHeaderFooterPostStep
All Implemented Interfaces:
com.taleo.integration.client.step.CustomStep, com.taleo.integration.client.step.Step
Direct Known Subclasses:
ExportHeaderFooterPostStep, ImportHeaderFooterPostStep

public abstract class BaseHeaderFooterPostStep
extends BaseCustomCsvPostStep

Abstract post-processing step to add a header and/or footer to a CSV file.

This step takes all parameters from its base class BaseCustomCsvPostStep and the following additional parameters:

Details of the variables available to write the template are specific to concrete subclasses of this one.

The files can be specified as an absolute path or relative to the working directory.

This class and its subclasses are dependent on the Apache Velocity library version 1.5.

Author:
Romain Guay, Taleo Corporation

Field Summary
 
Fields inherited from class com.taleo.integration.client.customstep.BaseCustomStep
parameterNames
 
Fields inherited from class com.taleo.integration.client.step.BaseCustomStep
parameters
 
Fields inherited from class com.taleo.integration.client.step.BaseStep
commType, ERROR_NULL_GLOBAL_CONFIG, ERROR_NULL_PIPELINE, ERROR_NULL_STEP_CONFIG, productCode, tempFolder, type, version
 
Constructor Summary
BaseHeaderFooterPostStep()
          Constructor without arguments.
 
Method Summary
protected abstract  org.apache.velocity.VelocityContext createContext(java.io.File file, java.io.File targetFile)
          Create the Velocity context with the given file and target file.
 void execute(java.io.File inFile, java.io.File outFile)
          Copy the input file to the output file while adding the header and/or footer.
 void execute(java.io.File inFile, java.io.File outFile, java.io.File targetFile)
          Copy the input file to the output file while adding the header and/or footer.
 java.lang.String getFooterTemplate()
           
 java.lang.String getFooterTemplateFile()
           
 java.lang.String getHeaderTemplate()
           
 java.lang.String getHeaderTemplateFile()
           
 void init(com.taleo.ws.integration.client.GlobalConfig config)
           
 void setFooterTemplate(java.lang.String template)
           
 void setFooterTemplateFile(java.lang.String templateFile)
           
 void setHeaderTemplate(java.lang.String template)
           
 void setHeaderTemplateFile(java.lang.String templateFile)
           
protected  void writeFooter(org.apache.velocity.app.VelocityEngine velocity, org.apache.velocity.VelocityContext context, java.io.BufferedWriter writer)
          Write the footer in the given writer.
protected  void writeHeader(org.apache.velocity.app.VelocityEngine velocity, org.apache.velocity.VelocityContext context, java.io.BufferedWriter writer)
          Write the header in the given writer.
 
Methods inherited from class com.taleo.integration.client.customstep.csv.BaseCustomCsvPostStep
getSupportedPipeline
 
Methods inherited from class com.taleo.integration.client.customstep.csv.BaseCustomCsvStep
execute, getColumnIndex, getColumnName, getCsvDelimiter, getCsvQuoteCharacter, isCsvHeaderPresent, setCsvDelimiter, setCsvHeaderPresent, setCsvQuoteCharacter
 
Methods inherited from class com.taleo.integration.client.customstep.BaseCustomStep
createTempFile, createTempFile, getEncoding, getTempFolder, isActive, registerParameterName, setActive, setEncoding, validateParameterNames
 
Methods inherited from class com.taleo.integration.client.step.BaseCustomStep
getDescription, getIdentifier, getName, getType, init
 
Methods inherited from class com.taleo.integration.client.step.BaseStep
getAllProcessSupportPipeline, getCurrentFile, getCurrentFile, getCurrentMessage, getPostProcessSupportPipeline, getPreProcessSupportPipeline, isOriginalFile, validateLastStepType, validateMessageType, validatePipeline
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.taleo.integration.client.step.Step
validatePipeline
 

Constructor Detail

BaseHeaderFooterPostStep

public BaseHeaderFooterPostStep()
Constructor without arguments.

Method Detail

getHeaderTemplateFile

public java.lang.String getHeaderTemplateFile()
Returns:

setHeaderTemplateFile

public void setHeaderTemplateFile(java.lang.String templateFile)
Parameters:
templateFile -

getHeaderTemplate

public java.lang.String getHeaderTemplate()
Returns:

setHeaderTemplate

public void setHeaderTemplate(java.lang.String template)
Parameters:
template -

getFooterTemplateFile

public java.lang.String getFooterTemplateFile()
Returns:

setFooterTemplateFile

public void setFooterTemplateFile(java.lang.String templateFile)
Parameters:
templateFile -

getFooterTemplate

public java.lang.String getFooterTemplate()
Returns:

setFooterTemplate

public void setFooterTemplate(java.lang.String template)
Parameters:
template -

init

public void init(com.taleo.ws.integration.client.GlobalConfig config)
Overrides:
init in class BaseCustomCsvStep

execute

public void execute(java.io.File inFile,
                    java.io.File outFile)
             throws java.lang.Exception
Copy the input file to the output file while adding the header and/or footer.

Parameters:
inFile - The input file
outFile - The output file
Throws:
java.lang.Exception

execute

public void execute(java.io.File inFile,
                    java.io.File outFile,
                    java.io.File targetFile)
             throws java.lang.Exception
Copy the input file to the output file while adding the header and/or footer.

Parameters:
inFile - The input file
outFile - The output file
targetFile - The target results file for the integration. This is used to allow using the file name and path as variables in the Velocity templates.
Throws:
java.lang.Exception

createContext

protected abstract org.apache.velocity.VelocityContext createContext(java.io.File file,
                                                                     java.io.File targetFile)
                                                              throws java.io.IOException
Create the Velocity context with the given file and target file. This method must be implemented by subclasses.

Parameters:
file - The file containing the data before adding the header and footer.
targetFile - The target results file for this integration.
Returns:
The Velocity context.
Throws:
java.io.IOException

writeHeader

protected void writeHeader(org.apache.velocity.app.VelocityEngine velocity,
                           org.apache.velocity.VelocityContext context,
                           java.io.BufferedWriter writer)
                    throws java.io.IOException
Write the header in the given writer.

Parameters:
velocity - The Velocity engine.
context - The Velocity context.
writer - The writer.
Throws:
java.io.IOException

writeFooter

protected void writeFooter(org.apache.velocity.app.VelocityEngine velocity,
                           org.apache.velocity.VelocityContext context,
                           java.io.BufferedWriter writer)
                    throws java.io.IOException
Write the footer in the given writer.

Parameters:
velocity - The Velocity engine.
context - The Velocity context.
writer - The writer.
Throws:
java.io.IOException