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.ListeningExecutorServicegetExecutorService()Returns the executor pool.Map<String,String>getGraphResultsForResourceId(ResourceId resourceId)Returns a map of graphs for a given resource id.OnmsNodegetNodeForId(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.ViewselectDefaultViewForUsername(String username)Returns the default view for a given username.voidsetAlarmDao(AlarmDao alarmDao)Method to set the alarm dao.voidsetCategoryDao(CategoryDao categoryDao)Method to set the category dao.voidsetGraphDao(GraphDao graphDao)Method to set the graph dao.voidsetGroupDao(GroupDao groupDao)Method to set the group dao.voidsetMonitoredServiceDao(MonitoredServiceDao monitoredServiceDao)Method to set the monitored service dao.voidsetNodeDao(NodeDao nodeDao)Method to set the node dao.voidsetNotificationDao(NotificationDao notificationDao)Method to set the notification dao.voidsetOutageDao(OutageDao outageDao)Method to set the outage dao.voidsetResourceDao(ResourceDao resourceDao)Method to set the resource dao.voidsetTransactionOperations(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- theNodeDaoto be used
-
setMonitoredServiceDao
public void setMonitoredServiceDao(MonitoredServiceDao monitoredServiceDao)
Method to set the monitored service dao.- Parameters:
monitoredServiceDao- theMonitoredServiceDaoto be used
-
setResourceDao
public void setResourceDao(ResourceDao resourceDao)
Method to set the resource dao.- Parameters:
resourceDao- theResourceDaoto be used
-
setGraphDao
public void setGraphDao(GraphDao graphDao)
Method to set the graph dao.- Parameters:
graphDao- theGraphDaoto be used
-
setNotificationDao
public void setNotificationDao(NotificationDao notificationDao)
Method to set the notification dao.- Parameters:
notificationDao- theNotificationDaoto be used
-
setCategoryDao
public void setCategoryDao(CategoryDao categoryDao)
Method to set the category dao.- Parameters:
categoryDao- theCategoryDaoto be used
-
setAlarmDao
public void setAlarmDao(AlarmDao alarmDao)
Method to set the alarm dao.- Parameters:
alarmDao- theAlarmDaoto be used
-
setGroupDao
public void setGroupDao(GroupDao groupDao)
Method to set the group dao.- Parameters:
groupDao- theGroupDaoto be used
-
setOutageDao
public void setOutageDao(OutageDao outageDao)
Method to set the outage dao.- Parameters:
outageDao- theOutageDaoto 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:
getOnmsCategoriesin 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:
getOnmsCategoriesFromViewCategoriesin 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:
calculateCellStatusin interfaceSurveillanceViewService- Parameters:
view- the view to use- Returns:
- the array of
SurveillanceStatusinstances
-
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:
getNodesForCategoriesin 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:
getAlarmsForCategoriesin 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:
getNotificationsForCategoriesin 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:
getNodeRtcsForCategoriesin 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:
getResourceTypeMapForNodeIdin 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:
getResourceTypeMapForNodeIdin 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:
getGraphResultsForResourceIdin 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:
selectDefaultViewForUsernamein 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:
getExecutorServicein interfaceSurveillanceViewService- Returns:
- the executor service pool
-
getNodeForId
public OnmsNode getNodeForId(int id)
Returns a node for a given id.- Specified by:
getNodeForIdin interfaceSurveillanceViewService- Parameters:
id- the node id- Returns:
- the node
-
-