예제 #1
0
  public ActionForward fetchEscalationLevel(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    EscalationDao escalationDaoImpl = new EscalationDaoImpl();
    EscalationForm escalationForm = (EscalationForm) form;
    EscalationDTO escalationDTO = new EscalationDTO();
    String escalation_level_status = null;

    Document document = DocumentHelper.createDocument();
    Element root = document.addElement("options");
    Element optionElement, hiddenElement;

    try {
      String escalation_type = escalationForm.getEscalation_type();
      String workflow_step_id = escalationForm.getWorkflow_step_id();

      System.out.println("escalation_type---->" + escalation_type);
      System.out.println("workflow_step_id---->" + workflow_step_id);

      if (escalation_type != null && workflow_step_id != null) {
        populate(form, request);

        List escalation_level_list =
            escalationDaoImpl.getEscalation_Level(escalation_type, workflow_step_id);

        if (escalation_level_list != null && escalation_level_list.size() > 0) {
          escalationForm.setEscalation_level_list(escalation_level_list);
          for (int intCounter = 0; intCounter < escalation_level_list.size(); intCounter++) {
            optionElement = root.addElement("option");
            optionElement.addAttribute(
                "value",
                ((EscalationDTO) escalation_level_list.get(intCounter)).getEscalation_level());
            optionElement.addAttribute(
                "text",
                ((EscalationDTO) escalation_level_list.get(intCounter)).getEscalation_level());
            hiddenElement = root.addElement("hidden");
            hiddenElement.addAttribute(
                "status",
                ((EscalationDTO) escalation_level_list.get(intCounter))
                    .getEscalation_level_status());
          }
        }
        response.setContentType("text/xml");
        response.setHeader("Cache-Control", "No-Cache");
        PrintWriter out = response.getWriter();
        XMLWriter writer = new XMLWriter(out);
        writer.write(document);
        logger.info("document : \n\n" + document.asXML());
        writer.flush();
        out.flush();
      }
    } catch (Exception exception) {
      exception.printStackTrace();
    }
    return null;
  }
예제 #2
0
  public ActionForward initEditEscalation(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    ActionErrors errors = new ActionErrors();
    ActionForward forward = new ActionForward();

    try {

      EscalationForm escalationForm = (EscalationForm) form;
      EscalationDao escalationDaoImpl = new EscalationDaoImpl();
      EscalationDTO escalationDTO = new EscalationDTO();
      String requestNo = escalationForm.getWorkflow_escalation_id();

      populate(form, request);
      List escalation_template_list = escalationForm.getEscalation_template_list();
      escalationDTO = escalationDaoImpl.getEscalationdtls(requestNo);

      BeanUtils.copyProperties(escalationForm, escalationDTO);
      escalationForm.setEscalation_template_list(escalation_template_list);
    } catch (Exception exp) {
      exp.printStackTrace();
      errors.add("editEscalation", new ActionError(""));
      saveErrors(request, errors);
      return mapping.findForward("EditEscalation");
    }
    forward = mapping.findForward("EditEscalation");
    return (forward);
  }
예제 #3
0
  public ActionForward searchEscalation(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    ActionErrors errors = new ActionErrors();
    ActionForward forward = new ActionForward(); // return value

    try {

      EscalationForm escalationForm = (EscalationForm) form;
      EscalationDTO escalationDTO = new EscalationDTO();
      EscalationDao escalationDaoImpl = new EscalationDaoImpl();

      if (request.getAttribute("editSuccess") != null) {

        // String escalationType=request.getAttribute("escalationType").toString();
        String escalationID = request.getAttribute("escalationID").toString();
        escalationForm.setWorkflow_escalation_id(escalationID);
        populate(form, request);
        // escalationForm.setParamEscalationType(escalationType);
        System.out.println(
            "inside edit success---->show " + escalationForm.getWorkflow_escalation_id());
      }

      BeanUtils.copyProperties(escalationDTO, escalationForm);

      List escalationMasterList = escalationDaoImpl.searchEscalation(escalationDTO);

      if (request.getAttribute("editSuccess") != null) {
        String escalationType = request.getAttribute("escalationType").toString();
        escalationForm.setParamEscalationType(escalationType);
      }

      System.out.println("Escalation Master List------>" + escalationMasterList);

      escalationForm.setEscalationMasterList(escalationMasterList);

    } catch (BusinessException exp) {
      errors.add("searchEscalation", new ActionError(exp.getBusinessCode()));
      saveErrors(request, errors);
      return mapping.findForward("SearchEscalation");
    } catch (ApplicationException exp) {

      errors.add("searchEscalation", new ActionError(exp.getBusinessCode()));
      saveErrors(request, errors);
      return mapping.findForward("SearchEscalation");
    } catch (Exception exp) {

      errors.add("searchEscalation", new ActionError(""));
      saveErrors(request, errors);
      return mapping.findForward("SearchEscalation");
    }

    forward = mapping.findForward("SearchEscalation");
    return (forward);
  }
