OpenNMS API 1.2.9

## org.opennms.web.outage
Class OutageFactory

    java.lang.Object
      org.opennms.web.outage.OutageFactory

public class OutageFactory
extends java.lang.Object

Encapsulates all querying functionality for outages.

Author:
  Lawrence Karnowski , Jason Johns , OpenNMS

Nested Class Summary
`static class` `OutageFactory.OutageType` Convenience class to determine what sort of notices to include in a query.
`static class` `OutageFactory.SortStyle` Convenience class to determine sort style of a query.

Field Summary
`static OutageFactory.SortStyle` `DEFAULT_SORT_STYLE`
`protected static org.apache.log4j.Category` `log`

Constructor Summary
`private` `OutageFactory()` Private constructor so this class cannot be instantiated.

Method Summary
`protected static java.lang.String` `getOrderByClause(OutageFactory.SortStyle sortStyle)` Convenience method for getting the SQL ORDER BY clause related to a given sort style.
`static Outage` `getOutage(int outageId)`
`static int` `getOutageCount()` Return the count of current outages.
`static int` `getOutageCount(OutageFactory.OutageType ackType, Filter[] filters)` Count the number of outages for a given acknowledgement type.
`static Outage[]` `getOutages()` Return all unresolved outages sorted by the default sort style, outage identifier.
`static Outage[]` `getOutages(OutageFactory.SortStyle sortStyle)` Return all unresolved outages sorted by the given sort style.
`static Outage[]` `getOutages(OutageFactory.SortStyle sortStyle, OutageFactory.OutageType outType)` Return all outages (optionally only unresolved outages) sorted by the given sort style.
`static Outage[]` `getOutages(OutageFactory.SortStyle sortStyle, OutageFactory.OutageType outType, Filter[] filters)` Return all outages (optionally only unresolved outages) sorted by the given sort style.
`static Outage[]` `getOutages(OutageFactory.SortStyle sortStyle, OutageFactory.OutageType outType, Filter[] filters, int limit, int offset)` Return all notices (optionally only unacknowledged notices) sorted by the given sort style.
`static Outage[]` `getOutagesForInterface(int nodeId, java.lang.String ipAddress)` Return all unresolved notices for the given interface.
`static Outage[]` `getOutagesForInterface(int nodeId, java.lang.String ipAddress, boolean includeResolved)` Deprecated. Replaced by " #getOutagesForInterface(int,String,SortStyle,OutageType) getOutagesForInterface(int,String,SortStyle,OutageType)"
`static Outage[]` `getOutagesForInterface(int nodeId, java.lang.String ipAddress, OutageFactory.SortStyle sortStyle, OutageFactory.OutageType outType)` Return all outages (optionally only unresolved outages) sorted by given sort style for the given interface.
`static Outage[]` `getOutagesForInterface(java.lang.String ipAddress)` Return all unacknowledged notices sorted by time for that have the given IP address, regardless of what node they belong to.
`static Outage[]` `getOutagesForInterface(java.lang.String ipAddress, boolean includeResolved)` Deprecated. Replaced by " #getOutagesForInterface(String,SortStyle,OutageType) getOutagesForInterface(String,SortStyle,OutageType)"
`static Outage[]` `getOutagesForInterface(java.lang.String ipAddress, OutageFactory.SortStyle sortStyle, OutageFactory.OutageType outType)` Return all outages (optionally only unresolved outages) sorted by given sort style for the given IP address.
`static Outage[]` `getOutagesForNode(int nodeId)` Return all current outages sorted by time for the given node.
`static Outage[]` `getOutagesForNode(int nodeId, OutageFactory.SortStyle sortStyle, OutageFactory.OutageType outType)` Return all outages (optionally only unresolved outages) sorted by given sort style for the given node.
`static Outage[]` `getOutagesForService(int serviceId)` Return all unresloved outaged sorted by time for the given service type, regardless of what node or interface they belong to.
`static Outage[]` `getOutagesForService(int serviceId, boolean includeResolved)` Deprecated. Replaced by " #getOutagesForService(int,SortStyle,OutageType) getOutagesForInterface(int,SortStyle,OutageType)"
`static Outage[]` `getOutagesForService(int serviceId, OutageFactory.SortStyle sortStyle, OutageFactory.OutageType outType)` Return all outages (optionally only unresolved outages) sorted by given sort style for the given service identifier.
`static Outage[]` `getOutagesForService(int nodeId, java.lang.String ipAddress, int serviceId)` Return all unresolved outages sorted by time for the given service.
`static Outage[]` `getOutagesForService(int nodeId, java.lang.String ipAddress, int serviceId, boolean includeResolved)` Deprecated. Replaced by " #getOutagesForService(int,String,int,SortStyle,OutageType) getOutagesForInterface(int,String,int,SortStyle,OutageType)"
`static Outage[]` `getOutagesForService(int nodeId, java.lang.String ipAddress, int serviceId, OutageFactory.SortStyle sortStyle, OutageFactory.OutageType outType)` Return all outages (optionally only unresolved outages) sorted by given sort style for the given service.
`protected static java.lang.String` `getOutageTypeClause(OutageFactory.OutageType outType)` Convenience method for getting the SQL ORDER BY clause related to a given sort style.
`protected static Outage[]` `rs2Outages(java.sql.ResultSet rs)` Convenience method for translating a `java.sql.ResultSet` containing outage information into an array of `Outage` objects.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_SORT_STYLE

    public static final OutageFactory.SortStyle DEFAULT_SORT_STYLE

