wt.calendar
Class CalendarMonth

java.lang.Object
  extended bywt.calendar.CalendarMonth
All Implemented Interfaces:
Externalizable, Serializable

public class CalendarMonth
extends Object
implements Externalizable

This is a lightweight class to transport the user's calendar data from the server to the client. The attributes represent the working, nonworking, and delegated days for a given month in as compact manner as feasible. There are getter methods to exposed and abstract the data for display purposes. Each instance of this class will comprise one calendar month's worth of data for the user. This amount of time was chosen because it is the same amount of time that will be displayed to the use at any given time. Note that to access the system calendar, the user parm would need to be the WTPrincipalReference for the WTGroup assigned in the wt.properties file to the property wt.admin.adminGroup.

Supported API: false

Extendable: false

See Also:
Serialized Form

Field Summary
private static int ALL_DAYS_SET
           
private static String CLASSNAME
           
private static int[] day_bits
           
private  Hashtable delegatedDays
           
static long EXTERNALIZATION_VERSION_UID
           
private  int nonWorkingDays
           
protected static long OLD_FORMAT_VERSION_UID
           
private static String RESOURCE
           
(package private) static long serialVersionUID
           
private static boolean VERBOSE
           
private  int workingDays
           
 
Constructor Summary
CalendarMonth()
           
 
Method Summary
static CalendarMonth CalendarMonth()
           
private  int checkBit(int set, int bit)
           
private  int clearBit(int set, int bit)
           
 WTPrincipalReference getDelegate(int dayOfTheMonth)
          Returns null if the day is not delegated.
 Hashtable getDelegatedDays()
          Gets the value of the attribute: delegatedDays; Used to hold days delegated (working or not).
 int getNonWorkingDays()
          Gets the value of the attribute: nonWorkingDays; Used to hold days marked as non-working by the user.
 int getWorkingDays()
          Gets the value of the attribute: workingDays; Used to hold days marked as working by the user.
 boolean isChanged(int dayOfTheMonth)
           
protected  boolean isDaySet(int day, int bits)
           
 boolean isNonWorking(int dayOfTheMonth)
          

Supported API: false
 boolean isWorking(int dayOfTheMonth)
          

