org.rhq.enterprise.server.alert
Class AlertDefinitionManagerBean

java.lang.Object
  extended by org.rhq.enterprise.server.alert.AlertDefinitionManagerBean
All Implemented Interfaces:
AlertDefinitionManagerLocal, AlertDefinitionManagerRemote

public class AlertDefinitionManagerBean
extends Object
implements AlertDefinitionManagerLocal, AlertDefinitionManagerRemote

Author:
Joseph Marques

Constructor Summary
AlertDefinitionManagerBean()
           
 
Method Summary
 void copyAlertDefinitions(org.rhq.core.domain.auth.Subject subject, Integer[] alertDefinitionIds)
           
 int createAlertDefinition(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.alert.AlertDefinition alertDefinition, Integer resourceId, boolean validateNotificationConfiguration)
          Creates a new alert definition.
 int createDependentAlertDefinition(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.alert.AlertDefinition alertDefinition, int resourceId)
          This is exactly the same as AlertDefinitionManagerLocal.createAlertDefinition(Subject, AlertDefinition, Integer, boolean) but assumes the resource is part of a group (or has given resource type for templates) for which a group or template alert definition is being created.
 int disableAlertDefinitions(org.rhq.core.domain.auth.Subject subject, int[] alertDefinitionIds)
           
 int enableAlertDefinitions(org.rhq.core.domain.auth.Subject subject, int[] alertDefinitionIds)
           
 List<org.rhq.core.domain.common.composite.IntegerOptionItem> findAlertDefinitionOptionItemsForGroup(org.rhq.core.domain.auth.Subject subject, int groupId)
           
 List<org.rhq.core.domain.common.composite.IntegerOptionItem> findAlertDefinitionOptionItemsForResource(org.rhq.core.domain.auth.Subject subject, int resourceId)
           
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.alert.AlertDefinition> findAlertDefinitions(org.rhq.core.domain.auth.Subject subject, int resourceId, org.rhq.core.domain.util.PageControl pageControl)
           
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.alert.AlertDefinition> findAlertDefinitionsByCriteria(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.criteria.AlertDefinitionCriteria criteria)
           
 List<org.rhq.core.domain.alert.AlertDefinition> findAllRecoveryDefinitionsById(org.rhq.core.domain.auth.Subject subject, Integer alertDefinitionId)
           
 org.rhq.core.domain.alert.AlertDefinition getAlertDefinition(org.rhq.core.domain.auth.Subject subject, int alertDefinitionId)
           
 org.rhq.core.domain.alert.AlertDefinition getAlertDefinitionById(org.rhq.core.domain.auth.Subject subject, int alertDefinitionId)
           
 String[] getAlertNotificationConfigurationPreview(org.rhq.core.domain.auth.Subject sessionSubject, org.rhq.core.domain.alert.notification.AlertNotification[] notifications)
           
 boolean isEnabled(Integer definitionId)
           
 boolean isGroupAlertDefinition(Integer definitionId)
           
 boolean isResourceAlertDefinition(Integer definitionId)
           
 boolean isTemplate(Integer definitionId)
           
 void purgeInternals(int alertDefinitionId)
           
 int purgeUnusedAlertDefinitions()
           
 int removeAlertDefinitions(org.rhq.core.domain.auth.Subject subject, int[] alertDefinitionIds)
           
 org.rhq.core.domain.alert.AlertDefinition updateAlertDefinition(org.rhq.core.domain.auth.Subject subject, int alertDefinitionId, org.rhq.core.domain.alert.AlertDefinition alertDefinition, boolean resetMatching)
           
 org.rhq.core.domain.alert.AlertDefinition updateDependentAlertDefinition(org.rhq.core.domain.auth.Subject subject, int alertDefinitionId, org.rhq.core.domain.alert.AlertDefinition alertDefinition, boolean resetMatching)
          This method is similar in use-case to AlertDefinitionManagerLocal.createDependentAlertDefinition(Subject, AlertDefinition, int).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AlertDefinitionManagerBean

public AlertDefinitionManagerBean()
Method Detail

findAlertDefinitions

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.alert.AlertDefinition> findAlertDefinitions(org.rhq.core.domain.auth.Subject subject,
                                                                                                         int resourceId,
                                                                                                         org.rhq.core.domain.util.PageControl pageControl)
Specified by:
findAlertDefinitions in interface AlertDefinitionManagerLocal

getAlertDefinitionById

public org.rhq.core.domain.alert.AlertDefinition getAlertDefinitionById(org.rhq.core.domain.auth.Subject subject,
                                                                        int alertDefinitionId)
Specified by:
getAlertDefinitionById in interface AlertDefinitionManagerLocal

findAlertDefinitionOptionItemsForResource

public List<org.rhq.core.domain.common.composite.IntegerOptionItem> findAlertDefinitionOptionItemsForResource(org.rhq.core.domain.auth.Subject subject,
                                                                                                              int resourceId)
Specified by:
findAlertDefinitionOptionItemsForResource in interface AlertDefinitionManagerLocal

findAlertDefinitionOptionItemsForGroup

public List<org.rhq.core.domain.common.composite.IntegerOptionItem> findAlertDefinitionOptionItemsForGroup(org.rhq.core.domain.auth.Subject subject,
                                                                                                           int groupId)
Specified by:
findAlertDefinitionOptionItemsForGroup in interface AlertDefinitionManagerLocal

createDependentAlertDefinition

public int createDependentAlertDefinition(org.rhq.core.domain.auth.Subject subject,
                                          org.rhq.core.domain.alert.AlertDefinition alertDefinition,
                                          int resourceId)
                                   throws InvalidAlertDefinitionException
Description copied from interface: AlertDefinitionManagerLocal
This is exactly the same as AlertDefinitionManagerLocal.createAlertDefinition(Subject, AlertDefinition, Integer, boolean) but assumes the resource is part of a group (or has given resource type for templates) for which a group or template alert definition is being created.

This method assumes the caller already checked the subject has permissions to create a group or template alert definition on a group / resource type the resource is member of.

In another words this method is a helper to GroupAlertDefinitionManagerLocal.createGroupAlertDefinitions(Subject, AlertDefinition, Integer) and AlertTemplateManagerLocal.createAlertTemplate(Subject, AlertDefinition, Integer).

Specified by:
createDependentAlertDefinition in interface AlertDefinitionManagerLocal
Parameters:
subject - the user that is creating the group or template alert definition
alertDefinition - the alert definition on the resource
resourceId - the resource
Returns:
the id of the newly created alert definition
Throws:
InvalidAlertDefinitionException

createAlertDefinition

public int createAlertDefinition(org.rhq.core.domain.auth.Subject subject,
                                 org.rhq.core.domain.alert.AlertDefinition alertDefinition,
                                 Integer resourceId,
                                 boolean validateNotificationConfiguration)
                          throws InvalidAlertDefinitionException
Description copied from interface: AlertDefinitionManagerLocal
Creates a new alert definition. Note that the suject is checked to have necessary authz, which might not be what you want in all use cases. See AlertDefinitionManagerLocal.createDependentAlertDefinition(Subject, AlertDefinition, int) for further discussion of this.

Specified by:
createAlertDefinition in interface AlertDefinitionManagerLocal
Parameters:
subject - the user creating the alert definition
alertDefinition - the new alert definition to persist
resourceId - the resource id for which the def is being created
validateNotificationConfiguration - if true, the configuration of the def's notifications is validated. This is NOT what you want if, for example, you are merely creating a copy of an existing definition. Some notifications might require more input when creating the notification than is then persisted in their configs (prominent example being the CLI alert sender). This would then cause the validation to fail every time you created a copy of a definition and tried to persist it. Note that passing false AND having new, unpersisted notifications in the alert definition can lead to invalid configuration being stored for the notifications.
Returns:
the id of the newly persisted alert definition
Throws:
InvalidAlertDefinitionException

removeAlertDefinitions

public int removeAlertDefinitions(org.rhq.core.domain.auth.Subject subject,
                                  int[] alertDefinitionIds)
Specified by:
removeAlertDefinitions in interface AlertDefinitionManagerLocal
Specified by:
removeAlertDefinitions in interface AlertDefinitionManagerRemote

enableAlertDefinitions

public int enableAlertDefinitions(org.rhq.core.domain.auth.Subject subject,
                                  int[] alertDefinitionIds)
Specified by:
enableAlertDefinitions in interface AlertDefinitionManagerLocal
Specified by:
enableAlertDefinitions in interface AlertDefinitionManagerRemote

isEnabled

public boolean isEnabled(Integer definitionId)
Specified by:
isEnabled in interface AlertDefinitionManagerLocal

isTemplate

public boolean isTemplate(Integer definitionId)
Specified by:
isTemplate in interface AlertDefinitionManagerLocal

isGroupAlertDefinition

public boolean isGroupAlertDefinition(Integer definitionId)
Specified by:
isGroupAlertDefinition in interface AlertDefinitionManagerLocal

isResourceAlertDefinition

public boolean isResourceAlertDefinition(Integer definitionId)
Specified by:
isResourceAlertDefinition in interface AlertDefinitionManagerLocal

disableAlertDefinitions

public int disableAlertDefinitions(org.rhq.core.domain.auth.Subject subject,
                                   int[] alertDefinitionIds)
Specified by:
disableAlertDefinitions in interface AlertDefinitionManagerLocal
Specified by:
disableAlertDefinitions in interface AlertDefinitionManagerRemote

copyAlertDefinitions

public void copyAlertDefinitions(org.rhq.core.domain.auth.Subject subject,
                                 Integer[] alertDefinitionIds)
Specified by:
copyAlertDefinitions in interface AlertDefinitionManagerLocal

findAllRecoveryDefinitionsById

public List<org.rhq.core.domain.alert.AlertDefinition> findAllRecoveryDefinitionsById(org.rhq.core.domain.auth.Subject subject,
                                                                                      Integer alertDefinitionId)
Specified by:
findAllRecoveryDefinitionsById in interface AlertDefinitionManagerLocal

updateAlertDefinition

public org.rhq.core.domain.alert.AlertDefinition updateAlertDefinition(org.rhq.core.domain.auth.Subject subject,
                                                                       int alertDefinitionId,
                                                                       org.rhq.core.domain.alert.AlertDefinition alertDefinition,
                                                                       boolean resetMatching)
                                                                throws InvalidAlertDefinitionException,
                                                                       AlertDefinitionUpdateException
Specified by:
updateAlertDefinition in interface AlertDefinitionManagerLocal
resetMatching - Incur the overhead of resetting any partial alert matching that has taken place. This *must* be set true if updating conditions, dampening rules or the conditionExpressin (ANY vs ALL). If in doubt, set to true as the loss of partial matching is better than corrupted matching.
Returns:
Throws:
InvalidAlertDefinitionException
AlertDefinitionUpdateException

updateDependentAlertDefinition

public org.rhq.core.domain.alert.AlertDefinition updateDependentAlertDefinition(org.rhq.core.domain.auth.Subject subject,
                                                                                int alertDefinitionId,
                                                                                org.rhq.core.domain.alert.AlertDefinition alertDefinition,
                                                                                boolean resetMatching)
                                                                         throws InvalidAlertDefinitionException,
                                                                                AlertDefinitionUpdateException
Description copied from interface: AlertDefinitionManagerLocal
This method is similar in use-case to AlertDefinitionManagerLocal.createDependentAlertDefinition(Subject, AlertDefinition, int). It assumes that the the update is part of some more complex operation (like updating alert definition on a group or a template) and that authz checks have already been performed.

This method is therefore identical to AlertDefinitionManagerLocal.updateAlertDefinition(Subject, int, AlertDefinition, boolean) but does not perform any authorization checks.

Specified by:
updateDependentAlertDefinition in interface AlertDefinitionManagerLocal
Parameters:
subject - the user that is updating the alert definition
Returns:
Throws:
InvalidAlertDefinitionException
AlertDefinitionUpdateException

purgeInternals

public void purgeInternals(int alertDefinitionId)
Specified by:
purgeInternals in interface AlertDefinitionManagerLocal

purgeUnusedAlertDefinitions

public int purgeUnusedAlertDefinitions()
Specified by:
purgeUnusedAlertDefinitions in interface AlertDefinitionManagerLocal

getAlertDefinition

public org.rhq.core.domain.alert.AlertDefinition getAlertDefinition(org.rhq.core.domain.auth.Subject subject,
                                                                    int alertDefinitionId)
Specified by:
getAlertDefinition in interface AlertDefinitionManagerLocal
Specified by:
getAlertDefinition in interface AlertDefinitionManagerRemote

findAlertDefinitionsByCriteria

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.alert.AlertDefinition> findAlertDefinitionsByCriteria(org.rhq.core.domain.auth.Subject subject,
                                                                                                                   org.rhq.core.domain.criteria.AlertDefinitionCriteria criteria)
Specified by:
findAlertDefinitionsByCriteria in interface AlertDefinitionManagerLocal
Specified by:
findAlertDefinitionsByCriteria in interface AlertDefinitionManagerRemote

getAlertNotificationConfigurationPreview

public String[] getAlertNotificationConfigurationPreview(org.rhq.core.domain.auth.Subject sessionSubject,
                                                         org.rhq.core.domain.alert.notification.AlertNotification[] notifications)
Specified by:
getAlertNotificationConfigurationPreview in interface AlertDefinitionManagerLocal
Specified by:
getAlertNotificationConfigurationPreview in interface AlertDefinitionManagerRemote


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