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

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
All Implemented Interfaces:
com.taleo.integration.client.step.CustomStep, com.taleo.integration.client.step.Step
Direct Known Subclasses:
AbstractSortStep, BaseCustomCsvPostStep, BaseCustomCsvPreStep, BreakStep, DeleteFileStep, LogContextStep, MoveFileStep, RemoveEmptyLinesPostStep, WriteFileStep

public abstract class BaseCustomCsvStep
extends BaseCustomStep

Abstract custom step for all processing of CSV files.

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

In the case of an export, those parameters can be read from the query file which is accessible from the custom steps. But there are cases where we need to specify them here. For example, if the extract is done in XML and transformed in CSV after, the query will not contain those values. If values are specified in the query and as parameters, the parameters have precedence. Ultimately, if they are not specified at all, the defaults apply.

In the case of an import, the load specification is not accessible from within the custom steps. Those parameters must then be provided otherwise the defaults will be used.

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
BaseCustomCsvStep()
          Constructor without arguments.
 
Method Summary
 void execute(com.taleo.ws.integration.client.Pipeline pipeline)
           
protected  int getColumnIndex(java.io.File file, java.lang.String column)
          Get the index of the specified column in the file.
protected  java.lang.String getColumnName(java.io.File file, java.lang.String column)
          Get the name of the specified column in the file.
 char getCsvDelimiter()
           
 char getCsvQuoteCharacter()
           
 void init(com.taleo.ws.integration.client.GlobalConfig config)
           
 boolean isCsvHeaderPresent()
           
 void setCsvDelimiter(char csvDelimiter)
           
 void setCsvHeaderPresent(boolean csvHeaderPresent)
           
 void setCsvQuoteCharacter(char csvQuoteCharacter)
           
 
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, getSupportedPipeline, 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

BaseCustomCsvStep

public BaseCustomCsvStep()
Constructor without arguments.

Method Detail

getCsvDelimiter

public char getCsvDelimiter()
Returns:

setCsvDelimiter

public void setCsvDelimiter(char csvDelimiter)
Parameters:
csvDelimiter -

isCsvHeaderPresent

public boolean isCsvHeaderPresent()
Returns:

setCsvHeaderPresent

public void setCsvHeaderPresent(boolean csvHeaderPresent)
Parameters:
csvHeaderPresent -

getCsvQuoteCharacter

public char getCsvQuoteCharacter()
Returns:

setCsvQuoteCharacter

public void setCsvQuoteCharacter(char csvQuoteCharacter)
Parameters:
csvQuoteCharacter -

init

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

execute

public void execute(com.taleo.ws.integration.client.Pipeline pipeline)
             throws com.taleo.integration.client.step.StepException
Throws:
com.taleo.integration.client.step.StepException

getColumnIndex

protected int getColumnIndex(java.io.File file,
                             java.lang.String column)
                      throws java.io.IOException,
                             InvalidCSVFileFormat
Get the index of the specified column in the file. The column may already contain the index number or may contain the name of the column.

Parameters:
file - The CSV file
column - The name or index (0 based) of the column
Throws:
java.io.IOException
InvalidCSVFileFormat

getColumnName

protected java.lang.String getColumnName(java.io.File file,
                                         java.lang.String column)
                                  throws java.io.IOException,
                                         InvalidCSVFileFormat
Get the name of the specified column in the file. The column may already contain the name of may also contain the index of the column.

Parameters:
file - The CSV file
column - The name or index (0 based) of the column
Throws:
java.io.IOException
InvalidCSVFileFormat