public String delete() { statusMessage = SUCCESS_MESSAGE; result = "true"; setDeleteId(new Long((linkDelete.getAttributes().get("deleteId").toString()))); setClassificationName((String) linkDelete.getAttributes().get("classificationName")); try { VDCGroup vdcgroup = vdcGroupService.findById(deleteId); vdcGroupService.removeVdcGroup(vdcgroup); HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest(); String referer = (String) request.getHeader("referer"); result = referer.substring(referer.lastIndexOf("/") + 1, referer.indexOf(".")); result = getFriendlyLinkName(); resultLink = referer; // this.vdcGroupService.updateGroupOrder(order); // TBD } catch (Exception e) { statusMessage = FAIL_MESSAGE + " " + e.getCause().toString(); result = "failed"; } finally { Iterator iterator = FacesContext.getCurrentInstance().getMessages("AddClassificationsPageForm"); while (iterator.hasNext()) { iterator.remove(); } FacesContext.getCurrentInstance() .addMessage("AddClassificationsPageForm", new FacesMessage(statusMessage)); return "success"; } }
/** * Callback method that is called whenever a page is navigated to, either directly via a URL, or * indirectly via page navigation. Customize this method to acquire resources that will be needed * for event handlers and lifecycle methods, whether or not this page is performing post back * processing. * * <p>Note that, if the current request is a postback, the property values of the components do * <strong>not</strong> represent any values submitted with this request. Instead, they represent * the property values that were saved for this view when it was rendered. */ public void init() { super.init(); if (cid != null) deleteId = cid; if (deleteId != null) { VDCGroup vdcGroup = vdcGroupService.findById(deleteId); classificationName = vdcGroup.getName(); } }