Oracle Fusion Middleware Java API Reference for Oracle Business Rules
11g Release 1 (11.1.1.7)

E10663-11

oracle.rules.sdk2.decisiontable
Class RuleSheet

java.lang.Object
  extended by oracle.rules.sdk2.dictionary.DictionaryObject
      extended by oracle.rules.sdk2.dictionary.DictionaryComponent
          extended by oracle.rules.sdk2.ruleset.RuleComponent
              extended by oracle.rules.sdk2.ruleset.RuleCommon
                  extended by oracle.rules.sdk2.decisiontable.RuleSheet
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.String,java.lang.Object>

public class RuleSheet
extends RuleCommon

A RuleSheet represents a decision table. A RuleSheet provides model support for authoring a set of related rules. The rules share a common PatternTable, Dimensions, and DTActions. The PatternTable selects the fact type(s) for the decision table. Dimensions are the common part of rule conditions shared by all rules, typically a fact property such as "age". Each rule references a DimensionNode that contains one or more Buckets drawn from a Bucketset associated with the Dimension. The bucket value is combined with the Dimension to generate a rule condition, such as "age < 25". DTActions are the common part of actions, and may be parameterized.

Dimensions and DTActions can be reordered within the RuleSheet using DictionaryComponentTable.move(int,int,boolean) A RuleSheet may be flagged with "order rules by bucket". In this case, DTRules cannot be explicitly reordered. DTRules are ordered by the position of the DimensionNode Buckets in the containing Bucketset.

RuleSheet provides boolean properties to allow/disallow gaps and to automatically resolve conflicts by overriding subsuming rules. There is also a method to check for gaps RuleSheet.findGaps()

A base priority can be defined so that all rules in the sheet will have priority greater than or equal to the base.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class oracle.rules.sdk2.dictionary.DictionaryComponent
DictionaryComponent.Diff, DictionaryComponent.DiffType
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
static java.lang.String CONFLICT_AUTO_OVERRIDE
           
static java.lang.String CONFLICT_IGNORE
           
