Before you start

Prepare for the tutorial by reading its description, and checking the audience and prerequisites.

In this tutorial, you use the Ruleflow Editor to make a ruleflow to control rule execution in an application used by a fictitious car rental company.

The company needs to implement a car rental policy that changes regularly, and provide a reservation application. To implement the application, you add a ruleflow to a rule project, and then you define the ruleflow structure by creating ruleflow elements and transitions between these elements.

If you want to view what is created with this tutorial, see Viewing the completed tutorial.

Note: Some of the dates used in the tutorial are calculated based on the current date. Therefore, you might see date values that are not recent or differ from the results shown in this tutorial. This should not be considered an error.

A car rental company needs to implement a car rental policy that changes regularly. The company must also provide a reservation application that does the following:

  • Enables car rental agents to complete rental agreement forms. At this stage, rules are used to assess customer eligibility and validate the rental agreement.
  • Enables car rental agents to quote a price for a reservation. Rules compute the price and select the best promotional discount plan.
  • Determines car assignments for customers. Rules resolve car assignments when customers come for pickup, and give upgrades if there is a shortage of cars.

When working with ruleflows, you can use one of these approaches:

  • Bottom-up approach: After creating the rules, you add them to a ruleflow.
  • Top-down approach: You design the ruleflow first, and then write and add rules to the designed structure.

You use the bottom-up approach in this tutorial. The tutorial provides the rules, which are based on the operations of a car rental company.

This tutorial is for developers who want to use ruleflows to control rule execution. It assumes that you are familiar with business rule programming principles, Java™, and the Eclipse environment.

Learning objectives

You do the following tasks:
  • Create and edit a ruleflow.
  • Define rule tasks, transitions, and transition conditions.

Time required

This tutorial should take approximately 30 minutes to finish. If you explore other concepts related to this tutorial, it could take longer to complete.

Audience

This tutorial is primarily for developers work on business rule applications.

Prerequisites

You can find the files for this tutorial in the following directories:
  • <InstallDir>/studio/tutorials/shared
  • <InstallDir>/studio/tutorials/ruleflow

The ruleflow directory has the following structure:

  • answer: The answer directory for the tutorial, which contains an executable example.
  • start: The start directory for the tutorial, which contains a rule project with two rule packages eligibility and pricing, two ruleset parameters named rental and pricing, and a decision operation that uses the parameters as inputs.

Best practices

This tutorial includes the following best practices for creating and defining a ruleflow:
  • Make your ruleflows easier to understand by clicking the Layout All Nodes button Layout All Nodes button in the ruleflow editor. Example...
  • Select an engine execution algorithm that best suits your operation. Example...
  • Always create an else transition in case a condition is not met. Example...