Chapter 1 Rule Language Grammar : Accessing Concept and Event Properties

Accessing Concept and Event Properties
This section describes how to access concept properties and event properties using the BusinessEvents language.
Concept Property Atom
This is the syntax for accessing a concept property atom:
 
instanceName.propertyName
where instanceName is the identifier of the concept instance, and propertyName is the name of the concept property that you want to access.
For example to get the current value of the cost propertyAtom:
 
int x = instanceA.cost;
For example, to set a value with the current system time stamp:
 
instanceA.cost = value;
Get and Set PropertyAtom Value With User-Specified Time
You can get and set PropertyAtom values as follows:
   type Instance.PropertyAtom.gettype(PropertyAtom propertyAtomName, \
                                  long time)
where type is the type of the PropertyAtom and propertyAtomName is the name of the PropertyAtom, and time is the time from which you want to retrieve the value.
   Instance.PropertyAtom.settype(PropertyAtom propertyAtomName, \
                               type value, long time)
where type is the type of the PropertyAtom and the type of the new value, propertyAtomName is the name of the PropertyAtom, value is the value to store in the ring buffer, and time is the time stamp for the new entry.
BusinessEvents manages these requests as follows:
If the ring buffer has vacancies, BusinessEvents inserts the new entry into the correct place based on its time stamp, shifts the older values out one place, and returns True.
If the ring buffer is full, and the new value has a more recent time stamp than the oldest value, BusinessEvents inserts the new value into the correct place, shifts older values if necessary, drops the oldest value, and returns True.
If the ring buffer is full, and the new value has a time stamp that is older than the oldest value in the ring buffer, BusinessEvents does not insert the new value into the ring buffer, and it returns False.
Concept Property Array
This is the syntax for accessing a concept property array:
 
instanceName.propertyName
where instanceName is the identifier of the concept instance, and propertyName is the name of the concept property that you want to access.
Accessing a Value in the Property Array
To access a value in a property array, identify the position in the array of the value as shown:
 
instanceName.propertyName[indexPosition]
For example:
 
String x = instanceA.lineItem[0];
This gets the current value of the first property atom in the array, lineItem, and assigns it to the local variable, x.
Array index difference  In the BusinessEvents language, array indexes start from zero (0). However, in XSLT and XPath languages, they start from one (1). It’s important to remember this difference when using the rule language in the rule editor, and when working in the XSLT mapper and the XPath builder.
Adding a Value to a Property Array
You can append a value to the end of a property array — you cannot add a value to any other position in an array. This is the syntax:
 
instanceName.propertyName[indexPosition] = value
To use the syntax shown above you must know the index position of the end of the array. You can append a value to the end of an array without knowing the index position of the end of the array using the @length attribute as shown:
 
instanceName.propertyName[instanceName.propertyName@length] = value
Event Property
This is the syntax for accessing an event property:
 
eventName.propertyName
For example:
 
String x = eventA.customer;
where eventName is the identifier of the concept instance and propertyName is the name of the event property that you want to access.