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

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

public class CsvImportFileTool
extends FileTool

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

Author:
Romain Guay - Taleo Corporation

Constructor Summary
CsvImportFileTool(java.io.File file, boolean headerPresent, char csvDelimiter, char csvQuoteCharacter, java.lang.String encoding)
          Constructor with the import results file, CSV header indicator, CSV delimiter, quotation character and encoding.
CsvImportFileTool(java.io.File file, boolean headerPresent, char csvDelimiter, char csvQuoteCharacter, java.lang.String encoding, java.io.File targetFile)
          Constructor with the import results file, CSV header indicator, CSV delimiter, quotation character, encoding and the target file.
 
Method Summary
 java.lang.String content()
          Return the file content.
 int createCount()
          Return the create count.
 int deleteCount()
          Return the delete count.
 java.lang.String errorContent()
          Return the error content.
 java.lang.String errorContent(java.lang.String excludePattern)
          Return the error content, excluding the ones where the given regex pattern is found at least once.
 int errorCount()
          Return the error count.
 int errorCount(java.lang.String excludePattern)
          Return the error count, excluding the ones where the given regex pattern is found at least once.
 java.lang.String headerRow()
          Return the CSV header row if present.
 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.
 int successCount()
          Return the success count.
 int updateCount()
          Return the update count.
 
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

CsvImportFileTool

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

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

CsvImportFileTool

public CsvImportFileTool(java.io.File file,
                         boolean headerPresent,
                         char csvDelimiter,
                         char csvQuoteCharacter,
                         java.lang.String encoding,
                         java.io.File targetFile)
Constructor with the import results 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 - The CSV delimiter.
csvQuoteCharacter - The 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
InvalidCSVFileFormat

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

successCount

public int successCount()
                 throws java.io.IOException
Return the success count.

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

createCount

public int createCount()
                throws java.io.IOException
Return the create count.

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

updateCount

public int updateCount()
                throws java.io.IOException
Return the update count.

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

deleteCount

public int deleteCount()
                throws java.io.IOException
Return the delete count.

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

headerRow

public java.lang.String headerRow()
Return the CSV header row if present.

Returns:

errorCount

public int errorCount()
               throws java.io.IOException
Return the error count.

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

errorCount

public int errorCount(java.lang.String excludePattern)
               throws java.io.IOException
Return the error count, excluding the ones where the given regex pattern is found at least once.

Please make sure to follow regex syntax, taking into consideration that some characters may need to be escaped. Also, multiple exclusions can be separated with the | character meaning OR in regex.

Parameters:
excludePattern - The regex exclude pattern.
Returns:
The error count.
Throws:
java.io.IOException
See Also:
Pattern

errorContent

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

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

errorContent

public java.lang.String errorContent(java.lang.String excludePattern)
                              throws java.io.IOException
Return the error content, excluding the ones where the given regex pattern is found at least once.

Please make sure to follow regex syntax, taking into consideration that some characters may need to be escaped. Also, multiple exclusions can be separated with the | character meaning OR in regex.

Parameters:
excludePattern - The regex exclude pattern.
Returns:
Throws:
java.io.IOException
See Also:
Pattern