Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.hq.events.server.session
Class AlertDefinitionManagerEJBImpl

java.lang.Object
  extended by org.hyperic.hq.events.server.session.SessionBase
      extended by org.hyperic.hq.events.server.session.AlertDefinitionManagerEJBImpl
All Implemented Interfaces:
java.io.Serializable, javax.ejb.EnterpriseBean, javax.ejb.SessionBean

public class AlertDefinitionManagerEJBImpl
extends SessionBase
implements javax.ejb.SessionBean

Stores Events to and deletes Events from storage

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.hyperic.hq.events.server.session.SessionBase
DATASOURCE, SEQUENCE_INTERVAL
 
Constructor Summary
AlertDefinitionManagerEJBImpl()
           
 
Method Summary
 void cleanupAlertDefs(java.util.List alertDefIds)
           
 AlertDefinitionValue createAlertDefinition(AlertDefinitionValue a)
          Create a new alert definition
 AlertDefinitionValue createAlertDefinition(AuthzSubject subj, AlertDefinitionValue a)
          Create a new alert definition
 void deleteAlertDefinitions(AuthzSubject subj, java.lang.Integer[] ids)
          Remove alert definitions
 void disassociateResource(Resource r)
          Set Resource to null on entity's alert definitions
 void ejbActivate()
           
 void ejbCreate()
           
 void ejbPassivate()
           
 void ejbPostCreate()
           
 void ejbRemove()
           
 AlertDefinition findAlertDefinitionById(java.lang.Integer id)
           
 PageList findAlertDefinitionChildren(java.lang.Integer id)
          Get list of children alert definition for a parent alert definition
 java.util.SortedMap findAlertDefinitionNames(AppdefEntityID id, java.lang.Integer parentId)
          Get list of alert definition names for a resource
 java.util.SortedMap findAlertDefinitionNames(AuthzSubject subj, AppdefEntityID id, java.lang.Integer parentId)
          Get list of alert definition names for a resource
 java.util.List findAlertDefinitions(AuthzSubject subj, AlertSeverity minSeverity, java.lang.Boolean enabled, boolean excludeTypeBased, PageInfo pInfo)
          Find alert definitions passing the criteria.
 java.util.List findAlertDefinitions(AuthzSubject subject, AppdefEntityID id)
          Get list of alert definition POJOs for a resource
 PageList findAlertDefinitions(AuthzSubject subj, AppdefEntityID id, PageControl pc)
           
 PageList findAlertDefinitions(AuthzSubject subj, AppdefEntityTypeID aetid, PageControl pc)
          Get list of alert conditions for a resource or resource type
 java.util.List findAlertDefinitions(AuthzSubject subject, Resource prototype)
          Get list of alert definitions for a resource type.
 PageList findAllAlertDefinitions(AuthzSubject subj)
          Get list of all alert conditions
 java.lang.Integer findChildAlertDefinitionId(AppdefEntityID aeid, java.lang.Integer pid, boolean allowStale)
          Get the resource-specific alert definition ID by parent ID, allowing for the query to return a stale copy of the alert definition (for efficiency reasons).
 java.util.List findRelatedAlertDefinitions(AuthzSubject subj, Resource res)
          Get a list of all alert definitions for the resource and its descendents
 java.util.List findTypeBasedDefinitions(AuthzSubject subj, java.lang.Boolean enabled, PageInfo pInfo)
          Get the list of type-based alert definitions.
 int getActiveCount()
           
 java.util.List getAllDeletedAlertDefs()
          Prefetches all collections associated with each alertDef that is deleted and has a null resourceId into ehcache.
 AlertDefinitionValue getById(AuthzSubject subj, java.lang.Integer id)
          Find an alert definition and return a value object
 AlertDefinition getByIdAndCheck(AuthzSubject subj, java.lang.Integer id)
          Find an alert definition
 AlertDefinition getByIdNoCheck(java.lang.Integer id)
          Find an alert definition and return a basic value.
 AlertConditionValue[] getConditionsById(java.lang.Integer id)
          Get an alert definition's conditions
 java.lang.String getNameById(java.lang.Integer id)
          Get an alert definition's name
