com.webmethods.caf.faces.data.calendar
Class BusinessCalendarModel

java.lang.Object
  extended by com.webmethods.caf.faces.data.calendar.BusinessCalendarModel
All Implemented Interfaces:
IContentProvider
Direct Known Subclasses:
TaskBusinessCalendarModel

public class BusinessCalendarModel
extends Object
implements IContentProvider

The content provider for a business calendar. Used to calculate resulting date and time based on setting applied to the model.


Field Summary
static String ADJUSTMENT_CURRENT_DAY_END
           
static String ADJUSTMENT_CURRENT_DAY_START
           
static String ADJUSTMENT_NEXT_DAY_END
           
static String ADJUSTMENT_NEXT_DAY_START
           
 
Constructor Summary
BusinessCalendarModel()
           
 
Method Summary
 String getBaseAdjustment()
          Get the adjustment setting used in the resulting day calculation.
 Object getBaseDateTime()
          Get the base date time to be evaluated by the selected calendar and used to calculate the result date time.
protected  Date getCalendarEvaluatorBaseDate()
          Get the base date time as a date.
 Object getCorporateCalendar()
          Get the object stored as the corporate calendar.
 String getDateTimeFormat()
          Get the date time format used to convert a String value to a date.
 Object[] getPropertyKeys()
          Get property keys method required by IContentProvider.
 Date getResultDateTime()
          Calculate the resulting date time.
 Class getType(Object propertyName)
          Get type method required by IContentProvider.
 Object getUserCalendar()
          Get the object stored as the user calendar.
 Object getValue(Object propertyName)
          Get value method required by IContentProvider.
 int getWorkdays()
          Get work days in a week.
 int getWorkhours()
          Get work hours for a day.
 int getWorkminutes()
          Get the number of minutes in a work day.
 boolean hasProperty(Object propertyName)
          Has property method required by IContentProvider.
 boolean isUseUserPersonalCalendar()
          Is the user's personal calendar being used for the result date time calculation verses the default corporate calendar.
 void setBaseAdjustment(String baseAdjustment)
          Adjust the base date time used in the resulting day calculation.
 void setBaseDateTime(Object baseDateTime)
          Set the base date time to be evaluated by the selected calendar and used to calculate the result date time.
 void setCorporateCalendar(Object corpCalendar)
          Set the calendar object ID or alias for the corporate calendar.
 void setDateTimeFormat(String dateFormat)
          Set the date time format used to convert a String value to a date.
 void setUserCalendar(Object userCalendar)
          Set the value for the user calendar.
 void setUseUserPersonalCalendar(boolean useUserPersonalCalendar)
          Use the user's personal calendar for calculation verses the default corporate calendar.
 void setWorkdays(int workdays)
          Set the number of work days in a week.
 void setWorkhours(int workhours)
          Set the number of work hours for a day.
 void setWorkminutes(int workminutes)
          Set the number of minutes in a work day.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.webmethods.caf.faces.data.IContentProvider
toString
 

Field Detail

ADJUSTMENT_CURRENT_DAY_START

public static final String ADJUSTMENT_CURRENT_DAY_START
See Also:
Constant Field Values

ADJUSTMENT_CURRENT_DAY_END

public static final String ADJUSTMENT_CURRENT_DAY_END
See Also:
Constant Field Values

ADJUSTMENT_NEXT_DAY_START

public static final String ADJUSTMENT_NEXT_DAY_START
See Also:
Constant Field Values

ADJUSTMENT_NEXT_DAY_END

public static final String ADJUSTMENT_NEXT_DAY_END
See Also:
Constant Field Values
Constructor Detail

BusinessCalendarModel

public BusinessCalendarModel()
Method Detail

getPropertyKeys

public Object[] getPropertyKeys()
Get property keys method required by IContentProvider.

Specified by:
getPropertyKeys in interface IContentProvider
Returns:
The default value of null.

getType

public Class getType(Object propertyName)
              throws PropertyNotFoundException
Get type method required by IContentProvider.

Specified by:
getType in interface IContentProvider
Parameters:
propertyName -
Returns:
The default value of null.
Throws:
PropertyNotFoundException - if property is not supported

getValue

public Object getValue(Object propertyName)
                throws EvaluationException,
                       PropertyNotFoundException
Get value method required by IContentProvider.

Specified by:
getValue in interface IContentProvider
Parameters:
propertyName -
Returns:
The default value of null.
Throws:
EvaluationException - if error during property evaluation
PropertyNotFoundException - if property is not supported

hasProperty

public boolean hasProperty(Object propertyName)
Has property method required by IContentProvider.

Specified by:
hasProperty in interface IContentProvider
Parameters:
propertyName -
Returns:
The default value of false.

getResultDateTime

public Date getResultDateTime()
                       throws ContentProviderException
