Search code examples
oracle-adfjdeveloperentityobject

How to get Business Rules from Entity Object programatically?


In my Fusion Web Application, I have defined several business rules in entity objects. Everything works fine. The problem is that I can not get them programatically. I have searched through the EntityObjects Impl java class, but there is no method that should perform validation. Does anyone know any way, how to get the business rules from an entity object? I need to get at least a list of those.

Update:

EntityDefImpl eoDef = EntityDefImpl.findDefObject("package...MyEO");

            for (Object o : eoDef.getValidators()) {
                System.out.println("Rule: " + o);
            }

But even in this case, I do not get a list of business rules.


Solution

  • Try the following instead of your implementation

    EntityDefImpl eoDef = EntityDefImpl.findDefObject("package...MyEO");
    AttributeDefImpl myAttribute=getAttributeDefImpl("MyAttribute"); //Get the first Attribute
    
    for (Object o : myAttribute.getValidators()) {
                System.out.println("Rule: " + o);
     }
    

    The one you did will get the Entity level validators only, this one will get you this specific attribute validators!