com.taleo.integration.client.customstep.lrd
Class RunDateManager

java.lang.Object
  extended by com.taleo.integration.client.customstep.lrd.RunDateManager

public class RunDateManager
extends java.lang.Object

RunDateManager that saves the last run dates on the file system.

It also exposes the current run date that is by default the local system date but can be taken from another date provider.

This class can be called from within a Java process or run in standalone mode to get/set the last run date in a file.

If the last run date is null, it is considered 1 day before now.

Author:
Romain Guay - Taleo Corporation

Field Summary
static java.lang.String PIPELINE_KEY
          Key for the RunDateManager in the pipeline.
 
Constructor Summary
RunDateManager(java.io.File file)
          Constructor with the file to store the last run date.
RunDateManager(java.io.File file, DateProvider dateProvider)
          Constructor with the file to store the last run date and the date provider.
RunDateManager(java.io.File file, DateProvider dateProvider, double maxExtractDays)
          Constructor with the file to store the last run date, the date provider and the maximum number of days to extract.
RunDateManager(java.io.File file, DateProvider dateProvider, double maxExtractDays, java.lang.String dateTimeMask)
          Constructor with the file to store the last run date, the date provider and the maximum number of days to extract.
 
Method Summary
 java.util.Date getDefaultLastRunDate()
          Get the default last run date, which is 1 day before the current run date.
 java.util.Date getEffectiveLastRunDate()
          Deprecated. Use getLastRunDate() instead.
 java.util.Date getEffectiveRunDate()
          Get the effective run date used for filtering.
 java.io.File getFile()
          Return the file where the last run date is stored.
 java.util.Date getLastRunDate()
          Get the last run date.
 java.util.Date getRunDate()
          Get the current run date.
static void main(java.lang.String[] args)
          Execute to get and/or set the last run date.
protected  java.util.Date maskDate(java.util.Date date)
          Mask the given date.
 java.util.Date saveLastRunDate()
          Save the effective run date as the new last run date.
 java.util.Date saveLastRunDate(java.util.Date date)
          Save the given date as the new last run date.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PIPELINE_KEY

public static final java.lang.String PIPELINE_KEY
Key for the RunDateManager in the pipeline.

See Also:
Constant Field Values
Constructor Detail

RunDateManager

public RunDateManager(java.io.File file)
Constructor with the file to store the last run date.

Parameters:
file - The file to store the last run date.

RunDateManager

public RunDateManager(java.io.File file,
                      DateProvider dateProvider)
Constructor with the file to store the last run date and the date provider.

Parameters:
file - The file to store the last run date.
dateProvider - The date provider for the current date.

RunDateManager

public RunDateManager(java.io.File file,
                      DateProvider dateProvider,
                      double maxExtractDays)
Constructor with the file to store the last run date, the date provider and the maximum number of days to extract.

Parameters:
file - The file to store the last run date.
dateProvider - The date provider for the current date.
maxExtractDays - The maximum number of days to extract (0 means no maximum).

RunDateManager

public RunDateManager(java.io.File file,
                      DateProvider dateProvider,
                      double maxExtractDays,
                      java.lang.String dateTimeMask)
Constructor with the file to store the last run date, the date provider and the maximum number of days to extract.

Parameters:
file - The file to store the last run date.
dateProvider - The date provider for the current date.
maxExtractDays - The maximum number of days to extract (0 means no maximum).
dateTimeMask - The date/time mask to apply to dates.
Method Detail

main

public static void main(java.lang.String[] args)
Execute to get and/or set the last run date.

Use the -help option to get usage description.

Exits with 0 on success and 1 in case of error.

Parameters:
args - Arguments

getFile

public java.io.File getFile()
Return the file where the last run date is stored.

Returns:

getRunDate

public java.util.Date getRunDate()
Get the current run date.

Returns:

getLastRunDate

public java.util.Date getLastRunDate()
Get the last run date.

Returns:
Throws:
java.io.IOException

getEffectiveRunDate

public java.util.Date getEffectiveRunDate()
Get the effective run date used for filtering.

Returns:

getEffectiveLastRunDate

public java.util.Date getEffectiveLastRunDate()
Deprecated. Use getLastRunDate() instead.

Get the effective last run date used for filtering.

Returns:
Throws:
java.io.IOException

getDefaultLastRunDate

public java.util.Date getDefaultLastRunDate()
Get the default last run date, which is 1 day before the current run date.

Returns:

saveLastRunDate

public java.util.Date saveLastRunDate()
                               throws java.io.IOException
Save the effective run date as the new last run date.

Returns:
The newly saved last run date.
Throws:
java.io.IOException

saveLastRunDate

public java.util.Date saveLastRunDate(java.util.Date date)
                               throws java.io.IOException
Save the given date as the new last run date.

Returns:
The newly saved last run date.
Throws:
java.io.IOException

maskDate

protected java.util.Date maskDate(java.util.Date date)
Mask the given date.

Parameters:
date - The date to be masked.
Returns:
The masked date.