static java.lang.String CONFLICT_MANUAL
           
 
Fields inherited from class oracle.rules.sdk2.dictionary.DictionaryComponent
PROP_ACCESS, PROP_ACTION_SELECTED, PROP_ACTION_TABLE, PROP_ACTIVE, PROP_ADVANCED_MODE, PROP_AGGREGATE, PROP_AGGREGATE_TABLE, PROP_ALIAS, PROP_ALLOW_GAPS, PROP_ALWAYS_SELECTED, PROP_ARRAY, PROP_ARRAY_COMPONENT_TYPE, PROP_ARRAY_COMPONENT_TYPE_ID, PROP_ARRAY_FACT_TYPE_TABLE, PROP_AUTO_CONFLICT_RESOLUTION, PROP_AUTO_PATTERN_PROPERTY, PROP_BODY, PROP_BUCKET_ID_TABLE, PROP_BUCKET_SET, PROP_BUCKET_SET_ID, PROP_BUCKET_SET_TABLE, PROP_BUCKET_TABLE, PROP_CALENDAR_FORM, PROP_CHECK_RULE_FLOW, PROP_CHILD_DIMENSION_NODES, PROP_CONFLICT, PROP_CONFLICT_POLICY, PROP_CONNECTIVE, PROP_CONSTANT, PROP_CONSTRUCTOR, PROP_CONSTRUCTOR_TABLE, PROP_CREATION_UPDATE_NUMBER, PROP_CURSOR_POSITION, PROP_CUSTOM_BINDING, PROP_CUSTOMIZABLE, PROP_CUSTOMIZABLE_TEMPLATE, PROP_DATA_MODEL, PROP_DATA_SOURCE, PROP_DECISION_FUNCTION, PROP_DECISION_FUNCTION_INPUT_TABLE, PROP_DECISION_FUNCTION_OUTPUT_TABLE, PROP_DECISION_FUNCTION_RULESET_TABLE, PROP_DECISION_FUNCTION_TABLE, PROP_DESCRIPTION, PROP_DICTIONARY_LINK_TABLE, PROP_DIMENSION_NODE_TABLE, PROP_DIMENSION_TABLE, PROP_DT_ACTION_NODE_TABLE, PROP_DT_ACTION_PARAMETER_NAME, PROP_DTACTION_TABLE, PROP_DTRULE_TABLE, PROP_EFFECTIVE_END_DATE, PROP_EFFECTIVE_START_DATE, PROP_ENUM, PROP_ENUM_BUCKET_SET, PROP_ENUM_BUCKET_SET_ID, PROP_ENUM_TYPE, PROP_EXCEPTION_IDS, PROP_EXCEPTIONS, PROP_EXCLUDED, PROP_EXPRESSION, PROP_EXPRESSION_TABLE, PROP_FACT_PATH, PROP_FACT_PATH_IDS, PROP_FACT_TYPE, PROP_FACT_TYPE_ID, PROP_FACT_TYPE_TABLE, PROP_FIELD_TABLE, PROP_FINAL, PROP_FORM, PROP_FORMAL_PARAMETER_TABLE, PROP_FUNCTION, PROP_FUNCTION_ID, PROP_FUNCTION_SIGNATURE, PROP_FUNCTION_TABLE, PROP_GENERATED_FROM, PROP_ID, PROP_INCLUDED, PROP_INTERFACE, PROP_INTERFACE_IDS, PROP_INTERFACES, PROP_IS_ABSTRACT, PROP_IS_CONSTANT, PROP_IS_ENUM, PROP_IS_FINAL, PROP_IS_JAXB2, PROP_IS_PRIMARY_KEY, PROP_IS_STATIC, PROP_IS_TOPLEVEL_VIEW_OBJECT, PROP_LEFT, PROP_LIFECYCLE, PROP_LIFECYCLE_DESCRIPTION, PROP_LIST, PROP_LIST_CONTENT_TYPE, PROP_LIST_CONTENT_TYPE_ID, PROP_LOCAL, PROP_LOGICAL, PROP_METHOD_TABLE, PROP_MODIFIERS, PROP_NAME, PROP_NAMESPACE, PROP_NESTED_TABLE, PROP_NO_CONFLICT, PROP_NODE_NAME, PROP_OPERATOR, PROP_OPERATOR_ID, PROP_ORDER_RULES_BY_BUCKET, PROP_OTHERWISE, PROP_OUTPUT_TYPES, PROP_OVERLOADED_PARAMETER_TABLE, PROP_OVERRIDDEN_BY, PROP_OVERRIDE, PROP_PACKAGE, PROP_PARAMETER_ALIAS, PROP_PARAMETER_ID, PROP_PARAMETER_LIST, PROP_PARAMETER_NAME, PROP_PARAMETER_REQUIRED, PROP_PARAMETER_TYPE_IDS, PROP_PARAMETER_TYPES, PROP_PARENT_DIMENSION_NODE, PROP_PATTERN_TABLE, PROP_PREFIX_LINKED_NAMES, PROP_PRIORITY, PROP_PRIVATE_BUCKET_SET, PROP_PROPERTIES, PROP_PROPERTY_TABLE, PROP_READABLE, PROP_REF_ID, PROP_REPORT_BYUSE_NAMES, PROP_REPORT_PATTERNS, PROP_RESOLVED_TARGET, PROP_RESOLVED_VALUE, PROP_RESOURCE_BUNDLE, PROP_RETURN_TYPE, PROP_RIGHT, PROP_RIGHT_SEPARATOR, PROP_RULE_FIRING_LIMIT, PROP_RULE_FIRING_LIMIT_ERROR, PROP_RULE_REPORT_TABLE, PROP_RULE_SET_TABLE, PROP_RULE_SHEET_TABLE, PROP_RULE_TABLE, PROP_RULESET, PROP_RUN_AFTER, PROP_RUN_BEFORE, PROP_SERVICE_CONFIGURATION, PROP_SERVICE_NAME, PROP_SERVICE_NAMESPACE, PROP_SHARED_BUCKET_SET, PROP_SHARED_BUCKET_SET_ID, PROP_SHOW_CONSTANTS, PROP_SHOW_FUNCTIONS, PROP_SHOW_VARIABLES, PROP_SIMPLE_TEST_TABLE, PROP_SOURCE, PROP_STATELESS, PROP_STATIC, PROP_SUPER_CLASS, PROP_SUPER_CLASS_ID, PROP_SUPPORT_XPATH, PROP_SUPPORTS_XPATH_ENABLED, PROP_SYSTEM, PROP_TARGET, PROP_TARGET_PACKAGE, PROP_TEST_FORM, PROP_TIMESTAMP, PROP_TOKEN_UNDER_CURSOR, PROP_TRANSLATED_ALIAS, PROP_TRANSLATED_DESCRIPTION, PROP_TRANSLATED_PARAMETER_LIST, PROP_TRANSLATED_VARIABLE, PROP_TREE, PROP_TREE_MODE, PROP_TYPE, PROP_TYPE_ID, PROP_TYPE_IDS, PROP_TYPES, PROP_UNSAVED_TRANSLATED_ALIAS, PROP_UNSAVED_TRANSLATED_DESCRIPTION, PROP_UPDATE_NUMBER, PROP_UPDATE_TIME, PROP_VALIDATION_UPDATE_NUMBER, PROP_VALUE, PROP_VALUES, PROP_VARIABLE, PROP_VARIABLE_TABLE, PROP_VERSION, PROP_VISIBILITY_FILTER, PROP_VISIBILITY_FILTER_ENABLED, PROP_VISIBLE, PROP_WEB_SERVICE, PROP_WRITABLE, PROP_XML_NAME
 
