org.rhq.enterprise.server.alert
Class AlertNotificationManagerBean

java.lang.Object
  extended by org.rhq.enterprise.server.alert.AlertNotificationManagerBean
All Implemented Interfaces:
AlertNotificationManagerLocal

public class AlertNotificationManagerBean
extends Object
implements AlertNotificationManagerLocal

Author:
Joseph Marques, Heiko W. Rupp

Constructor Summary
AlertNotificationManagerBean()
           
 
Method Summary
 org.rhq.core.domain.alert.notification.AlertNotification addAlertNotification(org.rhq.core.domain.auth.Subject user, int alertDefinitionId, org.rhq.core.domain.alert.notification.AlertNotification notification)
          Add a new AlertNotification to the passed definition
 int cleanseAlertNotificationByRole(int roleId)
           
 int cleanseAlertNotificationBySubject(int subjectId)
           
 boolean finalizeNotifications(org.rhq.core.domain.auth.Subject subject, List<org.rhq.core.domain.alert.notification.AlertNotification> notifications)
          This method calls out to the alert senders responsible to individual notifications and ask them to finalize and validate the notifications before they are processed further.
 AlertSenderInfo getAlertInfoForSender(String shortName)
           
 org.rhq.core.domain.alert.notification.AlertNotification getAlertNotification(org.rhq.core.domain.auth.Subject user, int alertNotificationId)
           
 CustomAlertSenderBackingBean getBackingBeanForSender(String shortName, Integer alertNotificationId)
          Return the backing bean for the AlertSender with the passed shortName.
 String getBackingBeanNameForSender(String shortName)
           
 org.rhq.core.domain.configuration.definition.ConfigurationDefinition getConfigurationDefinitionForSender(String shortName)
           
 List<org.rhq.core.domain.alert.notification.AlertNotification> getNotificationsForAlertDefinition(org.rhq.core.domain.auth.Subject user, int alertDefinitionId)
          Return notifications for a certain alertDefinitionId NOTE: this only returns notifications that have an AlertSender defined.
 List<String> listAllAlertSenders()
          Return a list of all available AlertSenders in the system by their shortname.
 void massReconfigure(List<Integer> alertNotificationIds, Map<String,String> newConfigurationValues)
          This method can be used to reconfigure a number of notifications en-masse.
 int purgeOrphanedAlertNotifications()
           
 int removeNotifications(org.rhq.core.domain.auth.Subject subject, Integer alertDefinitionId, Integer[] notificationIds)
          Remove the passed notifications from the passed alert definition (all identified by their id)
 void updateAlertNotification(org.rhq.core.domain.auth.Subject subject, int alertDefinitionId, org.rhq.core.domain.alert.notification.AlertNotification notification)
          Persist changes to the passed AlertNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AlertNotificationManagerBean

public AlertNotificationManagerBean()
Method Detail

addAlertNotification

public org.rhq.core.domain.alert.notification.AlertNotification addAlertNotification(org.rhq.core.domain.auth.Subject user,
                                                                                     int alertDefinitionId,
                                                                                     org.rhq.core.domain.alert.notification.AlertNotification notification)
                                                                              throws AlertDefinitionUpdateException
Description copied from interface: AlertNotificationManagerLocal
Add a new AlertNotification to the passed definition

Specified by:
addAlertNotification in interface AlertNotificationManagerLocal
Parameters:
user - subject of the caller
alertDefinitionId - Id of the alert definition
Throws:
AlertDefinitionUpdateException - if the AlertNotification is not associated with a known sender

updateAlertNotification

public void updateAlertNotification(org.rhq.core.domain.auth.Subject subject,
                                    int alertDefinitionId,
                                    org.rhq.core.domain.alert.notification.AlertNotification notification)
Description copied from interface: AlertNotificationManagerLocal
Persist changes to the passed AlertNotification

Specified by:
updateAlertNotification in interface AlertNotificationManagerLocal

removeNotifications

public int removeNotifications(org.rhq.core.domain.auth.Subject subject,
                               Integer alertDefinitionId,
                               Integer[] notificationIds)
Description copied from interface: AlertNotificationManagerLocal
Remove the passed notifications from the passed alert definition (all identified by their id)

