Red Hat Training
A Red Hat training course is available for Red Hat Decision Manager
Chapter 2. Data objects
Data objects are the building blocks for the rule assets that you create. Data objects are custom data types implemented as Java objects in specified packages of your project. For example, you might create a Person
object with data fields Name
, Address
, and Date of Birth
to specify personal details for loan application rules. These custom data types determine what data your assets and your decision service are based on.
The following illustration shows the Violation
and Driver
data objects that you will create in this tutorial.
Figure 2.1. Driver department traffic violations data objects
2.1. Creating the Violation data object
The Violation
data object contains data fields based on violation details, such as Violation Date
, Fine Amount
, and Speed Limit
.
Prerequisites
You have created the Driver department traffic violations
project.
Procedure
- Log in to Decision Central. Click Menu → Design → Projects, then Driver department traffic violations.
- Click Create New Asset → Data Object.
In the Create new Data Object wizard, enter the following values:
-
Data Object:
Violation
. -
Package: select
com.myteam.driverdepartmenttrafficviolations
.
-
Data Object:
Click Ok.
Figure 2.2. Create new Data Object window
2.1.1. Adding the Violation data object data fields
Prerequisites
You have created the Violation
data object.
Procedure
The data fields in the Violation
data object define the available constraints that you can select from when you define your violation rules later.
In the
Violation-general properties
section, locate the Label property and enter: Violation.Figure 2.3. General properties
- Click + add field.
Enter the following values:
-
Id:
code
-
Label:
Code
-
Type:
String
-
Id:
Click Create and continue, then enter the following values:
-
Id:
points
-
Label:
Points
-
Type:
Integer
-
Id:
Click Create and continue, then enter the following values:
-
Id:
violationDate
-
Label:
Violation Date
-
Type:
Date
-
Id:
Click Create and continue, then enter the following values:
-
Id:
type
-
Label:
Type
-
Type:
String
-
Id:
Click Create and continue, then enter the following values:
-
Id:
fineAmount
-
Label:
Fine Amount
-
Type:
Double
-
Id:
Click Create and continue, then enter the following values:
-
Id:
speedLimit
-
Label:
Speed Limit
-
Type:
Integer
-
Id:
Click Create and continue, then enter the following values:
-
Id:
actualSpeed
-
Label:
Actual Speed
-
Type:
Integer
-
Id:
- Click Create.
- Click Save, then click Save to confirm your changes.
Click the Driver department traffic violations label to return to the Assets view of the project.
Figure 2.4. Violation data object fields
2.2. Creating the Driver data object
The Driver
data object contains data fields based on driver details, such as Name
, Age
, and Total Points
.
Prerequisites
You have created the Driver department traffic violations
project.
Procedure
- Log in to Decision Central. Click Menu → Design → Projects, then Driver department traffic violations.
- Click Create New Asset → Data Object.
In the Create new Data Object wizard, enter the following values:
-
Data Object:
Driver
. -
Package: select
com.myteam.driverdepartmenttrafficviolations
.
-
Data Object:
Click Ok.
Figure 2.5. Create new Data Object window
2.2.1. Adding the Driver data object data fields
Prerequisites
You have created the Driver
data object.
Procedure
The data fields in the Driver
data object define the driver details that you can select from when you define your violation rules later.
-
In the
'Driver'- general properties
section, locate the Label property and enter: Driver. - Click + add field.
Enter the following values:
-
Id:
name
-
Label:
Full Name
-
Type:
String
-
Id:
Click Create and continue, then enter the following values:
-
Id:
age
-
Label:
Age
-
Type:
Integer
-
Id:
Click Create and continue, then enter the following values:
-
Id:
state
-
Label:
State
-
Type:
String
-
Id:
Click Create and continue, then enter the following values:
-
Id:
city
-
Label:
City
-
Type:
String
-
Id:
Click Create and continue, then enter the following values:
-
Id:
violations
-
Label:
Violations
-
Type:
Violation(com.myteam.driverdepartmenttrafficviolations.Violation)
- List: Select this check box to enable the field to hold multiple items for the specified type.
-
Id:
Click Create and continue, then enter the following values:
-
Id:
fineAmount
-
Label:
Fine Amount
-
Type:
Double
-
Id:
Click Create and continue, then enter the following values:
-
Id:
totalPoints
-
Label:
Total Points
-
Type:
Integer
-
Id:
Click Create and continue, then enter the following values:
-
Id:
reason
-
Label:
Reason
-
Type:
String
-
Id:
- Click Create.
- Click Save, then click Save to confirm your changes.
Click the Driver department traffic violations label to return to the Assets view of the project.
Figure 2.6. Driver data object fields