Class DefaultSurveillanceViewService
- java.lang.Object
-
- org.opennms.features.vaadin.surveillanceviews.service.DefaultSurveillanceViewService
-
- All Implemented Interfaces:
SurveillanceViewService
public class DefaultSurveillanceViewService extends Object implements SurveillanceViewService
Service class that encapsulate helper methods for surveillance views.- Author:
- Christian Pape
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.opennms.features.vaadin.surveillanceviews.service.SurveillanceViewService
SurveillanceViewService.NodeRtc
-
-
Constructor Summary
Constructors Constructor Description DefaultSurveillanceViewService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SurveillanceStatus[][]
calculateCellStatus(View view)
Computes and returns the cell status used for displaying the surveillance view.List<OnmsAlarm>
getAlarmsForCategories(Set<OnmsCategory> rowCategories, Set<OnmsCategory> colCategories)
Returns the list of OpenNMS alarm instances for a given set of row and column categories.com.google.common.util.concurrent.ListeningExecutorService
getExecutorService()
Returns the executor pool.Map<String,String>
getGraphResultsForResourceId(ResourceId resourceId)
Returns a map of graphs for a given resource id.OnmsNode
getNodeForId(int id)
Returns a node for a given id.List<SurveillanceViewService.NodeRtc>
getNodeRtcsForCategories(Set<OnmsCategory> rowCategories, Set<OnmsCategory> colCategories)
Returns the list of RTC calculations for a given set of row and column categories.List<OnmsNode>
getNodesForCategories(Set<OnmsCategory> rowCategories, Set<OnmsCategory> colCategories)
Returns the list of OpenNMS node instances for a given set of row and column categories.List<OnmsNotification>
getNotificationsForCategories(Set<OnmsCategory> rowCategories, Set<OnmsCategory> colCategories, Map<OnmsNotification,String> customSeverity)
Returns the list og OpenNMS notification instacnes for a given set of row and column categories.List<OnmsCategory>
getOnmsCategories()
Returns a list of the existing OpenNMS categories.Set<OnmsCategory>
getOnmsCategoriesFromViewCategories(Collection<Category> viewCats)
Returns a list of OpenNMS categories for a given collection of view categoriesMap<OnmsResourceType,List<OnmsResource>>
getResourceTypeMapForNodeId(int nodeId)
Returns a map of OpenNMS resource type/resource mappings for a given node id.Map<OnmsResourceType,List<OnmsResource>>
getResourceTypeMapForNodeId(String nodeId)
Returns a map of OpenNMS resource type/resource mappings for a given node id.View
selectDefaultViewForUsername(String username)
Returns the default view for a given username.void
setAlarmDao(AlarmDao alarmDao)
Method to set the alarm dao.void
setCategoryDao(CategoryDao categoryDao)
Method to set the category dao.void
setGraphDao(GraphDao graphDao)
Method to set the graph dao.void
setGroupDao(GroupDao groupDao)
Method to set the group dao.void
setMonitoredServiceDao(MonitoredServiceDao monitoredServiceDao)
Method to set the monitored service dao.void
setNodeDao(NodeDao nodeDao)
Method to set the node dao.void
setNotificationDao(NotificationDao notificationDao)
Method to set the notification dao.void
setOutageDao(OutageDao outageDao)
Method to set the outage dao.void
setResourceDao(ResourceDao resourceDao)
Method to set the resource dao.void
setTransactionOperations(org.springframework.transaction.support.TransactionOperations transactionOperations)
Method to set the transaction operations instance
-
-
-
Method Detail
-
setNodeDao
public void setNodeDao(NodeDao nodeDao)
Method to set the node dao.- Parameters:
nodeDao
- theNodeDao
to be used
-
setMonitoredServiceDao
public void setMonitoredServiceDao(MonitoredServiceDao monitoredServiceDao)
Method to set the monitored service dao.- Parameters:
monitoredServiceDao
- theMonitoredServiceDao
to be used
-
setResourceDao
public void setResourceDao(ResourceDao resourceDao)
Method to set the resource dao.- Parameters:
resourceDao
- theResourceDao
to be used
-
setGraphDao
public void setGraphDao(GraphDao graphDao)
Method to set the graph dao.- Parameters:
graphDao
- theGraphDao
to be used
-
setNotificationDao
public void setNotificationDao(NotificationDao notificationDao)
Method to set the notification dao.- Parameters:
notificationDao
- theNotificationDao
to be used
-
setCategoryDao
public void setCategoryDao(CategoryDao categoryDao)
Method to set the category dao.- Parameters:
categoryDao
- theCategoryDao
to be used
-
setAlarmDao
public void setAlarmDao(AlarmDao alarmDao)
Method to set the alarm dao.- Parameters:
alarmDao
- theAlarmDao
to be used
-
setGroupDao
public void setGroupDao(GroupDao groupDao)
Method to set the group dao.- Parameters:
groupDao
- theGroupDao
to be used
-
setOutageDao
public void setOutageDao(OutageDao outageDao)
Method to set the outage dao.- Parameters:
outageDao
- theOutageDao
to be used
-
setTransactionOperations
public void setTransactionOperations(org.springframework.transaction.support.TransactionOperations transactionOperations)
Method to set the transaction operations instance- Parameters:
transactionOperations
-
-
getOnmsCategories
public List<OnmsCategory> getOnmsCategories()
Returns a list of the existing OpenNMS categories.- Specified by:
getOnmsCategories
in interfaceSurveillanceViewService
- Returns:
- the list of categories
-
getOnmsCategoriesFromViewCategories
public Set<OnmsCategory> getOnmsCategoriesFromViewCategories(Collection<Category> viewCats)
Returns a list of OpenNMS categories for a given collection of view categories- Specified by:
getOnmsCategoriesFromViewCategories
in interfaceSurveillanceViewService
- Parameters:
viewCats
- the categories to search for- Returns:
- the set of OpenNMS categories
-
calculateCellStatus
public SurveillanceStatus[][] calculateCellStatus(View view)
Computes and returns the cell status used for displaying the surveillance view.- Specified by:
calculateCellStatus
in interfaceSurveillanceViewService
- Parameters:
view
- the view to use- Returns:
- the array of
SurveillanceStatus
instances
-
getNodesForCategories
public List<OnmsNode> getNodesForCategories(Set<OnmsCategory> rowCategories, Set<OnmsCategory> colCategories)
Returns the list of OpenNMS node instances for a given set of row and column categories.- Specified by:
getNodesForCategories
in interfaceSurveillanceViewService
- Parameters:
rowCategories
- the row categoriescolCategories
- the column categories- Returns:
- the list of nodes found
-
getAlarmsForCategories
public List<OnmsAlarm> getAlarmsForCategories(Set<OnmsCategory> rowCategories, Set<OnmsCategory> colCategories)
Returns the list of OpenNMS alarm instances for a given set of row and column categories.- Specified by:
getAlarmsForCategories
in interfaceSurveillanceViewService
- Parameters:
rowCategories
- the row categoriescolCategories
- the column categories- Returns:
- the list of alarms found
-
getNotificationsForCategories
public List<OnmsNotification> getNotificationsForCategories(Set<OnmsCategory> rowCategories, Set<OnmsCategory> colCategories, Map<OnmsNotification,String> customSeverity)
Returns the list og OpenNMS notification instacnes for a given set of row and column categories.- Specified by:
getNotificationsForCategories
in interfaceSurveillanceViewService
- Parameters:
rowCategories
- the row categoriescolCategories
- the column categoriescustomSeverity
- the custom severity to be used- Returns:
- a list of notifications found
-
getNodeRtcsForCategories
public List<SurveillanceViewService.NodeRtc> getNodeRtcsForCategories(Set<OnmsCategory> rowCategories, Set<OnmsCategory> colCategories)
Returns the list of RTC calculations for a given set of row and column categories.- Specified by:
getNodeRtcsForCategories
in interfaceSurveillanceViewService
- Parameters:
rowCategories
- the row categoriescolCategories
- the column categories- Returns:
- the list of
SurveillanceViewService.NodeRtc
-
getResourceTypeMapForNodeId
public Map<OnmsResourceType,List<OnmsResource>> getResourceTypeMapForNodeId(int nodeId)
Returns a map of OpenNMS resource type/resource mappings for a given node id.- Specified by:
getResourceTypeMapForNodeId
in interfaceSurveillanceViewService
- Parameters:
nodeId
- the node id to search resources for- Returns:
- the mappings of resource types and resources
-
getResourceTypeMapForNodeId
public Map<OnmsResourceType,List<OnmsResource>> getResourceTypeMapForNodeId(String nodeId)
Returns a map of OpenNMS resource type/resource mappings for a given node id.- Specified by:
getResourceTypeMapForNodeId
in interfaceSurveillanceViewService
- Parameters:
nodeId
- the node id to search resources for- Returns:
- the mappings of resource types and resources
-
getGraphResultsForResourceId
public Map<String,String> getGraphResultsForResourceId(ResourceId resourceId)
Returns a map of graphs for a given resource id.- Specified by:
getGraphResultsForResourceId
in interfaceSurveillanceViewService
- Parameters:
resourceId
- the resource id to search graphs for- Returns:
- the map of graphs
-
selectDefaultViewForUsername
public View selectDefaultViewForUsername(String username)
Returns the default view for a given username. 1. If a view which name equals the username exists it will be returned 2. If a view which name equals the user's group exists it will be returned 3. the default view defined by the default-view attribute will be returned- Specified by:
selectDefaultViewForUsername
in interfaceSurveillanceViewService
- Parameters:
username
- the username to be used- Returns:
- the default view for this user
-
getExecutorService
public com.google.common.util.concurrent.ListeningExecutorService getExecutorService()
Returns the executor pool.- Specified by:
getExecutorService
in interfaceSurveillanceViewService
- Returns:
- the executor service pool
-
getNodeForId
public OnmsNode getNodeForId(int id)
Returns a node for a given id.- Specified by:
getNodeForId
in interfaceSurveillanceViewService
- Parameters:
id
- the node id- Returns:
- the node
-
-