wt.calendar
Class LocalCAP

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

public class LocalCAP
extends Object
implements CalendarAccessProtocol, Externalizable

Concrete class for local access to our rudimentary Windchill based calendar.

Supported API: false

Extendable: false

See Also:
Serialized Form

Field Summary
protected static long CAL_LB
           
protected static long CAL_UB
           
private static boolean CALC_DEFAULTS
           
private static String CLASSNAME
           
protected static int DEBUG
           
protected static String DELTA
           
protected static String DELTA_ERROR
           
static long EXTERNALIZATION_VERSION_UID
           
protected static boolean initSysCal
           
protected static String MS_TIMEZONE
           
protected static TimeZone MSTZ
           
protected static int MSTZ_OFFSET
           
private static String NON_WORK_DAYS_OF_THE_WEEK
           
protected static long OLD_FORMAT_VERSION_UID
           
protected static boolean PROM_MODE
           
private static String RESOURCE
           
(package private) static long serialVersionUID
           
static WTCalendar system_calendar
           
protected static boolean VERBOSE
           
 
Constructor Summary
LocalCAP()
           
 
Method Summary
private  QuerySpec buildOwnerQuery(WTPrincipal p)
          Search Conditions *
 Enumeration calcComponents(long start_date, long end_date)
           
static long calculateMaxCalDate()
          This method calculates the largest calendar entry that we should see in the Calendar Component table based upon today's date and the upper_bound in the wt.properties file.
static long calculateMinCalDate()
          This method calculates the smallest calendar entry that we should see in the Calendar Component table based upon today's date and the delta in the wt.properties file.
static GregorianCalendar convert_long_ToCalendar(long l)
           
static Timestamp convert_longToTimestamp(long l)
           
static long convertCalendarTo_long(Calendar tmpCal)
           
static Timestamp convertCalendarToTimestamp(Calendar tmpCal)
           
static long convertTimestampTo_long(Timestamp t)
           
static GregorianCalendar convertTimestampToCalendar(Timestamp t)
           
 WTCalendar createCalendar(WTPrincipalReference user, long start_date, long end_date, int zone_offset)
          This method will create the specified calendar component over the date range start-end inclusive.
 CalendarComponent createComponent(WTCalendar userCalendar, long start_date, long end_date, WTPrincipalReference delegate, boolean workingDay, int zone_offset)
          This method will create the specified calendar component over the date range start-end inclusive.
 Vector createComponents(WTCalendar userCalendar, long start_date, long end_date, WTPrincipalReference delegate, boolean workingDay, int zone_offset)
          This method will create the specified calendar component over the date range start-end inclusive.
 boolean deleteCalendar(WTPrincipalReference user, int zone_offset)
          This method will delete the specified calendar component type for the user over the date range start-end inclusive.
 boolean deleteComponent(WTCalendar userCalendar, long start_date, long end_date, int zone_offset)
          This method will delete the specified calendar component type for the user over the date range start-end inclusive.
 boolean deleteComponents(WTCalendar userCalendar, long start_date, long end_date, int zone_offset)
          This method will delete the specified calendar component type for the user over the date range start-end inclusive.
 Enumeration getAllComponents(WTCalendar userCalendar)
           
 WTCalendar getCalendar(CalendarComponent comp)
           
 WTCalendar getCalendar(ComponentLink compLink)
           
 Enumeration getComponent(WTCalendar userCalendar, long start_date, long end_date)
           
 Enumeration getComponents(WTCalendar userCalendar, long start_date, long end_date)
           
static int getDelta()
           
private  ObjectIdentifier getId(Object object)
           
static long getMaxDBEndDate()
          This method gets the largest END_DATE value from the Calendar Component table.
static long getMinDBStartDate()
          This method gets the smallest START_DATE value from the Calendar Component table.
 Enumeration getParentCalendar(WTCalendar userCalendar)
           
protected static WTPrincipalReference getSysCalOwnerRef()
           
