Monday, June 6, 2011

Adding business rules programmatically

First add a method validator to your EO.
Use the method super.registerRowException to add the error.


    public boolean validateEntityRules() {
      //call to OBR 
      Collection results = RulesUtil.validateEntity(this, getClass().getName());

      if (results == null || results.isEmpty()) {
          return true;
      } else {
          for (Object result : results) {
            super.registerRowException(new JboException((String) result));
          }
          return false;    
      }

No comments:

Post a Comment