|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.service.util.ChunkedTimeInterval
public class ChunkedTimeInterval
A component that provides a consistent window (chunk) of time for any time value within that window. For example, if configured with a time window size of 3 hours (intervalCount of 3 and an intervalUnitName of "hours"), this component will calculate the same start and end time for any time value within that period.
This is useful for providing a degree of time granularity when data is cached. It can be used to avoid the problem of filling the cache with time values that will never repeat. The names of the available interval type are, "second", "minute", "hour", "day", "week", "month" and "year". They may be specified with their plural forms as well (e.g "minute" is the same as "minutes"). Sample Nucleus component configuration:/path/to/TimeInterval.properties $class=atg.service.util.ChunkedTimeInterval # When class is used as a nucleus component, should use request scope only $scope=request # Create a window of three hours intervalCount=3 intervalUnitName=hoursThen link client component's properties to this componet's startTime/endTime or startDate/endDate properties. Created 2010-01-22
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
|
static int |
FIRST_YEAR
|
Fields inherited from class atg.nucleus.GenericService |
---|
SERVICE_INFO_KEY |
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging |
---|
DEFAULT_LOG_TRACE_STATUS |
Fields inherited from interface atg.nucleus.logging.ApplicationLogging |
---|
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS |
Constructor Summary | |
---|---|
ChunkedTimeInterval()
Default constructor which will base start and end date/time values from current time |
|
ChunkedTimeInterval(java.util.Date pBaseDate)
Constructor with which the base date used to calculate start and end date/time values is specified. |
Method Summary | |
---|---|
protected void |
calculate()
Calculate, or recalculate, the start and end date/time values. |
java.util.Date |
getBaseDate()
Return the Date value used to calculate the time window. |
java.util.Date |
getEndDate()
Return the calculated end time of the time interval based on the specified (or default) baseDate. |
long |
getEndTime()
Return the calculated end of the time interval in milliseconds. |
java.lang.String |
getEndTimeAsString()
Return the calculated end time of the time interval in milliseconds, as a String. |
long |
getEndTimeSeconds()
Return the calculated start time of the time interval in seconds. |
java.lang.String |
getEndTimeSecondsAsString()
Return the calculated end time of the time interval in seconds as a String. |
int |
getIntervalCount()
The number of 'intervalUnitName' time units for the chunk. |
java.lang.String |
getIntervalUnitName()
The time interval unit name. |
long |
getMillisecondsUntil(java.util.Date pDate)
Return the number of milliseconds until the specified date. |
long |
getMillisecondsUntilEnd()
Return the number of milliseconds until the end date. |
java.util.Date |
getStartDate()
Return the calculated start date of the time interval based on the specified (or default) baseDate. |
long |
getStartTime()
Return the calculated start of the time interval in milliseconds. |
java.lang.String |
getStartTimeAsString()
Return the calculated start time of the time interval in milliseconds, as a String. |
long |
getStartTimeSeconds()
Return the calculated start time of the time interval in seconds. |
java.lang.String |
getStartTimeSecondsAsString()
Return the calculated start date of the time interval in seconds, based on the specified (or default) baseDate, as a String. |
protected boolean |
isCalculationNecessary(java.util.Date pDate)
Return true if the end date has not yet been calculated or if it has and that date has passed. |
void |
setBaseDate(java.util.Date pDate)
Set the Date value used to calculate the time window. |
void |
setIntervalCount(int pIntervalCount)
The number of 'intervalUnitName' time units for the chunk. |
void |
setIntervalUnitName(java.lang.String pUnitName)
The time interval unit name. |
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
---|
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int FIRST_YEAR
public static java.lang.String CLASS_VERSION
Constructor Detail |
---|
public ChunkedTimeInterval()
public ChunkedTimeInterval(java.util.Date pBaseDate)
pBaseDate
- The base date or nullMethod Detail |
---|
public void setIntervalUnitName(java.lang.String pUnitName)
pUnitName
- the name of the time intervalpublic java.lang.String getIntervalUnitName()
public void setIntervalCount(int pIntervalCount)
pIntervalCount
- a positive integerpublic int getIntervalCount()
public java.util.Date getStartDate()
public long getStartTime()
public java.lang.String getStartTimeAsString()
public long getStartTimeSeconds()
public java.lang.String getStartTimeSecondsAsString()
public java.util.Date getEndDate()
public long getEndTime()
public java.lang.String getEndTimeAsString()
public long getEndTimeSeconds()
public java.lang.String getEndTimeSecondsAsString()
public long getMillisecondsUntilEnd()
public long getMillisecondsUntil(java.util.Date pDate)
pDate
- a non-null date value.
public java.util.Date getBaseDate()
setBaseDate(java.util.Date)
public void setBaseDate(java.util.Date pDate)
pDate
- the base time used for time window calculationgetBaseDate()
protected boolean isCalculationNecessary(java.util.Date pDate)
protected void calculate()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |