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*/