static org.hyperic.hq.events.shared.AlertDefinitionManagerLocal getOne()
           
 java.util.Collection getUsing(Escalation e)
          Returns the AlertDefinitions using the passed escalation.
 boolean isAlertDefined(AppdefEntityID id, java.lang.Integer parentId)
          Get list of alert conditions for a resource or resource type
 boolean isEnabled(java.lang.Integer id)
          Return array of two values: enabled and act on trigger ID
 boolean isResourceTypeAlertDefinition(java.lang.Integer id)
          Check if an alert definition is a resource type alert definition.
 void setEscalation(AuthzSubject subj, java.lang.Integer defId, java.lang.Integer escId)
          Set the escalation on the alert definition
 void setSessionContext(javax.ejb.SessionContext ctx)
           
 void startup()
           
 AlertDefinitionValue updateAlertDefinition(AlertDefinitionValue adval)
          Update an alert definition
 void updateAlertDefinitionActiveStatus(AuthzSubject subj, AlertDefinition def, boolean activate)
          Activate/deactivate an alert definition.
 void updateAlertDefinitionBasic(AuthzSubject subj, java.lang.Integer id, java.lang.String name, java.lang.String desc, int priority, boolean activate)
          Update just the basics
 boolean updateAlertDefinitionInternalEnable(AuthzSubject subj, AlertDefinition def, boolean enable)
          Enable/Disable an alert definition.
 boolean updateAlertDefinitionInternalEnable(AuthzSubject subj, java.lang.Integer defId, boolean enable)
          Enable/Disable an alert definition.
 boolean updateAlertDefinitionInternalEnable(AuthzSubject subj, java.util.List ids, boolean enable)
          Enable/Disable an alert definition.
 void updateAlertDefinitionsActiveStatus(AuthzSubject subj, java.lang.Integer[] ids, boolean activate)
          Activate/deactivate an alert definitions.
 
Methods inherited from class org.hyperic.hq.events.server.session.SessionBase
canCreateAlertDefinition, canCreateEscalation, canCreateResourceTypeAlertDefinitionTemplate, canDeleteAlertDefinition, canDeleteResourceTypeAlertDefinitionTemplate, canFixAcknowledgeAlerts, canFixAcknowledgeAlerts, canModifyAlertDefinition, canModifyEscalation, canModifyResourceTypeAlertDefinitionTemplate, canRemoveEscalation, canViewAlertDefinition, canViewEscalation, canViewResourceTypeAlertDefinitionTemplate, describeCondition, findResource, getAppdefEntityID, getInitialContext, getNextId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AlertDefinitionManagerEJBImpl

public AlertDefinitionManagerEJBImpl()
Method Detail

createAlertDefinition

public AlertDefinitionValue createAlertDefinition(AuthzSubject subj,
                                                  AlertDefinitionValue a)
                                           throws AlertDefinitionCreateException,
                                                  PermissionException
Create a new alert definition

Throws:
AlertDefinitionCreateException
PermissionException

createAlertDefinition

public AlertDefinitionValue createAlertDefinition(AlertDefinitionValue a)
Create a new alert definition


updateAlertDefinitionBasic

public void updateAlertDefinitionBasic(AuthzSubject subj,
                                       java.lang.Integer id,
                                       java.lang.String name,
                                       java.lang.String desc,
                                       int priority,
                                       boolean activate)
                                throws PermissionException
Update just the basics

Throws:
PermissionException

updateAlertDefinition

public AlertDefinitionValue updateAlertDefinition(AlertDefinitionValue adval)
                                           throws AlertConditionCreateException,
                                                  ActionCreateException,
                                                  javax.ejb.RemoveException
Update an alert definition

Throws:
AlertConditionCreateException
ActionCreateException
javax.ejb.RemoveException

updateAlertDefinitionsActiveStatus

public void updateAlertDefinitionsActiveStatus(AuthzSubject subj,
                                               java.lang.Integer[] ids,
                                               boolean activate)
                                        throws PermissionException
Activate/deactivate an alert definitions.

Throws:
PermissionException

updateAlertDefinitionActiveStatus

public void updateAlertDefinitionActiveStatus(AuthzSubject subj,
                                              AlertDefinition def,
                                              boolean activate)
                                       throws PermissionException
Activate/deactivate an alert definition.

Throws:
PermissionException

updateAlertDefinitionInternalEnable

