com.taleo.integration.client.customstep.csv
Class CsvToXmlPreStep
java.lang.Object
com.taleo.integration.client.step.BaseStep
com.taleo.integration.client.step.BaseCustomStep
com.taleo.integration.client.customstep.BaseCustomStep
com.taleo.integration.client.customstep.csv.BaseCustomCsvStep
com.taleo.integration.client.customstep.csv.BaseCustomCsvPreStep
com.taleo.integration.client.customstep.csv.CsvToXmlPreStep
- All Implemented Interfaces:
- com.taleo.integration.client.step.CustomStep, com.taleo.integration.client.step.Step
public class CsvToXmlPreStep
- extends BaseCustomCsvPreStep
Pre-processing step to create an XML file from a CSV. The source CSV file is
the current file in the pipeline.
This step takes all parameters from its base class
BaseCustomCsvPreStep
and
the following additional parameters:
- fields: Optional - The comma delimited list of CSV field names or
indexes (0 based) to use in building the XML. If absent, all the fields are
translated into the XML result.
- xmlFields: Optional - The comma delimited list of XML field names
for the corresponding CSV fields. If a field is not mentioned here, it will
keep its original name or be named FIELD_0, FIELD_1, according to its
position in the file if there is no CSV header. Names should be valid XML
names.
- outputFile: Optional - The complete path of the resulting XML. If
absent the output becomes the current document in the execution pipeline.
The resulting XML is simply structured as follows:
<XML>
<RECORD>
<FIELDNAME1>xxxxxxxxxx</FIELDNAME1>
<FIELDNAME2>xxxxxxxxxx</FIELDNAME2>
...
</RECORD>
...
</XML>
If the CSV has no header row, the fields are named "FIELD_0", "FIELD_1",
etc., by their index in the CSV. This also applies if a given header has no
value.
This simple format can further be transformed with XSL in subsequent steps if
needed.
This step is also tolerant with regards to incomplete CSV rows. It will
simply set blank values to the missing fields.
This class is dependent on:
Here is an example of how to define this custom step in the TCC configuration
file.
- Author:
- Romain Guay, Taleo Corporation
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 |
Methods inherited from class com.taleo.integration.client.step.BaseCustomStep |
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 |
CsvToXmlPreStep
public CsvToXmlPreStep()
- Constructor without arguments.
getFields
public java.lang.String[] getFields()
- Returns:
setFields
public void setFields(java.lang.String[] fields)
- Parameters:
strings
-
getXmlFields
public java.lang.String[] getXmlFields()
- Returns:
setXmlFields
public void setXmlFields(java.lang.String[] xmlFields)
- Parameters:
strings
-
getOutputFile
public java.lang.String getOutputFile()
- Get the output file.
- Returns:
setOutputFile
public void setOutputFile(java.lang.String outputFile)
- Set the output file.
- Parameters:
outputFile
-
getIdentifier
public java.lang.String getIdentifier()
- Specified by:
getIdentifier
in interface com.taleo.integration.client.step.CustomStep
- Specified by:
getIdentifier
in interface com.taleo.integration.client.step.Step
- Specified by:
getIdentifier
in class com.taleo.integration.client.step.BaseCustomStep
getDescription
public java.lang.String getDescription()
- Specified by:
getDescription
in interface com.taleo.integration.client.step.CustomStep
- Specified by:
getDescription
in interface com.taleo.integration.client.step.Step
- Specified by:
getDescription
in class com.taleo.integration.client.step.BaseCustomStep
getName
public java.lang.String getName()
- Specified by:
getName
in interface com.taleo.integration.client.step.CustomStep
- Specified by:
getName
in interface com.taleo.integration.client.step.Step
- Specified by:
getName
in class com.taleo.integration.client.step.BaseCustomStep
init
public void init(com.taleo.ws.integration.client.GlobalConfig config)
- Overrides:
init
in class BaseCustomCsvStep
execute
public void execute(com.taleo.ws.integration.client.Pipeline pipeline)
throws com.taleo.integration.client.step.StepException
- Specified by:
execute
in interface com.taleo.integration.client.step.Step
- Overrides:
execute
in class BaseCustomCsvStep
- Throws:
com.taleo.integration.client.step.StepException
execute
public void execute(java.io.File inFile,
java.io.File outFile)
throws java.io.IOException,
InvalidCSVFileFormat,
org.xml.sax.SAXException
- Create the XML file.
- Parameters:
inFile
- The CSV input fileoutFile
- The XML output file
- Throws:
java.io.IOException
InvalidCSVFileFormat
org.xml.sax.SAXException