|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwt.projmgmt.util.CalendarHelper
Encapsulates calendar functions.
Supported API: false
Extendable: false
Field Summary | |
private static CalendarService |
calService
|
private static String |
CLASSNAME
|
static long |
EXTERNALIZATION_VERSION_UID
|
static long |
MILLIS_IN_DAY
Number of milliseconds in a day (86400000L). |
static long |
MILLIS_IN_HOUR
|
protected static long |
OLD_FORMAT_VERSION_UID
|
private static String |
RESOURCE
|
(package private) static long |
serialVersionUID
|
(package private) static boolean |
SERVER
|
private static TimeZone |
serverTimeZone
|
private static WTPrincipal |
systemCalendarOwner
|
private static boolean |
VERBOSE
|
Constructor Summary | |
CalendarHelper()
|
Method Summary | |
static TimeToElapse |
calculateDuration(ExecutionObject exec_obj,
Timestamp start,
Timestamp finish)
Computes and returns the duration ( TimeToElapse )
given the ExecutionObject , a start and
a finish time (Timestamp ). |
static Timestamp |
calculateFinish(ExecutionObject exec_obj,
Timestamp start,
TimeToElapse duration)
Computes and returns the finish time ( Timestamp )
given the ExecutionObject , the start
time and the duration time (Timestamp ). |
static TimeToElapse |
calculateUserDuration(WTPrincipal user,
Timestamp start,
Timestamp finish)
Computes and returns the duration ( TimeToElapse )
given the wt.orgWTUser , a start and a finish time (Timestamp ). |
static Timestamp |
calculateUserFinish(WTPrincipal user,
Timestamp start,
TimeToElapse duration)
Computes and returns the finish time given the wt.orgWTUser ,
the start time (Timestamp ) and the duration (TimeToElapse ). |
static Timestamp |
convertCalendarToTimestamp(Calendar tmpCal)
Given a java.util.Calendar obj, return a java.sql.Timestamp obj. |
private static GregorianCalendar |
convertTimestampToCalendar(Timestamp time)
Given a java.sql.Timestamp obj, return a java.util.Calendar obj. |
private static CalendarService |
getCalendarService()
|
static Timestamp |
getNextWorkingDay(WTPrincipal user,
Timestamp aDay)
Calculates and returns the next working day. |
static Timestamp |
getNextWorkingDay(WTPrincipal user,
Timestamp aDay,
TimeZone aTZ)
Calculates and returns the next working day. |
static WTPrincipal |
getPrincipal(ExecutionObject exec_obj)
|
private static TimeZone |
getServerTZ()
|
static WTPrincipal |
getSystemCalendarOwner()
Retrieves, caches and returns the system administrators group. |
static boolean |
isNonWorking(WTPrincipal user,
Date date,
TimeZone tzone)
Return whether or not the specified Date is
considered a working day for the specified
WTPrincipal in the specified
TimeZone . |
void |
readExternal(ObjectInput input)
Reads the non-transient fields of this class from an external source. |
private boolean |
readOldVersion(ObjectInput input,
long readSerialVersionUID,
boolean passThrough,
boolean superDone)
Reads the non-transient fields of this class from an external source, which is not the current version. |
protected boolean |
readVersion(CalendarHelper thisObject,
ObjectInput input,
long readSerialVersionUID,
boolean passThrough,
boolean superDone)
Reads the non-transient fields of this class from an external source. |
private static long |
resetHours(Timestamp time)
Convert time to a Calendar object and set it to 00:00 hours on that day. |
static Calendar |
shiftToMethodServerTime(WTPrincipal user,
Timestamp time)
This method takes the specified Timestamp and interprets it
as a year, month, day, hour, minute, second, & millisecond in the specified
WTUser 's preferred timezone. |
static Calendar |
shiftToUserTime(WTPrincipal user,
Timestamp time)
This method takes the specified Timestamp and interprets it
as a year, month, day, hour, minute, second, & millisecond in the method
server's time zone (usually GMT). |
private static String |
showTime(Timestamp time)
|
void |
writeExternal(ObjectOutput output)
Writes the non-transient fields of this class to an external source. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final String RESOURCE
private static final String CLASSNAME
public static final long MILLIS_IN_DAY
static final long serialVersionUID
public static final long EXTERNALIZATION_VERSION_UID
protected static final long OLD_FORMAT_VERSION_UID
private static CalendarService calService
private static WTPrincipal systemCalendarOwner
private static TimeZone serverTimeZone
private static final boolean VERBOSE
public static final long MILLIS_IN_HOUR
static final boolean SERVER
Constructor Detail |
public CalendarHelper()
Method Detail |
public void writeExternal(ObjectOutput output) throws IOException
writeExternal
in interface Externalizable
output
-
IOException
public void readExternal(ObjectInput input) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
input
-
IOException
ClassNotFoundException
protected boolean readVersion(CalendarHelper thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone) throws IOException, ClassNotFoundException
thisObject
- input
- readSerialVersionUID
- passThrough
- superDone
-
IOException
ClassNotFoundException
private boolean readOldVersion(ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone) throws IOException, ClassNotFoundException
input
- readSerialVersionUID
- passThrough
- superDone
-
IOException
ClassNotFoundException
public static TimeToElapse calculateDuration(ExecutionObject exec_obj, Timestamp start, Timestamp finish) throws WTException
TimeToElapse
)
given the ExecutionObject
, a start and
a finish time (Timestamp
).
exec_obj
- start
- finish
-
WTException
public static Timestamp calculateFinish(ExecutionObject exec_obj, Timestamp start, TimeToElapse duration) throws WTException
Timestamp
)
given the ExecutionObject
, the start
time and the duration time (Timestamp
).
exec_obj
- start
- duration
-
WTException
public static TimeToElapse calculateUserDuration(WTPrincipal user, Timestamp start, Timestamp finish) throws WTException
TimeToElapse
)
given the wt.orgWTUser
, a start and a finish time (Timestamp
). If the used passed as argument is null, the
system administrators group is used.
user
- start
- finish
-
WTException
public static Timestamp calculateUserFinish(WTPrincipal user, Timestamp start, TimeToElapse duration) throws WTException
wt.orgWTUser
,
the start time (Timestamp
) and the duration (TimeToElapse
). If the user is null, the system
administrators group is used.
user
- start
- duration
-
WTException
public static WTPrincipal getSystemCalendarOwner() throws WTException
WTException
public static boolean isNonWorking(WTPrincipal user, Date date, TimeZone tzone) throws WTException
Date
is
considered a working day for the specified
WTPrincipal
in the specified
TimeZone
.
If user
is null
then the system administrators
group is used.
Supported API: false
user
- date
- tzone
-
WTException
public static Timestamp getNextWorkingDay(WTPrincipal user, Timestamp aDay) throws WTException
WTException
public static Timestamp getNextWorkingDay(WTPrincipal user, Timestamp aDay, TimeZone aTZ) throws WTException
WTException
public static WTPrincipal getPrincipal(ExecutionObject exec_obj) throws WTException
WTException
private static CalendarService getCalendarService()
private static long resetHours(Timestamp time)
private static GregorianCalendar convertTimestampToCalendar(Timestamp time)
public static Timestamp convertCalendarToTimestamp(Calendar tmpCal)
private static String showTime(Timestamp time)
public static Calendar shiftToMethodServerTime(WTPrincipal user, Timestamp time) throws WTException
Timestamp
and interprets it
as a year, month, day, hour, minute, second, & millisecond in the specified
WTUser
's preferred timezone. It returns a
Calendar
that represents the same year, month, day, hour,
minute, second & millisecond in the method server's time zone (usually GMT).
Please note that the Calendar
returned by this method
does not represent the same instant in time as the specified
Timestamp
.
user
- the user whose time zone should be shifted fromtime
- the time to shift
WTException
public static Calendar shiftToUserTime(WTPrincipal user, Timestamp time) throws WTException
Timestamp
and interprets it
as a year, month, day, hour, minute, second, & millisecond in the method
server's time zone (usually GMT). It returns a Calendar
that represents the same year, month, day, hour, minute, second & millisecond
in the WTUser
's preferred timezone.
Please note that the Calendar
returned by this method
does not represent the same instant in time as the specified
Timestamp
.
user
- the user whose time zone should be shifted totime
- the time to shift
WTException
private static TimeZone getServerTZ() throws WTException
WTException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |