First page Back Continue Last page Text

oracle adf workshop


Assigning the Global Rule to an Object

After the business rule has been registered with the project (which is automatic when you create a new validation rule from the New Gallery), you can assign it to an entity or attribute. This is completed in the properties for any specific entity object. Select the entity or attribute to use the business rule, and invoke the Add Validation Rule dialog box. The display name that you specified appears in the Rule Types list of the Add Validation Rule dialog box.

When using the rule, you are required to specify values for any properties defined in the rule. In this way the programmatic validation rule can be reused in another entity object with different date values.

The example shows assigning the rule to the Person entity. The Rule Type comes from the Rule Display Name that you specified when you created the new validation rule. After selecting the rule type as the global validation rule that you defined, you are presented with a rule definition panel where you can provide values for the properties that you defined in the validation rule. In this case, you want the CreationDate of the Person entity to be before, or the same, as the LastUpdateDate, so you specify those attribute names for the earlierDateAttrName and laterDateAttrName, respectively.

You also can modify the Validation Execution tab so that validation fires only when one of the specified attributes has changed. In this example, you need to also generate the Java class for the entity, because the code accesses EntityImpl to get the names of the attributes to compare.