Esempio n. 1
0
 public ActionForward updateMonitorService(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   MonitorService monitorService = (MonitorService) ((DynaActionForm) form).get("monitorService");
   DependencyUtil.clearDependencyProperty(monitorService);
   monitorHostserviceService.updateMonitorService(monitorService);
   return mapping.findForward("success");
 }
Esempio n. 2
0
 public ActionForward viewMonitorService(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   String id = request.getParameter("id");
   MonitorService monitorService =
       monitorHostserviceService.getMonitorService(Integer.valueOf(id));
   DependencyUtil.initDependencyProperty(monitorService);
   ((DynaActionForm) form).set("monitorService", monitorService);
   return mapping.findForward("view");
 }
 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");
 }
Esempio n. 4
0
  /**
   * 增加主机服务
   *
   * @param mapping .
   * @param form .
   * @param request .
   * @param response .
   * @return .
   * @throws Exception .
   */
  public ActionForward addMonitorService(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    ActionMessages errors = new ActionMessages();
    MonitorService monitorService = (MonitorService) ((DynaActionForm) form).get("monitorService");
    String type = (String) ((DynaActionForm) form).get("type");
    DependencyUtil.clearDependencyProperty(monitorService);
    monitorHostserviceService.saveMonitorService(monitorService);

    if (!errors.isEmpty()) {
      saveErrors(request, errors);
      return mapping.findForward("input");
    } else {
      return mapping.findForward("success");
    }
  }
  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");
  }
  /**
   * 增加服务模板
   *
   * @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");
    }
  }