예제 #4
0
  public ActionForward editEscalation(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    ActionErrors errors = new ActionErrors();
    ActionForward forward = new ActionForward(); // return value
    boolean editSuccess = false;
    String flag = null;

    try {
      HttpSession session = request.getSession(false);
      UserDetailsDTO userDetails = (UserDetailsDTO) session.getAttribute("USER_INFO");

      EscalationForm escalationForm = (EscalationForm) form;
      String requestNo = escalationForm.getWorkflow_escalation_id();
      System.out.println("EDIT ACTION------------" + requestNo);

      if (escalationForm != null) {
        String userName = userDetails.getUserLoginId();
        escalationForm.setModified_by(userName);

        EscalationDTO escalationDTO = new EscalationDTO();
        EscalationDao escalationDaoImpl = new EscalationDaoImpl();
        BeanUtils.copyProperties(escalationDTO, escalationForm);

        editSuccess = escalationDaoImpl.editEscalation(escalationDTO, requestNo);

        if (editSuccess == true) {
          flag = "editsuccessful";
          request.setAttribute("editSuccess", flag);
          request.setAttribute("escalationID", requestNo);
          request.setAttribute("escalationType", escalationDTO.getEscalation_type());
        }
      }
    } catch (Exception exp) {
      errors.add("editCategory", new ActionError(""));
      saveErrors(request, errors);
      return mapping.findForward("InitEditEscalation");
    }
    if (!errors.isEmpty()) {
      saveErrors(request, errors);
      // Forward control to the appropriate 'failure' URI (change name as desired)
      forward = mapping.findForward("EditEscalation");
    } else {
      // Forward control to the appropriate 'success' URI (change name as desired)
      errors.add("editCategory", new ActionError("message.success"));
      saveErrors(request, errors);
      forward = mapping.findForward("EditEscalationSuccess");
      request.setAttribute("errorFlag", "1");
    }
    // Finish with
    return (forward);
  }
예제 #5
0
  public ActionForward fetchFlowList(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    EscalationDao escalationDaoImpl = new EscalationDaoImpl();
    EscalationForm escalationForm = (EscalationForm) form;
    EscalationDTO escalationDTO = new EscalationDTO();

    Document document = DocumentHelper.createDocument();
    Element root = document.addElement("options");
    Element optionElement;
    try {

      String escalation_type = escalationForm.getEscalation_type();
      System.out.println("escalation_type---->" + escalation_type);

      if (escalation_type != null) {
        // escalation_type = Long.parseLong(request.getParameter("circleID").toString());

        populate(form, request);

        List flow_level_list = escalationForm.getFlow_level_list();

        if (flow_level_list != null && flow_level_list.size() > 0) {
          for (int intCounter = 0; intCounter < flow_level_list.size(); intCounter++) {
            optionElement = root.addElement("option");
            optionElement.addAttribute(
                "value", ((EscalationDTO) flow_level_list.get(intCounter)).getWorkflow_step_id());
            optionElement.addAttribute(
                "text", ((EscalationDTO) flow_level_list.get(intCounter)).getWorkflow_step_id());
          }
        }
        response.setContentType("text/xml");
        response.setHeader("Cache-Control", "No-Cache");
        PrintWriter out = response.getWriter();
        XMLWriter writer = new XMLWriter(out);
        writer.write(document);
        logger.info("document : \n\n" + document.asXML());
        writer.flush();
        out.flush();
      }
    } catch (Exception exception) {
      exception.printStackTrace();
    }
    return null;
  }
예제 #6
0
  public ActionForward initCreateEscalation(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    ActionErrors errors = new ActionErrors();
    ActionForward forward = new ActionForward();

    try {
      EscalationForm escalataionForm = (EscalationForm) form;
      escalataionForm.setEscalation_type(null);
      escalataionForm.setWorkflow_step_id(null);
      escalataionForm.setEscalation_level(null);
      escalataionForm.setEscalation_level_status(null);
      escalataionForm.setEscalation_template(null);
      populate(form, request);
    } catch (Exception e) {
      logger.error("Exception Occurred" + e);
      errors.add("name", new ActionError("id"));
    }
    forward = mapping.findForward("CreateEscalation");
    return (forward);
  }
