droolsonboarding
  • Introduction
  • Technical Materials
  • Overview
  • Drools tutorial
    • Installing Drools Tooling
    • Data Model used in the tutorial
    • Lesson 1 : Core concepts
    • Lesson 2 : binding
    • lesson 3 : Some more drools languages
    • lesson 4 : ruleflow
    • lesson 5 : Exercise
      • Requirements
  • BRMS tutorial
    • Organizational Unit And repository
    • Data Model
    • Business Requirements
    • Design
    • Implementing the Process Flow
    • Implementation technical parts
    • Implementing the initial step
    • Implementing standard price step
    • Implementing the Child over 3 years old is free promotion step
    • Implementing the Birthday promotion step
    • Implementing the Zurich reduction step
    • Implementing the final step
    • Conclusion
  • BRMS Runtime tutorial
    • Install needed tools to run the workbench
Powered by GitBook
On this page
  • Creating the rule
  • Creating rule to insert a period
  • Creating rule to start a process
  • Testing the rule

Was this helpful?

  1. BRMS tutorial

Implementing the Child over 3 years old is free promotion step

PreviousImplementing standard price stepNextImplementing the Birthday promotion step

Last updated 5 years ago

Was this helpful?

Creating the rule

Create a new Guided Rule that you call YougestUnder3yearsOldFree

then Add a new Constraint

Select the List class. Click on the "There is a list.." and the click on the Expression Builder button

on the first "Choose" select the size() function and on the second "greater than"

Then click on the "All Person with" link and select the age attribute and add the following constraint.

Then Add a new constraint of type Accumulate

And select the Number type from the add a pattern link.

Then make the rule look like this

Creating rule to insert a period

Create a drl file with the following content

Creating rule to start a process

To be able to start a process from a test scenario, we want to insert an object and set a attribute that would be the process id we want to start. So we first create a new Item of type Data Obkect that we shall call StartProcess. And we should add a field called procesId of type String

Testing the rule

Create the test scenario by inserting Objects like follows.

Then click on the pencil Click on the "From Collect" link and then chose the person fact type

Then we shall create a guided rule called StartProcessRule as follows. In the Then add free form drl