org.opennms.web.event
Class EventFactory

java.lang.Object
  extended by org.opennms.web.event.EventFactory

public class EventFactory
extends Object

Encapsulates all querying functionality for events.

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

Method Summary
static void acknowledge(Event[] events, String user)
          Acknowledge a list of events with the given username and the current time.
static void acknowledge(Event[] events, String user, Date time)
          Acknowledge a list of events with the given username and the given time.
static void acknowledge(Filter[] filters, String user)
          Acknowledge with the given username and the current time all events that match the given filter criteria.
static void acknowledge(Filter[] filters, String user, Date time)
          Acknowledge with the given username and the given time all events that match the given filter criteria.
static void acknowledge(int[] eventIds, String user)
          Acknowledge a list of events with the given username and the current time.
static void acknowledge(int[] eventIds, String user, Date time)
          Acknowledge a list of events with the given username and the given time.
static void acknowledgeAll(String user)
          Acknowledge all unacknowledged events with the given username and the given time.
static void acknowledgeAll(String user, Date time)
          Acknowledge all unacknowledged events with the given username and the given time.
protected static String getAcknowledgeTypeClause(AcknowledgeType ackType)
          Convenience method for getting the SQL ORDER BY clause related to a given sort style.
static Event getEvent(int eventId)
          Return a specific event.
static int getEventCount()
          Count all outstanding (unacknowledged) events.
static int getEventCount(AcknowledgeType ackType, Filter[] filters)
          Count the number of events for a given acknowledgement type.
static int[] getEventCountBySeverity(AcknowledgeType ackType, Filter[] filters)
          Count the number of events for a given acknowledgement type.
static int getEventCountForInterface(int nodeId, String ipAddress, AcknowledgeType ackType, javax.servlet.ServletContext servletContext)
          Return the number of events for this node ID, IP address, and the given acknowledgment type.
static int getEventCountForInterface(String ipAddress, AcknowledgeType ackType)
          Return the number of events for this IP address and the given acknowledgment type.
static int getEventCountForNode(int nodeId, AcknowledgeType ackType)
          Return the number of events for this node and the given acknowledgment type.
static int getEventCountForService(int serviceId, AcknowledgeType ackType, javax.servlet.ServletContext servletContext)
          Return the number of events for this node ID, IP address, service ID, and the given acknowledgement type.
static int getEventCountForService(int nodeId, String ipAddress, int serviceId, AcknowledgeType ackType, javax.servlet.ServletContext servletContext)
          Return the number of events for this node ID, IP address, service ID, and the given acknowledgement type.
static Event[] getEvents()
          Return all unacknowledged events sorted by time.
static Event[] getEvents(AcknowledgeType ackType)
          Return all unacknowledged or acknowledged events sorted by time.
static Event[] getEvents(SortStyle sortStyle)
          Return all unacknowledged events sorted by the given sort style.
static Event[] getEvents(SortStyle sortStyle, AcknowledgeType ackType)
          Return all events (optionally only unacknowledged events) sorted by the given sort style.
static Event[] getEvents(SortStyle sortStyle, AcknowledgeType ackType, Filter[] filters)
          Return all events (optionally only unacknowledged events) sorted by the given sort style.
static Event[] getEvents(SortStyle sortStyle, AcknowledgeType ackType, Filter[] filters, int limit, int offset)
          Return all events (optionally only unacknowledged events) sorted by the given sort style.
static Event[] getEvents(SortStyle sortStyle, boolean includeAcknowledged)
          Deprecated. Replaced by " #getEvents(SortStyle,AcknowledgeType) getEvents(SortStyle, AcknowledgeType)"
static Event[] getEventsForInterface(int nodeId, int ifIndex, SortStyle sortStyle, AcknowledgeType ackType, int throttle, int offset, javax.servlet.ServletContext servletContext)
          Return some maximum number of events or less (optionally only unacknowledged events) sorted by the given sort style for the given node and IP address.
static Event[] getEventsForInterface(int nodeId, String ipAddress, boolean includeAcknowledged, javax.servlet.ServletContext servletContext)
          Deprecated. Replaced by " #getEventsForInterface(int,String,SortStyle,AcknowledgeType) getEventsForInterface( int, String, SortStyle, AcknowledgeType )"
static Event[] getEventsForInterface(int nodeId, String ipAddress, javax.servlet.ServletContext servletContext)
          Return all unacknowledged events sorted by event ID for the given interface.
static Event[] getEventsForInterface(int nodeId, String ipAddress, SortStyle sortStyle, AcknowledgeType ackType, int throttle, int offset, javax.servlet.ServletContext servletContext)
          Return some maximum number of events or less (optionally only unacknowledged events) sorted by the given sort style for the given node and IP address.
static Event[] getEventsForInterface(String ipAddress)
          Return all unacknowledged events sorted by time for that have the given IP address, regardless of what node they belong to.
static Event[] getEventsForInterface(String ipAddress, boolean includeAcknowledged)
          Deprecated. Replaced by " #getEventsForInterface(String,SortStyle,AcknowledgeType) getEventsForInterface( String, SortStyle, AcknowledgeType )"
static Event[] getEventsForInterface(String ipAddress, SortStyle sortStyle, AcknowledgeType ackType, int throttle, int offset)
          Return some maximum number of events or less (optionally only unacknowledged events) sorted by the given sort style for the given IP address.
static Event[] getEventsForNode(int nodeId, boolean includeAcknowledged, javax.servlet.ServletContext servletContext)
          Deprecated. Replaced by " #getEventsForNode(int,SortStyle,AcknowledgeType) getEventsForNode( int, SortStyle, AcknowledgeType )"
static Event[] getEventsForNode(int nodeId, javax.servlet.ServletContext servletContext)
          Return all unacknowledged events sorted by event ID for the given node.
static Event[] getEventsForNode(int nodeId, SortStyle sortStyle, AcknowledgeType ackType, int throttle, int offset, javax.servlet.ServletContext servletContext)
          Return some maximum number of events or less (optionally only unacknowledged events) sorted by the given sort style for the given node.
static Event[] getEventsForNode(int nodeId, SortStyle sortStyle, AcknowledgeType ackType, javax.servlet.ServletContext servletContext)
          Return all events (optionally only unacknowledged events) sorted by the given sort style for the given node.
static Event[] getEventsForPoller(String poller)
          Return all unacknowledged events sorted by time for that have the given distributed poller.
static Event[] getEventsForPoller(String poller, boolean includeAcknowledged)
          Return all events (optionally only unacknowledged events) sorted by time that have the given distributed poller.
static Event[] getEventsForService(int serviceId, boolean includeAcknowledged, javax.servlet.ServletContext servletContext)
          Return all events (optionally only unacknowledged events) sorted by time for the given service type, regardless of what node or interface they belong to.
static Event[] getEventsForService(int serviceId, javax.servlet.ServletContext servletContext)
          Return all unacknowledged events sorted by time for the given service type, regardless of what node or interface they belong to.
static Event[] getEventsForService(int serviceId, SortStyle sortStyle, AcknowledgeType ackType, int throttle, int offset, javax.servlet.ServletContext servletContext)
          Return some maximum number of events or less (optionally only unacknowledged events) sorted by the given sort style for the given service ID.
static Event[] getEventsForService(int nodeId, String ipAddress, int serviceId, boolean includeAcknowledged, javax.servlet.ServletContext servletContext)
          Deprecated. Replaced by " #getEventsForService(int,String,int,SortStyle,AcknowledgeType,int,int) getEventsForService( int, String, int, SortStyle, AcknowledgeType, int, int )"
static Event[] getEventsForService(int nodeId, String ipAddress, int serviceId, javax.servlet.ServletContext servletContext)
          Return all unacknowledged events sorted by time for the given service.
static Event[] getEventsForService(int nodeId, String ipAddress, int serviceId, SortStyle sortStyle, AcknowledgeType ackType, int throttle, int offset, javax.servlet.ServletContext servletContext)
          Return some maximum number of events or less (optionally only unacknowledged events) sorted by the given sort style for the given node, IP address, and service ID.
