Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.3.0)

E17493-04


oracle.ide.extension.rules
Class RuleEngine

java.lang.Object
  extended by oracle.ide.extension.rules.RuleEngine


public final class RuleEngine
extends java.lang.Object

Method Summary
 boolean evaluateRule(java.lang.String ruleId, Context ideContext)
          Evaluates the rule identified by the given ruleId and returns the boolean result (using a simple RuleEvaluationContext based on the given IDE Context object).
 boolean evaluateRule(java.lang.String ruleId, RuleEvaluationContext ruleContext)
          Evaluates the rule identified by the given ruleId and returns the boolean result.
 boolean evaluateRuleOrThrow(java.lang.String ruleId, Context ideContext)
          Evaluates the rule identified by the given ruleId (using a RuleEvaluationContext created for the given IDE Context object).
 boolean evaluateRuleOrThrow(java.lang.String ruleId, RuleEvaluationContext ruleContext)
          Evaluates the rule identified by the given ruleId and returns the boolean result.
static RuleEngine getInstance()
           
 Rule getRule(java.lang.String id)
          Returns the registered Rule with the given id, or null if no such Rule is registered
 RuleType getRuleType(java.lang.String id)
          Returns the registered RuleType with the given id, or null if no such RuleType is registered
 boolean isKnownRule(java.lang.String ruleId)
          Returns true if a rule with the given ruleId has previously been registered with the RuleEngine
 boolean matchesType(java.lang.String ruleId, java.util.Set<java.lang.String> ruleTypeIdSet)
          Returns true if a rule with the given ruleId has previously been registered and the rule's type is identified in the given ruleTypeIdSet.
 boolean registerRule(Rule rule)
          Attempts to register the given Rule with the RuleEngine.
 boolean registerRuleType(RuleType ruleType)
          Attempts to register the given RuleType with the RuleEngine.
 boolean validateRuleReference(java.lang.String ruleId, ElementContext referenceContext)
          Convenience method for validating a rule reference.
 boolean validateRuleReference(java.lang.String ruleId, java.util.Set<java.lang.String> expectedRuleTypes, ElementContext referenceContext)
          Convenience method for validating a rule reference.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Method Detail

getInstance

public static RuleEngine getInstance()

evaluateRule

public final boolean evaluateRule(java.lang.String ruleId,
                                  Context ideContext)
Evaluates the rule identified by the given ruleId and returns the boolean result (using a simple RuleEvaluationContext based on the given IDE Context object). If the given rule does not exist or there is a problem evaluating the rule, this version of the method will log the exceptions and return false. If instead, the caller would like to process the exceptions, see the evaluateRuleOrThrow() methods.
Parameters:
ruleId -
ideContext -
Returns:
Throws:
RuleEvaluationException

evaluateRule

public boolean evaluateRule(java.lang.String ruleId,
                            RuleEvaluationContext ruleContext)
Evaluates the rule identified by the given ruleId and returns the boolean result. If the given rule does not exist or there is a problem evaluating the rule, this version of the method will log the exceptions and return false. If instead, the caller would like to process the exceptions, see the evaluateRuleOrThrow() method.
Parameters:
ruleId -
ruleContext -
Returns:
Throws:
RuleEvaluationException

evaluateRuleOrThrow

public final boolean evaluateRuleOrThrow(java.lang.String ruleId,
                                         Context ideContext)
                                  throws RuleEvaluationException
Evaluates the rule identified by the given ruleId (using a RuleEvaluationContext created for the given IDE Context object). Returns the boolean result. This method logs and throws a RuleEvaluationException if the rule does not exist or there is a problem evaluating the rule.
Parameters:
ruleId -
ideContext -
Returns:
Throws:
RuleEvaluationException

evaluateRuleOrThrow

public boolean evaluateRuleOrThrow(java.lang.String ruleId,
                                   RuleEvaluationContext ruleContext)
                            throws RuleEvaluationException
Evaluates the rule identified by the given ruleId and returns the boolean result. This method logs and throws a RuleEvaluationException if the rule does not exist or there is a problem evaluating the rule.
Parameters:
ruleId -
ruleContext -
Returns:
Throws:
RuleEvaluationException

registerRuleType

public boolean registerRuleType(RuleType ruleType)
Attempts to register the given RuleType with the RuleEngine. Returns true if the registration was successful, returns false if an exisiting RuleType with the same ID is already registered.
Parameters:
ruleType -
Returns:

getRuleType

public RuleType getRuleType(java.lang.String id)
Returns the registered RuleType with the given id, or null if no such RuleType is registered
Parameters:
id -
Returns:

registerRule

public boolean registerRule(Rule rule)
Attempts to register the given Rule with the RuleEngine. Returns true if the registration was successful, returns false if an exisiting Rule with the same ID is already registered.
Parameters:
rule -
Returns:

getRule

public Rule getRule(java.lang.String id)
Returns the registered Rule with the given id, or null if no such Rule is registered
Parameters:
id -
Returns:

isKnownRule

public boolean isKnownRule(java.lang.String ruleId)
Returns true if a rule with the given ruleId has previously been registered with the RuleEngine
Parameters:
ruleId -
Returns:

matchesType

public boolean matchesType(java.lang.String ruleId,
                           java.util.Set<java.lang.String> ruleTypeIdSet)
Returns true if a rule with the given ruleId has previously been registered and the rule's type is identified in the given ruleTypeIdSet. If the rule is a composite rule, true is only returned if every rule particle contained in the composite rule matches a type in the set.
Parameters:
ruleId -
ruleTypeIdSet -
Returns:

validateRuleReference

public boolean validateRuleReference(java.lang.String ruleId,
                                     ElementContext referenceContext)
Convenience method for validating a rule reference. This method expects to be called with a non-null ruleId. The referenceContext parameter is optional. The method first checks that the ruleId is not empty, and that it matches a registered rule. If the referenceContext parameter is non-null, error messages will be logged to the referenceContext's logger if the checks fail. ElementVisitors that must parse rule reference attributes can use this method to perform the necessary validation and error reporting.
Parameters:
ruleId -
referenceContext -
Returns:

validateRuleReference

public boolean validateRuleReference(java.lang.String ruleId,
                                     java.util.Set<java.lang.String> expectedRuleTypes,
                                     ElementContext referenceContext)
Convenience method for validating a rule reference. This method expects to be called with a non-null ruleId, but the ruleTypeIdSet and referenceContext parameters are optional. The method first checks that the ruleId is not empty, and that it matches a registered rule. Then, if the ruleTypeIdSet parameter is non-null, it will check that the rule's type is in the set. If the referenced rule is a composite rule, true is only returned if every rule particle contained in the composite rule matches a type in the set. If the referenceContext parameter is non-null, error messages will be logged to the referenceContext's logger if the checks fail. ElementVisitors that must parse rule reference attributes can use this method to perform the necessary validation and error reporting.
Parameters:
ruleId -
expectedRuleTypes -
referenceContext -
Returns:

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.3.0)

E17493-04


Copyright © 1997, 2012, Oracle. All rights reserved.