public class AlertDefinitionDAO extends Object
AlertDefinitionDAO
class is used to manage the persistence and
retrieval of AlertDefinitionEntity
instances.Constructor and Description |
---|
AlertDefinitionDAO() |
Modifier and Type | Method and Description |
---|---|
void |
create(AlertDefinitionEntity alertDefinition)
Persists a new alert definition, also creating the associated
AlertGroupEntity relationship for the definition's service default
group. |
void |
createOrUpdate(AlertDefinitionEntity alertDefinition)
Creates or updates the specified entity.
|
List<AlertDefinitionEntity> |
findAgentScoped(long clusterId)
Gets all alert definitions that are not bound to a particular service.
|
List<AlertDefinitionEntity> |
findAll()
Gets all alert definitions stored in the database.
|
List<AlertDefinitionEntity> |
findAll(long clusterId)
Gets all alert definitions stored in the database.
|
List<AlertDefinitionEntity> |
findAllEnabled(long clusterId)
Gets all enabled alert definitions stored in the database for the specified
cluster.
|
AlertDefinitionEntity |
findById(long definitionId)
Gets an alert definition with the specified ID.
|
List<AlertDefinitionEntity> |
findByIds(List<Long> definitionIds)
Gets all of the alert definitions for the list of IDs given.
|
AlertDefinitionEntity |
findByName(long clusterId,
String definitionName)
Gets an alert definition with the specified name.
|
List<AlertDefinitionEntity> |
findByService(long clusterId,
String serviceName)
Gets all alert definitions for the given service in the specified cluster.
|
List<AlertDefinitionEntity> |
findByServiceComponent(long clusterId,
String serviceName,
String componentName)
Gets all alert definitions that are not bound to a particular service.
|
List<AlertDefinitionEntity> |
findByServiceMaster(long clusterId,
Set<String> services)
Gets all alert definitions for the specified services that do not have a
component and do not belong to AGGREGATE source type.
|
List<AlertDefinitionEntity> |
findBySourceType(Long clusterId,
SourceType sourceType) |
AlertDefinitionEntity |
merge(AlertDefinitionEntity alertDefinition)
Merge the speicified alert definition with the existing definition in the
database.
|
void |
refresh(AlertDefinitionEntity alertDefinition)
Refresh the state of the alert definition from the database.
|
void |
remove(AlertDefinitionEntity alertDefinition)
Removes the specified alert definition and all related history and
associations from the database.
|
void |
removeAll(long clusterId)
Removes all
AlertDefinitionEntity that are associated with the
specified cluster ID. |
public AlertDefinitionEntity findById(long definitionId)
definitionId
- the ID of the definition to retrieve.null
if none exists.public AlertDefinitionEntity findByName(long clusterId, String definitionName)
clusterId
- the ID of the cluster.definitionName
- the name of the definition (not null
).null
if none exists.public List<AlertDefinitionEntity> findAll()
null
).public List<AlertDefinitionEntity> findAll(long clusterId)
null
).public List<AlertDefinitionEntity> findAllEnabled(long clusterId)
null
).public List<AlertDefinitionEntity> findByIds(List<Long> definitionIds)
definitionIds
- the IDs of the definitions to retrieve.null
).public List<AlertDefinitionEntity> findByService(long clusterId, String serviceName)
clusterId
- the ID of the cluster.serviceName
- the name of the service.null
).public List<AlertDefinitionEntity> findByServiceMaster(long clusterId, Set<String> services)
clusterId
- the ID of the cluster.services
- the services to match on.null
).public List<AlertDefinitionEntity> findByServiceComponent(long clusterId, String serviceName, String componentName)
clusterId
- the ID of the cluster.serviceName
- the name of the service (not null
).componentName
- the name of the service component (not null
).null
).public List<AlertDefinitionEntity> findAgentScoped(long clusterId)
clusterId
- the ID of the cluster.null
).public List<AlertDefinitionEntity> findBySourceType(Long clusterId, SourceType sourceType)
public void create(AlertDefinitionEntity alertDefinition) throws org.apache.ambari.server.AmbariException
AlertGroupEntity
relationship for the definition's service default
group. Fires an AlertDefinitionRegistrationEvent
.alertDefinition
- the definition to persist (not null
).org.apache.ambari.server.AmbariException
public void refresh(AlertDefinitionEntity alertDefinition)
alertDefinition
- the definition to refresh (not null
).public AlertDefinitionEntity merge(AlertDefinitionEntity alertDefinition)
AlertDefinitionChangedEvent
.alertDefinition
- the definition to merge (not null
).null
).public void createOrUpdate(AlertDefinitionEntity alertDefinition) throws org.apache.ambari.server.AmbariException
AlertDefinitionEntity.getDefinitionId()
in order to determine
whether the entity should be created or merged.alertDefinition
- the definition to create or update (not null
).org.apache.ambari.server.AmbariException
public void remove(AlertDefinitionEntity alertDefinition)
AlertDefinitionDeleteEvent
.alertDefinition
- the definition to remove.public void removeAll(long clusterId)
AlertDefinitionEntity
that are associated with the
specified cluster ID.clusterId
- the cluster ID.Copyright © 2022 Apache Software Foundation. All rights reserved.