### log

    protected static final org.apache.log4j.Category log

Constructor Detail

### OutageFactory

    private OutageFactory()

  Private constructor so this class cannot be instantiated.

Method Detail

### getOutageCount

    public static int getOutageCount()
                              throws java.sql.SQLException

  Return the count of current outages.

  Note: This method has been optimized for the simplest query.

  Throws:
    `java.sql.SQLException`

### getOutageCount

    public static int getOutageCount(OutageFactory.OutageType ackType,
                                     Filter[] filters)
                              throws java.sql.SQLException

  Count the number of outages for a given acknowledgement type.

  Throws:
    `java.sql.SQLException`

### getOutage

    public static Outage getOutage(int outageId)
                            throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### getOutages

    public static Outage[] getOutages()
                               throws java.sql.SQLException

  Return all unresolved outages sorted by the default sort style, outage identifier.

  Throws:
    `java.sql.SQLException`

### getOutages

    public static Outage[] getOutages(OutageFactory.SortStyle sortStyle)
                               throws java.sql.SQLException

  Return all unresolved outages sorted by the given sort style.

  Throws:
    `java.sql.SQLException`

### getOutages

    public static Outage[] getOutages(OutageFactory.SortStyle sortStyle,
                                      OutageFactory.OutageType outType)
                               throws java.sql.SQLException

  Return all outages (optionally only unresolved outages) sorted by the given sort style.

  Throws:
    `java.sql.SQLException`

### getOutages

    public static Outage[] getOutages(OutageFactory.SortStyle sortStyle,
                                      OutageFactory.OutageType outType,
                                      Filter[] filters)
                               throws java.sql.SQLException

  Return all outages (optionally only unresolved outages) sorted by the given sort style.

  Throws:
    `java.sql.SQLException`

### getOutages

    public static Outage[] getOutages(OutageFactory.SortStyle sortStyle,
                                      OutageFactory.OutageType outType,
                                      Filter[] filters,
                                      int limit,
                                      int offset)
                               throws java.sql.SQLException

  Return all notices (optionally only unacknowledged notices) sorted by the given sort style.

  Note: This limit/offset code is Postgres specific! Per Shane , this is okay for now until we can come up with an Oracle alternative too.

  Parameters:
    `limit` - if -1 or zero, no limit or offset is used
    `offset` - if -1, no limit or offset if used
  Throws:
    `java.sql.SQLException`

### getOutagesForNode

    public static Outage[] getOutagesForNode(int nodeId)
                                      throws java.sql.SQLException

  Return all current outages sorted by time for the given node.

  Throws:
    `java.sql.SQLException`

### getOutagesForNode

    public static Outage[] getOutagesForNode(int nodeId,
                                             OutageFactory.SortStyle sortStyle,
                                             OutageFactory.OutageType outType)
                                      throws java.sql.SQLException

  Return all outages (optionally only unresolved outages) sorted by given sort style for the given node.

  Throws:
    `java.sql.SQLException`

### getOutagesForInterface

    public static Outage[] getOutagesForInterface(int nodeId,
                                                  java.lang.String ipAddress)
                                           throws java.sql.SQLException

  Return all unresolved notices for the given interface.

  Throws:
    `java.sql.SQLException`

### getOutagesForInterface

    public static Outage[] getOutagesForInterface(int nodeId,
                                                  java.lang.String ipAddress,
                                                  OutageFactory.SortStyle sortStyle,
                                                  OutageFactory.OutageType outType)
                                           throws java.sql.SQLException

  Return all outages (optionally only unresolved outages) sorted by given sort style for the given interface.

  Throws:
    `java.sql.SQLException`

