Home > Data Model Assistant

Define Constraints from Rules

Some features are not always easy to implement. This is generally the case for customer-specific business rules. In those cases, the underlying logic has to be described in a programmatic manner, using Java code. We will see in this chapter how to define and use these programmatic constraints.

The definition of a constraint is performed in two steps:

  1. Create a rule which will be usable in the model,

  2. Associate the rule with an element in the model.

See also:

Create a Rule

Let’s first create a rule. For this, select the Business Objects and Rules table at the root of the DMA adaptation:

At this step, we can define a rule with the following properties:

For example, we want to create the following constraint on table Royalties : the range between elements lo_range and hi_range is lower than 1000. First, we declare the class implementing the constraint in the Business Objects and Rules table, and we specify that the rule has a parameter named "param1":

Associate the Rule with an Element

Now that the rule has been created in the Business Objects and Rules table, we can associate this rule with the lo_range and hi_range elements in table Royalties . For this, select Advanced constraints in lo_range element and set the properties of Specific constraint as below:

Home > Data Model Assistant