Chapter 3. Guided Rules


Guided Rules are business rules that you can create in a UI-based Guided Rules designer that leads you through the rule creation process. The rule designer provides fields and options for acceptable input based on the object model of the rule being edited. All data objects related to the rule must be in the same project package as the rule. Assets in the same package are imported by default. You can use the Data Objects tab of the rule designer to verify that all required data objects are listed or to import any other needed data objects.

Figure 3.1. The Guided Rule designer

The Guided Rule designer

3.1. Creating the Driver License Suspension rule

The Driver license suspension rule is created using the Guided Rule wizard and is comprised of various conditions and their resulting actions.

Prerequisite

Created both the Violation and Driver data objects.

Procedure

  1. Log in to Decision Central. Click Menu Design Projects, then Driver department traffic violations.
  2. Click Create New Asset Guided Rule, then enter:

    • Guided Rule: DriverLicenseSuspensionRule
    • Package: com.myteam.driverdepartmenttrafficviolations
  3. Click Ok to open the Guided Rule designer.

    Figure 3.2. Create new Guided Rule window

    guided rule

3.2. Setting the Suspension rule conditions

The Suspension rule contains conditions that are used to determine the driver’s violation.

Prerequisite

You have created the Driver License Suspension rule

Procedure

  1. Click 6176 next to the WHEN label to open the Add a condition to the rule window. . . Select Driver and click Ok.

    Figure 3.3. Create new Guided Rule window

    add condition
  2. Click the There is a Driver label to open the Modify constraints for Driver window.
  3. Enter driver in the Variable name field and click Set.
  4. Click the There is a Driver[driver] and click Expression editor.
  5. Click [not bound] to open the Expression editor.
  6. In the Bind the Expression to a new variable field, enter: previousPts and click Set.
  7. From the Choose menu, select totalPoints.
  8. Click 6176 next to line 1 (the previousPts label) to open the Add a condition to the rule window.
  9. Select From Accumulate and click Ok.
  10. Click click to add pattern above the From Accumulate label and select Number from the choose fact type pull-down menu.
  11. Click There is a number label to open the Modify contraints for Driver window.
  12. Click Expression editor and select intValue() from the [not bound]: Choose menu.
  13. Click [not bound] to open the Expression editor.
  14. In the Bind the Expression to a new variable field, enter: totalNewPoints and click Set.
  15. Click click to add pattern and select Violation from the choose fact type pull-down menu.
  16. Click All Violation with: to open the Modify contraints for Violation window and select points from the Add a restriction on a field pull-down menu.
  17. Click please choose next to the points label and select greater than.
  18. Click 6191 , then click Literal value.
  19. Click the points label to open the Add a field window and enter vPoints and click Set.
  20. In the Function field, enter sum(vPoints).
  21. Select greater than or equal to from the totalNewPoints please choose pull-down menu.
  22. Click 6191 , click New formula, and enter 20-previousPts in the new field.
  23. Click Save, then click Save to confirm your changes.

Figure 3.4. Suspension Rule conditions

rule conditions

3.3. Setting the Suspension rule actions

The Suspension rule actions determine a driver’s resulting penalties including points and fine amounts based on the Suspension rule conditions.

Prerequisite

You have created set the Suspension rule conditions

Procedure

  1. Click (show options…​).

    Figure 3.5. show options selection

    show options
  2. Click 6176 next to the THEN label and select Change field values of driver, then click Ok.
  3. Click the Set value of Driver [driver] field and select state from the Add field pull-down menu.
  4. Click 6191 next to state in the Set value of Driver [driver] section to open the Field value window.
  5. Click Literal value and enter suspend in the new field.

    Figure 3.6. New field

    suspend entry
  6. Click 6176 next to the (options) label below the Set value of Driver [driver] section.
  7. From the Add an option to the rule window, select the ruleflow-group option from the Attribute pull-down menu.
  8. Enter trafficViolation in to the ruleflow-group field.
  9. Click Save, then click Save to confirm your changes.

    Figure 3.7. Suspension rule actions

    rulepanel
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.