Ejemplo n.º 1
0
 public void saveSelected() {
   if (current == null) {
     UtilityController.addErrorMessage("Nothing to save");
     return;
   }
   if (current.getPerson() == null) {
     UtilityController.addErrorMessage("Nothing to save");
     return;
   }
   if (current.getPerson().getName().trim().equals("")) {
     UtilityController.addErrorMessage("Please enter a name");
     return;
   }
   if (current.getPerson().getId() == null || current.getPerson().getId() == 0) {
     getPersonFacade().create(current.getPerson());
   } else {
     getPersonFacade().edit(current.getPerson());
   }
   if (getCurrent().getId() != null && getCurrent().getId() > 0) {
     getFacade().edit(current);
     UtilityController.addSuccessMessage("updated Successfully");
   } else {
     current.setCreatedAt(Calendar.getInstance(TimeZone.getTimeZone("IST")).getTime());
     current.setCreater(sessionController.getLoggedUser());
     getFacade().create(current);
     UtilityController.addSuccessMessage("saved Successfully");
   }
   recreateModel();
   getItems();
 }
Ejemplo n.º 2
0
  public void delete() {

    if (current != null) {
      current.setRetired(true);
      current.setRetiredAt(Calendar.getInstance(TimeZone.getTimeZone("IST")).getTime());
      current.setRetirer(sessionController.getLoggedUser());
      getFacade().edit(current);
      UtilityController.addSuccessMessage("DeleteSuccessfull");
    } else {
      UtilityController.addSuccessMessage("NothingToDelete");
    }
    recreateModel();
    getItems();
    current = null;
    getCurrent();
  }