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 RuleComponent

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

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

Direct Known Subclasses:
  Action, AdvancedExpression, Expression, Pattern, Rule, RuleSet, SimpleTest

public abstract class RuleComponent
extends java.util.HashMap

RuleComponent is an Abstract Class which enables access to properties through generic accessors by extending HashMap.

The generic get and set can also be used to set additional custom properties which will be stored with the rule component when it is serialized (comments for example). A custom property value must be a String. To avoid collisions, its name must end with "Custom" (@see Util#CUSTOM).

For String property named X, there are corresponding properties

        getX()                    return the value of X
        get ("X")

        setX ("myValue")          assign "myValue" to X
        put ("X", "myValue")

        getXOptions()             return a String array of option choices
        get("X" + Util.OPTIONS)
        getOptions("X")

        setXOptions(myOptionArray) set the options array, overrides SDK setting
        put ("X" + Util.OPTIONS, myOptionArray)

        getXSelected()            return index of selection in options Array
        get("X" + Util.SELECTED)  (cannot be set)
        getSelected ("X")

        getXConstraint()          return name of data model constraint on X
        get("X" + Util.CONSTRAINT)
        getConstraint ("X")

        setXConstraint("Cname")   return name of data model constraint on X
        set("X" + Util.CONSTRAINT, "Cname")

See Also:
  Serialized Form

Method Summary
`void` | `clear()` HashMap.clear() is overridden to set the RuleComponent tree to its initial state.
`void` | `discardCopy()` Discards the most recent saved copy.
`java.lang.Object` | `get(java.lang.Object key)` Generic property getter inheirited from `RuleComponent`.
`RuleComponent` | `get(java.lang.String tableName, int index)` Returns the RuleComponent at the given index from the named RuleComponentTable.
`java.lang.String` | `getConstraint(java.lang.String propertyName)` Returns the option list for the property, if any.
`java.lang.String[]` | `getConstraintList(java.lang.String propertyName)`
`java.lang.String` | `getCustom(java.lang.String propertyName)` Returns the value of the input custom property.
`java.lang.String` | `getDescription()` Returns the user supplied description of this rule component.
`java.lang.String` | `getID()` Returns a unique ID for each rule component in the edit session.
`java.lang.String[]` | `getOptions(java.lang.String propertyName)` Returns the option array for the property, if any.
`RuleComponent` | `getParent()`
`RuleComponentTable` | `getParentTable()`
`java.lang.String[]` | `getPropertyNames()`
`java.lang.Double[]` | `getRange(java.lang.String propertyName)`
`int` | `getSelected(java.lang.String propertyName)` Returns the index of the selected option in the list returned by getOptions().
`java.lang.Object` | `put(java.lang.Object key, java.lang.Object value)` Generic property setter.
`java.lang.Object` | `remove(java.lang.Object key)` HashMap.remove() is overridden to allow only custom properties, constraints, and program set options to be removed.
`void` | `restoreCopy()` Restores the RuleComponent's properties to their state at the time of the last saveCopy().
`void` | `saveCopy()` Creates a deep copy of this RuleComponent so that a restore can be performed later.
`void` | `setCustom(java.lang.String propertyName, java.lang.String value)` Sets the value of the input custom property.
`void` | `setDescription(java.lang.String description)` Sets the user supplied description of this rule component.
`java.lang.String` | `toString()`
`void` | `validate()` Validates the correctness of the RuleComponent and all RuleComponents below it.

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`

Method Detail

### get

    public java.lang.Object get(java.lang.Object key)

  Generic property getter inheirited from `RuleComponent`.

  Please see the specific bean class for a list of properties.

  Parameters:
    `key` - a String containing the property name to be fetched.
  Returns:
    the value corresponding to the key: a String, String[], RuleComponent, or RuleComponentTable

### put

    public java.lang.Object put(java.lang.Object key,
                                java.lang.Object value)

  Generic property setter. Throws runtime exceptions for incorrect arguments. Please see the specific bean class for a list of properties, their types, and permissible values.

  A put() with either null key or null value throws a NullPointerException.

  A put() with a key that is not a String throws a ClassCastException

  A put() of a value that is not of the correct type for the key throws a ClassCastException.

  Bean properties which have no set() method are read only, and cannot be modified using the put(). Attempting to do so throws a runtime IllegalArgumentException. PROP_ID, and PROP_*_SELECTED are always read only.

  Parameters:
    `key` - the key of the property to set
    `value` - the value of the named property to set
  Returns:
    the previous value of the property
  Throws:
    `java.lang.NullPointerException` - if key or value is null
    `java.lang.ClassCastException` - if key is not a String or value is not of right class for key
    `java.lang.IllegalArgumentException` - if attempt is made to change a read only property, or if options or constraint list are not a subset of system allowable options.

### clear

    public void clear()

  HashMap.clear() is overridden to set the RuleComponent tree to its initial state.

### remove

    public java.lang.Object remove(java.lang.Object key)

  HashMap.remove() is overridden to allow only custom properties, constraints, and program set options to be removed.
  Parameters:
    `key` - the property to remove
  Throws:
    `java.lang.ClassCastException` - if key is not a String
    `java.lang.IllegalArgumentException` - if key does not end with Util.CUSTOM or Util.OPTIONS or Util.CONSTRAINT

### get

    public RuleComponent get(java.lang.String tableName,
                             int index)

  Returns the RuleComponent at the given index from the named RuleComponentTable. Shorthand for:

          (RuleComponent)(((RuleComponentTable)(get ("myTable"))).get(i));

  Parameters:
    `tableName` - a String property which must be the name of a RuleComponentTable
    `index` - of the requested RuleComponent
  Returns:
    the RuleComponent at the requested index

### getRange

    public java.lang.Double[] getRange(java.lang.String propertyName)

  Parameters:
    `propertyName` -
  Returns:
    the low and high values allowed for this integer property, null if not applicable

### validate

    public void validate()
                  throws RuleEditorException,
                         RuleEditorSDKException

  Validates the correctness of the RuleComponent and all RuleComponents below it.
  Throws:
    `RuleEditorException` - for user input errors
    `RuleEditorSDKException` - incorrect SDK usage

### getDescription

    public java.lang.String getDescription()

  Returns the user supplied description of this rule component. Defaults to "", must be set using setDescription()
  Returns:
    the user supplied description of the RuleComponent

### setDescription

    public void setDescription(java.lang.String description)

  Sets the user supplied description of this rule component.

### getID

    public java.lang.String getID()

  Returns a unique ID for each rule component in the edit session. ID is only valid for the length of the edit session.
  Returns:
    the unique editing ID of the RuleComponent

### saveCopy

    public void saveCopy()

  Creates a deep copy of this RuleComponent so that a restore can be performed later. Copies are stacked, enabling multiple restore points.

### discardCopy

    public void discardCopy()
                     throws RuleEditorException

  Discards the most recent saved copy.
  Throws:
    `RuleEditorException` - if there are no more saved copies on the stack.
    `RuleEditorException` - if there are no more saved copies on the stack.

### restoreCopy

    public void restoreCopy()
                     throws RuleEditorException

  Restores the RuleComponent's properties to their state at the time of the last saveCopy().
  Throws:
    `RuleEditorException` - if there are no more saved copies on the stack.

### getConstraintList

    public java.lang.String[] getConstraintList(java.lang.String propertyName)

### getConstraint

    public java.lang.String getConstraint(java.lang.String propertyName)

  Returns the option list for the property, if any. Shorthand for:

          (String)(get (propertyName + Util.CONSTRAINT))

  Parameters:
    `propertyName` - a String property with an option list
  Returns:
    the constraint or null if no constraint is set for the property

### getOptions

    public java.lang.String[] getOptions(java.lang.String propertyName)

  Returns the option array for the property, if any. This may be the system default options, the String array set by setOptions(), or the ENUM list set by setConstraint(). Shorthand for:

          (String[])(get (propertyName + Util.OPTIONS))

  Parameters:
    `propertyName` - a String property with an option list
  Returns:
    index of the selected option in the list return by getOptions

### getSelected

    public int getSelected(java.lang.String propertyName)

  Returns the index of the selected option in the list returned by getOptions(). Shorthand for:

          ((Integer)(get (propertyName + Util.SELECTED))).intValue()

  Parameters:
    `propertyName` - a String property with an option list
  Returns:
    index of the selected option in the list return by getOptions

### getCustom

    public java.lang.String getCustom(java.lang.String propertyName)

  Returns the value of the input custom property. Shorthand for:

          (String)(get (propertyName + Util.CUSTOM))

  Parameters:
    `propertyName` - custom property name without the Util.CUSTOM suffix
  Returns:
    the value of the String property, or null if not found

### setCustom

    public void setCustom(java.lang.String propertyName,
                          java.lang.String value)

  Sets the value of the input custom property. If the property exists, value is replaced, otherwise, a new custom property is created. Type safe shorthand for:

          put (propertyName + Util.CUSTOM, value))

  Parameters:
    `propertyName` - custom property name without the Util.CUSTOM suffix

### getParent

    public RuleComponent getParent()

### getParentTable

    public RuleComponentTable getParentTable()

### getPropertyNames

    public java.lang.String[] getPropertyNames()

### toString

    public java.lang.String toString()

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.