Esempio n. 1
0
 @Action(
     value = "save-material-ajax",
     results = {
       @Result(
           name = "success",
           location = "/WEB-INF/content/ajax-material/material-add-ajax.jsp"),
       @Result(name = "input", location = "/WEB-INF/content/ajax-material/material-add-ajax.jsp")
     })
 public String save() throws Exception {
   try {
     if (materail != null && materailHash != materail.hashCode()) {
       if (materail.getPrefix().equals("") || materail.getPrefix().length() != 2) {
         addFieldError("prefix", Messages.getString("material.empty"));
         return INPUT;
       }
       if (materailService.hasCunjaction(materail.getId(), materail.getPrefix())) {
         addFieldError("prefix", Messages.getString("material.cunj"));
         return INPUT;
       }
       materailService.saveOrUpdate(materail);
       materailService.log(materail, "saveOrUpadate");
       request.setAttribute("materialSuccess", SUCCESS);
       return SUCCESS;
     }
   } catch (Exception e) {
     addFieldError("prefix", Messages.getString("material.cunj"));
   }
   return INPUT;
 }
Esempio n. 2
0
 @Action(
     value = "materials",
     results = {@Result(name = "success", type = "tiles", location = "/material-list.tiles")})
 public String list() throws Exception {
   this.setListOfMaterials(materailService.findAll());
   return SUCCESS;
 }
Esempio n. 3
0
 @Action(
     value = "material-list-ajax",
     results = {
       @Result(
           name = "success",
           location = "/WEB-INF/content/ajax-material/material-list-ajax.jsp")
     })
 public String list1() {
   this.setListOfMaterials(materailService.findAll());
   return SUCCESS;
 }
Esempio n. 4
0
 public void prepare() throws Exception {
   if (materail != null && materail.getId() != null) {
     this.materail = materailService.get(materail.getId());
     this.materailHash = materail.hashCode();
   }
 }