예제 #1
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);
  }
예제 #2
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);
  }