static Event[] getEventsForSeverity(int severity)
          Return all unacknowledged events sorted by time for the given severity.
static Event[] getEventsForSeverity(int severity, boolean includeAcknowledged)
          Deprecated. Replaced by " #getEventsForSeverity(int,SortStyle,AcknowledgeType) getEventsForSeverity( int, SortStyle, AcknowledgeType )"
static Event[] getEventsForSeverity(int severity, SortStyle sortStyle, AcknowledgeType ackType)
          getEventsForSeverity
protected static String getOrderByClause(SortStyle sortStyle)
          Convenience method for getting the SQL ORDER BY clause related to a given sort style.
protected static Event[] rs2Events(ResultSet rs)
          Convenience method for translating a java.sql.ResultSet containing event information into an array of Event objects.
static void unacknowledge(Event[] events)
          Unacknowledge a list of events.
static void unacknowledge(Filter[] filters)
          Unacknowledge events that match the given filter criteria.
static void unacknowledge(int[] eventIds)
          Unacknowledge a list of events.
static void unacknowledgeAll()
          Unacknowledge all acknowledged events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getEventCount

public static int getEventCount()
                         throws SQLException
Count all outstanding (unacknowledged) events.

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

getEventCount

public static int getEventCount(AcknowledgeType ackType,
                                Filter[] filters)
                         throws SQLException
Count the number of events for a given acknowledgement type.

Parameters:
ackType - a AcknowledgeType object.
filters - an array of org$opennms$web$filter$Filter objects.
Returns:
a int.
Throws:
SQLException - if any.

getEventCountBySeverity

public static int[] getEventCountBySeverity(AcknowledgeType ackType,
                                            Filter[] filters)
                                     throws SQLException
Count the number of events for a given acknowledgement type.

Parameters:
ackType - a AcknowledgeType object.
filters - an array of org$opennms$web$filter$Filter objects.
Returns:
An array of event counts. Each index of the array corresponds to the event severity for the counts (indeterminate is 1, critical is 7, etc).
Throws:
SQLException - if any.

getEvent

public static Event getEvent(int eventId)
                      throws SQLException
Return a specific event.

Parameters:
eventId - a int.
Returns:
a Event object.
Throws:
SQLException - if any.

getEvents

public static Event[] getEvents()
                         throws SQLException
Return all unacknowledged events sorted by time.

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

getEvents

public static Event[] getEvents(AcknowledgeType ackType)
                         throws SQLException
Return all unacknowledged or acknowledged events sorted by time.

Parameters:
ackType - a AcknowledgeType object.
Returns:
an array of Event objects.
Throws:
SQLException - if any.

getEvents

public static Event[] getEvents(SortStyle sortStyle)
                         throws SQLException
Return all unacknowledged events sorted by the given sort style.

Parameters:
sortStyle - a SortStyle object.
Returns:
an array of Event objects.
Throws:
SQLException - if any.

getEvents

public static Event[] getEvents(SortStyle sortStyle,
                                boolean includeAcknowledged)
                         throws SQLException
Deprecated. Replaced by " #getEvents(SortStyle,AcknowledgeType) getEvents(SortStyle, AcknowledgeType)"

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

Parameters:
sortStyle - a SortStyle object.
includeAcknowledged - a boolean.
Returns:
an array of Event objects.
Throws:
SQLException - if any.

getEvents

public static Event[] getEvents(SortStyle sortStyle,
                                AcknowledgeType ackType)
                         throws SQLException
Return all events (optionally only unacknowledged events) sorted by the given sort style.

Parameters:
sortStyle - a SortStyle object.
ackType - a AcknowledgeType object.
Returns:
an array of Event objects.
Throws:
SQLException - if any.

getEvents

public static Event[] getEvents(SortStyle sortStyle,
                                AcknowledgeType ackType,
                                Filter[] filters)
                         throws SQLException
Return all events (optionally only unacknowledged events) sorted by the given sort style.

Parameters:
sortStyle - a SortStyle object.
ackType - a AcknowledgeType object.
filters - an array of org$opennms$web$filter$Filter objects.
Returns:
an array of Event objects.
Throws:
SQLException - if any.

