Ejemplo n.º 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);
  }
Ejemplo n.º 2
0
  /**
   * This method is excuted when the user generates the Average Elapsed Time Detail Report. It
   * accesses the business methods for generating the report.
   *
   * @param mapping defines a path that is matched against the request URI of the incoming request
   *     and usually specifies the fully qualified class name of an Action class.
   * @param form class makes it easy to store and validate the data for your application's input
   *     forms.
   * @param request This interface is for getting data from the client to service the request
   * @param response Interface for sending MIME data to the client.
   * @return forward
   * @throws Exception
   */
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

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

    try {
      AvgElapsedTimeForm elapsedTimeForm = (AvgElapsedTimeForm) form;
      AvgElapsedTimeSummaryDTO reqDto = new AvgElapsedTimeSummaryDTO();

      BeanUtils.copyProperties(reqDto, elapsedTimeForm);
      reqDto.setCircleID(elapsedTimeForm.getCircleID());

      ReportBO reportBO = new ReportBO();
      elapsedTimeForm.setTicketDetailsList(reportBO.generateAverageTimeElapsedDetails(reqDto));

      Calendar cal = Calendar.getInstance();
      SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
      String value = sdf.format(cal.getTime());
      String value1 = "AverageTimeElapsedDetails" + "_" + value + ".xls";
      String value2 = "AverageTimeElapsedDetails" + "_" + value + ".html";

      if (ReportConstantImpl.REPORT_FORMAT_EXCEL.equals(elapsedTimeForm.getReportFormat())) {
        response.setContentType("application/vnd.ms-excel");
        response.setHeader("Content-disposition", "attachment; filename=" + value1);
        response.setHeader("Cache-Control", "max-age=0");
        forward = mapping.findForward("success");
      } else if (ReportConstantImpl.REPORT_FORMAT_HTML.equals(elapsedTimeForm.getReportFormat())) {
        response.setContentType("application/html");
        response.setHeader("Content-disposition", "attachment; filename=" + value2);
        response.setHeader("Cache-Control", "max-age=0");
        forward = mapping.findForward("success");
      } else {
        forward = mapping.findForward("displayOnSamePage");
      }

    } catch (BusinessException e) {
      errors.add("busErr", new ActionError(e.getBusinessCode()));
      saveErrors(request, errors);
      logger.error("BusinessException in Report Action" + e);
      forward = mapping.findForward("failure");
      e.printStackTrace();
    } catch (ApplicationException e) {
      errors.add("appErr", new ActionError(""));
      saveErrors(request, errors);
      logger.error("ApplicationException in Report Action" + e.getMessage());
      forward = mapping.findForward("failure");
      e.printStackTrace();

    } catch (Exception e) {
      errors.add("appErr", new ActionMessage(""));
      saveErrors(request, errors);
      logger.error("Exception in Report Action" + e.getMessage());
      forward = mapping.findForward("failure");
      e.printStackTrace();
    }

    return (forward);
  }
Ejemplo n.º 3
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);
  }