### getOutagesForInterface

    public static Outage[] getOutagesForInterface(int nodeId,
                                                  java.lang.String ipAddress,
                                                  boolean includeResolved)
                                           throws java.sql.SQLException

  Deprecated. Replaced by " #getOutagesForInterface(int,String,SortStyle,OutageType) getOutagesForInterface(int,String,SortStyle,OutageType)"

  Return all outages (optionally only unresolved notices) sorted by id for the given interface.

  Throws:
    `java.sql.SQLException`

### getOutagesForInterface

    public static Outage[] getOutagesForInterface(java.lang.String ipAddress)
                                           throws java.sql.SQLException

  Return all unacknowledged notices sorted by time for that have the given IP address, regardless of what node they belong to.

  Throws:
    `java.sql.SQLException`

### getOutagesForInterface

    public static Outage[] getOutagesForInterface(java.lang.String ipAddress,
                                                  OutageFactory.SortStyle sortStyle,
                                                  OutageFactory.OutageType outType)
                                           throws java.sql.SQLException

  Return all outages (optionally only unresolved outages) sorted by given sort style for the given IP address.

  Throws:
    `java.sql.SQLException`

### getOutagesForInterface

    public static Outage[] getOutagesForInterface(java.lang.String ipAddress,
                                                  boolean includeResolved)
                                           throws java.sql.SQLException

  Deprecated. Replaced by " #getOutagesForInterface(String,SortStyle,OutageType) getOutagesForInterface(String,SortStyle,OutageType)"

  Return all outages (optionally only unresolved outages) sorted by id that have the given IP address, regardless of what node they belong to.

  Throws:
    `java.sql.SQLException`

### getOutagesForService

    public static Outage[] getOutagesForService(int nodeId,
                                                java.lang.String ipAddress,
                                                int serviceId)
                                         throws java.sql.SQLException

  Return all unresolved outages sorted by time for the given service.

  Throws:
    `java.sql.SQLException`

### getOutagesForService

    public static Outage[] getOutagesForService(int nodeId,
                                                java.lang.String ipAddress,
                                                int serviceId,
                                                OutageFactory.SortStyle sortStyle,
                                                OutageFactory.OutageType outType)
                                         throws java.sql.SQLException

  Return all outages (optionally only unresolved outages) sorted by given sort style for the given service.

  Throws:
    `java.sql.SQLException`

### getOutagesForService

    public static Outage[] getOutagesForService(int nodeId,
                                                java.lang.String ipAddress,
                                                int serviceId,
                                                boolean includeResolved)
                                         throws java.sql.SQLException

  Deprecated. Replaced by " #getOutagesForService(int,String,int,SortStyle,OutageType) getOutagesForInterface(int,String,int,SortStyle,OutageType)"

  Return all outages (optionally only unresolved outages) sorted by time for the given service.

  Throws:
    `java.sql.SQLException`

### getOutagesForService

    public static Outage[] getOutagesForService(int serviceId)
                                         throws java.sql.SQLException

  Return all unresloved outaged sorted by time for the given service type, regardless of what node or interface they belong to.

  Throws:
    `java.sql.SQLException`

### getOutagesForService

    public static Outage[] getOutagesForService(int serviceId,
                                                OutageFactory.SortStyle sortStyle,
                                                OutageFactory.OutageType outType)
                                         throws java.sql.SQLException

  Return all outages (optionally only unresolved outages) sorted by given sort style for the given service identifier.

  Throws:
    `java.sql.SQLException`

### getOutagesForService

    public static Outage[] getOutagesForService(int serviceId,
                                                boolean includeResolved)
                                         throws java.sql.SQLException

  Deprecated. Replaced by " #getOutagesForService(int,SortStyle,OutageType) getOutagesForInterface(int,SortStyle,OutageType)"

  Return all outages (optionally only unresolved outages) sorted by id for the given service type, regardless of what node or interface they belong to.

  Throws:
    `java.sql.SQLException`

### rs2Outages

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

  Convenience method for translating a `java.sql.ResultSet` containing outage information into an array of `Outage` objects.

  Throws:
    `java.sql.SQLException`

### getOrderByClause

    protected static java.lang.String getOrderByClause(OutageFactory.SortStyle sortStyle)

  Convenience method for getting the SQL ORDER BY clause related to a given sort style.

### getOutageTypeClause

    protected static java.lang.String getOutageTypeClause(OutageFactory.OutageType outType)

  Convenience method for getting the SQL ORDER BY clause related to a given sort style.

  Parameters:
    `outType` - the outage type to map to a clause

OpenNMS API 1.2.9

Generated by ranger on May 19 2007 2335.