Interface ICalendarEvaluator


public interface ICalendarEvaluator
Calendar Evaluator is created for specified baseDate and workday calendars. See ICalendarSystem.getCalendarEvaluator(Date, IWorkdayCalendar) and ICalendarSystem.getCalendarEvaluator(Date, IWorkdayCalendar, IWorkdayCalendar). Evaluator may be created using just business workday calendar or combination of business workday calendar and user personal calendar. If specified user personal calendar is used to define user timeoff and busy schedule.

Only the following event types are considered in the calenar calculations: Event.EVENT_TYPE_HOLIDAY, Event.EVENT_TYPE_OUT_OF_THE_OFFICE, Event.EVENT_TYPE_WORKDAY

It is important to understand that all evaluations are done in the future date ranges off the baseDate passed when creating calendar evaluator

  • Method Summary

    Modifier and Type
    Method
    Description
    addWorkdays(Date dateTime, int value)
    Adds number of workdays to an absolute date and returns end of the business day.
    addWorkhours(Date dateTime, int value)
    Adds or substracts (negative value) number of workhours to the specified absolute date.
    addWorkminutes(Date dateTime, int value)
    Adds or substracts (negative value) number of workminutes to the specified absolute date.
    getNextWorkday(Date dateTime)
    Returns closest workday for specified dateTime.
    getWorkday(Date dateTime)
    Returns current workday for specified dateTime.
    queryWorkDays(Date startDate, Date endDate)
    Returns list of workday periods in the given date range
  • Method Details

    • queryWorkDays

      List<PeriodEvent> queryWorkDays(Date startDate, Date endDate)
      Returns list of workday periods in the given date range
      Parameters:
      startDate - start date for range
      endDate - end date for range
      Returns:
      list of workday periods within a range according to evaluator workday calendars
    • getWorkday

      PeriodEvent getWorkday(Date dateTime)
      Returns current workday for specified dateTime. If dateTime falls into date range for the workday defined in the calendar and not in the date range for holiday or user out of the office event, then current workday range is returned. Otherwise closest to specified dateTime workday is returned

      For example considering 9am-5pm Mon-Fri workdays:

      getWorkday(8am Mon) = 9am-5pm Mon
      getWorkday(11am Mon) = 9am-5pm Mon
      getWorkday(6pm Mon) = 9am-5pm Tue

      Parameters:
      dateTime - date time to query workday
      Returns:
      Workday datetime range
    • getNextWorkday

      PeriodEvent getNextWorkday(Date dateTime)
      Returns closest workday for specified dateTime. It skip any current workday if dateTime falls into date range for the workday defined in the calendar.

      For example considering 9am-5pm Mon-Fri workdays:

      getWorkday(8am Mon) = 9am-5pm Mon
      getWorkday(11am Mon) = 9am-5pm Tue
      getWorkday(6pm Mon) = 9am-5pm Tue

      Parameters:
      dateTime - date time to query workday
      Returns:
      Workday datetime range
    • addWorkdays

      Date addWorkdays(Date dateTime, int value)
      Adds number of workdays to an absolute date and returns end of the business day. If dateTime falls within a current workday date range it skips the current workday.

      For example considering 9am-5pm Mon-Fri workdays:

      8am Mon + (1 workday) = 5pm Mon
      11am Mon + (1 workday) = 5pm Tue
      6pm Mon + (1 workday) = 5pm Tue

      Parameters:
      dateTime - starting dateTime
      value - positive number of workday to add
      Returns:
      absolute date of the end of the current business day
    • addWorkhours

      Date addWorkhours(Date dateTime, int value)
      Adds or substracts (negative value) number of workhours to the specified absolute date.

      For example considering 9am-5pm Mon-Fri workdays:

      8am Mon + (1 workhour) = 10am Mon
      11am Mon + (1 workhour) = 12pm Mon
      6pm Mon + (1 workhour) = 10am Tue
      8am Tue - (1 workhour) = 4pm Mon

      Parameters:
      dateTime - absolute date to add or subtract workhours
      value - number of workhours to add (may be negative)
      Returns:
      absolute date within workday range
    • addWorkminutes

      Date addWorkminutes(Date dateTime, int value)
      Adds or substracts (negative value) number of workminutes to the specified absolute date.

      For example considering 9am-5pm Mon-Fri workdays:

      8am Mon + (15 workminutes) = 9:15am Mon
      11am Mon + (15 workminutes) = 12:15pm Mon
      6pm Mon + (15 workminutes) = 9:15am Tue
      8am Tue - (15 workminutes) = 4:45pm Mon

      Parameters:
      dateTime - absolute date to add or subtract workminutes
      value - number of workminutes to add (may be negative)
      Returns:
      absolute date within workday range