Smack

org.jivesoftware.smackx.pubsub
Class ItemPublishEvent<T extends Item>

java.lang.Object
  extended by org.jivesoftware.smackx.pubsub.NodeEvent
      extended by org.jivesoftware.smackx.pubsub.SubscriptionEvent
          extended by org.jivesoftware.smackx.pubsub.ItemPublishEvent<T>

public class ItemPublishEvent<T extends Item>
extends SubscriptionEvent

Represents an event generated by an item(s) being published to a node.

Author:
Robin Collier

Constructor Summary
ItemPublishEvent(java.lang.String nodeId, java.util.List<T> eventItems)
          Constructs an ItemPublishEvent with the provided list of Item that were published.
ItemPublishEvent(java.lang.String nodeId, java.util.List<T> eventItems, java.util.List<java.lang.String> subscriptionIds)
          Constructs an ItemPublishEvent with the provided list of Item that were published.
ItemPublishEvent(java.lang.String nodeId, java.util.List<T> eventItems, java.util.List<java.lang.String> subscriptionIds, java.util.Date publishedDate)
          Constructs an ItemPublishEvent with the provided list of Item that were published in the past.
 
Method Summary
 java.util.List<T> getItems()
          Get the list of Item that were published.
 java.util.Date getPublishedDate()
          Gets the original date the items were published.
 boolean isDelayed()
          Indicates whether this event was delayed.
 java.lang.String toString()
           
 
Methods inherited from class org.jivesoftware.smackx.pubsub.SubscriptionEvent
getSubscriptions, setSubscriptions
 
Methods inherited from class org.jivesoftware.smackx.pubsub.NodeEvent
getNodeId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ItemPublishEvent

public ItemPublishEvent(java.lang.String nodeId,
                        java.util.List<T> eventItems)
Constructs an ItemPublishEvent with the provided list of Item that were published.

Parameters:
nodeId - The id of the node the event came from
eventItems - The list of Item that were published

ItemPublishEvent

public ItemPublishEvent(java.lang.String nodeId,
                        java.util.List<T> eventItems,
                        java.util.List<java.lang.String> subscriptionIds)
Constructs an ItemPublishEvent with the provided list of Item that were published. The list of subscription ids represents the subscriptions that matched the event, in the case of the user having multiple subscriptions.

Parameters:
nodeId - The id of the node the event came from
eventItems - The list of Item that were published
subscriptionIds - The list of subscriptionIds

ItemPublishEvent

public ItemPublishEvent(java.lang.String nodeId,
                        java.util.List<T> eventItems,
                        java.util.List<java.lang.String> subscriptionIds,
                        java.util.Date publishedDate)
Constructs an ItemPublishEvent with the provided list of Item that were published in the past. The published date signifies that this is delayed event. The list of subscription ids represents the subscriptions that matched the event, in the case of the user having multiple subscriptions.

Parameters:
nodeId - The id of the node the event came from
eventItems - The list of Item that were published
subscriptionIds - The list of subscriptionIds
publishedDate - The original publishing date of the events
Method Detail

getItems

public java.util.List<T> getItems()
Get the list of Item that were published.

Returns:
The list of published Item

isDelayed

public boolean isDelayed()
Indicates whether this event was delayed. That is, the items were published to the node at some time in the past. This will typically happen if there is an item already published to the node before a user subscribes to it. In this case, when the user subscribes, the server may send the last item published to the node with a delay date showing its time of original publication.

Returns:
true if the items are delayed, false otherwise.

getPublishedDate

public java.util.Date getPublishedDate()
Gets the original date the items were published. This is only valid if isDelayed() is true.

Returns:
Date items were published if isDelayed() is true, null otherwise.

toString

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

Smack

Copyright © 2003-2007 Jive Software.