Method Summary
 boolean canMerge(java.util.List<DimensionNode> nodes)
          Test if nodes can be merged.
 boolean canSpan()
          Test whether the rulesheet can be spanned.
 boolean canSpan(java.util.List<DimensionNode> nodes)
          Test if any of the nodes can be spanned.
 boolean canUnspan()
          Test whether the rulesheet can be unspanned.
 void compact()
          Compact all rules.
 void compact(java.util.List<DimensionNode> nodes)
          Compact the dimension nodes.
 java.util.List<Gap> findGaps()
          Find the Gaps (missing rules) in the decision table
 java.util.List<Action> getActions()
           
 ActionTable getActionTable()
           
 SettableProperty<java.lang.Boolean> getAllowGapsProperty()
          Get AllowGaps Property.
 TranslatedProperty getConflictPolicyProperty()
          Get Conflict Policy Property.
 DimensionTable getDimensionTable()
          Get DimensionTable
 TableProperty<Dimension> getDimensionTableProperty()
          Get DimensionTable Property
 DTActionTable getDTActionTable()
          Get DTActionTable
 TableProperty<DTAction> getDTActionTableProperty()
          Get DTActionTable Property
 DTRuleTable getDTRuleTable()
          Get DTRuleTable
 TableProperty<DTRule> getDTRuleTableProperty()
          Get DTRuleTable Property
 SettableProperty<java.lang.Boolean> getOrderRulesByBucketProperty()
          Get OrderRulesByBucket Property
 boolean hasConflict()
          whether the decision table has any unresolved conflicts
 boolean hasNoConflict()
          whether the decision table has any conflicts resolved as "no conflict"
 boolean hasOverride()
          whether the decision table has any conflicts resolved as override
 boolean hasRunBefore()
          whether the decision table has any conflicts resolved as "run before"
 boolean isAllowGaps()
          Are gaps allowed during validation?
 boolean isAutoConflictResolution()
          Deprecated. use RuleSheet.getConflictPolicyProperty() and test if the value is RuleSheet.CONFLICT_AUTO_OVERRIDE
 boolean isOrderRulesByBucket()
          whether rules in this DT are automatically ordered by bucket value
 void merge(boolean deep)
          Deprecated. use RuleSheet.compact()
 void merge(java.util.List<DimensionNode> nodes)
          Merge the dimension nodes.
 void merge(java.util.List<DimensionNode> nodes, boolean deep)
          Deprecated. use #merge(List), #compact(List), or #span(List)
 void optimizeDimensionOrder()
          Reorder Dimensions so that the DimensionNode tree has a "low" number of DimensionNodes.
 java.lang.Object put(java.lang.String key, java.lang.Object value)
          Generic property setter.
 boolean removeActionlessRules()
          Remove rules with no actions selected
 boolean removeActionlessRules(int minRuleIndex, int maxRuleIndex)
          Remove rules with index between minRuleIndex and maxRuleIndex inclusive with no actions selected
 void setAllowGaps(boolean flag)
          set whether gaps are allowed during validation
 void setAutoConflictResolution(boolean flag)
          Deprecated. use RuleSheet.getConflictPolicyProperty() and set the value to RuleSheet.CONFLICT_AUTO_OVERRIDE or RuleSheet.CONFLICT_MANUAL
 void setOrderRulesByBucket(boolean flag)
          set whether rules in this DT are automatically ordered by bucket value
 void span()
          Span all contiguous dimension nodes with sameBuckets.
 void span(java.util.List<DimensionNode> nodes)
          Span the consecutive dimension nodes with sameBuckets.
 void split()
          Split all nodes in all Dimensions into siblings such that each node has a single bucket value.
 void unspan()
          Unspan all dimension nodes.
 