protected static WTCalendar getSystemCalendar()
           
 WTPrincipalReference getSystemCalOwner()
           
protected static WTCalendar initSystemCalendar(WTCalendar sys_cal)
           
private  SearchCondition onCalOid(long oid)
           
private  SearchCondition onOwner(WTPrincipal p)
           
static void printInterestingInfo(Calendar cal)
           
protected  WTCalendar propagateSystemCalendar(int the_month, int the_year)
           
 WTCalendar readCalendar(int calObjType, WTPrincipalReference user, long start_date, long end_date, int zone_offset)
          Read out the user's calendar objects of the type specified between the dates start and end.
 CalendarComponent readComponent(WTCalendar userCalendar, long start_date, long end_date, int zone_offset)
          Modifies the calendar component object having date range start-end inclusive.
 Vector readComponents(WTCalendar userCalendar, long start_date, long end_date, int zone_offset)
          Modifies the calendar component object having date range start-end inclusive.
 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(LocalCAP thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
private  void removeFromCache(WTCalendar userCalendar)
           
protected static Enumeration updateCache(WTCalendar userCalendar, long start_date, long end_date)
           
 WTCalendar updateCalendar(WTPrincipalReference user, WTPrincipalReference indefinite_delegate, long indefinite_delegate_date, int zone_offset)
          Modifies the calendar object type(s) over the date range start-end inclusive.
 CalendarComponent updateComponent(WTCalendar userCalendar, long start_date, long end_date, boolean workingDay, int zone_offset)
          Modifies the calendar object type(s) over the date range start-end inclusive.
 CalendarComponent updateComponent(WTCalendar userCalendar, long start_date, long end_date, WTPrincipalReference delegate, boolean workingDay, int zone_offset)
          Modifies the calendar object type(s) over the date range start-end inclusive.
 CalendarComponent updateComponent(WTCalendar userCalendar, long start_date, long end_date, WTPrincipalReference delegate, int zone_offset)
          Modifies the calendar object type(s) over the date range start-end inclusive.
 Vector updateComponents(WTCalendar userCalendar, long start_date, long end_date, boolean workingDay, int zone_offset)
          Modifies the calendar object type(s) over the date range start-end inclusive.
 Vector updateComponents(WTCalendar userCalendar, long start_date, long end_date, WTPrincipalReference delegate, boolean workingDay, int zone_offset)
          Modifies the calendar object type(s) over the date range start-end inclusive.
 Vector updateComponents(WTCalendar userCalendar, long start_date, long end_date, WTPrincipalReference delegate, int zone_offset)
          Modifies the calendar object type(s) over the date range start-end inclusive.
 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

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

system_calendar

public static WTCalendar system_calendar

VERBOSE

protected static boolean VERBOSE

DEBUG

protected static int DEBUG

initSysCal

protected static boolean initSysCal

MS_TIMEZONE

protected static String MS_TIMEZONE

MSTZ

protected static TimeZone MSTZ

MSTZ_OFFSET

protected static int MSTZ_OFFSET

DELTA

protected static String DELTA

PROM_MODE

protected static boolean PROM_MODE

CAL_UB

protected static long CAL_UB

CAL_LB

protected static long CAL_LB

CALC_DEFAULTS

private static boolean CALC_DEFAULTS

NON_WORK_DAYS_OF_THE_WEEK

private static String NON_WORK_DAYS_OF_THE_WEEK

DELTA_ERROR

protected static String DELTA_ERROR
Constructor Detail

LocalCAP

public LocalCAP()
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(LocalCAP 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

createCalendar

public WTCalendar createCalendar(WTPrincipalReference user,
                                 long start_date,
                                 long end_date,
                                 int zone_offset)
                          throws CalendarException
This method will create the specified calendar component over the date range start-end inclusive. Returns true if successful.

Supported API: false

Specified by:
createCalendar in interface CalendarAccessProtocol
Parameters:
user -
start_date -
end_date -
zone_offset -
Returns:
WTCalendar
Throws:
CalendarException

readCalendar

public WTCalendar readCalendar(int calObjType,
                               WTPrincipalReference user,
                               long start_date,
                               long end_date,
                               int zone_offset)
                        throws CalendarException
Read out the user's calendar objects of the type specified between the dates start and end. Returns the objects in a vector..

Supported API: false

Specified by:
readCalendar in interface CalendarAccessProtocol
Parameters:
calObjType -
user -
start_date -
end_date -
zone_offset -
Returns:
WTCalendar
Throws:
CalendarException

updateCalendar

public WTCalendar updateCalendar(WTPrincipalReference user,
                                 WTPrincipalReference indefinite_delegate,
                                 long indefinite_delegate_date,
                                 int zone_offset)
                          throws CalendarException
Modifies the calendar object type(s) over the date range start-end inclusive. Return true if successfull.

Supported API: false

Specified by:
updateCalendar in interface CalendarAccessProtocol
Parameters:
user -
indefinite_delegate -
indefinite_delegate_date -
zone_offset -
Returns:
WTCalendar
Throws:
CalendarException

deleteCalendar

public boolean deleteCalendar(WTPrincipalReference user,
                              int zone_offset)
                       throws CalendarException
This method will delete the specified calendar component type for the user over the date range start-end inclusive. Returns true if successfull.

Supported API: false

Specified by:
deleteCalendar in interface CalendarAccessProtocol
Parameters:
user -
zone_offset -
Returns:
boolean
Throws:
CalendarException

createComponent

public CalendarComponent createComponent(WTCalendar userCalendar,
                                         long start_date,
                                         long end_date,
                                         WTPrincipalReference delegate,
                                         boolean workingDay,
                                         int zone_offset)
                                  throws CalendarException
This method will create the specified calendar component over the date range start-end inclusive. Returns true if successful.

Supported API: false

Specified by:
createComponent in interface CalendarAccessProtocol
Parameters:
userCalendar -
start_date -
end_date -
delegate -
workingDay -
zone_offset -
Returns:
CalendarComponent
Throws:
CalendarException

readComponent

public CalendarComponent readComponent(WTCalendar userCalendar,
                                       long start_date,
                                       long end_date,
                                       int zone_offset)
                                throws CalendarException
Modifies the calendar component object having date range start-end inclusive. Return the modified component.

Supported API: false

Specified by:
readComponent in interface CalendarAccessProtocol
Parameters:
userCalendar -
start_date -
end_date -
zone_offset -
Returns:
CalendarComponent
Throws:
CalendarException

updateComponent

public CalendarComponent updateComponent(WTCalendar userCalendar,
                                         long start_date,
                                         long end_date,
                                         WTPrincipalReference delegate,
                                         boolean workingDay,
                                         int zone_offset)
                                  throws CalendarException
Modifies the calendar object type(s) over the date range start-end inclusive. Return true if successfull.

Supported API: false

Specified by:
updateComponent in interface CalendarAccessProtocol
Parameters:
userCalendar -
start_date -
end_date -
delegate -
workingDay -
zone_offset -
Returns:
CalendarComponent
Throws:
CalendarException

updateComponent

public CalendarComponent updateComponent(WTCalendar userCalendar,
                                         long start_date,
                                         long end_date,
                                         boolean workingDay,
                                         int zone_offset)
                                  throws CalendarException
Modifies the calendar object type(s) over the date range start-end inclusive. Return true if successfull.

Supported API: false

Specified by:
updateComponent in interface CalendarAccessProtocol
Parameters:
userCalendar -
start_date -
end_date -
workingDay -
zone_offset -
Returns:
CalendarComponent
Throws:
CalendarException

updateComponent

public CalendarComponent updateComponent(WTCalendar userCalendar,
                                         long start_date,
                                         long end_date,
                                         WTPrincipalReference delegate,
                                         int zone_offset)
                                  throws CalendarException
Modifies the calendar object type(s) over the date range start-end inclusive. Return true if successfull.

Supported API: false

Specified by:
updateComponent in interface CalendarAccessProtocol
Parameters:
userCalendar -
start_date -
end_date -
delegate -
zone_offset -
Returns:
CalendarComponent
Throws:
CalendarException

deleteComponent

public boolean deleteComponent(WTCalendar userCalendar,
                               long start_date,
                               long end_date,
                               int zone_offset)
                        throws CalendarException
This method will delete the specified calendar component type for the user over the date range start-end inclusive. Returns true if successfull.

Supported API: false

Specified by:
deleteComponent in interface CalendarAccessProtocol
Parameters:
userCalendar -
start_date -
end_date -
zone_offset -
Returns:
boolean
Throws:
CalendarException

createComponents

public Vector createComponents(WTCalendar userCalendar,
                               long start_date,
                               long end_date,
                               WTPrincipalReference delegate,
                               boolean workingDay,
                               int zone_offset)
                        throws CalendarException
This method will create the specified calendar component over the date range start-end inclusive. Returns true if successful.

Supported API: false

Specified by:
createComponents in interface CalendarAccessProtocol
Parameters:
userCalendar -
start_date -
end_date -
delegate -
workingDay -
zone_offset -
Returns:
Vector
Throws:
CalendarException

readComponents

public Vector readComponents(WTCalendar userCalendar,
                             long start_date,
                             long end_date,
                             int zone_offset)
                      throws CalendarException
Modifies the calendar component object having date range start-end inclusive. Return the modified component.

Supported API: false

Specified by:
readComponents in interface CalendarAccessProtocol
Parameters:
userCalendar -
start_date -
end_date -
zone_offset -
Returns:
Vector
Throws:
CalendarException

updateComponents

public Vector updateComponents(WTCalendar userCalendar,
                               long start_date,
                               long end_date,
                               WTPrincipalReference delegate,
                               boolean workingDay,
                               int zone_offset)
                        throws CalendarException
Modifies the calendar object type(s) over the date range start-end inclusive. Return true if successfull.

Supported API: false

Specified by:
updateComponents in interface CalendarAccessProtocol
Parameters:
userCalendar -
start_date -
end_date -
delegate -
workingDay -
zone_offset -
Returns:
Vector
Throws:
CalendarException

updateComponents

public Vector updateComponents(WTCalendar userCalendar,
                               long start_date,
                               long end_date,
                               WTPrincipalReference delegate,
                               int zone_offset)
                        throws CalendarException
Modifies the calendar object type(s) over the date range start-end inclusive. Return true if successfull.

Supported API: false

Specified by:
updateComponents in interface CalendarAccessProtocol
Parameters:
userCalendar -
start_date -
end_date -
delegate -
zone_offset -
Returns:
Vector
Throws:
CalendarException

updateComponents

public Vector updateComponents(WTCalendar userCalendar,
                               long start_date,
                               long end_date,
                               boolean workingDay,
                               int zone_offset)
                        throws CalendarException
Modifies the calendar object type(s) over the date range start-end inclusive. Return true if successfull.

Supported API: false

Specified by:
updateComponents in interface CalendarAccessProtocol
Parameters:
userCalendar -
start_date -
end_date -
workingDay -
zone_offset -
Returns:
Vector
Throws:
CalendarException

deleteComponents

public boolean deleteComponents(WTCalendar userCalendar,
                                long start_date,
                                long end_date,
                                int zone_offset)
                         throws CalendarException
This method will delete the specified calendar component type for the user over the date range start-end inclusive. Returns true if successfull.

Supported API: false

Specified by:
deleteComponents in interface CalendarAccessProtocol
Parameters:
userCalendar -
start_date -
end_date -
zone_offset -
Returns:
boolean
Throws:
CalendarException

getAllComponents

public Enumeration getAllComponents(WTCalendar userCalendar)
                             throws WTException
Throws:
WTException

getCalendar

public WTCalendar getCalendar(ComponentLink compLink)
                       throws WTException
Throws:
WTException

getCalendar

public WTCalendar getCalendar(CalendarComponent comp)
                       throws WTException
Throws:
WTException

getComponent

public Enumeration getComponent(WTCalendar userCalendar,
                                long start_date,
                                long end_date)
                         throws WTException
Throws:
WTException

getComponents

public Enumeration getComponents(WTCalendar userCalendar,
                                 long start_date,
                                 long end_date)
                          throws WTException
Throws:
WTException

getParentCalendar

public Enumeration getParentCalendar(WTCalendar userCalendar)
                              throws WTException
Throws:
WTException

buildOwnerQuery

private QuerySpec buildOwnerQuery(WTPrincipal p)
                           throws WTException
Search Conditions *

Throws:
WTException

onOwner

private SearchCondition onOwner(WTPrincipal p)
                         throws WTException
Throws:
WTException

onCalOid

private SearchCondition onCalOid(long oid)
                          throws WTException
Throws:
WTException

getSysCalOwnerRef

protected static WTPrincipalReference getSysCalOwnerRef()
                                                 throws WTException
Throws:
WTException

getSystemCalendar

protected static WTCalendar getSystemCalendar()
                                       throws CalendarException
Throws:
CalendarException

initSystemCalendar

protected static WTCalendar initSystemCalendar(WTCalendar sys_cal)
                                        throws CalendarException
Throws:
CalendarException

getSystemCalOwner

public WTPrincipalReference getSystemCalOwner()

propagateSystemCalendar

protected WTCalendar propagateSystemCalendar(int the_month,
                                             int the_year)
                                      throws CalendarException
Throws:
CalendarException

removeFromCache

private void removeFromCache(WTCalendar userCalendar)
                      throws WTException
Throws:
WTException

convertTimestampToCalendar

public static GregorianCalendar convertTimestampToCalendar(Timestamp t)

convert_long_ToCalendar

public static GregorianCalendar convert_long_ToCalendar(long l)

convertCalendarToTimestamp

public static Timestamp convertCalendarToTimestamp(Calendar tmpCal)

convertTimestampTo_long

public static long convertTimestampTo_long(Timestamp t)

convert_longToTimestamp

public static Timestamp convert_longToTimestamp(long l)

convertCalendarTo_long

public static long convertCalendarTo_long(Calendar tmpCal)

getDelta

public static int getDelta()

calculateMaxCalDate

public static long calculateMaxCalDate()
                                throws CalendarException
This method calculates the largest calendar entry that we should see in the Calendar Component table based upon today's date and the upper_bound in the wt.properties file. The upper bound is in years. The max date is calculated as the last day of the current month in the future year.

Throws:
CalendarException

calculateMinCalDate

public static long calculateMinCalDate()
                                throws CalendarException
This method calculates the smallest calendar entry that we should see in the Calendar Component table based upon today's date and the delta in the wt.properties file. The lower bound is in years. The min date is calculated as the first day of the current month in the past year.

Throws:
CalendarException

getMaxDBEndDate

public static long getMaxDBEndDate()
This method gets the largest END_DATE value from the Calendar Component table.


getMinDBStartDate

public static long getMinDBStartDate()
This method gets the smallest START_DATE value from the Calendar Component table.


printInterestingInfo

public static void printInterestingInfo(Calendar cal)

updateCache

protected static Enumeration updateCache(WTCalendar userCalendar,
                                         long start_date,
                                         long end_date)
                                  throws WTException
Throws:
WTException

calcComponents

public Enumeration calcComponents(long start_date,
                                  long end_date)
                           throws WTException
Throws:
WTException

getId

private ObjectIdentifier getId(Object object)