net.sf.xaj.support
Class DateParametersResolver

java.lang.Object
  extended by net.sf.xaj.support.AbstractSimpleParametersResolver
      extended by net.sf.xaj.support.DateParametersResolver
All Implemented Interfaces:
XAttack.IterationParametersResolver

public class DateParametersResolver
extends AbstractSimpleParametersResolver

Resolve date strings.

This resolver will geneate a Map with a single String property of a date formatted by the SimpleDateFormat class. The dates will "roll" over each iteration, based on the calendarIterationType and calendarIterationAmount properties. These default so that the generated date iterates over one day for each iteration.

The dates are offset from the date this class is first instantiated, unless the startDate property is configured.

The configurable properties of this class are:

datePattern
The SimpleDateFormat date pattern to use. Defaults to yyyyMMdd.
calendarIterationType
For each iteration, the Calendar type constant to add to the starting date.
randomTimeJitter
If greater than zero, then a random maximum amount of time to add or subtract from the resolved date. Can be useful for randomzing a document creation time, within limits of a given time (like a day). The time type is specified by the randomTimeJitterType property. Defaults to zero.
randomTimeJitterDirection
If set to 0, then randomly apply jitter as negative and positive values. If set to anything less than 0, only apply negative values. If set to anything greater than 0, only apply positive values. Defaults to 0 to the jitter is applied randomly backwards and forwards.
randomTimeJitterType
The Calendar time type to apply with the generated random jitter. Defaults to Calendar.MILLISECOND.

Version:
$Revision$ $Date$
Author:
matt

Field Summary
static java.lang.String DEFAULT_PARAM_NAME
          The default value for the paramName property.
 
Constructor Summary
DateParametersResolver()
          Default constructor.
 
Method Summary
 float getCalendarIterationAmount()
           
 int getCalendarIterationType()
           
 java.lang.String getDatePattern()
           
 int getRandomTimeJitter()
           
 int getRandomTimeJitterDirection()
           
 int getRandomTimeJitterType()
           
 java.lang.String getStartDate()
           
 java.util.Map<java.lang.String,?> resolveParameters(int iteration)
          Resolve the parameters for a given iteration.
 void setCalendarIterationAmount(float calendarIterationAmount)
           
 void setCalendarIterationType(int calendarIterationType)
           
 void setDatePattern(java.lang.String datePattern)
           
 void setRandomTimeJitter(int randomTimeJitter)
           
 void setRandomTimeJitterDirection(int randomTimeJitterDirection)
           
 void setRandomTimeJitterType(int randomTimeJitterType)
           
 void setStartDate(java.lang.String startDate)
           
 
Methods inherited from class net.sf.xaj.support.AbstractSimpleParametersResolver
getParamName, resolveSimpleMap, resolveSimpleMap, setParamName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PARAM_NAME

public static final java.lang.String DEFAULT_PARAM_NAME
The default value for the paramName property.

See Also:
Constant Field Values
Constructor Detail

DateParametersResolver

public DateParametersResolver()
Default constructor.

Method Detail

resolveParameters

public java.util.Map<java.lang.String,?> resolveParameters(int iteration)
Description copied from interface: XAttack.IterationParametersResolver
Resolve the parameters for a given iteration.

Parameters:
iteration - the iteration count
Returns:
Map of parameter values

getCalendarIterationAmount

public float getCalendarIterationAmount()
Returns:
the calendarIterationAmount

setCalendarIterationAmount

public void setCalendarIterationAmount(float calendarIterationAmount)
Parameters:
calendarIterationAmount - the calendarIterationAmount to set

getCalendarIterationType

public int getCalendarIterationType()
Returns:
the calendarIterationType

setCalendarIterationType

public void setCalendarIterationType(int calendarIterationType)
Parameters:
calendarIterationType - the calendarIterationType to set

getDatePattern

public java.lang.String getDatePattern()
Returns:
the datePattern

setDatePattern

public void setDatePattern(java.lang.String datePattern)
Parameters:
datePattern - the datePattern to set

getStartDate

public java.lang.String getStartDate()
Returns:
the startDate

setStartDate

public void setStartDate(java.lang.String startDate)
Parameters:
startDate - the startDate to set

getRandomTimeJitter

public int getRandomTimeJitter()
Returns:
the randomTimeJitter

setRandomTimeJitter

public void setRandomTimeJitter(int randomTimeJitter)
Parameters:
randomTimeJitter - the randomTimeJitter to set

getRandomTimeJitterDirection

public int getRandomTimeJitterDirection()
Returns:
the randomTimeJitterDirection

setRandomTimeJitterDirection

public void setRandomTimeJitterDirection(int randomTimeJitterDirection)
Parameters:
randomTimeJitterDirection - the randomTimeJitterDirection to set

getRandomTimeJitterType

public int getRandomTimeJitterType()
Returns:
the randomTimeJitterType

setRandomTimeJitterType

public void setRandomTimeJitterType(int randomTimeJitterType)
Parameters:
randomTimeJitterType - the randomTimeJitterType to set