getEvents

public static Event[] getEvents(SortStyle sortStyle,
                                AcknowledgeType ackType,
                                Filter[] filters,
                                int limit,
                                int offset)
                         throws SQLException
Return all events (optionally only unacknowledged events) 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
sortStyle - a SortStyle object.
ackType - a AcknowledgeType object.
filters - an array of org$opennms$web$filter$Filter objects.
Returns:
an array of Event objects.
Throws:
SQLException - if any.

getEventsForNode

public static Event[] getEventsForNode(int nodeId,
                                       javax.servlet.ServletContext servletContext)
                                throws SQLException
Return all unacknowledged events sorted by event ID for the given node.

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

getEventsForNode

public static Event[] getEventsForNode(int nodeId,
                                       boolean includeAcknowledged,
                                       javax.servlet.ServletContext servletContext)
                                throws SQLException
Deprecated. Replaced by " #getEventsForNode(int,SortStyle,AcknowledgeType) getEventsForNode( int, SortStyle, AcknowledgeType )"

Return all events (optionally only unacknowledged events) sorted by event ID for the given node.

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

getEventsForNode

public static Event[] getEventsForNode(int nodeId,
                                       SortStyle sortStyle,
                                       AcknowledgeType ackType,
                                       javax.servlet.ServletContext servletContext)
                                throws SQLException
Return all events (optionally only unacknowledged events) sorted by the given sort style for the given node.

Parameters:
nodeId - a int.
sortStyle - a SortStyle object.
ackType - a AcknowledgeType object.
Returns:
an array of Event objects.
Throws:
SQLException - if any.

getEventsForNode

public static Event[] getEventsForNode(int nodeId,
                                       SortStyle sortStyle,
                                       AcknowledgeType ackType,
                                       int throttle,
                                       int offset,
                                       javax.servlet.ServletContext servletContext)
                                throws SQLException
Return some maximum number of events or less (optionally only unacknowledged events) sorted by the given sort style for the given node.

Parameters:
throttle - a value less than one means no throttling
nodeId - a int.
sortStyle - a SortStyle object.
ackType - a AcknowledgeType object.
offset - a int.
Returns:
an array of Event objects.
Throws:
SQLException - if any.

getEventCountForNode

public static int getEventCountForNode(int nodeId,
                                       AcknowledgeType ackType)
                                throws SQLException
Return the number of events for this node and the given acknowledgment type.

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

getEventsForInterface

public static Event[] getEventsForInterface(int nodeId,
                                            String ipAddress,
                                            javax.servlet.ServletContext servletContext)
                                     throws SQLException
Return all unacknowledged events sorted by event ID for the given interface.

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

getEventsForInterface

public static Event[] getEventsForInterface(int nodeId,
                                            String ipAddress,
                                            boolean includeAcknowledged,
                                            javax.servlet.ServletContext servletContext)
                                     throws SQLException
Deprecated. Replaced by " #getEventsForInterface(int,String,SortStyle,AcknowledgeType) getEventsForInterface( int, String, SortStyle, AcknowledgeType )"

Return all events (optionally only unacknowledged events) sorted by time for the given interface.

Parameters:
nodeId - a int.
ipAddress - a String object.
includeAcknowledged - a boolean.
Returns:
an array of Event objects.
Throws:
SQLException - if any.

getEventsForInterface

public static Event[] getEventsForInterface(int nodeId,
                                            String ipAddress,
                                            SortStyle sortStyle,
                                            AcknowledgeType ackType,
                                            int throttle,
                                            int offset,
                                            javax.servlet.ServletContext servletContext)
                                     throws SQLException
Return some maximum number of events or less (optionally only unacknowledged events) sorted by the given sort style for the given node and IP address.

Parameters:
throttle - a value less than one means no throttling
offset - which row to start on in the result list
nodeId - a int.
ipAddress - a String object.
sortStyle - a SortStyle object.
ackType - a AcknowledgeType object.
Returns:
an array of Event objects.
Throws:
SQLException - if any.

getEventsForInterface

public static Event[] getEventsForInterface(int nodeId,
                                            int ifIndex,
                                            SortStyle sortStyle,
                                            AcknowledgeType ackType,
                                            int throttle,
                                            int offset,
                                            javax.servlet.ServletContext servletContext)
                                     throws SQLException
Return some maximum number of events or less (optionally only unacknowledged events) sorted by the given sort style for the given node and IP address.

Parameters:
throttle - a value less than one means no throttling
offset - which row to start on in the result list
nodeId - a int.
ifIndex - a int.
sortStyle - a SortStyle object.
ackType - a AcknowledgeType object.
Returns:
an array of Event objects.
Throws:
SQLException - if any.

getEventsForInterface

public static Event[] getEventsForInterface(String ipAddress)
                                     throws SQLException
Return all unacknowledged events sorted by time for that have the given IP address, regardless of what node they belong to.

Parameters:
ipAddress - a String object.
Returns:
an array of Event objects.
Throws:
SQLException - if any.

getEventsForInterface

public static Event[] getEventsForInterface(String ipAddress,
                                            boolean includeAcknowledged)
                                     throws SQLException
Deprecated. Replaced by " #getEventsForInterface(String,SortStyle,AcknowledgeType) getEventsForInterface( String, SortStyle, AcknowledgeType )"

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

Parameters:
ipAddress - a String object.
includeAcknowledged - a boolean.
Returns:
an array of Event objects.
Throws:
SQLException - if any.

getEventsForInterface

public static Event[] getEventsForInterface(String ipAddress,
                                            SortStyle sortStyle,
                                            AcknowledgeType ackType,
                                            int throttle,
                                            int offset)
                                     throws SQLException
Return some maximum number of events or less (optionally only unacknowledged events) sorted by the given sort style for the given IP address.

Parameters:
throttle - a value less than one means no throttling
offset - which row to start on in the result list
ipAddress - a String object.
sortStyle - a SortStyle object.
ackType - a AcknowledgeType object.
Returns:
an array of Event objects.
Throws:
SQLException - if any.

getEventCountForInterface

public static int getEventCountForInterface(int nodeId,
                                            String ipAddress,
                                            AcknowledgeType ackType,
                                            javax.servlet.ServletContext servletContext)
                                     throws SQLException
Return the number of events for this node ID, IP address, and the given acknowledgment type.

Parameters:
nodeId - a int.
ipAddress - a String object.
ackType - a AcknowledgeType object.
Returns:
a int.
Throws:
SQLException - if any.

getEventCountForInterface

public static int getEventCountForInterface(String ipAddress,
                                            AcknowledgeType ackType)
                                     throws SQLException
Return the number of events for this IP address and the given acknowledgment type.

Parameters:
ipAddress - a String object.
ackType - a AcknowledgeType object.
Returns:
a int.
Throws:
SQLException - if any.

getEventsForService

public static Event[] getEventsForService(int nodeId,
                                          String ipAddress,
                                          int serviceId,
                                          javax.servlet.ServletContext servletContext)
                                   throws SQLException
Return all unacknowledged events sorted by time for the given service.

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

getEventsForService

public static Event[] getEventsForService(int nodeId,
                                          String ipAddress,
                                          int serviceId,
                                          boolean includeAcknowledged,
                                          javax.servlet.ServletContext servletContext)
                                   throws SQLException
Deprecated. Replaced by " #getEventsForService(int,String,int,SortStyle,AcknowledgeType,int,int) getEventsForService( int, String, int, SortStyle, AcknowledgeType, int, int )"

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

Parameters:
nodeId - a int.
ipAddress - a String object.
serviceId - a int.
includeAcknowledged - a boolean.
Returns:
an array of Event objects.
Throws:
SQLException - if any.

getEventsForService

public static Event[] getEventsForService(int nodeId,
                                          String ipAddress,
                                          int serviceId,
                                          SortStyle sortStyle,
                                          AcknowledgeType ackType,
                                          int throttle,
                                          int offset,
                                          javax.servlet.ServletContext servletContext)
                                   throws SQLException
