org.opennms.web.outage
Class OutageModel

java.lang.Object
  extended by org.opennms.web.outage.OutageModel

public class OutageModel
extends Object

As the nonvisual logic for the Services Down (Outage) servlet and JSPs, this class queries the database for current outages and provides utility methods for manipulating that list of outages.

Since:
1.8.1
Version:
$Id: $
Author:
Lawrence Karnowski , OpenNMS , Lawrence Karnowski , OpenNMS

Constructor Summary
OutageModel()
          Create a new OutageModel.
 
Method Summary
 Node[] filterNodesWithCurrentOutages(Node[] nodes)
          filterNodesWithCurrentOutages
 OutageSummary[] getAllOutageSummaries(Date date)
          Return a list of IP addresses, the number of services down on each IP address, and the longest time a service has been down for each IP address.
 int getCurrentOutageCount()
          getCurrentOutageCount
 Outage[] getCurrentOutages()
          Query the database to retrieve the current outages.
 Outage[] getCurrentOutagesForNode(int nodeId)
          getCurrentOutagesForNode
 Collection<Integer> getCurrentOutagesIdsForNode(int nodeId)
          getCurrentOutagesIdsForNode
 OutageSummary[] getCurrentOutageSummaries()
          Return a list of IP addresses, the number of services down on each IP address, and the longest time a service has been down for each IP address.
 OutageSummary[] getCurrentSDSOutageSummaries()
          Return a list of IP addresses, the number of services down on each IP address, and the longest time a service has been down for each IP address.
 Outage[] getNonCurrentOutagesForNode(int nodeId)
          getNonCurrentOutagesForNode
 Outage[] getOutagesForInterface(int nodeId, String ipInterface)
          getOutagesForInterface
 Outage[] getOutagesForInterface(int nodeId, String ipAddr, Date time)
          Get all current outages and any resolved outages since the given time for the given interface.
 Outage[] getOutagesForNode(int nodeId)
          Get all outages for a given node.
 Outage[] getOutagesForNode(int nodeId, Date time)
          Get all current outages and any resolved outages since the given time for the given node.
 Outage[] getOutagesForService(int nodeId, String ipInterface, int serviceId)
          getOutagesForService
 Outage[] getOutagesForService(int nodeId, String ipAddr, int serviceId, Date time)
          Get all current outages and any resolved outages since the given time for the given service.
 int getSuppressedOutageCount()
          getSuppressedOutageCount
 Outage[] getSuppressedOutages()
          getSuppressedOutages
protected static Outage[] rs2Outages(ResultSet rs)
          rs2Outages
protected static Outage[] rs2Outages(ResultSet rs, boolean includesRegainedTime)
          rs2Outages
protected static Outage[] rs2Outages(ResultSet rs, boolean includesRegainedTime, boolean includesNotifications)
          rs2Outages
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OutageModel

public OutageModel()
Create a new OutageModel.

Method Detail

getCurrentOutages

public Outage[] getCurrentOutages()
                           throws SQLException
Query the database to retrieve the current outages.

Returns:
An array of Outageobjects, or if there are none, an empty array.
Throws:
SQLException - If there is a problem getting a database connection or making a query.

getSuppressedOutages

public Outage[] getSuppressedOutages()
                              throws SQLException

getSuppressedOutages

Returns:
an array of Outage objects.
Throws:
SQLException - if any.

getCurrentOutageCount

public int getCurrentOutageCount()
                          throws SQLException

getCurrentOutageCount

Returns:
a int.
Throws:
SQLException - if any.

getSuppressedOutageCount

public int getSuppressedOutageCount()
                             throws SQLException

getSuppressedOutageCount

Returns:
a int.
Throws:
SQLException - if any.

getCurrentOutagesForNode

public Outage[] getCurrentOutagesForNode(int nodeId)
                                  throws SQLException

getCurrentOutagesForNode

Parameters:
nodeId - a int.
Returns:
an array of Outage objects.
Throws:
SQLException - if any.

getCurrentOutagesIdsForNode

public Collection<Integer> getCurrentOutagesIdsForNode(int nodeId)
                                                throws SQLException

getCurrentOutagesIdsForNode

Parameters:
nodeId - a int.
Returns:
a Collection object.
Throws:
SQLException - if any.

filterNodesWithCurrentOutages

public Node[] filterNodesWithCurrentOutages(Node[] nodes)
                                     throws SQLException

filterNodesWithCurrentOutages

Parameters:
nodes - an array of Node objects.
Returns:
an array of Node objects.
Throws:
SQLException - if any.

