Class Ticket


  • public class Ticket
    extends java.lang.Object
    OpenNMS Trouble Ticket Model class used to contain common ticket data by implementations of TicketerPlugin API.
    Author:
    Mathew Brozowski, David Hustace
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Ticket.State
      Enumeration for representation of a Ticket's state.
    • Constructor Summary

      Constructors 
      Constructor Description
      Ticket()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAttribute​(java.lang.String key, java.lang.String value)
      Adds a single free form attribute to the Ticket.
      java.lang.Integer getAlarmId()
      Returns the ID of the originator alarm
      java.lang.String getAttribute​(java.lang.String key)
      Gets a single free form attribute from a Ticket.
      java.util.Map<java.lang.String,​java.lang.String> getAttributes()
      getAttributes
      java.lang.String getDetails()
      TODO: This should probably turn into a collection of comments.
      java.lang.String getId()
      This should be the ticket ID assigned by the HelpDesk system.
      java.net.InetAddress getIpAddress()
      Returns the IP address of the originator alarm
      java.lang.String getModificationTimestamp()
      A timestamp to be used for optimistic locking with the trouble ticketing system
      java.lang.Integer getNodeId()
      Returns the ID of the originator node
      java.util.List<RelatedAlarmSummary> getRelatedAlarms()  
      Ticket.State getState()
      Returns the current Ticket.State
      java.lang.String getSummary()
      Returns a simple high level summary about the ticket that is generated from the Alarm logmsg.
      java.lang.String getUser()
      User name owning/createing the ticket.
      boolean hasAttributes()  
      boolean hasId()  
      boolean isSituation()  
      void setAlarmId​(java.lang.Integer alarmId)
      Sets the ID of the originator alarm.
      void setAttributes​(java.util.Map<java.lang.String,​java.lang.String> attributes)
      Store a list of free form attributes in the Ticket.
      void setDetails​(java.lang.String details)
      TODO: This should probably turn into a collection of comments or some such thing.
      void setId​(java.lang.String id)
      The TicketerPlugin should set the ID.
      void setIpAddress​(java.net.InetAddress ipAddress)
      Sets the IP address of the originator alarm.
      void setModificationTimestamp​(java.lang.String modificationTimestamp)
      setModificationTimestamp
      void setNodeId​(java.lang.Integer nodeId)
      Sets the ID of the originator node.
      void setRelatedAlarms​(java.util.List<RelatedAlarmSummary> relatedAlarms)
      Set related alarms for the current alarm associated with ticket.
      void setSituation​(boolean situation)
      Set as true if this alarm is a situation.
      void setState​(Ticket.State state)
      Sets the Ticket state to one of the Ticket.State Enums.
      void setSummary​(java.lang.String summary)
      Set a summary into the ticket.
      void setUser​(java.lang.String user)
      Set the user name owning the ticket.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • Ticket

        public Ticket()
    • Method Detail

      • getAttributes

        public java.util.Map<java.lang.String,​java.lang.String> getAttributes()

        getAttributes

        Returns:
        a Map of free from attributes of the ticket. Typically, from OnmsAlarm attributes.
      • setAttributes

        public void setAttributes​(java.util.Map<java.lang.String,​java.lang.String> attributes)
        Store a list of free form attributes in the Ticket. Typically, from the OnmsAlarm attributes.
        Parameters:
        attributes - a Map object.
      • addAttribute

        public void addAttribute​(java.lang.String key,
                                 java.lang.String value)
        Adds a single free form attribute to the Ticket.
        Parameters:
        key - a String object.
        value - a String object.
      • getAttribute

        public java.lang.String getAttribute​(java.lang.String key)
        Gets a single free form attribute from a Ticket.
        Parameters:
        key - a String object.
        Returns:
        a String object.
      • getSummary

        public java.lang.String getSummary()
        Returns a simple high level summary about the ticket that is generated from the Alarm logmsg.
        Returns:
        A string containing the summary of the ticket.
      • setSummary

        public void setSummary​(java.lang.String summary)
        Set a summary into the ticket. Typically the alarm's logmsg.
        Parameters:
        summary - a String object.
      • getDetails

        public java.lang.String getDetails()
        TODO: This should probably turn into a collection of comments.
        Returns:
        A string of details about the Ticket.
      • setDetails

        public void setDetails​(java.lang.String details)
        TODO: This should probably turn into a collection of comments or some such thing.
        Parameters:
        details - a String object.
      • getId

        public java.lang.String getId()
        This should be the ticket ID assigned by the HelpDesk system.
        Returns:
        a String object.
      • hasId

        public boolean hasId()
      • hasAttributes

        public boolean hasAttributes()
      • setId

        public void setId​(java.lang.String id)
        The TicketerPlugin should set the ID.
        Parameters:
        id - a String object.
      • getUser

        public java.lang.String getUser()
        User name owning/createing the ticket. Will be set initially to the user name set in the parameter of the create ticket event.
        Returns:
        a String containing the user name that owns the ticket.
      • setUser

        public void setUser​(java.lang.String user)
        Set the user name owning the ticket. Typically set by the TicketerServiceLayer implemenation as the user name parameter from the create ticket event.
        Parameters:
        user - a String object.
      • getState

        public Ticket.State getState()
        Returns the current Ticket.State
        Returns:
        the ticket state enum.
      • setState

        public void setState​(Ticket.State state)
        Sets the Ticket state to one of the Ticket.State Enums.
        Parameters:
        state - a Ticket.State object.
      • getModificationTimestamp

        public java.lang.String getModificationTimestamp()
        A timestamp to be used for optimistic locking with the trouble ticketing system
        Returns:
        a String object.
      • setModificationTimestamp

        public void setModificationTimestamp​(java.lang.String modificationTimestamp)

        setModificationTimestamp

        Parameters:
        modificationTimestamp - a String object.
      • getAlarmId

        public java.lang.Integer getAlarmId()
        Returns the ID of the originator alarm
        Returns:
        the alarm ID.
      • setAlarmId

        public void setAlarmId​(java.lang.Integer alarmId)
        Sets the ID of the originator alarm.
        Parameters:
        alarmId - a Integer object.
      • getNodeId

        public java.lang.Integer getNodeId()
        Returns the ID of the originator node
        Returns:
        the node ID.
      • setNodeId

        public void setNodeId​(java.lang.Integer nodeId)
        Sets the ID of the originator node.
        Parameters:
        nodeId - a Integer object.
      • getIpAddress

        public java.net.InetAddress getIpAddress()
        Returns the IP address of the originator alarm
        Returns:
        the IP address.
      • setIpAddress

        public void setIpAddress​(java.net.InetAddress ipAddress)
        Sets the IP address of the originator alarm.
        Parameters:
        ipAddress - a InetAddress object.
      • isSituation

        public boolean isSituation()
        Returns:
        boolean depending on whether alarm is situation or not. default is false.
      • setSituation

        public void setSituation​(boolean situation)
        Set as true if this alarm is a situation.
        Parameters:
        situation - whether or not this alarm is a situation.
      • setRelatedAlarms

        public void setRelatedAlarms​(java.util.List<RelatedAlarmSummary> relatedAlarms)
        Set related alarms for the current alarm associated with ticket.
        Parameters:
        relatedAlarms - a List of RelatedAlarmSummary
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object