Return some maximum number of events or less (optionally only unacknowledged events) sorted by the given sort style for the given node, IP address, and service ID.

Parameters:
throttle - a value less than one means no throttling
offset - which row to start on in the result list
nodeId - a int.
ipAddress - a String object.
serviceId - a int.
sortStyle - a SortStyle object.
ackType - a AcknowledgeType object.
Returns:
an array of Event objects.
Throws:
SQLException - if any.

getEventsForService

public static Event[] getEventsForService(int serviceId,
                                          javax.servlet.ServletContext servletContext)
                                   throws SQLException
Return all unacknowledged events sorted by time for the given service type, regardless of what node or interface they belong to.

Parameters:
serviceId - a int.
Returns:
an array of Event objects.
Throws:
SQLException - if any.

getEventsForService

public static Event[] getEventsForService(int serviceId,
                                          boolean includeAcknowledged,
                                          javax.servlet.ServletContext servletContext)
                                   throws SQLException
Return all events (optionally only unacknowledged events) sorted by time for the given service type, regardless of what node or interface they belong to.

Parameters:
serviceId - a int.
includeAcknowledged - a boolean.
Returns:
an array of Event objects.
Throws:
SQLException - if any.

getEventsForService

public static Event[] getEventsForService(int serviceId,
                                          SortStyle sortStyle,
                                          AcknowledgeType ackType,
                                          int throttle,
                                          int offset,
                                          javax.servlet.ServletContext servletContext)
                                   throws SQLException
Return some maximum number of events or less (optionally only unacknowledged events) sorted by the given sort style for the given service ID.

Parameters:
throttle - a value less than one means no throttling
offset - which row to start on in the result list
serviceId - a int.
sortStyle - a SortStyle object.
ackType - a AcknowledgeType object.
Returns:
an array of Event objects.
Throws:
SQLException - if any.

getEventCountForService

public static int getEventCountForService(int nodeId,
                                          String ipAddress,
                                          int serviceId,
                                          AcknowledgeType ackType,
                                          javax.servlet.ServletContext servletContext)
                                   throws SQLException
Return the number of events for this node ID, IP address, service ID, and the given acknowledgement type.

Parameters:
nodeId - a int.
ipAddress - a String object.
serviceId - a int.
ackType - a AcknowledgeType object.
Returns:
a int.
Throws:
SQLException - if any.

getEventCountForService

public static int getEventCountForService(int serviceId,
                                          AcknowledgeType ackType,
                                          javax.servlet.ServletContext servletContext)
                                   throws SQLException
Return the number of events for this node ID, IP address, service ID, and the given acknowledgement type.

Parameters:
serviceId - a int.
ackType - a AcknowledgeType object.
Returns:
a int.
Throws:
SQLException - if any.

getEventsForSeverity

public static Event[] getEventsForSeverity(int severity)
                                    throws SQLException
Return all unacknowledged events sorted by time for the given severity.

Parameters:
severity - a int.
Returns:
an array of Event objects.
Throws:
SQLException - if any.

getEventsForSeverity

public static Event[] getEventsForSeverity(int severity,
                                           boolean includeAcknowledged)
                                    throws SQLException
Deprecated. Replaced by " #getEventsForSeverity(int,SortStyle,AcknowledgeType) getEventsForSeverity( int, SortStyle, AcknowledgeType )"

Return all events (optionally only unacknowledged events) sorted by time for the given severity.

Parameters:
severity - a int.
includeAcknowledged - a boolean.
Returns:
an array of Event objects.
Throws:
SQLException - if any.

getEventsForSeverity

public static Event[] getEventsForSeverity(int severity,
                                           SortStyle sortStyle,
                                           AcknowledgeType ackType)
                                    throws SQLException

getEventsForSeverity

Parameters:
severity - a int.
sortStyle - a SortStyle object.
ackType - a AcknowledgeType object.
Returns:
an array of Event objects.
Throws:
SQLException - if any.

getEventsForPoller

public static Event[] getEventsForPoller(String poller)
                                  throws SQLException
