Fuego.Rules : Rule

Instances of the Rule component represent a Dynamic Business Rule defined in your project. This component can fetch, evaluate and modify Rules.

Refer to Oracle BPM Studio Help for details about Dynamic Business Rules.

Create new instances of Rule passing the name of an existing rule to the Rule(String name) constructor. You cannot create new business rules with this component. If the specified rule does not exist, the component with throw an exception.

Method method update() modifies the expression of this Rule instance in memory. Method store() creates new version of the rule and persists the changes. You cannot create new rules with this component.

Note: For each rule defined in your project, an implicit method (named after the ID of the rule) is automatically added to all processes in the project. When invoked, these methods evaluate the associated rule. For example, if you define a rule named "CreditScore", a method named "creditScore()" is available to all processes.
Important: Dynamic Business Rules work on project instance variables. You cannot evaluate a rule from a Global activity, because Globals are outside the context of a process instance.

Example 1: Fetch and evaluate a dynamic rule using the Rule component

  creditScoreRule = Rule( "credit_score" )

  approved = evaluate(creditScoreRule)

  if approved == true then
    logMessage "Credit approved"
  else
    logMessage "Credit rejected. Low credit score"
  end	
      

Example 2: Fetch and evaluate a dynamic rule using implicit project method instead of using the Rule component.

  approved = this.creditScore()

  if approved then
    logMessage "Credit approved"
  else
    logMessage "Credit rejected. Low credit score"
  end