public boolean updateAlertDefinitionInternalEnable(AuthzSubject subj,
                                                   AlertDefinition def,
                                                   boolean enable)
                                            throws PermissionException
Enable/Disable an alert definition. For internal use only where the mtime does not need to be reset on each update.

Returns:
true if the enable/disable succeeded.
Throws:
PermissionException

updateAlertDefinitionInternalEnable

public boolean updateAlertDefinitionInternalEnable(AuthzSubject subj,
                                                   java.lang.Integer defId,
                                                   boolean enable)
                                            throws javax.ejb.FinderException,
                                                   PermissionException
Enable/Disable an alert definition. For internal use only where the mtime does not need to be reset on each update.

Returns:
true if the enable/disable succeeded.
Throws:
javax.ejb.FinderException
PermissionException

updateAlertDefinitionInternalEnable

public boolean updateAlertDefinitionInternalEnable(AuthzSubject subj,
                                                   java.util.List ids,
                                                   boolean enable)
                                            throws PermissionException
Enable/Disable an alert definition. For internal use only where the mtime does not need to be reset on each update.

Returns:
true if the enable/disable succeeded.
Throws:
PermissionException

setEscalation

public void setEscalation(AuthzSubject subj,
                          java.lang.Integer defId,
                          java.lang.Integer escId)
                   throws PermissionException
Set the escalation on the alert definition

Throws:
PermissionException

getUsing

public java.util.Collection getUsing(Escalation e)
Returns the AlertDefinitions using the passed escalation.


deleteAlertDefinitions

public void deleteAlertDefinitions(AuthzSubject subj,
                                   java.lang.Integer[] ids)
                            throws javax.ejb.RemoveException,
                                   PermissionException
Remove alert definitions

Throws:
javax.ejb.RemoveException
PermissionException

disassociateResource

public void disassociateResource(Resource r)
Set Resource to null on entity's alert definitions


getAllDeletedAlertDefs

public java.util.List getAllDeletedAlertDefs()
Prefetches all collections associated with each alertDef that is deleted and has a null resourceId into ehcache.

Returns:
List of Integer of AlertDefintion ids

cleanupAlertDefs

public void cleanupAlertDefs(java.util.List alertDefIds)
Parameters:
alertDefIds - List of Integer of alertDefIds

getById

public AlertDefinitionValue getById(AuthzSubject subj,
                                    java.lang.Integer id)
                             throws PermissionException
Find an alert definition and return a value object

Throws:
PermissionException - if user does not have permission to manage alerts

getByIdAndCheck

public AlertDefinition getByIdAndCheck(AuthzSubject subj,
                                       java.lang.Integer id)
                                throws PermissionException
Find an alert definition

Throws:
PermissionException - if user does not have permission to manage alerts

getByIdNoCheck

public AlertDefinition getByIdNoCheck(java.lang.Integer id)
Find an alert definition and return a basic value. This is called by the abstract trigger, so it does no permission checking.

Parameters:
id - The alert def Id.

isResourceTypeAlertDefinition

public boolean isResourceTypeAlertDefinition(java.lang.Integer id)
Check if an alert definition is a resource type alert definition.

Parameters:
id - The alert def Id.
Returns:
true if the alert definition is a resource type alert definition.
Throws:
javax.ejb.FinderException

findAlertDefinitionById

public AlertDefinition findAlertDefinitionById(java.lang.Integer id)

getNameById

public java.lang.String getNameById(java.lang.Integer id)
                             throws javax.ejb.FinderException
Get an alert definition's name

Throws:
javax.ejb.FinderException

getConditionsById

public AlertConditionValue[] getConditionsById(java.lang.Integer id)
                                        throws javax.ejb.FinderException
Get an alert definition's conditions

Throws:
javax.ejb.FinderException

isAlertDefined

public boolean isAlertDefined(AppdefEntityID id,
                              java.lang.Integer parentId)
Get list of alert conditions for a resource or resource type


findAllAlertDefinitions

public PageList findAllAlertDefinitions(AuthzSubject subj)
Get list of all alert conditions

Returns:
a PageList of AlertDefinitionValue objects

findChildAlertDefinitionId

public java.lang.Integer findChildAlertDefinitionId(AppdefEntityID aeid,
                                                    java.lang.Integer pid,
                                                    boolean allowStale)
