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);
/* tell the AlertEngine about the new or modified AlertConfig*/
AlertEngine.getInstance().updateAlertConfig(alertConfig);