Package org.opennms.netmgt.dao.mock
Class MockOutageDao
- java.lang.Object
-
- org.opennms.netmgt.dao.mock.AbstractMockDao<OnmsOutage,java.lang.Integer>
-
- org.opennms.netmgt.dao.mock.MockOutageDao
-
- All Implemented Interfaces:
LegacyOnmsDao<OnmsOutage,java.lang.Integer>
,OnmsDao<OnmsOutage,java.lang.Integer>
,OutageDao
,org.springframework.beans.factory.InitializingBean
public class MockOutageDao extends AbstractMockDao<OnmsOutage,java.lang.Integer> implements OutageDao
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.opennms.netmgt.dao.mock.AbstractMockDao
AbstractMockDao.NullEventForwarder
-
-
Constructor Summary
Constructors Constructor Description MockOutageDao()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
countOutagesByNode()
Get the number of nodes with outages.java.lang.Integer
currentOutageCount()
currentOutageCountOnmsOutage
currentOutageForService(OnmsMonitoredService service)
Return the current open outage for the service or if the service is up and has no open outage, return null.OnmsOutage
currentOutageForServiceFromPerspective(OnmsMonitoredService service, OnmsMonitoringLocation perspective)
java.util.Collection<OnmsOutage>
currentOutages()
currentOutagesjava.util.Collection<OnmsOutage>
currentOutagesForServiceFromPerspectivePoller(OnmsMonitoredService service)
Return all current open outages for the given service be it detected from Perspective Poller.java.util.Collection<OnmsOutage>
findAll(java.lang.Integer offset, java.lang.Integer limit)
findAllprotected void
generateId(OnmsOutage outage)
java.util.List<HeatMapElement>
getHeatMapItemsForEntity(java.lang.String entityNameColumn, java.lang.String entityIdColumn, java.lang.String restrictionColumn, java.lang.String restrictionValue, java.lang.String... groupByColumns)
Retrieves heatmap elements for a given combination of database columns.protected java.lang.Integer
getId(OnmsOutage outage)
java.util.List<OutageSummary>
getNodeOutageSummaries(int rows)
Get the list of current outages, one per node.java.util.Collection<OnmsOutage>
getStatusChangesForApplicationIdBetween(java.util.Date startDate, java.util.Date endDate, java.lang.Integer applicationId)
java.util.Collection<OnmsOutage>
matchingCurrentOutages(ServiceSelector selector)
Finds all current (unresolved) outages that match the given service selector.java.util.Collection<CurrentOutageDetails>
newestCurrentOutages(java.util.List<java.lang.String> serviceNames)
Finds the latest (unresolved) outages that match the given services.java.lang.Integer
save(OnmsOutage entity)
When we save an outage, make sure to add the outage to the currentOutages property ofOnmsMonitoredService
.-
Methods inherited from class org.opennms.netmgt.dao.mock.AbstractMockDao
afterPropertiesSet, clear, countAll, countMatching, countMatching, delete, delete, findAll, findMatching, findMatching, flush, get, getAlarmAssociationDao, getAlarmDao, getAssetRecordDao, getCategoryDao, getDistPollerDao, getEventDao, getIpInterfaceDao, getMonitoredServiceDao, getMonitoringLocationDao, getNodeDao, getServiceRegistry, getServiceTypeDao, getSnmpInterfaceDao, initialize, load, lock, saveOrUpdate, update
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opennms.netmgt.dao.api.LegacyOnmsDao
countMatching, findMatching
-
Methods inherited from interface org.opennms.netmgt.dao.api.OnmsDao
clear, countAll, countMatching, delete, delete, findAll, findMatching, flush, get, initialize, load, lock, saveOrUpdate, update
-
-
-
-
Method Detail
-
generateId
protected void generateId(OnmsOutage outage)
- Specified by:
generateId
in classAbstractMockDao<OnmsOutage,java.lang.Integer>
-
getId
protected java.lang.Integer getId(OnmsOutage outage)
- Specified by:
getId
in classAbstractMockDao<OnmsOutage,java.lang.Integer>
-
save
public java.lang.Integer save(OnmsOutage entity)
When we save an outage, make sure to add the outage to the currentOutages property ofOnmsMonitoredService
.- Specified by:
save
in interfaceOnmsDao<OnmsOutage,java.lang.Integer>
- Overrides:
save
in classAbstractMockDao<OnmsOutage,java.lang.Integer>
-
currentOutageCount
public java.lang.Integer currentOutageCount()
Description copied from interface:OutageDao
currentOutageCount
- Specified by:
currentOutageCount
in interfaceOutageDao
- Returns:
- a
Integer
object.
-
currentOutages
public java.util.Collection<OnmsOutage> currentOutages()
Description copied from interface:OutageDao
currentOutages
- Specified by:
currentOutages
in interfaceOutageDao
- Returns:
- a
Collection
object.
-
currentOutageForService
public OnmsOutage currentOutageForService(OnmsMonitoredService service)
Description copied from interface:OutageDao
Return the current open outage for the service or if the service is up and has no open outage, return null.- Specified by:
currentOutageForService
in interfaceOutageDao
-
currentOutageForServiceFromPerspective
public OnmsOutage currentOutageForServiceFromPerspective(OnmsMonitoredService service, OnmsMonitoringLocation perspective)
- Specified by:
currentOutageForServiceFromPerspective
in interfaceOutageDao
-
currentOutagesForServiceFromPerspectivePoller
public java.util.Collection<OnmsOutage> currentOutagesForServiceFromPerspectivePoller(OnmsMonitoredService service)
Description copied from interface:OutageDao
Return all current open outages for the given service be it detected from Perspective Poller.- Specified by:
currentOutagesForServiceFromPerspectivePoller
in interfaceOutageDao
-
newestCurrentOutages
public java.util.Collection<CurrentOutageDetails> newestCurrentOutages(java.util.List<java.lang.String> serviceNames)
Description copied from interface:OutageDao
Finds the latest (unresolved) outages that match the given services.- Specified by:
newestCurrentOutages
in interfaceOutageDao
- Parameters:
serviceNames
- a list of services- Returns:
- a
Collection
of outages
-
matchingCurrentOutages
public java.util.Collection<OnmsOutage> matchingCurrentOutages(ServiceSelector selector)
Description copied from interface:OutageDao
Finds all current (unresolved) outages that match the given service selector.- Specified by:
matchingCurrentOutages
in interfaceOutageDao
- Parameters:
selector
- a service selector (filter + service list)- Returns:
- a
Collection
of outages
-
findAll
public java.util.Collection<OnmsOutage> findAll(java.lang.Integer offset, java.lang.Integer limit)
Description copied from interface:OutageDao
findAll
-
countOutagesByNode
public int countOutagesByNode()
Description copied from interface:OutageDao
Get the number of nodes with outages.- Specified by:
countOutagesByNode
in interfaceOutageDao
- Returns:
- the number of nodes with outages.
-
getNodeOutageSummaries
public java.util.List<OutageSummary> getNodeOutageSummaries(int rows)
Description copied from interface:OutageDao
Get the list of current outages, one per node. If a node has more than one outage, the oldest outstanding outage is returned.- Specified by:
getNodeOutageSummaries
in interfaceOutageDao
- Parameters:
rows
- The maximum number of outages to return.- Returns:
- A list of outages.
-
getHeatMapItemsForEntity
public java.util.List<HeatMapElement> getHeatMapItemsForEntity(java.lang.String entityNameColumn, java.lang.String entityIdColumn, java.lang.String restrictionColumn, java.lang.String restrictionValue, java.lang.String... groupByColumns)
Description copied from interface:OutageDao
Retrieves heatmap elements for a given combination of database columns.- Specified by:
getHeatMapItemsForEntity
in interfaceOutageDao
- Parameters:
entityNameColumn
- the entity's name columnentityIdColumn
- the entity's id columnrestrictionColumn
- a column used for a restriction of the resultsrestrictionValue
- the value that must match against the restrictionColumngroupByColumns
- columns used for the SQL group-by clause- Returns:
- the heatmap elements for this query
-
getStatusChangesForApplicationIdBetween
public java.util.Collection<OnmsOutage> getStatusChangesForApplicationIdBetween(java.util.Date startDate, java.util.Date endDate, java.lang.Integer applicationId)
- Specified by:
getStatusChangesForApplicationIdBetween
in interfaceOutageDao
-
-