Class JsonRule

java.lang.Object
org.openremote.model.rules.json.JsonRule

public class JsonRule extends Object
A declarative rule definition a.k.a. JSON rules; consists of:

LHS

when - A series of grouped RuleConditions to which bitwise operations can be performed based on the LogicGroup.operator of each group. These are used to filter AttributeInfos in the RuleEngine that this rule is loaded into to determine which Assets match; if one or more assets match then the RHS then will be triggered. Once a rule is triggered the AttributeInfos that triggered the rule cannot trigger the rule again until it no longer matches (within the context of the RuleCondition i.e. an AttributeInfo can re-trigger a rule if it is matched by a different RuleCondition)

The otherwise RuleActions are applied to the Assets filtered by the query that don't match the AssetQuery.attributes predicates. when must evaluate to true and this condition must evaluate to true.

RHS

then - Defines a series of RuleActions to perform when the bitwise result of applying all RuleConditions in the when is true.

otherwise - Defines a series of RuleActions to perform when there is one or more asset that matched rule doesn't match the assets specified in the when. The list of assets this applies to is the assets filtered by applying the when but excluding the AssetQuery.attributes predicates and excluding any assets that match the entire when. If the number of these assets is greater than 0 then these RuleActions will be executed.