简体   繁体   中英

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.

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!

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM