Class WorkingCalendar
java.lang.Object
com.appiancorp.core.expr.calendar.PortableWorkingCalendar
com.appiancorp.suiteapi.process.calendar.WorkingCalendar
- Direct Known Subclasses:
SystemCalendar
public class WorkingCalendar
extends com.appiancorp.core.expr.calendar.PortableWorkingCalendar
A bean representing a calendar. It contains the default start and end times for each
day of the week, and start and end times for specific days. It also stores which
days are working and non-working days.
-
Field Summary
FieldsFields inherited from class com.appiancorp.core.expr.calendar.PortableWorkingCalendar
timeZoneId, TOO_MANY_ITERATIONS_BEFORE_RESULT_OR_LIMIT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd given number of working days to the given Calendar, yielding another Calendar that is also a working time.Add given number of working hours to the given Calendar, yielding another Calendar that is also a working time.addMinutes(Calendar startDateTime, int numberOfMinutes) Add given number of working minutes to the given Calendar, yielding another Calendar that is also a working time.calendarFromTimestamp(Timestamp timestamp, TimeZone defaultTimeZone) Create a Calendar from the givenjava.sql.Timestamp, adjusted for the configured TimeZone of the WorkingCalendar, or defaultTimeZone if none.CalendarElement[][]Get the default start and end times for the days of the week.Get whether or not deleting this calendar is enabled or disabled.getId()Gets the id of this calendargetName()Gets the calendar's nameGet the start and end times for specific days.Get whether or not this is a system calendar.Get the id of the time zone for this calendar.static booleanisNonWorking(CalendarElement[] day) Tells if the given day is a non working day or not.booleanisWorkingDay(Calendar calendar) Is the day represented by this Calendar object a working day according to this working calendar?booleanisWorkTime(Calendar calendar) Does this Calendar represent a working time?voidsetDefaultDayOfWeek(CalendarElement[][] defaultDayOfWeek) Set the default start and end times for the days of the week.voidsetDisallowDelete(Boolean disallowDelete) Set whether or not deleting this calendar is enabled or disabled.voidSets the id of this calendarvoidSets the calendars namevoidsetSpecific(CalendarDateElement[] specific) Sets the start and end times for specific days.voidSet whether or not this is a system calendar.voidsetTimeZoneId(String timeZoneId) Set the name of the time zone for this calendar.toString()Simple toString method.intworkingDaysInRange(Calendar start, Calendar end) Count the number of working days in given range.intworkingHoursInRange(Calendar start, Calendar end) Count the number of working hours in given range.intworkingMinutesInRange(Calendar start, Calendar end) Count the number of working minutes in given range.Methods inherited from class com.appiancorp.core.expr.calendar.PortableWorkingCalendar
addDaysNoGmtAdjustment, addHoursNoGmtAdjustment, addMinutesNoGmtAdjustment, addMonthsNoGmtAdjustment, addSecondsNoGmtAdjustment, addYearsNoGmtAdjustment, adjustAddFinal, subtractDaysNoGmtAdjustment, subtractHoursNoGmtAdjustment, subtractMinutesNoGmtAdjustment, subtractMonthsNoGmtAdjustment, subtractSecondsNoGmtAdjustment, subtractYearsNoGmtAdjustment
-
Field Details
-
DEFAULT_CALENDAR_ID
-
SORT_BY_ID
-
SORT_BY_NAME
-
-
Constructor Details
-
WorkingCalendar
public WorkingCalendar()
-
-
Method Details
-
getId
Gets the id of this calendar- Returns:
- the id
-
setId
Sets the id of this calendar- Parameters:
id-
-
getName
Gets the calendar's name- Returns:
- the name
-
setName
Sets the calendars name- Parameters:
name-
-
getDefaultDayOfWeek
Get the default start and end times for the days of the week. TheseCalendarElements define the default start and end times for the days of the week. The first dimension of the array is the day of the week where 0 = Sunday, 1 = Monday, ... , and 6 = Saturday. The second dimension is equal to the number of start-end pairs that can be defined for a day (currently four).- Specified by:
getDefaultDayOfWeekin classcom.appiancorp.core.expr.calendar.PortableWorkingCalendar- Returns:
- Returns the defaultDayOfWeek.
- See Also:
-
setDefaultDayOfWeek
Set the default start and end times for the days of the week.- Parameters:
defaultDayOfWeek- The defaultDayOfWeek to set.- See Also:
-
getDisallowDelete
Get whether or not deleting this calendar is enabled or disabled. A value oftruemeans that deleting the calendar is not allowed.- Returns:
- Whether or not deleting is allowed for this calendar.
- See Also:
-
setDisallowDelete
Set whether or not deleting this calendar is enabled or disabled.- Parameters:
disallowDelete- Whether or not deleting is allowed for this calendar.- See Also:
-
getSpecific
Get the start and end times for specific days. This array ofCalendarDateElements defines start and end time pairs for specific dates. The size of the array is unbounded, and order does not matter. Therefore separate start and end pairs can be defined for the same date anywhere in the array.- Specified by:
getSpecificin classcom.appiancorp.core.expr.calendar.PortableWorkingCalendar- Returns:
- The start and end times for specific days.
- See Also:
-
setSpecific
Sets the start and end times for specific days.- Parameters:
specific- The start and end times to set for specific days.
-
getSystem
Get whether or not this is a system calendar.- Returns:
- Whether or not this is a system calendar.
- See Also:
-
setSystem
Set whether or not this is a system calendar.- Parameters:
system- Whether or not this is a system calendar.- See Also:
-
isNonWorking
Tells if the given day is a non working day or not.- Parameters:
day- The day to find out if it's a non working day- Returns:
- true if the day is a non working day.
-
toString
Simple toString method. Use for informational purposes, as the format may change in the future. -
calendarFromTimestamp
Create a Calendar from the givenjava.sql.Timestamp, adjusted for the configured TimeZone of the WorkingCalendar, or defaultTimeZone if none.- Parameters:
timestamp-defaultTimeZone-- Returns:
- adjusted Calendar, suitable for passing to other WorkingCalendar informational methods expecting a Calendar
-
setTimeZoneId
Set the name of the time zone for this calendar.- Overrides:
setTimeZoneIdin classcom.appiancorp.core.expr.calendar.PortableWorkingCalendar- Parameters:
timeZoneId- The time zone id to set for this calendar.- See Also:
-
getTimeZoneId
Get the id of the time zone for this calendar.- Overrides:
getTimeZoneIdin classcom.appiancorp.core.expr.calendar.PortableWorkingCalendar- Returns:
- The time zone for this calendar.
- See Also:
-
getTimeZone
- Overrides:
getTimeZonein classcom.appiancorp.core.expr.calendar.PortableWorkingCalendar- Returns:
-
workingDaysInRange
Count the number of working days in given range.- Overrides:
workingDaysInRangein classcom.appiancorp.core.expr.calendar.PortableWorkingCalendar- Parameters:
start-end-- Returns:
- count of working days in given range, negative if start is after end.
-
workingHoursInRange
Count the number of working hours in given range.- Overrides:
workingHoursInRangein classcom.appiancorp.core.expr.calendar.PortableWorkingCalendar- Parameters:
start-end-- Returns:
- count of working days in given range, negative if start is after end.
-
workingMinutesInRange
Count the number of working minutes in given range.- Overrides:
workingMinutesInRangein classcom.appiancorp.core.expr.calendar.PortableWorkingCalendar- Parameters:
start-end-- Returns:
- count of working days in given range, negative if start is after end.
-
isWorkTime
Does this Calendar represent a working time?- Overrides:
isWorkTimein classcom.appiancorp.core.expr.calendar.PortableWorkingCalendar- Parameters:
calendar-- Returns:
- true if the given Calendar object represents a working time in this working calendar
-
isWorkingDay
Is the day represented by this Calendar object a working day according to this working calendar? A day is a working day if any minute of that day is a working minute. Specific dates override day of week information.- Overrides:
isWorkingDayin classcom.appiancorp.core.expr.calendar.PortableWorkingCalendar- Parameters:
calendar-- Returns:
- true if the given Calendar object represents a working day in this working calendar
-
addDays
Add given number of working days to the given Calendar, yielding another Calendar that is also a working time. Will throw an IllegalArgumentException if the number to analyze exceeds 365 days of no working time, or is negative.- Overrides:
addDaysin classcom.appiancorp.core.expr.calendar.PortableWorkingCalendar- Parameters:
base-numberOfDays- ; non-negative- Returns:
- a Calendar object representing the date and time of the next working time the given number of days in the future
-
addHours
Add given number of working hours to the given Calendar, yielding another Calendar that is also a working time. Will throw an IllegalArgumentException if the number to analyze exceeds 365 days of no working time, or is negative.- Overrides:
addHoursin classcom.appiancorp.core.expr.calendar.PortableWorkingCalendar- Parameters:
startDateTime-numberOfHours- ; non-negative- Returns:
- a Calendar object representing the date and time of the next working time the given number of hours in the future
-
addMinutes
Add given number of working minutes to the given Calendar, yielding another Calendar that is also a working time. Will throw an IllegalArgumentException if the number to analyze exceeds 365 days of no working time, or is negative.- Overrides:
addMinutesin classcom.appiancorp.core.expr.calendar.PortableWorkingCalendar- Parameters:
startDateTime-numberOfMinutes- ; non-negative- Returns:
- a Calendar object representing the date and time of the next working time the given number of minutes in the future
-