OpenNMS API 1.2.9

## org.opennms.web.notification
Class NoticeFactory

    java.lang.Object
      org.opennms.web.notification.NoticeFactory

public class NoticeFactory
extends java.lang.Object

Encapsulates all querying functionality for notices

Author:
  Lawrence Karnowski , OpenNMS

Nested Class Summary
`static class` `NoticeFactory.AcknowledgeType` Convenience class to determine what sort of notices to include in a query.
`static interface` `NoticeFactory.Filter` Convenience class to determine what sort of notices to include in a query.
`static class` `NoticeFactory.InterfaceFilter` Encapsulates all interface filtering functionality.
`static class` `NoticeFactory.NodeFilter` Encapsulates all node filtering functionality.
`static class` `NoticeFactory.ResponderFilter` Encapsulates all responder filtering functionality.
`static class` `NoticeFactory.ServiceFilter` Encapsulates all service filtering functionality.
`static class` `NoticeFactory.SortStyle` Convenience class to determine sort style of a query.
`static class` `NoticeFactory.UserFilter` Encapsulates all user filtering functionality.

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

Method Summary
`static void` `acknowledge(int[] noticeIds, java.lang.String user)` Acknowledge a list of notices with the given username and the current time.
`static void` `acknowledge(int[] noticeIds, java.lang.String user, java.util.Date time)` Acknowledge a list of notices with the given username and the given time.
`static void` `acknowledge(Notification[] notices, java.lang.String user)` Acknowledge a list of notices with the given username
`static void` `acknowledge(Notification[] notices, java.lang.String user, java.util.Date time)` Acknowledge a list of notices with the given username and the given time.
`static boolean` `canDisplayEvent(int eventId)` This method determines the log status of an event associated with a notification
`protected static java.lang.String` `getAcknowledgeTypeClause(NoticeFactory.AcknowledgeType ackType)` Convenience method for getting the SQL ORDER BY clause related to a given sort style.
`static Notification` `getNotice(int noticeId)` Return a specific notice.
`static int` `getNoticeCount(NoticeFactory.AcknowledgeType ackType, NoticeFactory.Filter[] filters)` Count the number of notices for a given acknowledgement type.
`static Notification[]` `getNotices()` Return all unacknowledged notices sorted by id.
`static Notification[]` `getNotices(NoticeFactory.AcknowledgeType ackType)` Return all unacknowledged or acknowledged notices sorted by id.
`static Notification[]` `getNotices(NoticeFactory.SortStyle sortStyle)` Return all unacknowledged notices sorted by the given sort style.
`static Notification[]` `getNotices(NoticeFactory.SortStyle sortStyle, boolean includeAcknowledged)` Deprecated. Replaced by " #getNotices(SortStyle,AcknowledgeType) getNotices( SortStyle, AcknowledgeType )"
`static Notification[]` `getNotices(NoticeFactory.SortStyle sortStyle, NoticeFactory.AcknowledgeType ackType)` Return all notices (optionally only unacknowledged notices) sorted by the given sort style.
`static Notification[]` `getNotices(NoticeFactory.SortStyle sortStyle, NoticeFactory.AcknowledgeType ackType, NoticeFactory.Filter[] filters)` Return all notices (optionally only unacknowledged notices) sorted by the given sort style.
`static Notification[]` `getNotices(NoticeFactory.SortStyle sortStyle, NoticeFactory.AcknowledgeType ackType, NoticeFactory.Filter[] filters, int limit, int offset)` Return all notices (optionally only unacknowledged notices) sorted by the given sort style.
`static Notification[]` `getNoticesForInterface(int nodeId, java.lang.String ipAddress)` Return all unacknowledged notices for the given interface.
`static Notification[]` `getNoticesForInterface(int nodeId, java.lang.String ipAddress, boolean includeAcknowledged)` Return all notices (optionally only unacknowledged notices) sorted by id for the given interface.
`static Notification[]` `getNoticesForInterface(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 Notification[]` `getNoticesForInterface(java.lang.String ipAddress, boolean includeAcknowledged)` Return all notices (optionally only unacknowledged notices) sorted by id that have the given IP address, regardless of what node they belong to.
`static Notification[]` `getNoticesForNode(int nodeId)` Return all unacknowledged notices sorted by time for the given node.
`static Notification[]` `getNoticesForNode(int nodeId, boolean includeAcknowledged)` Deprecated. Replaced by " #getNoticesForNode(int,SortStyle,AcknowledgeType) getNoticesForNode( int, SortStyle, AcknowledgeType )"
`static Notification[]` `getNoticesForNode(int nodeId, NoticeFactory.SortStyle sortStyle, NoticeFactory.AcknowledgeType ackType)` Return all notices (optionally only unacknowledged notices) sorted by given sort style for the given node.
`static Notification[]` `getNoticesForService(int serviceId)` Return all unacknowledged notices sorted by time for the given service type, regardless of what node or interface they belong to.
`static Notification[]` `getNoticesForService(int serviceId, boolean includeAcknowledged)` Return all notices (optionally only unacknowledged notices) sorted by id for the given service type, regardless of what node or interface they belong to.
`static Notification[]` `getNoticesForService(int nodeId, java.lang.String ipAddress, int serviceId)` Return all unacknowledged notices sorted by time for the given service.
`static Notification[]` `getNoticesForService(int nodeId, java.lang.String ipAddress, int serviceId, boolean includeAcknowledged)` Return all notices (optionally only unacknowledged notices) sorted by time for the given service.
`protected static java.lang.String` `getOrderByClause(NoticeFactory.SortStyle sortStyle)` Convenience method for getting the SQL ORDER BY clause related to a given sort style.
`protected static Notification[]` `rs2Notices(java.sql.ResultSet rs)` Convenience method for translating a `java.sql.ResultSet` containing notice information into an array of `Notification` objects.

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

Constructor Detail

### NoticeFactory

    private NoticeFactory()

  Private constructor so this class cannot be instantiated.

Method Detail

### getNoticeCount

    public static int getNoticeCount(NoticeFactory.AcknowledgeType ackType,
                                     NoticeFactory.Filter[] filters)
                              throws java.sql.SQLException

  Count the number of notices for a given acknowledgement type.

  Throws:
    `java.sql.SQLException`

### getNotice

    public static Notification getNotice(int noticeId)
                                  throws java.sql.SQLException

  Return a specific notice.

  Throws:
    `java.sql.SQLException`

### canDisplayEvent

    public static boolean canDisplayEvent(int eventId)

  This method determines the log status of an event associated with a notification

  Parameters:
    `eventId` - the unique id of the event from the notice
  Returns:
    true if the event is display, false if log only

### getNotices

    public static Notification[] getNotices()
                                     throws java.sql.SQLException

  Return all unacknowledged notices sorted by id.

  Throws:
    `java.sql.SQLException`

### getNotices

    public static Notification[] getNotices(NoticeFactory.AcknowledgeType ackType)
                                     throws java.sql.SQLException

  Return all unacknowledged or acknowledged notices sorted by id.

  Throws:
    `java.sql.SQLException`

### getNotices

    public static Notification[] getNotices(NoticeFactory.SortStyle sortStyle)
                                     throws java.sql.SQLException

  Return all unacknowledged notices sorted by the given sort style.

  Throws:
    `java.sql.SQLException`

### getNotices

    public static Notification[] getNotices(NoticeFactory.SortStyle sortStyle,
                                            boolean includeAcknowledged)
                                     throws java.sql.SQLException

  Deprecated. Replaced by " #getNotices(SortStyle,AcknowledgeType) getNotices( SortStyle, AcknowledgeType )"

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

  Throws:
    `java.sql.SQLException`

### getNotices

    public static Notification[] getNotices(NoticeFactory.SortStyle sortStyle,
                                            NoticeFactory.AcknowledgeType ackType)
                                     throws java.sql.SQLException

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

  Throws:
    `java.sql.SQLException`

### getNotices

    public static Notification[] getNotices(NoticeFactory.SortStyle sortStyle,
                                            NoticeFactory.AcknowledgeType ackType,
                                            NoticeFactory.Filter[] filters)
                                     throws java.sql.SQLException

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

  Throws:
    `java.sql.SQLException`

### getNotices

    public static Notification[] getNotices(NoticeFactory.SortStyle sortStyle,
                                            NoticeFactory.AcknowledgeType ackType,
                                            NoticeFactory.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`

### getNoticesForNode

    public static Notification[] getNoticesForNode(int nodeId)
                                            throws java.sql.SQLException

  Return all unacknowledged notices sorted by time for the given node.

  Throws:
    `java.sql.SQLException`

### getNoticesForNode

    public static Notification[] getNoticesForNode(int nodeId,
                                                   boolean includeAcknowledged)
                                            throws java.sql.SQLException

  Deprecated. Replaced by " #getNoticesForNode(int,SortStyle,AcknowledgeType) getNoticesForNode( int, SortStyle, AcknowledgeType )"

  Return all notices (optionally only unacknowledged notices) sorted by id for the given node.

  Throws:
    `java.sql.SQLException`

### getNoticesForNode

    public static Notification[] getNoticesForNode(int nodeId,
                                                   NoticeFactory.SortStyle sortStyle,
                                                   NoticeFactory.AcknowledgeType ackType)
                                            throws java.sql.SQLException

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

  Throws:
    `java.sql.SQLException`

### getNoticesForInterface

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

  Return all unacknowledged notices for the given interface.

  Throws:
    `java.sql.SQLException`

### getNoticesForInterface

    public static Notification[] getNoticesForInterface(int nodeId,
                                                        java.lang.String ipAddress,
                                                        boolean includeAcknowledged)
                                                 throws java.sql.SQLException

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

  Throws:
    `java.sql.SQLException`

### getNoticesForInterface

    public static Notification[] getNoticesForInterface(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`

### getNoticesForInterface

    public static Notification[] getNoticesForInterface(java.lang.String ipAddress,
                                                        boolean includeAcknowledged)
                                                 throws java.sql.SQLException

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

  Throws:
    `java.sql.SQLException`

### getNoticesForService

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

  Return all unacknowledged notices sorted by time for the given service.

  Throws:
    `java.sql.SQLException`

### getNoticesForService

    public static Notification[] getNoticesForService(int nodeId,
                                                      java.lang.String ipAddress,
                                                      int serviceId,
                                                      boolean includeAcknowledged)
                                               throws java.sql.SQLException

  Return all notices (optionally only unacknowledged notices) sorted by time for the given service.

  Throws:
    `java.sql.SQLException`

### getNoticesForService

    public static Notification[] getNoticesForService(int serviceId)
                                               throws java.sql.SQLException

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

  Throws:
    `java.sql.SQLException`

### getNoticesForService

    public static Notification[] getNoticesForService(int serviceId,
                                                      boolean includeAcknowledged)
                                               throws java.sql.SQLException

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

  Throws:
    `java.sql.SQLException`

### acknowledge

    public static void acknowledge(Notification[] notices,
                                   java.lang.String user)
                            throws java.sql.SQLException

  Acknowledge a list of notices with the given username

  Throws:
    `java.sql.SQLException`

### acknowledge

    public static void acknowledge(Notification[] notices,
                                   java.lang.String user,
                                   java.util.Date time)
                            throws java.sql.SQLException

  Acknowledge a list of notices with the given username and the given time.

  Throws:
    `java.sql.SQLException`

### acknowledge

    public static void acknowledge(int[] noticeIds,
                                   java.lang.String user)
                            throws java.sql.SQLException

  Acknowledge a list of notices with the given username and the current time.

  Throws:
    `java.sql.SQLException`

### acknowledge

    public static void acknowledge(int[] noticeIds,
                                   java.lang.String user,
                                   java.util.Date time)
                            throws java.sql.SQLException

  Acknowledge a list of notices with the given username and the given time.

  Throws:
    `java.sql.SQLException`

### rs2Notices

    protected static Notification[] rs2Notices(java.sql.ResultSet rs)
                                        throws java.sql.SQLException

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

  Throws:
    `java.sql.SQLException`

### getOrderByClause

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

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

### getAcknowledgeTypeClause

    protected static java.lang.String getAcknowledgeTypeClause(NoticeFactory.AcknowledgeType ackType)

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

  Parameters:
    `ackType` - the acknowledge type to map to a clause

OpenNMS API 1.2.9

Generated by ranger on May 19 2007 2335.