Calculate the resulting date time. This is base on the base date time, calendar to us, and base time adjustment. The resulting date time is cached and used on the next call to this method. The cache can be reset by changing the value of the base date time, calendar to us, or base time adjustment.

Returns:
The cached resulting date time.
Throws:
ContentProviderException

getCorporateCalendar

public Object getCorporateCalendar()
Get the object stored as the corporate calendar.

Returns:
Object The calendar object ID or alias.
See Also:
ICalendarManager

setCorporateCalendar

public void setCorporateCalendar(Object corpCalendar)
Set the calendar object ID or alias for the corporate calendar. Clears the cached resulting date time.

Parameters:
corpCalendar - The calendar object ID or alias.
See Also:
ICalendarManager

getUserCalendar

public Object getUserCalendar()
Get the object stored as the user calendar.

Returns:
A IThingID, URI, or String value that resolves a URI.
See Also:
ICalendarManager

setUserCalendar

public void setUserCalendar(Object userCalendar)
Set the value for the user calendar. The value need to be a IThingID, URI, or String value that will allow a URI to be looked up. Clears the cached resulting date time.

Parameters:
userCalendar - A IThingID, URI, or String value that resolves a URI.
See Also:
ICalendarManager

isUseUserPersonalCalendar

public boolean isUseUserPersonalCalendar()
Is the user's personal calendar being used for the result date time calculation verses the default corporate calendar.

Returns:
True if the user calendar is set. False for default calendar.

setUseUserPersonalCalendar

public void setUseUserPersonalCalendar(boolean useUserPersonalCalendar)
Use the user's personal calendar for calculation verses the default corporate calendar. Clears the cached resulting date time.

Parameters:
useUserPersonalCalendar - True to use a personal calendar. False to use the default calendar.

getBaseDateTime

public Object getBaseDateTime()
Get the base date time to be evaluated by the selected calendar and used to calculate the result date time.

Returns:
The object to be use for the result date time calculations.

setBaseDateTime

public void setBaseDateTime(Object baseDateTime)
Set the base date time to be evaluated by the selected calendar and used to calculate the result date time. Clears the cached resulting date time.

Parameters:
baseDateTime - The object to be use for the result date time calculations.

getDateTimeFormat

public String getDateTimeFormat()
Get the date time format used to convert a String value to a date.

Returns:
String The String used to format parse the base date time
See Also:
SimpleDateFormat

setDateTimeFormat

public void setDateTimeFormat(String dateFormat)
Set the date time format used to convert a String value to a date. If the method setBaseDateTime is supplied a String value then a format must be supplied before the resulting date time can be calculated. Not suppling a format will cause the calculation to throw a ParseException. Clears the cached resulting date time.

Parameters:
dateFormat - A String to convert a date to a Date object. Example: "MM/dd/yyyy"
See Also:
SimpleDateFormat

getWorkdays

public int getWorkdays()
Get work days in a week.

Returns:
int The number of work days in a week.

setWorkdays

public void setWorkdays(int workdays)
Set the number of work days in a week. Clears the cached resulting date time.

Parameters:
workdays - The work days in a week

getWorkhours

public int getWorkhours()
Get work hours for a day.

Returns:
The number of hours in a work day.

setWorkhours

public void setWorkhours(int workhours)
Set the number of work hours for a day. Clears the cached resulting date time.

Parameters:
workhours - The number of work hours in a day.

getWorkminutes

public int getWorkminutes()
Get the number of minutes in a work day.

Returns:
The number of minutes in a work day.

setWorkminutes

public void setWorkminutes(int workminutes)
Set the number of minutes in a work day. Clears the cached resulting date time.

Parameters:
workminutes - The number of minutes in a work day

getBaseAdjustment

public String getBaseAdjustment()
Get the adjustment setting used in the resulting day calculation.

Returns:
The value set by setBaseAdjustment.

setBaseAdjustment

public void setBaseAdjustment(String baseAdjustment)
Adjust the base date time used in the resulting day calculation. One of the following values must be used or the adjustment is skipped.
Valid values are:
ADJUSTMENT_CURRENT_DAY_START - adjust to the start of the base date.
ADJUSTMENT_CURRENT_DAY_END - adjust to the end of the base date.
ADJUSTMENT_NEXT_DAY_START - adjust to the start of the day after the base date.
ADJUSTMENT_NEXT_DAY_END - adjust to the end of the day after the base date.
Null or any other value - skip adjustment.

Clears the cached resulting date time.

Parameters:
baseAdjustment - The setting to adjust the base time.

getCalendarEvaluatorBaseDate

protected Date getCalendarEvaluatorBaseDate()
                                     throws Exception
Get the base date time as a date. If the base date is not set by a Date object or getResultDateTime method has not been called this method will throw an exception.

Returns:
A Date object for base date time.
Throws:
Exception