How to get Business Rules from Entity Object programatically?

1.5k Views Asked by At

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.

3

There are 3 best solutions below

0
On BEST ANSWER

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!

1
On

Take a look at the EntityDefImpl class. Since it applies to all EO instances it carries the validation.enter link description here

1
On

If you just want to call it, you can use the Validate function from ViewObjectImpl (Since you want to call it from the Web Application programmatically or your Application Module)

If you want to add another Validation, then you should follow the first answer.