public String addAgree() { HttpServletRequest request = ServletActionContext.getRequest(); HttpSession session = request.getSession(); Users user = (Users) session.getAttribute("admin"); String key; if (agreement.getId() == null) { agreement.setPersonId(user.getPersonid()); Document document = new Document(); String temp = user.getAccount() + Constant.agreement; document.setTitle(temp); document.setDescription(temp); key = Persistence.setVariable(agreement); document.setTypePersist(key + "|agreement"); document.setUrl("showAgreement.jsp"); documentService.addDocument(document, workflowId, user.getId(), null); // agreementService.addAgree(agreement); System.out.println("add"); } else { agreement.setPersonId(user.getPersonid()); agreementService.updateAgree(agreement); System.out.println("update"); } String hql = ""; List<Agreement> agreements = agreementService.getAgreementPages((index == 0 ? 1 : index), Agreement.class, hql); int total = agreementService.getAllAgreements(Agreement.class, hql).size(); request.setAttribute("listAgree", agreements); request.setAttribute("currentIndex", (index == 0 ? 1 : index)); request.setAttribute("totalSize", total); return "selectAgree"; }
public String find() { String hql = ""; List<Agreement> agreements = agreementService.getAgreementPages((index == 0 ? 1 : index), Agreement.class, hql); int total = agreementService.getAllAgreements(Agreement.class, hql).size(); HttpServletRequest request = ServletActionContext.getRequest(); request.setAttribute("listObject", agreements); request.setAttribute("currentIndex", (index == 0 ? 1 : index)); request.setAttribute("totalSize", total); request.setAttribute("url", "AgreementAction!find?"); return "selectAgree"; }
public String deleteAgree() { System.out.println("agreeId is " + agreeId); Agreement agree = agreementService.selectAgree(Agreement.class, agreeId); agreementService.deleteAgree(agree); String hql = ""; List<Agreement> agreements = agreementService.getAgreementPages((index == 0 ? 1 : index), Agreement.class, hql); int total = agreementService.getAllAgreements(Agreement.class, hql).size(); HttpServletRequest request = ServletActionContext.getRequest(); request.setAttribute("listAgree", agreements); request.setAttribute("currentIndex", (index == 0 ? 1 : index)); request.setAttribute("totalSize", total); return "operator_success"; }