Class CalendarElement

java.lang.Object
com.appiancorp.suiteapi.process.calendar.CalendarElement
All Implemented Interfaces:
com.appiancorp.core.expr.calendar.PortableCalendarElement
Direct Known Subclasses:
CalendarDateElement

public class CalendarElement extends Object implements com.appiancorp.core.expr.calendar.PortableCalendarElement
The CalendarElement stores a start and end time, which is used by the WorkingCalendar to specify all start and end times per day. The start and end times are stored by specifying the minute of the day which will be the start time, and a duration which will define the end time.
  • Constructor Details

    • CalendarElement

      public CalendarElement()
      Constructs an empty CalendarElement (0 for both values).
    • CalendarElement

      public CalendarElement(int minuteOfDay_, int lengthInMinutes_)
      Constructs a CalendarElement with default values for the start minute and number of duration minutes.
      Parameters:
      minuteOfDay_ - The starting minute of the day.
      lengthInMinutes_ - The duration of this element in minutes.
  • Method Details

    • getLengthInMinutes

      public int getLengthInMinutes()
      Get the duration of this start-end period in minutes. The end time in minutes is determined by adding this duration to the start time in minutes.
      Specified by:
      getLengthInMinutes in interface com.appiancorp.core.expr.calendar.PortableCalendarElement
      Returns:
      The duration of the start-end period in minutes.
      See Also:
    • setLengthInMinutes

      public void setLengthInMinutes(int lengthInMinutes_)
      Set the duration of this start-end period in minutes.
      Parameters:
      lengthInMinutes_ - The duration of the start-end period in minutes to set.
      See Also:
    • getMinuteOfDay

      public int getMinuteOfDay()
      Get the minute of the day on which this start-end period will start. 0 minutes corresponds to midnight.
      Specified by:
      getMinuteOfDay in interface com.appiancorp.core.expr.calendar.PortableCalendarElement
      Returns:
      Returns the minuteOfDay.
      See Also:
    • setMinuteOfDay

      public void setMinuteOfDay(int minuteOfDay_)
      Set the minute of the day on which this start-end period will start.
      Parameters:
      minuteOfDay_ - The minuteOfDay to set.
      See Also:
    • startEndToString

      public String[] startEndToString(javax.servlet.http.HttpSession hs_)
      Returns the string respresentation of the Start and End time of this element.
      Parameters:
      hs_ - the http session, needed to format the entries according to the locale.
      Returns:
      an array of two elements, the first entry is the start time, the second entry is the end time.
    • stringToCalendarElement

      public static CalendarElement stringToCalendarElement(String startTime, String endTime, Locale locale, String calendarId) throws ParseException
      Given the start time and end time as strings, returns a calendar element. The strings must be formatted according to the picker format for times. If both entries are blank, a blank CalendarElement will be returned.
      Parameters:
      startTime - The start time as a string.
      endTime - The end time as a string.
      locale - The locale under which the passed strings where generated.
      calendarId - The Id of the calendar under which the passed strings where generated.
      Returns:
      a CalendarElement
      Throws:
      ParseException - If the startTime and/or endTime cannot be parsed into an actual time value.
    • toString

      public String toString()
      Simple toString method. The format of this is allowed to change.
      Overrides:
      toString in class Object
    • minuteString

      protected String minuteString(int minutes)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object