Did you know that you can extend the set of built-in, declarative ADF entity validation rules by writing your own? Sure you can! Example #28 (Custom DateRange Validation Rule Bean with Custom Design Time Editor) over on my not yet documented examples page illustrates an example DateRangeRule validator bean that validates that a starting date attribute comes before an ending date attribute. It also illustrates how you can define a custom JavaBean Customizer panel to provide a custom editing experience for downstream users of your validator bean in the ADF Business Components design time. The DateRangeRule validator bean is linked to its custom DateRangeRuleCustomizer via the DateRangeRuleBeanInfo class. This is a standard JavaBeans programming technique. The project contains two deployment profiles: one produces a runtime JAR file with only the DateRangeRule, the other produces a design time JAR file with the BeanInfo and the Customizer for the rule. To use the date validation rule in any Business Components project, just add a library for these two JAR files, then visit the "Registered Rules" panel under the "Business Components" section of the project properties to (Add...) this test.rules.DateRangeRule as one of the rules you want to use, and give it the name "DateRange" Once you've done that, the DateRange validator will appear in the list for you to add to your entity objects on the "Validation" panel of the Entity Object editor. The custom editor panel allows you to pick the Start Date Attribute and the End Date Attribute from the list of date-type attributes in your entity object.
11:53:39 PM
|
|