Supported API: false
 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(CalendarMonth thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
private  int setBit(int set, int bit)
           
protected  int setDay(int day, int bits)
           
protected  void setDelegatedDay(int dayOfMonth, WTPrincipalReference pRef)
           
 void setDelegatedDays(Hashtable a_DelegatedDays)
          Sets the value of the attribute: delegatedDays; Used to hold days delegated (working or not).
protected  void setNonWorkingDay(int day)
           
 void setNonWorkingDays(int a_NonWorkingDays)
          Sets the value of the attribute: nonWorkingDays; Used to hold days marked as non-working by the user.
protected  void setWorkingDay(int day)
           
 void setWorkingDays(int a_WorkingDays)
          Sets the value of the attribute: workingDays; Used to hold days marked as working by the user.
protected  int unsetDay(int day, int bits)
           
protected  void unsetNonWorkingDay(int day)
           
protected  void unsetWorkingDay(int day)
           
 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

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

workingDays

private int workingDays

nonWorkingDays

private int nonWorkingDays

delegatedDays

private Hashtable delegatedDays

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

EXTERNALIZATION_VERSION_UID

public static final long EXTERNALIZATION_VERSION_UID
See Also:
Constant Field Values

OLD_FORMAT_VERSION_UID

protected static final long OLD_FORMAT_VERSION_UID
See Also:
Constant Field Values

VERBOSE

private static boolean VERBOSE

day_bits

private static final int[] day_bits

ALL_DAYS_SET

private static final int ALL_DAYS_SET
See Also:
Constant Field Values
Constructor Detail

CalendarMonth

public CalendarMonth()
Method Detail

writeExternal

public void writeExternal(ObjectOutput output)
                   throws IOException
Writes the non-transient fields of this class to an external source.

Supported API: false

Specified by:
writeExternal in interface Externalizable
Parameters:
output -
Throws:
IOException

readExternal

public void readExternal(ObjectInput input)
                  throws IOException,
                         ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Specified by:
readExternal in interface Externalizable
Parameters:
input -
Throws:
IOException
ClassNotFoundException

readVersion

protected boolean readVersion(CalendarMonth thisObject,
                              ObjectInput input,
                              long readSerialVersionUID,
                              boolean passThrough,
                              boolean superDone)
                       throws IOException,
                              ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Parameters:
thisObject -
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

readOldVersion

private boolean readOldVersion(ObjectInput input,
                               long readSerialVersionUID,
                               boolean passThrough,
                               boolean superDone)
                        throws IOException,
                               ClassNotFoundException
Reads the non-transient fields of this class from an external source, which is not the current version.

Parameters:
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

getWorkingDays

public int getWorkingDays()
Gets the value of the attribute: workingDays; Used to hold days marked as working by the user. Typically, this will only hold differences to the windchill system calendar. (Working days are displayed as white). The value of this int will be zero (0) for the system calendar. The Java int is a signed 32 bit integer. As such it is ideally suited to hold boolean (0 or 1) information on the 31 day month - the 32nd bit holds the sign of the integer and thus won't be used.

Supported API: false

Returns:
int

setWorkingDays

public void setWorkingDays(int a_WorkingDays)
                    throws WTPropertyVetoException
Sets the value of the attribute: workingDays; Used to hold days marked as working by the user. Typically, this will only hold differences to the windchill system calendar. (Working days are displayed as white). The value of this int will be zero (0) for the system calendar. The Java int is a signed 32 bit integer. As such it is ideally suited to hold boolean (0 or 1) information on the 31 day month - the 32nd bit holds the sign of the integer and thus won't be used.

Supported API: false

Parameters:
a_WorkingDays -
Throws:
WTPropertyVetoException

getNonWorkingDays

public int getNonWorkingDays()
Gets the value of the attribute: nonWorkingDays; Used to hold days marked as non-working by the user. Typically, this will only hold differences to the windchill system calendar. (Non-Working days are displayed as gray). The bits corresponding to weekend days will be set for the system calendar. The two days considered to be "the weekend" will default to Friday and Saturday; but will be settable in the WTDefault.properties wt.calendar.weekend property (FriSat or SatSun are valid values). The Java int is a signed 32 bit integer. As such it is ideally suited to hold boolean (0 or 1) information on the 31 day month - the 32nd bit holds the sign of the integer and thus won't be used.

Supported API: false

Returns:
int

setNonWorkingDays

public void setNonWorkingDays(int a_NonWorkingDays)
                       throws WTPropertyVetoException
Sets the value of the attribute: nonWorkingDays; Used to hold days marked as non-working by the user. Typically, this will only hold differences to the windchill system calendar. (Non-Working days are displayed as gray). The bits corresponding to weekend days will be set for the system calendar. The two days considered to be "the weekend" will default to Friday and Saturday; but will be settable in the WTDefault.properties wt.calendar.weekend property (FriSat or SatSun are valid values). The Java int is a signed 32 bit integer. As such it is ideally suited to hold boolean (0 or 1) information on the 31 day month - the 32nd bit holds the sign of the integer and thus won't be used.

Supported API: false

Parameters:
a_NonWorkingDays -
Throws:
WTPropertyVetoException

getDelegatedDays

public Hashtable getDelegatedDays()
Gets the value of the attribute: delegatedDays; Used to hold days delegated (working or not). The value of this attribute will be null for the system calendar. The key will be an Integer representing the day of the month. The object stored under this key will be a WTPrincipalReference denoting the delegate.

Supported API: false

Returns:
Hashtable

setDelegatedDays

public void setDelegatedDays(Hashtable a_DelegatedDays)
                      throws WTPropertyVetoException
Sets the value of the attribute: delegatedDays; Used to hold days delegated (working or not). The value of this attribute will be null for the system calendar. The key will be an Integer representing the day of the month. The object stored under this key will be a WTPrincipalReference denoting the delegate.

Supported API: false

Parameters:
a_DelegatedDays -
Throws:
WTPropertyVetoException

isWorking

public boolean isWorking(int dayOfTheMonth)


Supported API: false

Parameters:
dayOfTheMonth -
Returns:
boolean

isNonWorking

public boolean isNonWorking(int dayOfTheMonth)


Supported API: false

Parameters:
dayOfTheMonth -
Returns:
boolean

getDelegate

public WTPrincipalReference getDelegate(int dayOfTheMonth)
Returns null if the day is not delegated.

Supported API: false

Parameters:
dayOfTheMonth -
Returns:
WTPrincipalReference

setBit

private int setBit(int set,
                   int bit)

setDay

protected int setDay(int day,
                     int bits)

clearBit

private int clearBit(int set,
                     int bit)

unsetDay

protected int unsetDay(int day,
                       int bits)

checkBit

private int checkBit(int set,
                     int bit)

isDaySet

protected boolean isDaySet(int day,
                           int bits)

setDelegatedDay

protected void setDelegatedDay(int dayOfMonth,
                               WTPrincipalReference pRef)
                        throws WTPropertyVetoException
Throws:
WTPropertyVetoException

setWorkingDay

protected void setWorkingDay(int day)

unsetWorkingDay

protected void unsetWorkingDay(int day)

setNonWorkingDay

protected void setNonWorkingDay(int day)

unsetNonWorkingDay

protected void unsetNonWorkingDay(int day)

CalendarMonth

public static CalendarMonth CalendarMonth()

isChanged

public boolean isChanged(int dayOfTheMonth)