/** save vo */ public String save() throws Exception { if (cancel != null) { return "cancel"; } if (delete != null) { return delete(); } // new vo NewsInfoContent newsInfoContent = new NewsInfoContent(); List args = new ArrayList(); boolean isNew = (model.getNewsInfoContent().getId() == null); try { if (!isNew) { String pkey = model.getId(); newsInfoContent = newsInfoContentManager.getNewsInfoContent(pkey); } else { newsInfoContent = new NewsInfoContent(); } // TODO modify this for save // newsInfoContent.setId(model.getId()); // newsInfoContent.setContent(model.getContent()); newsInfoContentManager.saveNewsInfoContent(newsInfoContent); } catch (Exception excp) { addActionError("newsInfoContent save Error!"); return INPUT; } String key = (isNew) ? "newsInfoContent.added" : "newsInfoContent.updated"; saveMessage(getText(key, args)); return SUCCESS; }
/** delete vo */ public String delete() { try { String pkey = model.getId(); newsInfoContentManager.removeNewsInfoContent(pkey); List args = new ArrayList(); args.add(model.getId()); saveMessage(getText("newsInfoContent.deleted", args)); return SUCCESS; } catch (Exception e) { log.error(e); this.addActionError("Delete Error!"); return INPUT; } }
/** update vo */ public String edit() { try { if (model.getId() != null) { String pkey = model.getId(); NewsInfoContent newsInfoContent = newsInfoContentManager.getNewsInfoContent(pkey); model.setNewsInfoContent(newsInfoContent); } else { NewsInfoContent newsInfoContent = new NewsInfoContent(); model.setNewsInfoContent(newsInfoContent); } return SUCCESS; } catch (Exception e) { log.error(e); this.addActionError("Delete Error!"); return INPUT; } }
/** list vo */ public String list() { try { List list = newsInfoContentManager.getNewsInfoContents(new NewsInfoContent()); model.setNewsInfoContents(list); return SUCCESS; } catch (Exception e) { log.error(e); this.addActionError("Delete Error!"); return INPUT; } }