First page Back Continue Last page Text

oracle adf workshop


Modifying the Code for the Global Rule

To achieve the goal of comparing any two date attributes in an entity, you modify the skeleton code as follows:

1. You want to use this validation rule to compare any two dates in any entity object, so you first add some properties that will specify which entity attributes should be compared. Add two more private strings and initialize them to null: private String earlierDateAttrName = ""; private String laterDateAttrName = ""; You also generate public accessors for these new properties by right-clicking the editor and selecting Generate Accessors. Accessors are not shown in the example in the slide.

2. Because you intend this to be an entity-level validation rule, you add a method that returns true if the rule is applied at the entity level: private boolean validatorAttachedAtEntityLevel(JboValidatorContext ctx) { return ctx.getOldValue() instanceof EntityImpl; }