|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.webmethods.caf.faces.data.object.DateRange
public class DateRange
Represents a period of time, optionally with regard to a fixed date.
The period of time (the "range") may be a fixed number of milliseconds,
a relative span ("today", "yesterday", etc.), or infinite (no start or end).
If the period of time is a fixed positive number of milliseconds, the fixed date is the range's start.
If the period of time is a fixed negative number of milliseconds, the fixed date is the range's end.
If DateRange.getFixedRange()
is zero, DateRange.getRelativeRange()
is DateRange.FIXED
,
and DateRange.getDate()
is null, the period of time is infinite,
and the calculated start and end dates will be null.
If DateRange.getFixedRange()
is Long.MAX_VALUE
and DateRange.getRelativeRange()
is DateRange.FIXED
,
then the period of time stretches from the specified date to the end of time.
If DateRange.getFixedRange()
is Long.MIN_VALUE
and DateRange.getRelativeRange()
is DateRange.FIXED
,
then the period of time stretches from the beginning of time to the specified date.
Field Summary | |
---|---|
static Date |
BEGINNING_OF_TIME
Date representing the beginning of time BEGINNING_OF_TIME set to "the epoch", namely January 1, 1970, 00:00:00 GMT |
protected Date |
date
Fixed date. |
static Date |
END_OF_TIME
Date representing the end of time END_OF_TIME set to 31-Dec-2099 |
static String |
FIXED
Fixed range. |
protected long |
fixedRange
Fixed range in milliseconds. |
static String |
NEXT_DAY
Relative range: tomorrow. |
static String |
NEXT_MONTH
Relative range: next month. |
static String |
NEXT_WEEK
Relative range: next week. |
static String |
NEXT_YEAR
Relative range: next year. |
static String |
PREVIOUS_DAY
Relative range: yesterday. |
static String |
PREVIOUS_MONTH
Relative range: previous month. |
static String |
PREVIOUS_WEEK
Relative range: previous week. |
static String |
PREVIOUS_YEAR
Relative range: previous year. |
protected static Set |
RELATIVE_RANGES
Set of valid relative ranges. |
protected String |
relativeRange
Relative range, an enumerated value. |
static String |
THIS_DAY
Relative range: today. |
static String |
THIS_MONTH
Relative range: this month. |
static String |
THIS_WEEK
Relative range: this week. |
static String |
THIS_YEAR
Relative range: this year. |
Constructor Summary | |
---|---|
DateRange()
Creates a new (infinite) date range with a fixed length of zero and no fixed date. |
|
DateRange(long fixedRange)
Creates a new date range with the specified fixed length and no fixed date. |
|
DateRange(long fixedRange,
Date date)
Creates a new date range with the specified fixed length and date. |
|
DateRange(String relativeRange)
Creates a new date range with the specified relative length. |
Method Summary | |
---|---|
Date |
calculateEnd()
Calculates range end, with regard to range's fixed date (or the current date, if the range has no fixed date) for the current user context. |
Date |
calculateEnd(FacesContext context)
Calculates range end, with regard to range's fixed date (or the current date, if the range has no fixed date). |
Date |
calculateEnd(FacesContext context,
Calendar calendar)
Calculates range end, with regard to range's fixed date (or the current date, if the range has no fixed date). |
Date |
calculateStart()
Calculates range start, with regard to range's fixed date (or the current date, if the range has no fixed date) for the current user context. |
Date |
calculateStart(FacesContext context)
Calculates range start, with regard to range's fixed date (or the current date, if the range has no fixed date). |
Date |
calculateStart(FacesContext context,
Calendar calendar)
Calculates range start, with regard to range's fixed date (or the current date, if the range has no fixed date). |
boolean |
equals(Object obj)
|
Date |
getDate()
Fixed date. |
long |
getFixedRange()
Fixed range in milliseconds. |
String |
getRelativeRange()
Relative range, an enumerated value. |
void |
setDate(Date date)
Fixed date. |
void |
setFixedRange(long fixedRange)
Fixed range in milliseconds. |
void |
setRelativeRange(String relativeRange)
Relative range, an enumerated value. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Date BEGINNING_OF_TIME
public static final Date END_OF_TIME
public static final String FIXED
public static final String PREVIOUS_DAY
public static final String PREVIOUS_WEEK
public static final String PREVIOUS_MONTH
public static final String PREVIOUS_YEAR
public static final String THIS_DAY
public static final String THIS_WEEK
public static final String THIS_MONTH
public static final String THIS_YEAR
public static final String NEXT_DAY
public static final String NEXT_WEEK
public static final String NEXT_MONTH
public static final String NEXT_YEAR
protected static Set RELATIVE_RANGES
protected long fixedRange
DateRange.relativeRange
is not DateRange.FIXED
, this must be zero.
protected String relativeRange
DateRange.FIXED
,
DateRange.THIS_DAY
, DateRange.PREVIOUS_DAY
,
DateRange.THIS_WEEK
, DateRange.PREVIOUS_WEEK
,
DateRange.THIS_MONTH
, DateRange.PREVIOUS_MONTH
,
DateRange.THIS_YEAR
, or DateRange.PREVIOUS_YEAR
.
If DateRange.fixedRange
is not zero, this must be DateRange.FIXED
.
protected Date date
DateRange.relativeRange
is DateRange.FIXED
, this is the range's end.
Constructor Detail |
---|
public DateRange()
public DateRange(long fixedRange)
fixedRange
- Fixed range in milliseconds.public DateRange(long fixedRange, Date date)
fixedRange
- Fixed range in milliseconds.date
- Fixed date. May be null (meaning no fixed date).public DateRange(String relativeRange)
DateRange.FIXED
,
DateRange.THIS_DAY
, DateRange.PREVIOUS_DAY
,
DateRange.THIS_WEEK
, DateRange.PREVIOUS_WEEK
,
DateRange.THIS_MONTH
, DateRange.PREVIOUS_MONTH
,
DateRange.THIS_YEAR
, or DateRange.PREVIOUS_YEAR
.
If DateRange.fixedRange
is not zero, this must be DateRange.FIXED
.
relativeRange
- Relative range, an enumerated value.Method Detail |
---|
public Date calculateStart()
DateRange.BEGINNING_OF_TIME
if no start date or range is infinite.public Date calculateStart(FacesContext context)
context
- Current user context.
DateRange.BEGINNING_OF_TIME
if no start date or range is infinite.public Date calculateStart(FacesContext context, Calendar calendar)
context
- Current user context.calendar
- the calendar to use pre-initialized to the correct timezone
DateRange.BEGINNING_OF_TIME
if no start date or range is infinite.public Date calculateEnd()
DateRange.END_OF_TIME
if no end date or range is infinite.public Date calculateEnd(FacesContext context)
context
- Current user context.
DateRange.END_OF_TIME
if no end date or range is infinite.public Date calculateEnd(FacesContext context, Calendar calendar)
context
- Current user context.calendar
- the calendar to use pre-initialized to the correct timezone
DateRange.END_OF_TIME
if no end date or range is infinite.public long getFixedRange()
DateRange.relativeRange
is not DateRange.FIXED
, this must be zero.
public void setFixedRange(long fixedRange)
DateRange.relativeRange
is not DateRange.FIXED
, this must be zero.
fixedRange
- Fixed range in milliseconds.public String getRelativeRange()
DateRange.FIXED
,
DateRange.THIS_DAY
, DateRange.PREVIOUS_DAY
,
DateRange.THIS_WEEK
, DateRange.PREVIOUS_WEEK
,
DateRange.THIS_MONTH
, DateRange.PREVIOUS_MONTH
,
DateRange.THIS_YEAR
, or DateRange.PREVIOUS_YEAR
.
If DateRange.fixedRange
is not zero, this must be DateRange.FIXED
.
public void setRelativeRange(String relativeRange)
DateRange.FIXED
,
DateRange.THIS_DAY
, DateRange.PREVIOUS_DAY
,
DateRange.THIS_WEEK
, DateRange.PREVIOUS_WEEK
,
DateRange.THIS_MONTH
, DateRange.PREVIOUS_MONTH
,
DateRange.THIS_YEAR
, or DateRange.PREVIOUS_YEAR
.
If DateRange.fixedRange
is not zero, this must be DateRange.FIXED
.
relativeRange
- Relative range, an enumerated value.public Date getDate()
DateRange.relativeRange
is DateRange.FIXED
, this is the range's end.
public void setDate(Date date)
DateRange.relativeRange
is DateRange.FIXED
, this is the range's end.
Fixed
- date. May be null (meaning no fixed date).public boolean equals(Object obj)
equals
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |