Dive into Oracle ADF

Send me a mail
 Dive into Oracle ADF   Click to see the XML version of this web page.   (Updated: 2/3/2008; 8:12:57 PM.)
Tips and tricks from Steve Muench on Oracle ADF Framework and JDeveloper IDE

Search blog with Google:
 

Search BC4J JavaDoc:
 

June 2003
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30          
May   Jul

Get Firefox!

Monday, June 09, 2003

"How can I know at runtime what custom validators are being used on my entity objects?"

In JDeveloper 9.0.5, there is a new API called getValidators() thatwill return you an ArrayList of your validator beans at runtime for an entity definition or any one of its attribute definitions, but until then, you can adopt a trick that Shailesh on our team pointed out to me today. You can provide a custom entity definition class for any entity, over use a globally customized entity definition class as the base class for one or more entities in your application, in a way that overrides the framework's method called loadCustomDef(DefXmlElement xmlElement).

The overridden method might look something like this:

  /* 
* This method will get called by entity definition
   * loading. The xmlElement passed in will be the
   * <Entity> element.
   */
  protected void loadCustomDef(DefElementImpl xmlElement) throws PersistenceException {
    NodeList validatorTags = xmlElement.getChildrenByTagName("ValidationBean");
/* Here you would do something more interesting than this... */
    System.out.println("Found " +
                        validatorTags.getLength()+
                        " custom validators for Entity "+
                        getFullName());   
  }

If you do this in a global way, you would add this method in a class that extends oracle.jbo.server.EntityDefImpl, and then provide your customized class name as the name of the Entity Definition class to use for any entities that you want to have this behavior.


7:46:30 AM    



© Copyright 2008 Steve Muench.