예제 #1
0
  public void replyComplaint() throws IOException {
    if (LoginBean.fbsLogin.getFbsCompany().getFbsMailSettingCollection().isEmpty()) {
      FacesContext.getCurrentInstance()
          .addMessage(
              null,
              new FacesMessage(FacesMessage.SEVERITY_ERROR, "Server Settings Not Found!", ""));
    } else {
      fbsComplaintReply.setFbsComplaint(fbsComplaint);
      fbsComplaintReply.setMessageDate(new Date());
      // replyMail reMail = new replyMail(fbsComplaint.getEmail(), fbsComplaint.getName(),
      // fbsComplaint.getSubject(), fbsComplaint.getComplaint(), fbsComplaintReply.getMessage(),
      // fbsComplaint.getComplaintId(), true, false);
      if (!fbsComplaintReply.getStatus().equalsIgnoreCase("0")) {
        System.out.println("condition true");
        fbsComplaint.setStatus(fbsComplaintReply.getStatus());
        fbsComplaintFacade.edit(fbsComplaint);
      } else {
        System.out.println("condition False");
        fbsComplaint.setStatus("Open");
        fbsComplaintReply.setStatus("Open");
        fbsComplaintFacade.edit(fbsComplaint);
      }
      if (renderType.equals("Reply")) {
        fbsComplaintReply.setType("Reply");
      } else {
        fbsComplaintReply.setType("Complaint");
      }

      fbsComplaintReplyFacade.create(fbsComplaintReply);
      replyMail reMail = new replyMail(fbsComplaint, fbsComplaintReply, true, false);
      Thread thread = new Thread(reMail);
      thread.start();
      fbsComplaintReply = new FbsComplaintReply();
      FacesContext.getCurrentInstance()
          .getExternalContext()
          .redirect(
              FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath()
                  + "/faces/jsfpages/Complaint/complaintDetails.xhtml?complaintId="
                  + fbsComplaint.getComplaintId());
      // fbsComplaint=new FbsComplaint();
      populate();
    }
  }
예제 #2
0
  @PostConstruct
  public void populate() {
    System.out.println("inside detail bean...........");
    HttpServletRequest request =
        (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();

    int complaintId = 0;
    if (request.getParameter("complaintId") != null) {
      complaintId = Integer.parseInt(request.getParameter("complaintId"));
    }
    fbsComplaint = fbsComplaintFacade.find(complaintId);
    fbsComplaintReplyList = (List<FbsComplaintReply>) fbsComplaint.getFbsComplaintReplyCollection();
    for (FbsComplaintReply f : fbsComplaintReplyList) {
      System.out.println(
          f.getComplaintReplyId()
              + " fbscomplaint is......."
              + f.getFbsComplaint().getComplaintId());
    }
  }