com.jivesoftware.util
Class RelativeDateRange
java.lang.Object
com.jivesoftware.util.RelativeDateRange
- All Implemented Interfaces:
- DateRange
public class RelativeDateRange
- extends java.lang.Object
- implements DateRange
A class to manage relative date range. A relative date range is a description of a timespan
of dates - ie, one week, or "today". The fixed time values are computed by passing in the
current date and then using the relative boundaries.
Each relative date range has an ID (suitable for parameter passing), a displayName (english
only) and a i18nKey which can be used as the key in an i18n lookup file.
Constructor Summary |
RelativeDateRange(java.lang.String ID,
java.lang.String displayName)
|
RelativeDateRange(java.lang.String ID,
java.lang.String displayName,
java.lang.String i18nKey)
|
Method Summary |
boolean |
equals(java.lang.Object o)
|
java.lang.String |
getDisplayName()
Returns a string representing a human-readable descriptive name of
this date range. |
java.util.Date |
getEndDate(java.util.Date date,
javax.servlet.http.HttpServletRequest request,
User user)
Returns the end date as a relative offset from the specified date. |
java.lang.String |
getI18nKey()
|
java.lang.String |
getID()
|
java.util.Date |
getStartDate(java.util.Date date,
javax.servlet.http.HttpServletRequest request,
User user)
Returns the start date as a relative offset from the specified date. |
int |
hashCode()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
TODAY
public static RelativeDateRange TODAY
YESTERDAY
public static RelativeDateRange YESTERDAY
THIS_WEEK
public static RelativeDateRange THIS_WEEK
LAST_WEEK
public static RelativeDateRange LAST_WEEK
LAST_7_DAYS
public static RelativeDateRange LAST_7_DAYS
THIS_MONTH
public static RelativeDateRange THIS_MONTH
LAST_MONTH
public static RelativeDateRange LAST_MONTH
LAST_30_DAYS
public static RelativeDateRange LAST_30_DAYS
LAST_90_DAYS
public static RelativeDateRange LAST_90_DAYS
THIS_YEAR
public static RelativeDateRange THIS_YEAR
LAST_YEAR
public static RelativeDateRange LAST_YEAR
ALL
public static RelativeDateRange ALL
NEVER
public static RelativeDateRange NEVER
ONE_YEAR
public static RelativeDateRange ONE_YEAR
_90_DAYS
public static RelativeDateRange _90_DAYS
ONE_MONTH
public static RelativeDateRange ONE_MONTH
_30_DAYS
public static RelativeDateRange _30_DAYS
ONE_WEEK
public static RelativeDateRange ONE_WEEK
_7_DAYS
public static RelativeDateRange _7_DAYS
ONE_DAY
public static RelativeDateRange ONE_DAY
RelativeDateRange
public RelativeDateRange(java.lang.String ID,
java.lang.String displayName)
RelativeDateRange
public RelativeDateRange(java.lang.String ID,
java.lang.String displayName,
java.lang.String i18nKey)
getID
public java.lang.String getID()
getDisplayName
public java.lang.String getDisplayName()
- Description copied from interface:
DateRange
- Returns a string representing a human-readable descriptive name of
this date range.
- Specified by:
getDisplayName
in interface DateRange
- Returns:
- a descriptive name of this date range.
getI18nKey
public java.lang.String getI18nKey()
getStartDate
public java.util.Date getStartDate(java.util.Date date,
javax.servlet.http.HttpServletRequest request,
User user)
- Returns the start date as a relative offset from the specified date.
- Specified by:
getStartDate
in interface DateRange
- Parameters:
date
- the date from which to calculate a relative offset.request
- the request object that may have locale information in it.user
- the User to use in determining locale
- Returns:
- a date representing a relative offset from date.
getEndDate
public java.util.Date getEndDate(java.util.Date date,
javax.servlet.http.HttpServletRequest request,
User user)
- Returns the end date as a relative offset from the specified date.
- Specified by:
getEndDate
in interface DateRange
- Parameters:
date
- the date from which to calculate a relative offset.request
- the request object that may have locale information in it.user
- the User to use in determining locale
- Returns:
- a date representing a relative offset from date.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in class java.lang.Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object
Copyright © 1999-2006 Jive Software.