Configure a calendar

The calendar feature is an advanced feature in Decision Insight. You need to purchase a license with the calendar option to use this feature.

Learn how to set up calendar configuration and how to evaluate it.

Once you have created a Calendar and the required period types, you have to setup the calendar configuration.

The configuration is an ordered list of rules that associate a period type and an ICS where the ICS defines when the period type is valid.

The ordered property of the rules is important because the first ICS that matches the timed query returns the associated Period type. If nothing matches, then the Default Period type is used.

Tip: You can define multiple rules referencing the same period type if needed.

Note that ICS are interpreted with the timezone that you setup for your configuration in the dedicated field.


  Rules evaluation example

Let's use the Activity calendar example we've used before.You have an Activity Calendar linked to the Process entity. In addition to the Default period, you have created a High and a Low periods.

On the single instance of the Process entity, We absorb a calendar configuration containing:

  • A first rule that associates everyday from 12h00 to 0h00  to the High period.
  • A second rule that associates everyday from 8h00 to 16h00 to the Low period.

When the configuration is considered at a given time, the configuration is browsed from top to bottom returning the first period that matches. If none of them matches, the Default period is returned.


To determine the current period at 13h00:

  1. We look at the first rule, 13h00 intersects [12h00: 0h00[ and return the High period.

To determine the current period at 9h00:

  1. We look at the first rule, 9h00 is not contained in the specified time range of the rule [12h00: 0h00[.
  2. We look at the second rule, that matches since 9h00 intersects [8h00:  16h00[ and return the Low period.

If when we want to determine the current period at 7h00:

  1. We look at the first rule, 7h00 is not contained in the specified time range of the rule [12h00: 0h00[.
  2. We look at the second rule that doesn't match either since 7h00 is not contained in [8h00: 16h00[.
  3. We return the Default period.

See Calendar Configuration for the details of the data type.

How to absorb a Calendar configuration

When you create a calendar,calendar configuration attribute is automatically created on the linked entity(s). This attribute has the same name as the calendar.

The absorption of the Calendar configuration is a standard data integration mapping.

In this example with an Activity calendar name linked to the Process entity, create a mapping that resolves an instance of Process ,then update the Activity attribute:

Select the calendar configuration

Create a mapping

To set a calendar configuration, follow these steps:

Step Action
1 Navigate to DATA INTEGRATION > Mappings.
2

Create a new mapping.

3 Set a name (for example: absorbConfiguration).
4

Create 2 parameters:

  • An Instant parameter named updateTime.
  • Calendar Configuration parameter named configuration.
5

Create an Instance operation over the Process entity.

  • Operations begin uses the updateTime parameter
6

Add a Change value(s) of attribute operation on the  Activity attribute and assign configuration parameter.

7 Save.

Tip: It is recommended to select an update time that matches the first occurrence of your calendar events. Updating the configuration sooner may trigger unnecessary recomputings for attributes using that calendar.
For example, if you add events in the future, then update time should be set at NOW. If you set an event at yesterday, then it should be set at yesterday also.

WebService configuration

When invoked from a WebService, use the following JSON:

{
  "updateTime" : "2017-06-15T00:00:00",
  "configuration": {
      "timeZone": "Europe/Paris",
      "rules": [
          {
            "period": "High",
            "ics": "BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTART:20160906T120000
DTEND:20160907T000000
RRULE:FREQ=DAILY
SEQUENCE:0
END:VEVENT
END:VCALENDAR"
          }
      ]
  }
}

Route configuration

When invoked from a routing context, use the following configuration:

<routes xmlns="http://camel.apache.org/schema/spring" xmlns:u="http://www.systar.com/aluminium/camel-util">
    <route>
        <from uri="timer://foo?repeatCount=1"/>
        <setBody>
            <u:map-create>
                <u:map-entry key="updateTime">
                    <simple resultType="org.joda.time.ReadableInstant">2017-06-15T00:00:00</simple>
                </u:map-entry>
                <u:map-entry key="configuration">
                    <u:map-create>
                        <u:map-entry key="timeZone">
                            <simple>Europe/Paris</simple>
                        </u:map-entry>
                        <u:map-entry key="rules">
                            <u:list-create>
                                <u:map-create>
                                    <u:map-entry key="period">
                                        <simple>High</simple>
                                    </u:map-entry>
                                    <u:map-entry key="ics">
                                        <simple>BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTART:20160906T120000
DTEND:20160907T000000
RRULE:FREQ=DAILY
SEQUENCE:0
END:VEVENT
END:VCALENDAR
                                        </simple>
                                    </u:map-entry>
                                </u:map-create>
                            </u:list-create>
                        </u:map-entry>
                    </u:map-create>
                </u:map-entry>
            </u:map-create>
        </setBody>
        <to uri="tnd-absorption:setActivityConfiguration"/>
    </route>
</routes

Related Links