Class Event
- java.lang.Object
-
- rocks.xmpp.extensions.pubsub.model.event.Event
-
public final class Event extends Object
The implementation of the<event/>
element in thehttp://jabber.org/protocol/pubsub#event
namespace.- See Also:
- XEP-0060: Publish-Subscribe, XML Schema
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DataForm
getConfigurationForm()
Gets the configuration form.List<Item>
getItems()
Gets the items of the event.String
getNode()
Gets the 'node' attribute of the child element.URI
getRedirectUri()
Gets the redirect URI in case the event is a delete event.List<String>
getRetractedItems()
Gets the retracted (deleted) items.Subscription
getSubscription()
Gets the subscription approval.boolean
hasItems()
Indicates, whether the has items.boolean
isConfiguration()
Indicates, whether the event is a configuration change event.boolean
isDelete()
Indicates, whether the event is a delete event, i.e. if a node has been deleted.boolean
isPurge()
Indicates, whether the event is purge event.boolean
isRetract()
Indicates, whether the event is a retract event.static Event
withConfiguration(String node, DataForm configuration)
Creates a pub-sub event with a configuration form.static Event
withDeletion(String node)
Creates a pub-sub event with delete information.static Event
withDeletion(String node, URI redirectUri)
Creates a pub-sub event with delete information.static Event
withItem(String node, Object payload, String id, Jid publisher)
Creates a pub-sub event with a single item.static Event
withItems(String node, List<Item> items)
Creates a pub-sub event with items.static Event
withPurge(String node)
Creates a pub-sub event with purge information.static Event
withRetractedItems(String node, List<String> deletedItemIds)
Creates a pub-sub event with delete information.static Event
withSubscription(String node, Jid jid, SubscriptionState subscription)
Creates a pub-sub event with subscription information.static Event
withSubscription(String node, Jid jid, SubscriptionState subscription, Instant expiry, String subid)
Creates a pub-sub event with subscription information.
-
-
-
Method Detail
-
withConfiguration
public static Event withConfiguration(String node, DataForm configuration)
Creates a pub-sub event with a configuration form.- Parameters:
node
- The node (required).configuration
- The configuration form (required).- Returns:
- The pub-sub event.
- See Also:
- Example 152
-
withDeletion
public static Event withDeletion(String node)
Creates a pub-sub event with delete information.- Parameters:
node
- The node (required).- Returns:
- The pub-sub event.
- See Also:
(String, URI)
, Example 160
-
withDeletion
public static Event withDeletion(String node, URI redirectUri)
Creates a pub-sub event with delete information.- Parameters:
node
- The node (required).redirectUri
- The redirect URI (optional).- Returns:
- The pub-sub event.
- See Also:
withDeletion(String)
, Example 160
-
withItem
public static Event withItem(String node, Object payload, String id, Jid publisher)
Creates a pub-sub event with a single item.- Parameters:
node
- The node (required).payload
- The item payload.id
- The item id (optional).publisher
- The publisher (optional).- Returns:
- The pub-sub event.
- See Also:
- Example 2
-
withItems
public static Event withItems(String node, List<Item> items)
Creates a pub-sub event with items.- Parameters:
node
- The node (required).items
- The items.- Returns:
- The pub-sub event.
- See Also:
- Example 2
-
withRetractedItems
public static Event withRetractedItems(String node, List<String> deletedItemIds)
Creates a pub-sub event with delete information.- Parameters:
node
- The node (required).deletedItemIds
- The deleted items' ids.- Returns:
- The pub-sub event.
- See Also:
PubSubFeature.DELETE_ITEMS
, 7.2.2.1 Delete And Notify
-
withPurge
public static Event withPurge(String node)
Creates a pub-sub event with purge information.- Parameters:
node
- The purged node (required).- Returns:
- The pub-sub event.
- See Also:
PubSubFeature.PURGE_NODES
,
-
withSubscription
public static Event withSubscription(String node, Jid jid, SubscriptionState subscription)
Creates a pub-sub event with subscription information.- Parameters:
node
- The node (required).jid
- The JID.subscription
- The subscription state.- Returns:
- The pub-sub event.
- See Also:
withSubscription(String, Jid, SubscriptionState, Instant, String)
, Example 172
-
withSubscription
public static Event withSubscription(String node, Jid jid, SubscriptionState subscription, Instant expiry, String subid)
Creates a pub-sub event with subscription information.- Parameters:
node
- The node (required).expiry
- The expiration date.jid
- The JID.subid
- The sub id.subscription
- The subscription state.- Returns:
- The pub-sub event.
- See Also:
withSubscription(String, Jid, SubscriptionState)
, Example 172
-
getNode
public final String getNode()
Gets the 'node' attribute of the child element.- Returns:
- The node.
-
isConfiguration
public final boolean isConfiguration()
Indicates, whether the event is a configuration change event.- Returns:
- True, if the configuration has changed.
- See Also:
getConfigurationForm()
-
isDelete
public final boolean isDelete()
Indicates, whether the event is a delete event, i.e. if a node has been deleted.- Returns:
- True, if a node has been deleted.
- See Also:
getRedirectUri()
-
isPurge
public final boolean isPurge()
Indicates, whether the event is purge event.- Returns:
- True, if a node has been purged.
-
hasItems
public final boolean hasItems()
Indicates, whether the has items.- Returns:
- True, if it has items.
- See Also:
getItems()
-
isRetract
public final boolean isRetract()
Indicates, whether the event is a retract event.- Returns:
- True, if items have been retracted.
- See Also:
getRetractedItems()
-
getSubscription
public final Subscription getSubscription()
Gets the subscription approval.- Returns:
- The subscription approval or null, if the event did not include a subscription.
-
getItems
public final List<Item> getItems()
Gets the items of the event.- Returns:
- The items of the event or an empty list, if the event did not include any items.
-
getRetractedItems
public final List<String> getRetractedItems()
Gets the retracted (deleted) items.- Returns:
- The retracted items.
-
getConfigurationForm
public final DataForm getConfigurationForm()
Gets the configuration form.- Returns:
- The configuration form or null, if the configuration form isn't included.
- See Also:
isConfiguration()
-
getRedirectUri
public final URI getRedirectUri()
Gets the redirect URI in case the event is a delete event.- Returns:
- The redirect URI or null, if a redirect URI isn't included.
- See Also:
isDelete()
-
-