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);
}