Interface NotificationItem

All Superinterfaces:
Serializable
All Known Implementing Classes:
BasicNotificationItem

public interface NotificationItem extends Serializable
NotificationItems are objects which can be send to clients. The destination of the NotificationItems is determined via a combination of agent, department and application. When the agent is a user or a global role, department and application information is not relevant. When the agent is a local role or hierarchic role, the department is relevant. When the agent is a hierarchic role, also the application (actually the department tree of the application) is relevant. Use BasicNotificationItem for a default implementation, or derive from this class.
  • Method Details

    • getApplication

      Application getApplication()
      The application of the item. Needed when the items agent is a hierarchic role.
      Returns:
      the items agent.
    • getAgent

      Agent getAgent()
      The agent the item is to be destined for. See also the special agent Names.EVERYBODY.
      Returns:
      the items agent.
    • getDept

      OrgUnit getDept()
      The department of the item. Needed when the items agent is a local or a hierarchic role.
      Returns:
      the items department.
    • getTopic

      String getTopic()
      Returns the topic-suffix to use for smartclient publishing. If the topic returns null, the item is neither delivered to smartclients nor delivered to other cluster nodes; it is solely delivered to RMI-Clients. The topic-string for delivery is constructed as "<Names.EP_APPLTOPICPREFIX>/<topic-string>".

      Some additional consideration for the topic is required when the agent Names.EVERYBODY is being used. In this case, when the topic starts with "/service", each smartclient/cometd session is notified individually, irrespective, whether the topic has been subscribed to excplicitly or not. When the prefix of the topic does not start with "/service", then the notification takes place via a single call to all sessions which subscribed the topic.

      Returns:
      the topic to send for smartclients
    • getJsonPayload

      JSONObject getJsonPayload()
      Returns the JSON representation that is send to the smartclients. This return-value is used as "payload" component of the message.

      It will generally be called for each client/session to be notified (if Names.EVERYBODY is used as agent together with a topic string not starting with "/service", the method will get called just once per cluster node).

      If it returns null, the item will not be delivered to smartclients.

      Beware: JSONObjects do not implement Serializable. When using an @enterprise cluster, then at the sending node, do not create instance variables with type JSONObject in derivations of NotificationItems, but use this method to create the proper JSONObject from other instance data at the receiving nodes.

      Returns:
      the JSON-Representation that is send to the smartclients.