Exemplo n.º 1
0
 public ActionForward selectMonitorServiceTemplate(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   String templateId = request.getParameter("templateId");
   if (StringUtils.isNotBlank(templateId)) {
     MonitorServiceTemplate monitorServiceTemplate =
         templateService.findMonitorServiceTemplateById(Integer.valueOf(templateId));
     request.setAttribute("monitorServiceTemplate", monitorServiceTemplate);
   }
   List list = templateService.findAllMonitorServiceTemplate();
   request.setAttribute("list", list);
   request.setAttribute("templateId", templateId);
   return mapping.findForward("selectServiceTemplate");
 }
Exemplo n.º 2
0
 public ActionForward updateMonitorServiceTemplate(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   MonitorServiceTemplate monitorServiceTemplate =
       (MonitorServiceTemplate) ((DynaActionForm) form).get("monitorServiceTemplate");
   DependencyUtil.clearDependencyProperty(monitorServiceTemplate);
   templateService.updateMonitorServiceTemplate(monitorServiceTemplate);
   return mapping.findForward("success");
 }
Exemplo n.º 3
0
  public ActionForward editMonitorServiceTemplate(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    String templateId = request.getParameter("templateId");
    MonitorServiceTemplate monitorServiceTemplate =
        templateService.findMonitorServiceTemplateById(Integer.valueOf(templateId));
    DependencyUtil.initDependencyProperty(monitorServiceTemplate);
    List monitorTimePeriods = templateService.findAllMonitorTimePeriods();
    List monitorContactgroups = monitorSupportService.findAllMonitorContactgroups();
    List serviceCommands = monitorSupportService.findMonitorCommands(Integer.valueOf(2));
    ((DynaActionForm) form).set("monitorServiceTemplate", monitorServiceTemplate);
    ((DynaActionForm) form).set("type", "edit");
    request.getSession().setAttribute("monitorTimePeriods", monitorTimePeriods);
    request.getSession().setAttribute("monitorContactgroups", monitorContactgroups);
    request.getSession().setAttribute("serviceCommands", serviceCommands);

    return mapping.findForward("input");
  }
Exemplo n.º 4
0
 public ActionForward viewMonitorServiceTemplate(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   String templateId = request.getParameter("templateId");
   MonitorServiceTemplate monitorServiceTemplate =
       templateService.findMonitorServiceTemplateById(Integer.valueOf(templateId));
   DependencyUtil.initDependencyProperty(monitorServiceTemplate);
   ((DynaActionForm) form).set("monitorServiceTemplate", monitorServiceTemplate);
   return mapping.findForward("view");
 }
Exemplo n.º 5
0
  public ActionForward deleteMonitorServiceTemplate(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    String templateId = request.getParameter("templateId");
    response.setCharacterEncoding("UTF-8");
    PrintWriter writer = response.getWriter();
    templateService.deleteMonitorServiceTemplate(Integer.valueOf(templateId));
    writer.write("删除服务模板成功!");

    return null;
  }
Exemplo n.º 6
0
  public ActionForward inputMonitorServiceTemplate(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    MonitorServiceTemplate monitorServiceTemplate = new MonitorServiceTemplate();
    List monitorTimePeriods = templateService.findAllMonitorTimePeriods();
    List monitorContactgroups = monitorSupportService.findAllMonitorContactgroups();
    List serviceCommands = monitorSupportService.findMonitorCommands(Integer.valueOf(2));
    ((DynaActionForm) form).set("monitorServiceTemplate", monitorServiceTemplate);
    ((DynaActionForm) form).set("type", "add");
    request.getSession().setAttribute("monitorTimePeriods", monitorTimePeriods);
    request.getSession().setAttribute("monitorContactgroups", monitorContactgroups);
    request.getSession().setAttribute("serviceCommands", serviceCommands);

    return mapping.findForward("input");
  }
Exemplo n.º 7
0
  public ActionForward listMonitorServiceTemplate(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    // query condition
    MonitorServiceTemplate monitorServiceTemplate =
        (MonitorServiceTemplate) ((DynaActionForm) form).get("monitorServiceTemplate");
    List monitorContactgroups = monitorSupportService.findAllMonitorContactgroups();

    DBPaginatedList page = new DBPaginatedList();
    PaginationUtil.pageInfoPopulate("row", request, page);
    templateService.findMonitorServiceTemplateByPage(page, monitorServiceTemplate);

    request.setAttribute("serviceTemplates", page);
    request.getSession().setAttribute("monitorContactgroups", monitorContactgroups);
    ((DynaActionForm) form).set("monitorServiceTemplate", monitorServiceTemplate);

    return mapping.findForward("list");
  }
Exemplo n.º 8
0
  /**
   * 增加服务模板
   *
   * @param mapping .
   * @param form .
   * @param request .
   * @param response .
   * @return .
   * @throws Exception .
   */
  public ActionForward addMonitorServiceTemplate(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    ActionMessages errors = new ActionMessages();
    try {
      MonitorServiceTemplate monitorServiceTemplate =
          (MonitorServiceTemplate) ((DynaActionForm) form).get("monitorServiceTemplate");
      DependencyUtil.clearDependencyProperty(monitorServiceTemplate);
      templateService.saveMonitorServiceTemplate(monitorServiceTemplate);
    } catch (TemplateAlreadyExistException e) {
      errors.add("addMonitorServiceTemplate", new ActionMessage("errors.TemplateExist"));
    }

    if (!errors.isEmpty()) {
      saveErrors(request, errors);
      return mapping.findForward("input");
    } else {
      return mapping.findForward("success");
    }
  }