Methods inherited from class oracle.rules.sdk2.ruleset.RuleCommon
getActiveProperty, getAdvancedModeProperty, getCalendarForm, getCalendarFormOptions, getCalendarFormProperty, getCalendarFormSelected, getEffectiveEndDate, getEffectiveEndDateProperty, getEffectiveStartDate, getEffectiveStartDateProperty, getLogicalProperty, getPattern, getPatterns, getPatternTable, getPatternTableProperty, getPriority, getPriorityOptions, getPriorityProperty, getReturnExpressionTableSize, getRoot, getSimpleTestTable, getTreeModeProperty, isActive, isAdvancedMode, isCustomizable, isLogical, isTreeMode, isValid, isVisible, mustBeAdvancedMode, mustNotBeTreeMode, setActive, setAdvancedMode, setCalendarForm, setCustomizable, setEffectiveEndDate, setEffectiveStartDate, setLogical, setPriority, setTreeMode
 
Methods inherited from class oracle.rules.sdk2.ruleset.RuleComponent
get, getParent, getParentTable, parentAction, parentActionContext, parentFunction, parentPattern, parentRule, parentRuleCommon, parentRuleSheet, parentVariable, RHSRuleVariables
 
Methods inherited from class oracle.rules.sdk2.dictionary.DictionaryComponent
clear, containsKey, containsValue, entrySet, get, getAlias, getAlias, getAlias, getAlias, getAliasProperty, getAllReferences, getCustom, getDependents, getDescription, getDescription, getDescriptionProperty, getDiff, getDiffProperties, getDiffs, getFullyQualifiedAlias, getFullyQualifiedName, getIndex, getIndex, getName, getNameProperty, getNext, getObjectPath, getOptions, getPrevious, getProperties, getProperty, getReferences, getSelected, getTranslatedAlias, getTranslatedAlias, getTranslatedDescription, hasDiff, init, init, isAliasDistinct, isEmpty, isFullyQualifiedName, isNameDistinct, isSystemProperty, isUnsavedTranslatedAlias, isUnsavedTranslatedDescription, keySet, putAll, remove, setAlias, setAlias, setCustom, setDescription, setDescription, setName, setTranslatedAlias, setTranslatedDescription, size, validate, validate, values
 
Methods inherited from class oracle.rules.sdk2.dictionary.DictionaryObject
equals, exists, getAEReferences, getCombinedDataModel, getContainedIDs, getContainedIDs, getDataModel, getDictionary, getID, getIndent, getLevel, getObjectType, getParentByClass, getParentComponent, getParentComponentTable, getParentObject, getRuleSet, getState, getWarnings, hashCode, isModified, validate
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

