Example #1
0
 public void addDivision() {
   try {
     logger.info("addDivision");
     Division model = new Division();
     model.setDivisionName(getDivisionName());
     model.setDivisionShortName(getDivisionShortname());
     if (getId() == 0) {
       divisionService.add(model);
     } else {
       model.setId(getId());
       divisionService.update(model);
     }
     this.setDivisionName("");
     this.setDivisionShortname("");
     FacesContext.getCurrentInstance()
         .addMessage(
             null,
             new FacesMessage(FacesMessage.SEVERITY_INFO, ParameterModel.STATUS_SAVE_SUCCESS, ""));
   } catch (Exception e) {
     e.printStackTrace();
     FacesContext.getCurrentInstance()
         .addMessage(
             null,
             new FacesMessage(FacesMessage.SEVERITY_ERROR, ParameterModel.STATUS_SAVE_FAIL, ""));
   }
 }
Example #2
0
 public void deleteDiv(int id) {
   Division d = new Division();
   d.setId(id);
   divisionService.delete(d);
   divs = divisionService.getAll();
   FacesContext.getCurrentInstance()
       .addMessage(
           null,
           new FacesMessage(FacesMessage.SEVERITY_INFO, ParameterModel.STATUS_DELETE_SUCCESS, ""));
 }
Example #3
0
 public void initDivision() {
   if (id != 0) {
     Division d = divisionService.getById(id);
     setDivisionName(d.getDivisionName());
     setDivisionShortname(d.getDivisionShortName());
   }
 }
Example #4
0
 public List<Division> getDivs() {
   if (divs == null) {
     divs = divisionService.getAll();
   }
   return divs;
 }