getNonCurrentOutagesForNode

public Outage[] getNonCurrentOutagesForNode(int nodeId)
                                     throws SQLException

getNonCurrentOutagesForNode

Parameters:
nodeId - a int.
Returns:
an array of Outage objects.
Throws:
SQLException - if any.

getOutagesForNode

public Outage[] getOutagesForNode(int nodeId)
                           throws SQLException
Get all outages for a given node.

Parameters:
nodeId - a int.
Returns:
an array of Outage objects.
Throws:
SQLException - if any.

getOutagesForNode

public Outage[] getOutagesForNode(int nodeId,
                                  Date time)
                           throws SQLException
Get all current outages and any resolved outages since the given time for the given node.

Parameters:
nodeId - this is the node to query
time - no resolved outages older than this time will be returned
Returns:
All current outages and resolved outages no older than time.
Throws:
SQLException - if any.

getOutagesForInterface

public Outage[] getOutagesForInterface(int nodeId,
                                       String ipInterface)
                                throws SQLException

getOutagesForInterface

Parameters:
nodeId - a int.
ipInterface - a String object.
Returns:
an array of Outage objects.
Throws:
SQLException - if any.

getOutagesForInterface

public Outage[] getOutagesForInterface(int nodeId,
                                       String ipAddr,
                                       Date time)
                                throws SQLException
Get all current outages and any resolved outages since the given time for the given interface.

Parameters:
nodeId - this is the node to query
ipAddr - this is the interface to query
time - no resolved outages older than this time will be returned
Returns:
All current outages and resolved outages no older than time.
Throws:
SQLException - if any.

getOutagesForService

public Outage[] getOutagesForService(int nodeId,
                                     String ipInterface,
                                     int serviceId)
                              throws SQLException

getOutagesForService

Parameters:
nodeId - a int.
ipInterface - a String object.
serviceId - a int.
Returns:
an array of Outage objects.
Throws:
SQLException - if any.

getOutagesForService

public Outage[] getOutagesForService(int nodeId,
                                     String ipAddr,
                                     int serviceId,
                                     Date time)
                              throws SQLException
Get all current outages and any resolved outages since the given time for the given service.

Parameters:
nodeId - this is the node to query
ipAddr - this is the interface to query
serviceId - this is the service to query
time - no resolved outages older than this time will be returned
Returns:
All current outages and resolved outages no older than time.
Throws:
SQLException - if any.

getCurrentOutageSummaries

public OutageSummary[] getCurrentOutageSummaries()
                                          throws SQLException
Return a list of IP addresses, the number of services down on each IP address, and the longest time a service has been down for each IP address. The list will be sorted in ascending order from the service down longest to the service down shortest.

Returns:
an array of OutageSummary objects.
Throws:
SQLException - if any.

getAllOutageSummaries

public OutageSummary[] getAllOutageSummaries(Date date)
                                      throws SQLException
Return a list of IP addresses, the number of services down on each IP address, and the longest time a service has been down for each IP address. The list will be sorted by the amount of time it has been down.

Parameters:
date - the starting date for the query
Returns:
an array of OutageSummary objects.
Throws:
SQLException - if any.

getCurrentSDSOutageSummaries

public OutageSummary[] getCurrentSDSOutageSummaries()
                                             throws SQLException
Return a list of IP addresses, the number of services down on each IP address, and the longest time a service has been down for each IP address. The list will be sorted in ascending order from the service down longest to the service down shortest. This is a clone of getCurrentOutageSummaries for Harrah's (special consideration).

Returns:
an array of OutageSummary objects.
Throws:
SQLException - if any.

rs2Outages

protected static Outage[] rs2Outages(ResultSet rs)
                              throws SQLException

rs2Outages

Parameters:
rs - a ResultSet object.
Returns:
an array of Outage objects.
Throws:
SQLException - if any.

rs2Outages

protected static Outage[] rs2Outages(ResultSet rs,
                                     boolean includesRegainedTime)
                              throws SQLException

rs2Outages

Parameters:
rs - a ResultSet object.
includesRegainedTime - a boolean.
Returns:
an array of Outage objects.
Throws:
SQLException - if any.

rs2Outages

protected static Outage[] rs2Outages(ResultSet rs,
                                     boolean includesRegainedTime,
                                     boolean includesNotifications)
                              throws SQLException

rs2Outages

Parameters:
rs - a ResultSet object.
includesRegainedTime - a boolean.
includesNotifications - a boolean.
Returns:
an array of Outage objects.
Throws:
SQLException - if any.


Copyright © 2011. All Rights Reserved.