CONFLICT_MANUAL

public static final java.lang.String CONFLICT_MANUAL
See Also:
Constant Field Values

CONFLICT_AUTO_OVERRIDE

public static final java.lang.String CONFLICT_AUTO_OVERRIDE
See Also:
Constant Field Values

CONFLICT_IGNORE

public static final java.lang.String CONFLICT_IGNORE
See Also:
Constant Field Values
Method Detail

getActions

public java.util.List<Action> getActions()
Specified by:
getActions in class RuleCommon

getDimensionTableProperty

public TableProperty<Dimension> getDimensionTableProperty()
Get DimensionTable Property

Returns:
Dimension TableProperty of the RuleSheet

getDimensionTable

public DimensionTable getDimensionTable()
Get DimensionTable

Returns:
DimensionTable of the RuleSheet

getDTActionTableProperty

public TableProperty<DTAction> getDTActionTableProperty()
Get DTActionTable Property

Returns:
DTAction TableProperty of the RuleSheet

getDTActionTable

public DTActionTable getDTActionTable()
Get DTActionTable

Returns:
DTActionTable of the RuleSheet

getActionTable

public ActionTable getActionTable()

getDTRuleTableProperty

public TableProperty<DTRule> getDTRuleTableProperty()
Get DTRuleTable Property

Returns:
DTRule TableProperty of the RuleSheet

getDTRuleTable

public DTRuleTable getDTRuleTable()
Get DTRuleTable

Returns:
DTRuleTable of the RuleSheet

getOrderRulesByBucketProperty

public SettableProperty<java.lang.Boolean> getOrderRulesByBucketProperty()
Get OrderRulesByBucket Property

Returns:
boolean SettableProperty

isOrderRulesByBucket

public boolean isOrderRulesByBucket()
whether rules in this DT are automatically ordered by bucket value

Returns:
boolean flag

setOrderRulesByBucket

public void setOrderRulesByBucket(boolean flag)
set whether rules in this DT are automatically ordered by bucket value

Parameters:
flag -

optimizeDimensionOrder

public void optimizeDimensionOrder()
Reorder Dimensions so that the DimensionNode tree has a "low" number of DimensionNodes. Finding the absolute minimum by brute force could be an expensive undertaking (d!) so instead we sort the dimensions by increasing number of distinct node values.


findGaps

public java.util.List<Gap> findGaps()
Find the Gaps (missing rules) in the decision table

Returns:
List of Gaps

merge

@Deprecated
public void merge(boolean deep)
           throws SDKException
Deprecated. use RuleSheet.compact()

Merge all rules. To merge rules (and actions) along a single dimension such that dimension nodes have no siblings in that dimension, use Dimension.merge(). To merge all rules that share a DimensionNode (with choice of whether to merge actions), use DimensionNode.merge(boolean). To merge two sibling DimensionNodes into one with combined buckets, use DimensionNode.merge(DimensionNode).

Parameters:
deep - if false then a single rule will remain after the merge. If true then rules with identical action nodes will be merged. If there are no actions, then the deep flag is irrelevent.
Throws:
SDKException

compact

public void compact()
Compact all rules. Rules with identical action nodes will be merged. If there are no actions, then all rules are merged to 1.


span

public void span()
Span all contiguous dimension nodes with sameBuckets.


canSpan

public boolean canSpan()
Test whether the rulesheet can be spanned.


unspan

public void unspan()
Unspan all dimension nodes.


canUnspan

public boolean canUnspan()
Test whether the rulesheet can be unspanned.


merge

@Deprecated
public void merge(java.util.List<DimensionNode> nodes,
                             boolean deep)
Deprecated. use #merge(List), #compact(List), or #span(List)

merge the rules containing the listed nodes (which must be siblings). Merged rules will share a single dimension node with merged buckets from the list of nodes.

