Business Rule in SOA Suite 12C

Introduction:

Business Rule is the component of both Oracle SOA Suite and Oracle BPM Suite. Oracle Business Rule enables the business user to modify the business rules without taking help from developer or without interrupting business processes. It is basically a combination of IF-ELSE condition designed by Oracle SOA suite. Here IF part is conditions or pattern match and ELSE part is action. Business Rules has elements like facts, rulesets, bucketsets, decision table and it can be associated with BPEL process. Bucketset (Value set in SOA Suite 12C) is used to define a list of values or range of values of a specific type. Bucketset can be associated with a fact property. Business user can change the business rules in SOA Composer.

Example of General Rules in Business Rule Process:

This example will give idea of general rules based on IF-ELSE condition. If department is 10, then approval is required for processing and if department is 20, then approval is not required.

Follow the below steps to execute this example.

  1. Create a new SOA application and SOA project. Navigate to File -> New -> Application. Select SOA ApplicationBusiness_Rule_1 Business_Rule_2
  2. Enter application name a�?BusinessRuleApplicationa��Business_Rule_3
  3. Click on Next and enter project name a�?BusinessRuleDemoa��Business_Rule_4
  4. Click on Next and select composite type as a�?Composite With Business Rulea��Business_Rule_5
  5. a�?Create Business Rulesa�� wizard will open. Enter directory name a�?ApprovalRulea��Business_Rule_6
  6. Create input and output parameter. Click on green plus icon and select a�?Input Parametera��.Business_Rule_7
  7. Select deptId from emp.xsd as input parameter. First import the schema file into the current project.Business_Rule_8 Business_Rule_9
  8. Click on OK and uncheck the checkbox a�?Maintain original directory structure for imported filesa��Business_Rule_10
  9. Select approvalReqd from emp.xsd as output parameterBusiness_Rule_11 Business_Rule_12
  10. Click on OK and a�?ApprovalRule.rulesa�� file will be created and the below screen will be displayed. Navigate to Rule Set tab. Click on green plus icon beside a�?Rule Seta�� and create new rule set. Now create general rules under rule set. Click on green plus icon in a�?General Rulesa�� section.Business_Rule_13
  11. Below window will appearBusiness_Rule_14
  12. Click on a�?insert testa�� and select a�?simple testa��Business_Rule_15 Business_Rule_16
  13. Click on 1st a�?operanda�� and select deptId.deptIdBusiness_Rule_17
  14. Click on 2nd a�?operanda�� and enter a value 10Business_Rule_18 Business_Rule_19
  15. Click on a�?insert actiona�� and select a�?assert newa��Business_Rule_20
  16. Select a�?targeta�� as a�?approvalReqda��Business_Rule_21
  17. Edit the property in a�?THENa�� section. Click on a�?edit propertiesa�� and select the value a�?truea�� for a�?approvalRequiredBusiness_Rule_22 Business_Rule_23
  18. Click on OK and Rule1 will look like the below screenshot. Create another rule for dept id 20. Click on green plus icon in the right top corner.Business_Rule_24
  19. Rule2 will be created below the Rule1Business_Rule_25
  20. Insert condition and action for dept id 20 like a�?Rule1′. Only change the a�?approvalRequireda�� value to a�?falsea��. Now a�?General Rulesa�� will be like below screenshot.Business_Rule_26
  21. Drag and drop a a�?BPEL Processa�� in the a�?Componentsa�� lane. Enter BPEL process name a�?BusinessRuleBPELProcessa�� and select template as a�?Asynchronous BPEL Processa��Business_Rule_27
  22. Connect BPEL process with the Business Rule. Now composite will look like this.Business_Rule_28
  23. Create a variable in BPEL process to hold the reply from the Business Rule. Click on variable icon in the main scope.Business_Rule_29
  24. Click on green plus icon to create new variableBusiness_Rule_30
  25. Enter variable name a�?approveReqa�� and select variable type as a�?Booleana��.Business_Rule_31 Business_Rule_32
  26. Select a�?Business Rulea�� from SOA Components and drag and drop it in between a�?receiveInputa�� and a�?callbackClienta��Business_Rule_33
  27. Double click on a�?Rule1a�� and select a�?ApprovalRulea�� as Dictionary. Service and Operation will be selected automatically based on the value of Dictionary.Business_Rule_34
  28. Create input fact and output fact. Click on a�?Createa�� icon in the a�?Assign input Factsa�� tab. Select input payload of BPEL process in the a�?Froma�� part and select dept id in the a�?Toa�� part.Business_Rule_35
  29. Now input part will be like thisBusiness_Rule_36
  30. Navigate to a�?Assign Output Factsa�� tab and create new output fact. Select approvalReqd in the a�?Froma�� part and select approvereq variable in the a�?Toa�� partBusiness_Rule_37
  31. Now output fact will be like thisBusiness_Rule_38
  32. SelectA�a�?IFa�� activity from ‘Structured Activities’ in the component palette and drag and drop it below the Business RuleBusiness_Rule_39
  33. Click on If and add a condition ($approveReq = a�?TRUEa��) in the expression builderBusiness_Rule_40 Business_Rule_41 Business_Rule_42
  34. Drag and drop two a�?Assigna�� activity under a�?IFa�� and a�?ELSEa�� partBusiness_Rule_43
  35. Assign the value a�?Approveda�� in the a�?Assigna�� activity under a�?IFa�� part and assign the value a�?Not Approveda�� in the a�?Assigna�� activity under a�?ELSEa�� part. Refer the below screenshotsBusiness_Rule_44 Business_Rule_45
  36. Now BPEL process will look like below screenshotBusiness_Rule_46
  37. Deploy the project and test the project in the Enterprise Manager Console.Business_Rule_47
  38. Enter 10 as input valueBusiness_Rule_48
  39. Click on a�?Test Web Servicea��Business_Rule_49
  40. Click on a�?Launch Flow Tracea�� to get the process flow of the SOA composite and the output value also.Business_Rule_50
  41. Click on a�?ApprovalRulea�� and check that Rule1 has fired as input value is 10.Business_Rule_51
  42. Click on a�?BusinessRuleBPELProcessa�� to view the output valueBusiness_Rule_52 Business_Rule_53
  43. Login to SOA Composer (http://localhost:7101/soa/composer). You can check all the rules from SOA composer. Click on a�?ApprovalRulea�� and check the rules that have created in this example. Business user can easily change the rules in SOA Composer without taking any help from any technical person.Business_Rule_54

Leave a Reply

Your email address will not be published. Required fields are marked *

Show my latest post here