Get the resource-specific alert definition ID by parent ID, allowing for the query to return a stale copy of the alert definition (for efficiency reasons).

Parameters:
aeid - The resource.
pid - The ID of the resource type alert definition (parent ID).
allowStale - true to allow stale copies of an alert definition in the query results; false to never allow stale copies, potentially always forcing a sync with the database.
Returns:
The alert definition ID or null if no alert definition is found for the resource.

findAlertDefinitions

public java.util.List findAlertDefinitions(AuthzSubject subj,
                                           AlertSeverity minSeverity,
                                           java.lang.Boolean enabled,
                                           boolean excludeTypeBased,
                                           PageInfo pInfo)
Find alert definitions passing the criteria.

Parameters:
minSeverity - Specifies the minimum severity that the defs should be set for
enabled - If non-null, specifies the nature of the returned definitions (i.e. only return enabled or disabled defs)
excludeTypeBased - If true, exclude any alert definitions associated with a type-based def.
pInfo - Paging information. The sort field must be a value from AlertDefSortField

findTypeBasedDefinitions

public java.util.List findTypeBasedDefinitions(AuthzSubject subj,
                                               java.lang.Boolean enabled,
                                               PageInfo pInfo)
                                        throws PermissionException
Get the list of type-based alert definitions.

Parameters:
enabled - If non-null, specifies the nature of the returned defs.
pInfo - Paging information. The sort field must be a value from AlertDefSortField
Throws:
PermissionException

findAlertDefinitions

public java.util.List findAlertDefinitions(AuthzSubject subject,
                                           AppdefEntityID id)
                                    throws PermissionException
Get list of alert definition POJOs for a resource

Throws:
PermissionException - if user cannot manage alerts for resource

findAlertDefinitions

public PageList findAlertDefinitions(AuthzSubject subj,
                                     AppdefEntityID id,
                                     PageControl pc)
                              throws PermissionException
Throws:
PermissionException

findAlertDefinitions

public java.util.List findAlertDefinitions(AuthzSubject subject,
                                           Resource prototype)
                                    throws PermissionException
Get list of alert definitions for a resource type.

Throws:
PermissionException

findAlertDefinitions

public PageList findAlertDefinitions(AuthzSubject subj,
                                     AppdefEntityTypeID aetid,
                                     PageControl pc)
                              throws PermissionException
Get list of alert conditions for a resource or resource type

Throws:
PermissionException

findRelatedAlertDefinitions

public java.util.List findRelatedAlertDefinitions(AuthzSubject subj,
                                                  Resource res)
Get a list of all alert definitions for the resource and its descendents

Parameters:
subj - the caller
res - the root resource
Returns:
a list of alert definitions

findAlertDefinitionChildren

public PageList findAlertDefinitionChildren(java.lang.Integer id)
Get list of children alert definition for a parent alert definition


findAlertDefinitionNames

public java.util.SortedMap findAlertDefinitionNames(AuthzSubject subj,
                                                    AppdefEntityID id,
                                                    java.lang.Integer parentId)
                                             throws PermissionException
Get list of alert definition names for a resource

Throws:
PermissionException

findAlertDefinitionNames

public java.util.SortedMap findAlertDefinitionNames(AppdefEntityID id,
                                                    java.lang.Integer parentId)
Get list of alert definition names for a resource


isEnabled

public boolean isEnabled(java.lang.Integer id)
Return array of two values: enabled and act on trigger ID


getActiveCount

public int getActiveCount()

startup

public void startup()

getOne

public static org.hyperic.hq.events.shared.AlertDefinitionManagerLocal getOne()

ejbCreate

public void ejbCreate()
               throws javax.ejb.CreateException
Throws:
javax.ejb.CreateException

ejbPostCreate

public void ejbPostCreate()

ejbActivate

public void ejbActivate()
Specified by:
ejbActivate in interface javax.ejb.SessionBean

ejbPassivate

public void ejbPassivate()
Specified by:
ejbPassivate in interface javax.ejb.SessionBean

ejbRemove

public void ejbRemove()
Specified by:
ejbRemove in interface javax.ejb.SessionBean

setSessionContext

public void setSessionContext(javax.ejb.SessionContext ctx)
Specified by:
setSessionContext in interface javax.ejb.SessionBean

Hyperic HQ Plugin API v. 4.4.0.2

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.