Wednesday, October 2, 2013

How to iterate entities in Application Module Impl class?




If you have a requirement to iterate through each entity object in Application Module Impl, Below is the quick and easiest way to get control of all the entities.

Scenario : Updatable Employee View object based on EmployeesEOImpl dragged onto the screen as <af:table> component, User could delete certain employees from the table, and need to get hold of deleted employee records in Application Module Impl

       

          Iterator it =
            EmployeesEOImpl.getDefinitionObject().getAllEntityInstancesIterator(getDBTransaction());

   while(it.hasnext()){
    EmployeesEOImpl eo = (EmployeesEOImpl)it.next();

            if (eo.getEntityState() == eo.STATUS_MODIFIED) {
                // Do this
            } else if (eo.getEntityState() == eo.STATUS_MODIFIED) {
                // Do this
            } else if (eo.getEntityState() == eo.STATUS_DELETED) {
               // Do this.
            }
}
       
 




No comments:

Post a Comment