Parameters:
nodes - siblings to merge
deep - whether to merge descendants of listed nodes that lead to the same actions or just merge the nodes but not their descendants. When not deep, different actions may be merged into an invalid DTActionNode.
See Also:
RuleSheet.merge(boolean)

merge

public void merge(java.util.List<DimensionNode> nodes)
Merge the dimension nodes. May delete rules and merge rule actions. Does nothing if nodes are not siblings

Parameters:
nodes -

span

public void span(java.util.List<DimensionNode> nodes)
Span the consecutive dimension nodes with sameBuckets.

Parameters:
nodes -

canSpan

public boolean canSpan(java.util.List<DimensionNode> nodes)
Test if any of the nodes can be spanned.

Parameters:
nodes -

compact

public void compact(java.util.List<DimensionNode> nodes)
Compact the dimension nodes. Nodes with same actions may be merged.

Parameters:
nodes -
Throws:
java.lang.IllegalArgumentException - if nodes are not siblings

canMerge

public boolean canMerge(java.util.List<DimensionNode> nodes)
Test if nodes can be merged. True iff all nodes are siblings.

Parameters:
nodes -

split

public void split()
           throws SDKException
Split all nodes in all Dimensions into siblings such that each node has a single bucket value. After the split, the rule sheet may be very large, but will not have overlaps.

Throws:
SDKException

removeActionlessRules

public boolean removeActionlessRules()
Remove rules with no actions selected

Returns:
whether rules were removed

removeActionlessRules

public boolean removeActionlessRules(int minRuleIndex,
                                     int maxRuleIndex)
Remove rules with index between minRuleIndex and maxRuleIndex inclusive with no actions selected

Returns:
whether rules were removed

getAllowGapsProperty

public SettableProperty<java.lang.Boolean> getAllowGapsProperty()
Get AllowGaps Property.

Returns:
boolean SettableProperty

isAllowGaps

public boolean isAllowGaps()
Are gaps allowed during validation?

Returns:
boolean flag

setAllowGaps

public void setAllowGaps(boolean flag)
set whether gaps are allowed during validation

Parameters:
flag -

getConflictPolicyProperty

public TranslatedProperty getConflictPolicyProperty()
Get Conflict Policy Property. Options are "manual", "auto override", and "ignore"

Returns:
String SettableProperty

isAutoConflictResolution

@Deprecated
public boolean isAutoConflictResolution()
Deprecated. use RuleSheet.getConflictPolicyProperty() and test if the value is RuleSheet.CONFLICT_AUTO_OVERRIDE

whether conflicts where ruleX's condition subsumes ruleY's condition are resolved automatically by ruleY overriding ruleX

Returns:
boolean flag

setAutoConflictResolution

@Deprecated
public void setAutoConflictResolution(boolean flag)
Deprecated. use RuleSheet.getConflictPolicyProperty() and set the value to RuleSheet.CONFLICT_AUTO_OVERRIDE or RuleSheet.CONFLICT_MANUAL

set whether conflicts are resolved automatically.

Parameters:
flag -
See Also:
RuleSheet.isAutoConflictResolution()

hasNoConflict

public boolean hasNoConflict()
whether the decision table has any conflicts resolved as "no conflict"

Returns:
boolean flag

hasOverride

public boolean hasOverride()
whether the decision table has any conflicts resolved as override

Returns:
boolean flag

hasRunBefore

public boolean hasRunBefore()
whether the decision table has any conflicts resolved as "run before"

Returns:
boolean flag

hasConflict

public boolean hasConflict()
whether the decision table has any unresolved conflicts

Returns:
boolean flag

put

public java.lang.Object put(java.lang.String key,
                            java.lang.Object value)
Description copied from class: DictionaryComponent
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.

Specified by:
put in interface java.util.Map<java.lang.String,java.lang.Object>
Overrides:
put in class RuleCommon
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

Oracle Fusion Middleware Java API Reference for Oracle Business Rules
11g Release 1 (11.1.1.7)

E10663-11

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.