Return all unacknowledged events sorted by time for that have the given distributed poller.

Parameters:
poller - a String object.
Returns:
an array of Event objects.
Throws:
SQLException - if any.

getEventsForPoller

public static Event[] getEventsForPoller(String poller,
                                         boolean includeAcknowledged)
                                  throws SQLException
Return all events (optionally only unacknowledged events) sorted by time that have the given distributed poller.

Parameters:
poller - a String object.
includeAcknowledged - a boolean.
Returns:
an array of Event objects.
Throws:
SQLException - if any.

acknowledge

public static void acknowledge(Event[] events,
                               String user)
                        throws SQLException
Acknowledge a list of events with the given username and the current time.

Parameters:
events - an array of Event objects.
user - a String object.
Throws:
SQLException - if any.

acknowledge

public static void acknowledge(Event[] events,
                               String user,
                               Date time)
                        throws SQLException
Acknowledge a list of events with the given username and the given time.

Parameters:
events - an array of Event objects.
user - a String object.
time - a java$util$Date object.
Throws:
SQLException - if any.

acknowledge

public static void acknowledge(int[] eventIds,
                               String user)
                        throws SQLException
Acknowledge a list of events with the given username and the current time.

Parameters:
eventIds - an array of int.
user - a String object.
Throws:
SQLException - if any.

acknowledge

public static void acknowledge(int[] eventIds,
                               String user,
                               Date time)
                        throws SQLException
Acknowledge a list of events with the given username and the given time.

Parameters:
eventIds - an array of int.
user - a String object.
time - a java$util$Date object.
Throws:
SQLException - if any.

acknowledge

public static void acknowledge(Filter[] filters,
                               String user)
                        throws SQLException
Acknowledge with the given username and the current time all events that match the given filter criteria.

Parameters:
filters - an array of org$opennms$web$filter$Filter objects.
user - a String object.
Throws:
SQLException - if any.

acknowledge

public static void acknowledge(Filter[] filters,
                               String user,
                               Date time)
                        throws SQLException
Acknowledge with the given username and the given time all events that match the given filter criteria.

Parameters:
filters - an array of org$opennms$web$filter$Filter objects.
user - a String object.
time - a java$util$Date object.
Throws:
SQLException - if any.

acknowledgeAll

public static void acknowledgeAll(String user)
                           throws SQLException
Acknowledge all unacknowledged events with the given username and the given time.

Parameters:
user - a String object.
Throws:
SQLException - if any.

acknowledgeAll

public static void acknowledgeAll(String user,
                                  Date time)
                           throws SQLException
Acknowledge all unacknowledged events with the given username and the given time.

Parameters:
user - a String object.
time - a java$util$Date object.
Throws:
SQLException - if any.

unacknowledge

public static void unacknowledge(Event[] events)
                          throws SQLException
Unacknowledge a list of events.

Parameters:
events - an array of Event objects.
Throws:
SQLException - if any.

unacknowledge

public static void unacknowledge(int[] eventIds)
                          throws SQLException
Unacknowledge a list of events.

Parameters:
eventIds - an array of int.
Throws:
SQLException - if any.

unacknowledge

public static void unacknowledge(Filter[] filters)
                          throws SQLException
Unacknowledge events that match the given filter criteria.

Parameters:
filters - an array of org$opennms$web$filter$Filter objects.
Throws:
SQLException - if any.

unacknowledgeAll

public static void unacknowledgeAll()
                             throws SQLException
Unacknowledge all acknowledged events.

Throws:
SQLException - if any.

rs2Events

protected static Event[] rs2Events(ResultSet rs)
                            throws SQLException
Convenience method for translating a java.sql.ResultSet containing event information into an array of Event objects.

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

getOrderByClause

protected static String getOrderByClause(SortStyle sortStyle)
Convenience method for getting the SQL ORDER BY clause related to a given sort style.

Parameters:
sortStyle - a SortStyle object.
Returns:
a String object.

getAcknowledgeTypeClause

protected static String getAcknowledgeTypeClause(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
Returns:
a String object.


Copyright © 2011. All Rights Reserved.