Task 6: Creating a ruleflow

You use ruleflows to control the execution flow of the rules.

About this task

Before writing the rules, you orchestrate how your rules are executed. You control rule execution using ruleflows. It is not essential to use ruleflows, but doing so makes rule execution more efficient.

When defining the flow of execution, you organize your rules into packages that contain related rules. Before you create a ruleflow, therefore, you create the relevant packages. You then treat these rule packages as tasks in the ruleflow. In this task, you create a package related to validation, and another related to eligibility.

Procedure

  1. Create two rule packages for storing your rules, one named eligibility and the other named validation.
    1. In the Orchestrate part of the Operation Map view, click Add rule package.
    2. In the New Rule Package wizard, in the Package field, type validation and then click Finish.

      The new validation rule package displays in the Rule Explorer.

    3. Create another package and name it eligibility.
  2. To create the ruleflow, in the Rule Explorer, select your rule project, and then right-click and select New > Ruleflow.
  3. In the New Ruleflow dialog, in the Name field, type mainflow and then click Finish.

    The Ruleflow Editor opens, displaying the Diagram page.

  4. Click the start node ruleflow start node in the Ruleflow palette and then click the Diagram page.
  5. Click the end node ruleflow start node in the Ruleflow palette and then click the Diagram page.
  6. Click the Create a ruletask icon Create a ruletask button in the palette and then click the Diagram page.

    A new rule task is created.

  7. Click the new rule task and then make the following entries on the properties view:
    • Change the ID to validation

    • For Rule Execution > Algorithm, select Fastpath

  8. Still in the properties view, click the Rule Selection tab, and then click Edit.
  9. In the Select Rules dialog, use the arrow button to move the validation package to the right-side panel and then click OK.
  10. Create a second rule task named eligibility and then set its properties the same as for the validation task.
  11. Move the eligibility package to the right-side panel of the Select Rules dialog and then click OK.
  12. Using the Create a transition icon Create a transition button in the palette, create the following transitions:
    • From the start node to the validation task

    • From the validation task to the end node

    • From the validation task to the eligibility task

    • From the eligibility task to the end point

  13. Select the transition between validation and eligibility task and enter the following in the Properties tab, within the condition:
    • Type data approved for the label
    • Underneath BAL for transition condition, type 'the loan' is approved
  14. Align the ruleflow by clicking the Layout All Nodes icon Layout All Nodes button.
  15. Save the ruleflow.

    Your ruleflow looks like this.

    COBOL tutorial: simple ruleflow
  16. In the Operation Map view, click Bind ruleflow.

    To use the ruleflow at run time, you must bind the ruleflow to the decision operation.

  17. In Decision Operation Overview, select Use main ruleflow.
  18. In the Ruleflow section of the decision operation view, click Choose a Ruleflow and select reszminiloan/rules/mainflow.
  19. Click OK.
  20. Save your work and close the decision operation editor.