com.taleo.integration.client.customstep.velocity
Class CsvExportFileTool

java.lang.Object
  extended by com.taleo.integration.client.customstep.velocity.FileTool
      extended by com.taleo.integration.client.customstep.velocity.CsvExportFileTool

public class CsvExportFileTool
extends FileTool

Class to expose a CSV export results file properties and content into Velocity templates.

Author:
Romain Guay - Taleo Corporation

Constructor Summary
CsvExportFileTool(java.io.File file, boolean headerPresent, char csvDelimiter, char csvQuoteCharacter, java.lang.String encoding)
          Constructor with the export file, CSV header indicator, CSV delimiter, quotation character and encoding.
CsvExportFileTool(java.io.File file, boolean headerPresent, char csvDelimiter, char csvQuoteCharacter, java.lang.String encoding, java.io.File targetFile)
          Constructor with the export file, CSV header indicator, CSV delimiter, quotation character, encoding and the target file.
 
Method Summary
 java.lang.String content()
          Return the file content.
 java.util.Date lastModified()
          Return the file last modified date.
 int lineCount()
          Return the line count including the header row if present.
 java.lang.String name()
          Return the file name including the extension.
 java.lang.String path()
          Return the file absolute path.
 int recordCount()
          Return the record count excluding the header row if present.
 long size()
          Return the file size.
 
Methods inherited from class com.taleo.integration.client.customstep.velocity.FileTool
content, content, lastModified, lineCount, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CsvExportFileTool

public CsvExportFileTool(java.io.File file,
                         boolean headerPresent,
                         char csvDelimiter,
                         char csvQuoteCharacter,
                         java.lang.String encoding)
Constructor with the export file, CSV header indicator, CSV delimiter, quotation character and encoding.

Parameters:
file - The export file.
encoding - The encoding.

CsvExportFileTool

public CsvExportFileTool(java.io.File file,
                         boolean headerPresent,
                         char csvDelimiter,
                         char csvQuoteCharacter,
                         java.lang.String encoding,
                         java.io.File targetFile)
Constructor with the export file, CSV header indicator, CSV delimiter, quotation character, encoding and the target file.

If specified, the targetFile is used to provide the file name and path in place of the file itself which is used for the contents. This is useful when the tool is used in the process of writing the target file and the name/path must be written within.

Parameters:
file - The export file.
headerPresent - Indicates if the CSV header is present in the file.
csvDelimiter - CSV delimiter.
csvQuoteCharacter - CSV quote character.
encoding - The encoding.
targetFile - The target file.
Method Detail

name

public java.lang.String name()
Return the file name including the extension.

Returns:
The file name.

path

public java.lang.String path()
Return the file absolute path.

Returns:
The file path.

lastModified

public java.util.Date lastModified()
Return the file last modified date.

Returns:
The file last modified date.

size

public long size()
Return the file size.

Returns:
The file size in bytes.

content

public java.lang.String content()
                         throws java.io.IOException
Return the file content.

Returns:
The file content.
Throws:
java.io.IOException

lineCount

public int lineCount()
              throws java.io.IOException
Return the line count including the header row if present.

Returns:
The line count.
Throws:
java.io.IOException

recordCount

public int recordCount()
                throws java.io.IOException
Return the record count excluding the header row if present.

Returns:
The record count.
Throws:
java.io.IOException
InvalidCSVFileFormat