@SuppressWarnings("unchecked")
 public static DivisionContainer getDivision(
     DivisionContainer divisionContainer,
     Division division,
     int offset,
     int limit,
     WebApplicationContext context) {
   try {
     if (divisionContainer == null) {
       divisionContainer = new DivisionContainer();
     }
     divisionContainer.removeAllItems();
     LoadFilteredFacade loadFilteredFacade = new LoadFilteredFacade(context);
     Object result[] = loadFilteredFacade.loadFilteredDivision(division, offset, limit);
     // paging.numberOfPages = ((Integer) result[0]).intValue();
     Set<Division> divisionSet = (Set<Division>) result[1];
     // paging.SIZE = ((Long) result[2]).longValue();
     divisionContainer.addAll(divisionSet);
   } catch (InstantiationException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (IllegalAccessException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (Exception e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   return divisionContainer;
 }
 @SuppressWarnings("unchecked")
 public static DivisionContainer getDivisionByPeriod(
     DivisionContainer divisionContainer,
     Division division,
     int period,
     int offset,
     int limit,
     WebApplicationContext context) {
   try {
     if (divisionContainer == null) {
       divisionContainer = new DivisionContainer();
     }
     divisionContainer.removeAllItems();
     LoadFilteredFacade loadFilteredFacade = new LoadFilteredFacade(context);
     Object result[] =
         loadFilteredFacade.loadFilteredDivisionByPeriod(division, period, offset, limit);
     Set<Division> divisionSet = null;
     if (result != null && result.length > 0) {
       divisionSet = (Set<Division>) result[1];
       divisionContainer.addAll(divisionSet);
     }
   } catch (InstantiationException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (IllegalAccessException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (Exception e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   return divisionContainer;
 }
 public void cancel() {
   if (!readonly && isDirty()) {
     documentsForm.discard();
     dirty = true;
     BeanItem<AttachedDocumentObject> beanItemAttachedDocumentObject = null;
     LoadFilteredFacade loadFilteredFacade = new LoadFilteredFacade(context);
     AttachedDocumentObject e =
         (AttachedDocumentObject)
             loadFilteredFacade.loadFilteredAttachedDocumentObjectById(
                 (AttachedDocumentObject) this.beanItem.getBean());
     if (e != null) beanItemAttachedDocumentObject = new BeanItem<AttachedDocumentObject>(e);
     beanItem = beanItemAttachedDocumentObject;
   }
 }
 private boolean isUserValid() {
   boolean isValid = false;
   userCurrent.setName(userName);
   userCurrent = loadFilteredFacade.loadUser(userCurrent);
   if (userCurrent != null && userCurrent.getId() != null) {
       /** Si se encontro el usuario */
     setUser(userCurrent);
     isValid = true;
   }
   return isValid;
 }