Class BasicNotificationItem

java.lang.Object
com.groiss.notification.BasicNotificationItem
All Implemented Interfaces:
NotificationItem, Serializable

public class BasicNotificationItem extends Object implements NotificationItem
A default implementation for NotificationItem. Can be used on its own or as extension point for further derivations.
See Also:
  • Field Details

    • COMMON_TOPIC

      public static final String COMMON_TOPIC
      Topic string which could be used for "generic" NotificationItems
      See Also:
  • Constructor Details

    • BasicNotificationItem

      public BasicNotificationItem(Application application, Agent agent, OrgUnit dept, Serializable payload)
      Construct a BasicNotificationItem.
      Parameters:
      application - set items Application
      agent - the items Agent
      dept - the items Orgunit
      payload - the object to transport
    • BasicNotificationItem

      public BasicNotificationItem()
      Public constructor.
  • Method Details

    • getType

      public short getType()
      Get the type of the NotificationEvent.
      Returns:
      the type of the NotificationEvent used to sent the item
    • setType

      public void setType(short type)
    • setPayload

      public void setPayload(Serializable payload)
      Set the Object to transport to the clients.
      Parameters:
      payload -
    • getPayload

      public Serializable getPayload()
    • setApplication

      public void setApplication(Application application)
      Sets the items application.
      Parameters:
      application - the application to set.
    • getApplication

      public Application getApplication()
      Description copied from interface: NotificationItem
      The application of the item. Needed when the items agent is a hierarchic role.
      Specified by:
      getApplication in interface NotificationItem
      Returns:
      the items agent.
    • setAgent

      public void setAgent(Agent agent)
      Set the items agent.
      Parameters:
      agent - the agent to set.
    • getAgent

      public Agent getAgent()
      Description copied from interface: NotificationItem
      The agent the item is to be destined for. See also the special agent Names.EVERYBODY.
      Specified by:
      getAgent in interface NotificationItem
      Returns:
      the items agent.
    • setDept

      public void setDept(OrgUnit dept)
    • getDept

      public OrgUnit getDept()
      Description copied from interface: NotificationItem
      The department of the item. Needed when the items agent is a local or a hierarchic role.
      Specified by:
      getDept in interface NotificationItem
      Returns:
      the items department.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getTopic

      public String getTopic()
      Returns null. Should be overridden in subclasses when the items are destined for smartclients.
      Specified by:
      getTopic in interface NotificationItem
      Returns:
      the topic to send for smartclients
      See Also:
    • getJsonPayload

      public JSONObject getJsonPayload()
      Returns null. Should be overridden in subclasses when the items are destined for smartclients.
      Specified by:
      getJsonPayload in interface NotificationItem
      Returns:
      the JSON-Representation that is send to the smartclients.
      See Also:
    • setPrivate

      public void setPrivate(boolean isPrivate)
      Can be used to designate an item for private notification without substitution ('for your eyes only'); agent must be a User.
    • isPrivate

      public boolean isPrivate()
      Check, if an item is for private notification without substitution.
    • getHttpSessionId

      public String getHttpSessionId()
      Get the session this item is destined for. Note that the agent must still match.
      Returns:
      the session this item is destined for.
    • setHttpSessionId

      public void setHttpSessionId(String sessionId)
      Set the sessionId (HttpSession.getId() for this notification Item. It will only be dispatches within the current cluster node to the appropriate session. Note, that there may be multiple notification/cometd sessions for one HTTP session (multiple tabs, ...). Implicitly, isPrivate() is true for such items.
      Parameters:
      sessionId -