Ejemplo n.º 1
0
  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";
  }
Ejemplo n.º 2
0
  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";
  }
Ejemplo n.º 3
0
 public String updateAgree() {
   System.out.println("agreeId  is " + agreeId);
   Agreement agree = agreementService.selectAgree(Agreement.class, agreeId);
   HttpServletRequest request = ServletActionContext.getRequest();
   request.setAttribute("agreement", agree);
   return "addAgreement";
 }
Ejemplo n.º 4
0
  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";
  }