Calendar Object

glp/0/{SID}/fb/cal/{handle}/sts

glp/0/{SID}/(rq|fb)/cal/{handle}/cfg


The IAP/MQ calendar object is addressed using the cal object type identifier.  An object of this type is known as a calendar.  Each calendar object contains the definition of one or more dates. When any of these dates, which can include repeating patterns and wildcards, match the current date, the calendar is considered active. Otherwise it is considered inactive.

For example, one calendar object could be used to define the days of school holidays in the current and the next calendar year. Exception schedules, defined within the schedule object type, can reference a calendar. Multiple schedule objects can reference a shared, calendar.

The calendar object supports all valid IAP/MQ object handles. A descriptive handle such as “school-holidays” is recommended.

Calendar Actions

The calendar object supports two actions: 

  • create
  • delete

The create action accepts a calendar configuration object with its arguments. The calendar configuration object can also be written directly with requests made in the IAP/MQ request channel. These requests can write the entire configuration object or parts of it. Items within the configuration object can be addressed directly in IAP/MQ, allowing you to change individual properties within a calendar object without writing the entire object.

The delete action requires no arguments. The delete action does not determine or resolve dependencies. For example, assume schedule S references calendar C. You can delete C without an error, but this triggers a re-evaluation of the schedules. Evaluating S does not trigger a warning ("C is not defined") as it would if C had not yet been defined. S's exception that references C will never activate until S is updated or C is created again.

The calendar object outputs a status object in the IAP/MQ feedback channel, which reports state and the optional error property.


Calendar Status Object

glp/0/{SID}/fb/cal/{handle}/sts

The calendar status object is published in the IAP/MQ feedback channel at the sts endpoint.

For example:  

glp/0/Ty6532/fb/cal/example/sts                                                   

Calendar Status Object Properties

Field Name       

Type               

Description

descString

(Optional)  desc is empty unless a description is provided.

state

String

(Optional)  The calendar becomes active when the current date is within any of the dates configured with this calendar.

Possible values are: active, inactive, deleted.

Default: "inactive

error

String

(Optional)  The error property is not present by default. It can be set to null or to a string that reports the most recently encountered error.

Calendar errors use the cal error category identifier, when one is provided. Diagnostics that include the identifier use the following format:
       <message> [ <category>#<number> ]

For example: Invalid time: “28:72:00” [cal#2]

Calendar errors include:

Time unavailable [iap#1]
Invalid date: <detail> [cal#1]
Invalid time: <detail> [cal#2]


Calendar Configuration Object

The calendar configuration object is published in the IAP/MQ feedback channel at the cfg endpoint. It can also be written to the same endpoint in the IAP/MQ request channel, or directly addressed to items within the configuration object, allowing you to change individual properties within an object without writing the entire object.

For example:  

glp/0/Ty6532/fb/cal/example/cfg                                                   

Calendar Configuration Object Properties

Field Name       

Type              

Description

dates

String

(Required)  A set of key-date pairs, where:

  • Each key within the set is a valid JSON identifier.
  • Keys are unique within the set.
  • Keys can take any valid JSON identifier value.
  • The value of a key has no significance but descriptive keys such as “Christmas” or “Thanksgiving” are recommended.
  • Each key maps to null or to a Date object. 
  • Keys with null values are ignored in the calendar evaluation.
  • Keys with valid values map to a Date object, but do not support the Date Reference Object.

Default: an empty set

descString

(Optional)  desc is empty unless a description is provided.

timespec

String

(Optional)  Defines how all date and time references within this object are interpreted. 

Possible values: 

  • utc - selects the UTC timezone
  • local - selects local wall time, including daylight saving time, where and when applicable.
  • standard - selects selects local standard time, not including daylight saving time.

Default: local

Calendar Configuration Object Example: Holidays

The following calendar configuration object defines holidays. The listing is incomplete for brevity.

{                                                                                                                                                                                                            
      dates: {
            christmas: {                           // December 25th, 26th
                  ot: “date:range”,
                  start: {
                        ot: “date:single”,
                        month: 12,
                        day: 25
                  },
                  end: {
                        ot: “date:single”,
                        day: 26
                  }
            },
            newyear: {                               // January 1st
                  ot: “date:single”,
                  month: 1,
                  day: 1
            },
            thanksgiving: {                         // last Thursday in November
                  ot: “date:week-and-day”,
                  month: 11,
                  weekday: 4,
                  days: 6
            }
      }
}