Class NotificationTask

  • All Implemented Interfaces:
    java.lang.Runnable

    public class NotificationTask
    extends java.lang.Object
    implements java.lang.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, java.util.Map<java.lang.String,​java.lang.String> someParams, java.util.List<NotificationTask> siblings, java.lang.String autoNotify, java.util.concurrent.Executor executor)
      Constructor, initializes some information
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Command[] getCommands()
      getCommands
      java.lang.String getEmail()
      getEmail
      int getNotifyId()
      Returns the unique id used to insert the row in the database for this notification task.
      long getSendTime()
      getSendTime
      java.lang.String getTuiPin()
      getTuiPin
      User getUser()
      getUser
      boolean isStarted()
      isStarted
      void run()
      run
      void setAutoNotify​(java.lang.String autoNotify)
      Sets the autoNotify info for the usersnotified table
      void setCommands​(Command[] commands)
      This method will construct the command that will be issued to send the actual page.
      void setNoticeId​(int anId)
      Sets the group id that will be inserted into the row in notifications table
      void setUser​(User aUser)
      Sets the user that the page needs to be sent to.
      void start()
      start
      java.lang.String toString()
      toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • NotificationTask

        public NotificationTask​(NotificationManager notificationManager,
                                UserManager userManager,
                                long sendTime,
                                java.util.Map<java.lang.String,​java.lang.String> someParams,
                                java.util.List<NotificationTask> siblings,
                                java.lang.String autoNotify,
                                java.util.concurrent.Executor executor)
        Constructor, initializes some information
        Parameters:
        someParams - the parameters from Notify
        notificationManager - a NotificationManager object.
        userManager - a UserManager object.
        sendTime - a long.
        siblings - a List object.
        autoNotify - a String object.
    • Method Detail

      • toString

        public java.lang.String toString()

        toString

        Overrides:
        toString in class java.lang.Object
        Returns:
        a String object.
      • 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
      • getUser

        public User getUser()

        getUser

        Returns:
        a User object.
      • setAutoNotify

        public void setAutoNotify​(java.lang.String autoNotify)
        Sets the autoNotify info for the usersnotified table
        Parameters:
        autoNotify - a String object.
      • 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.
      • getCommands

        public Command[] getCommands()

        getCommands

        Returns:
        an array of Command objects.
      • run

        public void run()

        run

        Specified by:
        run in interface java.lang.Runnable
      • getEmail

        public java.lang.String getEmail()
                                  throws java.io.IOException

        getEmail

        Returns:
        a String object.
        Throws:
        java.io.IOException - if any.
      • getTuiPin

        public java.lang.String getTuiPin()
                                   throws java.io.IOException

        getTuiPin

        Returns:
        a String object.
        Throws:
        java.io.IOException - if any.
      • start

        public void start()

        start

      • isStarted

        public boolean isStarted()

        isStarted

        Returns:
        a boolean.