Defining the Rule: IF/THEN

You will now create another rule using the second method of defining rules named IF/THEN.

Using this rule you can check the following:

If EffectiveDiscount>Threashold value and CustomerType = Premium Then BusinessAnalystReview is not required

If EffectiveDiscount>Threashold value and CustomerType != Premium Then BusinessAnalystReview is required

The condition is an expression that can evaluate to true or false. The action sets the result data.

How to do it...

I. Creating a rules dictionary

  1. Start Oracle JDeveloper, select Default Role, and click OK.
  2. Go to Application Navigator | Project and click on the process SalesToContract.
  3. Go to Component Palette | BPM and click on Business Rule from Activities.
  4. Click in the BusinessAnalyst swimlane, above the Is Business Analyst Review Required? gateway.
  5. You will find the BusinessRuleTask Properties dialog.
  6. Enter the Business Rule Task name as DiscountCheck.
  7. Click on the Implementation tab and click the green plus (+) icon to add a Business rule.
  8. You will find that a Create Business Rule dialog opens up.
  9. Go to the General tab of the dialog and enter a rule name DiscountCheck.
  10. In the Input and Output section click on the green plus (+) icon to add input and output Data objects.
  11. Click Input Data Object, browse for Quote, click Output Data Object, and browse for the ApprovalFlow object as the input and output of the Business rule.
  12. Click OK.
  13. In the Properties dialog, you will create a Data association. Click on the pencil icon to the right of Use Associations to check Data association.
  14. You can find the quote and ApprovalFlow objects as input and output for the DiscountCheck rule, respectively.
  15. When finished, Save.
  16. Go to BPM Project navigator | Business Catalog | Rules and you will find a DiscountCheck.rules file has been created. This is the rules dictionary.
  17. Create unconditional sequence flows as follows:
    • Sequence flow from the CheckCustomerType gateway to DiscountCheck
    • Sequence flow from DiscountCheck to the Is Business Analyst Review Required? gateway
    • Sequence flow from CustomerCheckOutcome to DiscountCheck
  18. The process will resemble the following screenshot:
    How to do it...

II. Defining Globals

In Oracle Business rules, a Global is similar to a public static variable in Java. You will create a Global to hold Customer Type values, as follows:

Global Name

Type

Value

Final

Discountvar

Double

30

Checked

  1. Go to BPM Project Navigator | Rules and click DiscountCheck.rules. This will open the Rule designer.
  2. Click on Globals in the Rule designer.
  3. Click on the green plus(+) icon to create a Global.
  4. Enter details as described in the preceding table.
  5. In the Value field, click the Expression Builder icon to enter an expression, enter a value, 30, and check Final and Constant. Checking Final means the global is non-modifiable.
    How to do it...
  6. When you have finished this, Save.

III. Defining Rules

  1. Go to the Rule designer for DiscountCheck.rules and select Rulesets | Ruleset1.
  2. Click on Create Rule, to create an IF/THEN rule for this ruleset.
    How to do it...
  3. Name the ruleset as DiscountCheckRuleSet, and enter CheckDiscount as name of the IF/THEN rule.
  4. Click on the green plus (+) icon to create another IF/THEN rule for this ruleset, and name it CheckDiscountNP.
  5. In the If section for the CheckDiscount rule, click<insert text> and enter an IF condition, as follows:
    QuoteRequestType.summary.effectiveDiscount>= Discountvar and
    QuoteRequestType.summary.customerType == "Premium"
    
  6. In the Then section, click<edit properties>. It will open Properties for ApprovalFlowType; enter values for businessPractiseReviewNeeded = false and check Constant value:
    asset new ApprovalFlowType(<editproperties>businessPractiseReview Needed:false)
    
    How to do it...
  7. In the IF section for the CheckDiscountNP rule, click<insert text> and enter an IF condition, as follows:
    QuoteRequestType.summary.effectiveDiscount>= Discountvar and
    QuoteRequestType.summary.customerType != "Premium"
    
  8. In the Then section, click<edit properties>. It will open Properties for ApprovalFlowType. Enter values for businessPractiseReviewNeeded = true and check Constant value.
    How to do it...

How it works...

When the process token reaches DiscountCheck, the If-Then-Else ruleset gets evaluated. If the effective discount is greater than 30% and the customer is a Premium customer, then a business analyst review is not required. The token moves to the Approvals Gateway.

If the effective discount is greater than 30% and customer is not a Premium customer, then a business analyst review is required. The token moves to the task Business Analyst Review.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.82.21