Specified by:
removeNotifications in interface AlertNotificationManagerLocal
Parameters:
subject - Caller
alertDefinitionId - alert definition to modify
notificationIds - Notifications to remove
Returns:
number of notifications removed

purgeOrphanedAlertNotifications

public int purgeOrphanedAlertNotifications()
Specified by:
purgeOrphanedAlertNotifications in interface AlertNotificationManagerLocal

getConfigurationDefinitionForSender

public org.rhq.core.domain.configuration.definition.ConfigurationDefinition getConfigurationDefinitionForSender(String shortName)
Specified by:
getConfigurationDefinitionForSender in interface AlertNotificationManagerLocal

listAllAlertSenders

public List<String> listAllAlertSenders()
Return a list of all available AlertSenders in the system by their shortname.

Specified by:
listAllAlertSenders in interface AlertNotificationManagerLocal
Returns:
list of senders.

getAlertInfoForSender

public AlertSenderInfo getAlertInfoForSender(String shortName)
Specified by:
getAlertInfoForSender in interface AlertNotificationManagerLocal

getBackingBeanForSender

public CustomAlertSenderBackingBean getBackingBeanForSender(String shortName,
                                                            Integer alertNotificationId)
Return the backing bean for the AlertSender with the passed shortName. If a notificationId is passed, we try to load the configuration for this notification and pass it to the CustomAlertSenderBackingBean instance

Specified by:
getBackingBeanForSender in interface AlertNotificationManagerLocal
Parameters:
shortName - name of a sender
alertNotificationId - id of the notification we assign this sender + its backing bean to
Returns:
an initialized BackingBean or null in case of error

getBackingBeanNameForSender

public String getBackingBeanNameForSender(String shortName)
Specified by:
getBackingBeanNameForSender in interface AlertNotificationManagerLocal

getNotificationsForAlertDefinition

public List<org.rhq.core.domain.alert.notification.AlertNotification> getNotificationsForAlertDefinition(org.rhq.core.domain.auth.Subject user,
                                                                                                         int alertDefinitionId)
Return notifications for a certain alertDefinitionId NOTE: this only returns notifications that have an AlertSender defined.

Specified by:
getNotificationsForAlertDefinition in interface AlertNotificationManagerLocal
Parameters:
user - Subject of the caller
alertDefinitionId - Id of the alert definition
Returns:
list of defined notification of the passed alert definition

getAlertNotification

public org.rhq.core.domain.alert.notification.AlertNotification getAlertNotification(org.rhq.core.domain.auth.Subject user,
                                                                                     int alertNotificationId)
Specified by:
getAlertNotification in interface AlertNotificationManagerLocal

finalizeNotifications

public boolean finalizeNotifications(org.rhq.core.domain.auth.Subject subject,
                                     List<org.rhq.core.domain.alert.notification.AlertNotification> notifications)
Description copied from interface: AlertNotificationManagerLocal
This method calls out to the alert senders responsible to individual notifications and ask them to finalize and validate the notifications before they are processed further. This gives the alert senders the chance to transform their configurations from what's being input by the user to what needs to be persisted and to perform validation of the configurations.

The notifications can be modified during this call. New properties can be added to their configurations, etc.

Specified by:
finalizeNotifications in interface AlertNotificationManagerLocal
Parameters:
subject - the subject that is requesting the changes
notifications - the notifications to process
Returns:
true if everything went ok, false if the validation fails. In this case one or more properties in the configuration or extra configuration of one or more of the notifications contains an error message describing the error.

cleanseAlertNotificationBySubject

public int cleanseAlertNotificationBySubject(int subjectId)
Specified by:
cleanseAlertNotificationBySubject in interface AlertNotificationManagerLocal

cleanseAlertNotificationByRole

public int cleanseAlertNotificationByRole(int roleId)
Specified by:
cleanseAlertNotificationByRole in interface AlertNotificationManagerLocal

massReconfigure

public void massReconfigure(List<Integer> alertNotificationIds,
                            Map<String,String> newConfigurationValues)
Description copied from interface: AlertNotificationManagerLocal
This method can be used to reconfigure a number of notifications en-masse.

Specified by:
massReconfigure in interface AlertNotificationManagerLocal
Parameters:
alertNotificationIds - the alert notifications to update
newConfigurationValues - a map where keys are the property names and values are the new property values


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.