Package org.jmanage.webui.forms

Examples of org.jmanage.webui.forms.AlertForm


                                 HttpServletRequest request,
                                 HttpServletResponse response)
            throws Exception {


        AlertForm alertForm = (AlertForm)actionForm;
        String sourceType = alertForm.getAlertSourceType();
        assert sourceType != null;
        ApplicationConfig appConfig= context.getApplicationConfig();
       
        if(sourceType.equals(AlertSourceConfig.SOURCE_TYPE_APPLICATION_DOWN)){
            String url = "/config/showAddAlert.do?"
View Full Code Here


                                 HttpServletRequest request,
                                 HttpServletResponse response)
            throws Exception {

        AccessController.checkAccess(Utils.getServiceContext(context), ACL_ADD_ALERT);
        AlertForm alertForm = (AlertForm)actionForm;
        String sourceType = request.getParameter(RequestParams.ALERT_SOURCE_TYPE);
        request.setAttribute("alertSourceType",
                            sourceType);
        if(sourceType.equals(AlertSourceConfig.SOURCE_TYPE_NOTIFICATION)){
            Expression expr = new Expression(alertForm.getExpression());
            request.setAttribute("sourceMBean", expr.getMBeanName());
            request.setAttribute("notificationType", expr.getTargetName());
        }else if(sourceType.equals(AlertSourceConfig.SOURCE_TYPE_GAUGE_MONITOR)
                || sourceType.equals(AlertSourceConfig.SOURCE_TYPE_STRING_MONITOR)){
            Expression expr = new Expression(alertForm.getExpression());
            request.setAttribute("sourceMBean", expr.getMBeanName());
            request.setAttribute("attribute", expr.getTargetName());
            MBeanService mbeanService = ServiceFactory.getMBeanService();
            ObjectAttribute objAttr = mbeanService.getObjectAttribute(
                    Utils.getServiceContext(context, expr),
View Full Code Here

                                 ActionMapping mapping,
                                 ActionForm actionForm,
                                 HttpServletRequest request,
                                 HttpServletResponse response)
            throws Exception {
        AlertForm form = (AlertForm)actionForm;
        ApplicationConfig appConfig = context.getApplicationConfig();
        AlertConfig alertConfig = null;
        String alertId = request.getParameter(RequestParams.ALERT_ID);
        if(alertId==null || alertId.equals("")){
            alertConfig = new AlertConfig(AlertConfig.getNextAlertId(),
                    form.getAlertName(),
                    form.getAlertDelivery(),
                    form.getEmailAddress());
            alertConfig.setAlertSourceConfig(getAlertSourceConfig(context,form));
            appConfig.addAlert(alertConfig);
        }else{
            alertConfig = appConfig.findAlertById(form.getAlertId());
            alertConfig.setAlertName(form.getAlertName());
            alertConfig.setAlertDelivery(form.getAlertDelivery());
            if(form.getEmailAddress()!=null){
                alertConfig.setEmailAddress(form.getEmailAddress());
            }
            alertConfig.setAlertSourceConfig(getAlertSourceConfig(context,form));
        }
        ApplicationConfigManager.updateApplication(appConfig);
View Full Code Here

                                 ActionForm actionForm,
                                 HttpServletRequest request,
                                 HttpServletResponse response)
            throws Exception {
        AccessController.checkAccess(Utils.getServiceContext(context), ACL_EDIT_ALERT);
        AlertForm form = (AlertForm)actionForm;
        String alertId = request.getParameter(RequestParams.ALERT_ID);
        ApplicationConfig appConfig = context.getApplicationConfig();
        AlertConfig alertConfig = appConfig.findAlertById(alertId);
        if(alertConfig!=null){
            form.setAlertName(alertConfig.getAlertName());
            form.setAlertDelivery(alertConfig.getAlertDelivery());
            form.setEmailAddress(alertConfig.getEmailAddress());
            AlertSourceConfig alertSrcConfig = alertConfig.getAlertSourceConfig();
            String sourceType = alertSrcConfig.getSourceType();
            form.setAlertSourceType(alertSrcConfig.getSourceType());
            request.setAttribute("alertSourceType",sourceType);
            request.setAttribute("sourceMBean", alertSrcConfig.getObjectName());
            // expression
            Expression expression = null;
            if(sourceType.equals(AlertSourceConfig.SOURCE_TYPE_NOTIFICATION) ||
              sourceType.equals(AlertSourceConfig.SOURCE_TYPE_APPLICATION_DOWN)){
                expression = new Expression(null, alertSrcConfig.getObjectName(),
                        alertSrcConfig.getNotificationType());
                request.setAttribute("notificationType",
                        alertSrcConfig.getNotificationType());
            }else if(sourceType.equals(
                    AlertSourceConfig.SOURCE_TYPE_GAUGE_MONITOR) ||sourceType.equals(
                    AlertSourceConfig.SOURCE_TYPE_STRING_MONITOR) ){
                expression = new Expression(null, alertSrcConfig.getObjectName(),
                        alertSrcConfig.getAttributeName());
                request.setAttribute("attribute", alertSrcConfig.getAttributeName());
                MBeanService mbeanService = ServiceFactory.getMBeanService();
                ObjectAttribute objAttr = mbeanService.getObjectAttribute(
                    Utils.getServiceContext(context, expression),
                    expression.getTargetName());
                request.setAttribute("currentAttrValue",
                        objAttr.getDisplayValue());
                if(sourceType.equals(
                    AlertSourceConfig.SOURCE_TYPE_GAUGE_MONITOR)){
                    form.setMinAttributeValue(alertSrcConfig.getLowThreshold().toString());
                    form.setMaxAttributeValue(alertSrcConfig.getHighThreshold().toString());
                }else if(sourceType.equals(
                    AlertSourceConfig.SOURCE_TYPE_STRING_MONITOR)){
                    form.setStringAttributeValue(alertSrcConfig.getStringAttributeValue());
                }
            }
            form.setExpression(expression.toString());
        }
        /*set current page for navigation*/
        request.setAttribute(RequestAttributes.NAV_CURRENT_PAGE, "Edit Alert");
        return mapping.findForward(Forwards.SUCCESS);
    }
View Full Code Here

TOP

Related Classes of org.jmanage.webui.forms.AlertForm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.