Alarms, triggers and actions
The alarm runs its rule sets over all EPCISDocuments that are imported, where the rules triggers (conditions) are tested and actions are executed when all conditions for a rule are satisfied.
DomContext
The triggers and actions available are controlled by the DomContext, context that lets you use XPATH to express triggers for the alarm.
Method | Parameter | Description | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
stringValue |
| Returns the String value of the document evaluated | ||||||||||||||
xmlValue |
| Returns the XML value of the document evaluated | ||||||||||||||
numberValue |
| Returns the number or NaN if the context can't be parsed to a number | ||||||||||||||
timeValue |
| Returns the DateTime of the context or time 0 if the context can't be parsed to a number | ||||||||||||||
xpath | expression | Returns the result from evaluating an XPATH expression | ||||||||||||||
action |
| Methods available on actions.
| ||||||||||||||
Trigger Examples
rule "tigger on ADD action" when $bn : DomContext( xpath( "//ObjectEvent/action" ).stringValue() == "ADD" ) then .... endrule "tigger on temperature extension" when $bn : DomContext( xpath( "//ObjectEvent/ttdata:temperature" ).numberValue() > 50 ) then .... endrule "tigger on time" when $bn : DomContext( ) eval( $bn.xpath( "//ObjectEvent/eventTime" ).timeValue().after( new java.util.Date( 2010,1,1 ) ) ) then .... endAction Examples
rule "Mail the EPCISDocument" when $bn : DomContext( ) then $bn.action().mail( "email@address.com", "Imported EPCISDocument", $bn.xmlValue() )endrule "Post the EPCISDocument" when $bn : DomContext( ) then $bn.action().post( "https://no-auth.server", $bn.xmlValue() ); $bn.action().post( "https://basic-auth.server", $bn.xmlValue(), "username", "password" );end