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 Details

    • DEFAULT_CALENDAR_ID

      public static final Long DEFAULT_CALENDAR_ID
    • SORT_BY_ID

      public static final Integer SORT_BY_ID
    • SORT_BY_NAME

      public static final Integer SORT_BY_NAME
  • Constructor Details

    • WorkingCalendar

      public WorkingCalendar()
  • Method Details

    • getId

      public Long getId()
      Gets the id of this calendar
      Returns:
      the id
    • setId

      public void setId(Long id)
      Sets the id of this calendar
      Parameters:
      id -
    • getName

      public String getName()
      Gets the calendar's name
      Returns:
      the name
    • setName

      public void setName(String name)
      Sets the calendars name
      Parameters:
      name -
    • getDefaultDayOfWeek

      public CalendarElement[][] getDefaultDayOfWeek()
      Get the default start and end times for the days of the week. These CalendarElements 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:
      getDefaultDayOfWeek in class com.appiancorp.core.expr.calendar.PortableWorkingCalendar
      Returns:
      Returns the defaultDayOfWeek.
      See Also:
    • setDefaultDayOfWeek

      public void setDefaultDayOfWeek(CalendarElement[][] defaultDayOfWeek)
      Set the default start and end times for the days of the week.
      Parameters:
      defaultDayOfWeek - The defaultDayOfWeek to set.
      See Also:
    • getDisallowDelete

      public Boolean getDisallowDelete()
      Get whether or not deleting this calendar is enabled or disabled. A value of true means that deleting the calendar is not allowed.
      Returns:
      Whether or not deleting is allowed for this calendar.
      See Also:
    • setDisallowDelete

      public void setDisallowDelete(Boolean disallowDelete)
      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

      public CalendarDateElement[] getSpecific()
      Get the start and end times for specific days. This array of CalendarDateElements 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:
      getSpecific in class com.appiancorp.core.expr.calendar.PortableWorkingCalendar
      Returns:
      The start and end times for specific days.
      See Also:
    • setSpecific

      public void setSpecific(CalendarDateElement[] specific)
      Sets the start and end times for specific days.
      Parameters:
      specific - The start and end times to set for specific days.
    • getSystem

      public Boolean getSystem()
      Get whether or not this is a system calendar.
      Returns:
      Whether or not this is a system calendar.
      See Also:
    • setSystem

      public void setSystem(Boolean system)
      Set whether or not this is a system calendar.
      Parameters:
      system - Whether or not this is a system calendar.
      See Also:
    • isNonWorking

      public static boolean isNonWorking(CalendarElement[] day)
      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

      public String toString()
      Simple toString method. Use for informational purposes, as the format may change in the future.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this working calendar
    • calendarFromTimestamp

      public Calendar calendarFromTimestamp(Timestamp timestamp, TimeZone defaultTimeZone)
      Create a Calendar from the given java.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

      public void setTimeZoneId(String timeZoneId)
      Set the name of the time zone for this calendar.
      Overrides:
      setTimeZoneId in class com.appiancorp.core.expr.calendar.PortableWorkingCalendar
      Parameters:
      timeZoneId - The time zone id to set for this calendar.
      See Also:
    • getTimeZoneId

      public String getTimeZoneId()
      Get the id of the time zone for this calendar.
      Overrides:
      getTimeZoneId in class com.appiancorp.core.expr.calendar.PortableWorkingCalendar
      Returns:
      The time zone for this calendar.
      See Also:
    • getTimeZone

      public TimeZone getTimeZone()
      Overrides:
      getTimeZone in class com.appiancorp.core.expr.calendar.PortableWorkingCalendar
      Returns:
    • workingDaysInRange

      public int workingDaysInRange(Calendar start, Calendar end)
      Count the number of working days in given range.
      Overrides:
      workingDaysInRange in class com.appiancorp.core.expr.calendar.PortableWorkingCalendar
      Parameters:
      start -
      end -
      Returns:
      count of working days in given range, negative if start is after end.
    • workingHoursInRange

      public int workingHoursInRange(Calendar start, Calendar end)
      Count the number of working hours in given range.
      Overrides:
      workingHoursInRange in class com.appiancorp.core.expr.calendar.PortableWorkingCalendar
      Parameters:
      start -
      end -
      Returns:
      count of working days in given range, negative if start is after end.
    • workingMinutesInRange

      public int workingMinutesInRange(Calendar start, Calendar end)
      Count the number of working minutes in given range.
      Overrides:
      workingMinutesInRange in class com.appiancorp.core.expr.calendar.PortableWorkingCalendar
      Parameters:
      start -
      end -
      Returns:
      count of working days in given range, negative if start is after end.
    • isWorkTime

      public boolean isWorkTime(Calendar calendar)
      Does this Calendar represent a working time?
      Overrides:
      isWorkTime in class com.appiancorp.core.expr.calendar.PortableWorkingCalendar
      Parameters:
      calendar -
      Returns:
      true if the given Calendar object represents a working time in this working calendar
    • isWorkingDay

      public boolean isWorkingDay(Calendar calendar)
      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:
      isWorkingDay in class com.appiancorp.core.expr.calendar.PortableWorkingCalendar
      Parameters:
      calendar -
      Returns:
      true if the given Calendar object represents a working day in this working calendar
    • addDays

      public Calendar addDays(Calendar base, int numberOfDays)
      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:
      addDays in class com.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

      public Calendar addHours(Calendar startDateTime, int numberOfHours)
      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:
      addHours in class com.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

      public Calendar addMinutes(Calendar startDateTime, int numberOfMinutes)
      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:
      addMinutes in class com.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