Extension point for defining kit rules.<font color="red">Important Note: The Rules framework is in preliminary design stage, and subject to API changes. </font>(c) SAP AG 2003-2006. All rights reserved.
Gets a helper object for parsing rules.
Defines a new rule.The rule definition object.Indicates whether to allow debugging.The newly defined rule.
Defines a rule helper function.The rule Id.The classifier name.The classifier type name. Can any qualified GML class name as well as primitive JS classes (String, Number, Boolean).The classifier computation expression (if omitted, the expression is taken to be equal to <code>name)</code>This method defines a new rule classifier, according to:
<ul><li>The classifier is computed in terms of the rule parameters. The classifier computation expression must evaluate to the specified classifier type. </li><li>The order in which the classifiers are defined determines the evaluation order of the rule constraints. </li><li>Rule classifiers can be defined at any point after the rule is defined but before it is used for the first time. This enables defining new classifiers even in extension kits. </li></ul>
Defines a rule helper function.The rule Id.The helper function name (should be unique within the scope of the rule).The function object.Indicates whether the helper was successfully defined.
Executes a rule.The rule Id.The rule arguments.The rule execution result.
Extends a rule by adding a new constrained behavior.The rule Id.The constraint definition.
Returns a specified rule object.The rule Id.The requested rule object.
Returns the complete rules table.Table of rule objects, indexed by rule id.Rule id's are stored in uppercase. Use <q ref="core.lib:Basic!UPPER">UPPER</q> macro to convert the rule id to uppercase
before using it as the index in this table.
Parses an XML object containing a collection of rule definitions.The rules XML object.The source file from which the XML object was read.
Reloads a specified rule.The rule Id.Indicates whether to suppress errors reporting.Indicates whether to allow debugging.Indicates whether the rule was successfully reloaded. In case of failure, use the $ENV.getKitErrors() to obtain the detailed error messages.
Removes a specified rule definition.The rule Id.
Represents a rule constraint.The CONSTRAINT_DEF structure is made of:
<table class="BOTH"><tr><td class="H V">Name </td><td class=H>Type </td><td class=H>Description </td></tr><tr><td class=V>constraint </td><td>String </td><td>The constraint expressed using the constraints syntax below. </td></tr><tr><td class=V>behavior </td><td>Function </td><td>The rule behavior when the constraint is satisfied. The behavior function can be defined using different forms, as described below. </td></tr><tr><td class=V>undo </td><td>Function </td><td>The rule undo when the constraint is satisfied. The undo function can be defined using different forms, as described below. </td></tr><tr><td class=V>redo </td><td>Function </td><td>The rule redo when the constraint is satisfied. The redo function can be defined using different forms, as described below. </td></tr><tr><td class=V>predicate </td><td>Function </td><td>Deprecated. An optional predicate that can be used to define conditional constraints. If provided, the constraint will be applied only if the predicate evaluates to <code>true.</code> The predicate function can be defined using different forms, as described below. </td></tr><tr><td class=V>comments </td><td>String </td><td>Optional. Comments for describing the constraint behavior. </td></tr></table>
<p>A constraint expression has the following syntax:</p>
<pre>
<i>constraint</i>:
<i>constraint-clause</i>
<i>constraint-clause</i> <i>or-operator</i> <i>constraint</i>
<b>(</b> <i>constraint</i> <b>)</b>
<i>constraint-clause</i>:
<i>constraint-term</i>
<i>constraint-term</i> <i>and-operator</i> <i>constraint-clause</i>
<i>constraint-term</i>:
<i>classifier</i> <i>isa-operator</i> <i>gml-operand</i>
<i>classifier</i> <i>isa-operator</i> <b>{</b> <i>gml-operand1</i>, <i>gml-operand2</i>, ... <b>}</b>
<i>classifier</i> <i>islike-operator</i> <i>string-operand</i>
<i>classifier</i> <i>isequal-operator</i> <i>operand</i>
<i>classifier</i> <i>notequal-operator</i> <i>operand</i>
<i>classifier</i>:
any classifier name
<i>operator</i>:
<i>or-operator</i>
<i>and-operator</i>
<i>isa-operator</i>
<i>islike-operator</i>
<i>isequal-operator</i>
<i>notequal-operator</i>
<i>or-operator</i>:
<b>or</b>
<b>||</b>
<i>and-operator</i>:
<b>and</b>
<b>&&</b>
<i>isa-operator</i>:
<b>isA</b>
<b><code>=</b></code>
<i>islike-operator</i>:
<b>isLike</b>
<b><code>=</b></code>
<i>isequal-operator</i>:
<b>isEqual</b>
<b>==</b>
<i>notequal-operator</i>:
<b>notEqual</b>
<b>!=</b>
<i>operand</i>:
gml-operand
string-operand
numeric-operand
boolean-operand
<i>gml-operand</i>:
any gmldom class name
<i>string-operand</i>:
<b>"</b> any string <b>"</b>
<b>'</b> any string <b>'</b>
<i>numeric-operand</i>:
any number
<i>boolean-operand</i>:
<b>true</b>
<b>false</b>
</pre>
Additional notes about the constraints syntax:
<ol><li>The operators are case-insensitive </li><li>The operators have the following precedence order (from lowest to highest): <ul><li>or </li><li>and </li><li>isA, isLike, isEqual, notEqual </li></ul> </li><li>Parantheses can be used for legibility. However, the parantheses are discarded before the constraint is parsed and thus do not affect the precedence order. </li><li>A classifier can be used at most once within the same constraint-term. </li></ol>
The behavior functions can be defined using any one of the following forms:
<ol><li>A function with same parameters signature as the rule </li><li>A function without parameters (the rule parameters can still be referenced directly by their name) </li><li>A string containing the function body (the rule parameters can be referenced directly by their name) </li></ol>
Represents a Storyboard rule definition.The RULE_DEF structure is made of:
<table class="BOTH"><tr><td class="H V">Name </td><td class=H>Type </td><td class=H>Description </td></tr><tr><td class=V>id </td><td>QName </td><td>The rule Id. Must be fully qualified (e.g. com.sap.mypackage:id) </td></tr><tr><td class=V>name </td><td>String </td><td>Optional. Display name for the rule. </td></tr><tr><td class=V>icon </td><td>String </td><td>Optional. Display icon for the rule. </td></tr><tr><td class=V>description </td><td>String </td><td>Optional. The rule description. </td></tr><tr><td class=V>parameters </td><td>String </td><td>The rule parameters. This is a comma-separated list of the rule parameters, where each parameter is given as a type+name pair (separated by whitespace). </td></tr><tr><td class=V>classifiers </td><td>String </td><td>The rule classifiers. This is a comma-separated list of the parameter names that are used for classifying the rule constraints. The classifiers are listed from the most important to the least important. All classifiers must be parameters of type GMLDOM object/class. </td></tr><tr><td class=V>returnValue </td><td>String </td><td>The rule return value (default is Boolean) </td></tr><tr><td class=V>constraints </td><td><nobr><q ref="core.env:KitRules!CONSTRAINT_DEF">CONSTRAINT_DEF</q>[]</nobr> </td><td>The list of rule constraints </td></tr><tr><td class=V>declarative </td><td>Boolean </td><td>Indicates whether the rule is declarative (default is <code>false).</code> A declarative rule is a rule whose behavior is defined without code. </td></tr><tr><td class=V>additive </td><td>Boolean </td><td>Indicates whether the rule constraints are additive. That is, all matching rule constraints are applied in increasing order of specificity. Default is <code>false.</code> </td></tr><tr><td class=V>restrictive </td><td>Boolean </td><td>Indicates whether the rule constraints are restrictive. That is, from the set of matching rule constraints only the most specific one is applied. Default is <code>true.</code> </td></tr><tr><td class=V>transactive </td><td>Boolean </td><td>Indicates whether the rule is transactional (default is <code>false).</code> A transactive rule is implicitly also a restrictive rule. </td></tr><tr><td class=V>protected </td><td>Boolean </td><td>Indicates whether the rule is protected (default is <code>false).</code> A protected rule can be extended only within the package in which it is defined. </td></tr><tr><td class=V>inlineCode </td><td>Boolean </td><td>Indicates whether to use inline code in the compiled rule for speed (default is <code>true).</code> </td></tr><tr><td class=V>behavior </td><td>Function </td><td>The default rule behavior when no rule constraints have been satisfied. The behavior function can be defined using different forms, as described in <q ref="core.env:KitRules!CONSTRAINT_DEF">CONSTRAINT_DEF</q>. </td></tr><tr><td class=V>undo </td><td>Function </td><td>The default rule undo when no rule constraints have been satisfied. The undo function can be defined using different forms, as described in <q ref="core.env:KitRules!CONSTRAINT_DEF">CONSTRAINT_DEF</q>. </td></tr><tr><td class=V>redo </td><td>Function </td><td>The default rule redo when no rule constraints have been satisfied. The redo function can be defined using different forms, as described in <q ref="core.env:KitRules!CONSTRAINT_DEF">CONSTRAINT_DEF</q>. </td></tr><tr><td class=V>initialize </td><td>Function </td><td>The rule initialization code. The initialization code is executed just before the rule behaviors are executed. </td></tr><tr><td class=V>finalize </td><td>Function </td><td>The rule finalization code. The finalization code is executed just after the rule behaviors are executed. </td></tr><tr><td class=V>parser </td><td>Function </td><td>The rule parsing code. The parsing code is used for parsing declarative rules in XML format. </td></tr><tr><td class=V>onreload </td><td>Function </td><td>The rule reloading handler. The reloading handler is executed just after the rule is reloaded (e.g., by the sdk tools) and can be used to refresh relevant parts of the workspace that may depend on the reloaded rule. The reloading handler is not invoked when the rule is first loaded (during kits installation). </td></tr><tr><td class=V>comments </td><td>String </td><td>Optional. Comments for describing the default rule behavior. </td></tr></table>
Notes:
<ol><li>The additive and restrictive flags are mutually exclusive. </li><li>A transactive rule is implicitly also a restrictive rule. </li></ol>