Package org.opennms.netmgt.notifd
Class NotificationTask
- java.lang.Object
-
- org.opennms.netmgt.notifd.NotificationTask
-
- All Implemented Interfaces:
Runnable
public class NotificationTask extends Object implements Runnable
This class holds all the data and logic for sending out a notification Each notification that is sent will be accompanied by a row in the notifications table. All notifications in a group will be identified with a common groupId number.- Author:
- Jason Johns , OpenNMS , Jeff Gehlbach Modification to pick an ExecuteStrategy based on the "binary" flag in notificationCommands.xml by:, David Hustace
-
-
Constructor Summary
Constructors Constructor Description NotificationTask(NotificationManager notificationManager, UserManager userManager, long sendTime, Map<String,String> someParams, List<NotificationTask> siblings, String autoNotify, Executor executor)Constructor, initializes some information
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Command[]getCommands()getCommandsStringgetEmail()getEmailintgetNotifyId()Returns the unique id used to insert the row in the database for this notification task.longgetSendTime()getSendTimeStringgetTuiPin()getTuiPinUsergetUser()getUserbooleanisStarted()isStartedvoidrun()runvoidsetAutoNotify(String autoNotify)Sets the autoNotify info for the usersnotified tablevoidsetCommands(Command[] commands)This method will construct the command that will be issued to send the actual page.voidsetNoticeId(int anId)Sets the group id that will be inserted into the row in notifications tablevoidsetUser(User aUser)Sets the user that the page needs to be sent to.voidstart()startStringtoString()toString
-
-
-
Constructor Detail
-
NotificationTask
public NotificationTask(NotificationManager notificationManager, UserManager userManager, long sendTime, Map<String,String> someParams, List<NotificationTask> siblings, String autoNotify, Executor executor)
Constructor, initializes some information- Parameters:
someParams- the parameters from NotifynotificationManager- aNotificationManagerobject.userManager- aUserManagerobject.sendTime- a long.siblings- aListobject.autoNotify- aStringobject.
-
-
Method Detail
-
toString
public String toString()
toString
-
getSendTime
public long getSendTime()
getSendTime
- Returns:
- a long.
-
getNotifyId
public int getNotifyId()
Returns the unique id used to insert the row in the database for this notification task.- Returns:
- int, the id of the row in notifications table
-
setUser
public void setUser(User aUser)
Sets the user that the page needs to be sent to.- Parameters:
aUser- the user info
-
setAutoNotify
public void setAutoNotify(String autoNotify)
Sets the autoNotify info for the usersnotified table- Parameters:
autoNotify- aStringobject.
-
setNoticeId
public void setNoticeId(int anId)
Sets the group id that will be inserted into the row in notifications table- Parameters:
anId- the group id to set for the row
-
setCommands
public void setCommands(Command[] commands)
This method will construct the command that will be issued to send the actual page.- Parameters:
commands- the commands to call at the console.
-
getEmail
public String getEmail() throws IOException
getEmail
- Returns:
- a
Stringobject. - Throws:
IOException- if any.
-
getTuiPin
public String getTuiPin() throws IOException
getTuiPin
- Returns:
- a
Stringobject. - Throws:
IOException- if any.
-
start
public void start()
start
-
isStarted
public boolean isStarted()
isStarted
- Returns:
- a boolean.
-
-