Ejemplo 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");
 }
Ejemplo n.º 2
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");
    }
  }
Ejemplo n.º 3
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");
    }
  }