Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle Business Rules Java API Reference 10g Release 3 (10.1.3) B19040-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.rules.sdk.editor.ruleset
Class Rule

`java.lang.Object
java.util.AbstractMap
java.util.HashMap
oracle.rules.sdk.editor.ruleset.RuleComponent
oracle.rules.sdk.editor.ruleset.Rule`

All Implemented Interfaces:
  java.lang.Cloneable, java.util.Map, java.io.Serializable

public class Rule
extends RuleComponent

A Rule consists of a table of `Pattern`s to be matched, and a table of `Action`s to be taken when a match occurs. See also `RuleSet`.

A Rule is structured as a set of nested tables.

        Rule
             Pattern Table
                 SimpleTest Table
             Action Table

E.g., The following rule has a PatternTable with 2 FactPatterns. Each fact pattern has one SimpleTest. The rule has an Action table with two actions. The second action has a parameter table with one parameter.

         Rule myRule
         {
            if ((patternA && patternA.x == 1) &&
                (patternB && patternB.y = patternA.y))
            {
                delete patternB;
                println(PatternB.y + "deleted");
            }
         }

The following applies to the Rule classes and to the nested classes it uses.

On output, String properties can be accessed using specific getters, such as getName(), or generic getters, such as getProperty("name"). There are corresponding methods for accessing option lists for the properties and the selected option. See `RuleComponent`

On input, property values can be set back into the same instances or into a copy (see RuleComponent copy()). If set into a copy, the apply method is used to update the original. On input, property values are always Strings.

Input events can be handled through use of specific methods on the classes or using theTableEditor class.

Validation is done when validate() is called rather than at set time.

See Also:
  Serialized Form

Field Summary
`static java.lang.String` | `PROP_ACTION_TABLE`
`static java.lang.String` | `PROP_NAME`
`static java.lang.String` | `PROP_PATTERN_TABLE`
`static java.lang.String` | `PROP_PRIORITY`

Method Summary
`Action` | `getAction(int i)` Shorthand for getActionTable.getAction(i)
`ActionTable` | `getActionTable()` table the actions for the rule
`java.lang.String` | `getName()` Get the name of the rule which must be unique within the rule set
`java.lang.String` | `getNameConstraint()`
`java.lang.String[]` | `getNameOptions()`
`int` | `getNameSelected()`
`Pattern` | `getPattern(int i)` Shorthand for getPatternTable.getPattern(i)
`PatternTable` | `getPatternTable()` table containing the patterns for the rule
`java.lang.String` | `getPriority()` Get a String containing a negative or positive integer.
`java.lang.String` | `getPriorityConstraint()`
`java.lang.String[]` | `getPriorityOptions()`
`int` | `getPrioritySelected()`
`java.lang.String[]` | `getPropertyNames()`
`void` | `setActionTable(ActionTable actionTable)`
`void` | `setName(java.lang.String name)` Set the name of the rule which must be unique within the rule set
`void` | `setNameConstraint(java.lang.String nameConstraint)`
`void` | `setNameOptions(java.lang.String[] nameOptions)`
`void` | `setPatternTable(PatternTable patternTable)`
`void` | `setPriority(java.lang.String priority)` Set a String containing a negative or positive integer.
`void` | `setPriorityConstraint(java.lang.String priorityConstraint)`
`void` | `setPriorityOptions(java.lang.String[] priorityOptions)`
`void` | `validate()` Validates the correctness of the RuleComponent and all RuleComponents below it.

Methods inherited from class oracle.rules.sdk.editor.ruleset.RuleComponent
`clear, discardCopy, get, get, getConstraint, getConstraintList, getCustom, getDescription, getID, getOptions, getParent, getParentTable, getRange, getSelected, put, remove, restoreCopy, saveCopy, setCustom, setDescription, toString`

Methods inherited from class java.util.HashMap
`clone, containsKey, containsValue, entrySet, isEmpty, keySet, putAll, size, values`

Methods inherited from class java.util.AbstractMap
`equals, hashCode`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.util.Map
`equals, hashCode`

Field Detail

### PROP_NAME

    public static final java.lang.String PROP_NAME

  See Also:
    Constant Field Values

### PROP_PRIORITY

    public static final java.lang.String PROP_PRIORITY

  See Also:
    Constant Field Values

### PROP_PATTERN_TABLE

    public static final java.lang.String PROP_PATTERN_TABLE

  See Also:
    Constant Field Values

### PROP_ACTION_TABLE

    public static final java.lang.String PROP_ACTION_TABLE

  See Also:
    Constant Field Values

Method Detail

### validate

    public void validate()
                  throws RuleEditorException,
                         RuleEditorSDKException

  Description copied from class: `RuleComponent`
  Validates the correctness of the RuleComponent and all RuleComponents below it.
  Overrides:
    `validate` in class `RuleComponent`
  Throws:
    `RuleEditorSDKException` - incorrect SDK usage
    `RuleEditorException` - for user input errors

### getPattern

    public Pattern getPattern(int i)

  Shorthand for getPatternTable.getPattern(i)
  Parameters:
    `i` - ordinal of pattern to retrieve from PatternTable
  Returns:
    the Pattern
  Throws:
    `java.lang.IndexOutOfBoundsException`

### getAction

    public Action getAction(int i)

  Shorthand for getActionTable.getAction(i)
  Parameters:
    `i` - ordinal of Action to retrieve from ActionTable
  Returns:
    the Action
  Throws:
    `java.lang.IndexOutOfBoundsException`

### getPropertyNames

    public java.lang.String[] getPropertyNames()

  Overrides:
    `getPropertyNames` in class `RuleComponent`

### getName

    public java.lang.String getName()

  Get the name of the rule which must be unique within the rule set

### setName

    public void setName(java.lang.String name)

  Set the name of the rule which must be unique within the rule set

### getNameConstraint

    public java.lang.String getNameConstraint()

### setNameConstraint

    public void setNameConstraint(java.lang.String nameConstraint)

### getNameOptions

    public java.lang.String[] getNameOptions()

### setNameOptions

    public void setNameOptions(java.lang.String[] nameOptions)

### getNameSelected

    public int getNameSelected()

### getPriority

    public java.lang.String getPriority()

  Get a String containing a negative or positive integer. Defaults to 0.

### setPriority

    public void setPriority(java.lang.String priority)

  Set a String containing a negative or positive integer. Defaults to 0.

### getPriorityConstraint

    public java.lang.String getPriorityConstraint()

### setPriorityConstraint

    public void setPriorityConstraint(java.lang.String priorityConstraint)

### getPriorityOptions

    public java.lang.String[] getPriorityOptions()

### setPriorityOptions

    public void setPriorityOptions(java.lang.String[] priorityOptions)

### getPrioritySelected

    public int getPrioritySelected()

### getPatternTable

    public PatternTable getPatternTable()

  table containing the patterns for the rule

### setPatternTable

    public void setPatternTable(PatternTable patternTable)

### getActionTable

    public ActionTable getActionTable()

  table the actions for the rule

### setActionTable

    public void setActionTable(ActionTable actionTable)

Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle Business Rules Java API Reference 10g Release 3 (10.1.3) B19040-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006, Oracle. All rights reserved.