예제 #7
0
  public void populate(ActionForm form, HttpServletRequest request) {
    ActionErrors errors = new ActionErrors();
    try {
      EscalationForm escalationForm = (EscalationForm) form;
      EscalationDao escalationDaoImpl = new EscalationDaoImpl();

      // Work Flow Rule Name
      List workflow_rule_name_list = escalationDaoImpl.getworkflow_rule_name_list();
      escalationForm.setWorkflow_rule_name_list(workflow_rule_name_list);

      // Flow Levels
      if (escalationForm.getEscalation_type() != null) {
        String escalation_type = escalationForm.getEscalation_type();
        List flow_level_list = escalationDaoImpl.getflow_levels_list(escalation_type);
        escalationForm.setFlow_level_list(flow_level_list);
      }

      // Escalation Type template
      List escalation_template_list = escalationDaoImpl.getEscalation_Template_List();
      escalationForm.setEscalation_template_list(escalation_template_list);
      System.out.println("escalation_template_list----" + escalation_template_list);
    } catch (Exception e) {
      logger.error("Exception Occurred" + e);
      errors.add("name", new ActionError("id"));
    }
  }
예제 #8
0
  public ActionForward initSearchEscalation(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    ActionErrors errors = new ActionErrors();
    ActionForward forward = new ActionForward(); // return value

    try {
      EscalationForm escalationForm = (EscalationForm) form;
      populate(form, request);
      escalationForm.setParamEscalationType(null);
      escalationForm.setEscalationMasterList(null);
    } catch (Exception e) {
      logger.error("Exception Occurred" + e);
      errors.add("name", new ActionError("id"));
    }

    forward = mapping.findForward("SearchEscalation");
    return (forward);
  }
예제 #9
0
  public ActionForward createEscalation(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    ActionErrors errors = new ActionErrors();
    ActionForward forward = new ActionForward();

    try {
      HttpSession session = request.getSession(false);
      UserDetailsDTO userDetails = (UserDetailsDTO) session.getAttribute("USER_INFO");

      EscalationForm escalationForm = (EscalationForm) form;
      EscalationDTO escalationDTO = new EscalationDTO();
      EscalationDao escalationDaoImpl = new EscalationDaoImpl();

      if (escalationForm != null) {
        logger.info("Form is not null");
        logger.debug("Form is not null");

        String userName = userDetails.getUserLoginId();
        escalationForm.setCreated_by(userName);
        escalationForm.setModified_by(userName);
        List escalation_level_list = escalationForm.getEscalation_level_list();

        BeanUtils.copyProperties(escalationDTO, escalationForm);

        int flag = escalationDaoImpl.createEscalation(escalationDTO);

        if (flag == 1) {
          //					errors.add(null, new ActionError("create.escalation.success"));
          //					saveErrors(request, errors);
          request.setAttribute(
              "RESET",
              "TRUE"); // used to identify from the initCreate Action that the action is called
          // after successfull creation.
          errors.add(null, new ActionError("create.escalation.success"));
          saveErrors(request, errors);
        } else if (flag == 2) {
          //					errors.add(null, new ActionError("create.escalation.existing"));
          //					saveErrors(request, errors);
          request.setAttribute(
              "RESET",
              "TRUE"); // used to identify from the initCreate Action that the action is called
          // after successfull creation.
          errors.add(null, new ActionError("create.escalation.existing"));
          saveErrors(request, errors);
        }
      }

    } catch (BusinessException exp) {
      exp.printStackTrace();
      errors.add("createEscalation", new ActionError(exp.getBusinessCode()));
      saveErrors(request, errors);
      return mapping.findForward("InitCreateEscalation");
    } catch (ApplicationException exp) {
      exp.printStackTrace();
      errors.add("createEscalation", new ActionError(exp.getBusinessCode()));
      saveErrors(request, errors);
      return mapping.findForward("InitCreateEscalation");
    } catch (Exception exp) {
      exp.printStackTrace();
      errors.add("createEscalation", new ActionError(""));
      saveErrors(request, errors);
      return mapping.findForward("InitCreateEscalation");
    }

    forward = mapping.findForward("CreateEscalationSuccess");
    return (forward);
  }