Package org.jivesoftware.openfire.pubsub
Class PublishedItem
- java.lang.Object
-
- org.jivesoftware.openfire.pubsub.PublishedItem
-
- All Implemented Interfaces:
Serializable
public class PublishedItem extends Object implements Serializable
A published item to a node. Once an item was published to a node, node subscribers will be notified of the new published item. The item publisher may be allowed to delete published items. After a published item was deleted node subscribers will get an event notification.Published items may be persisted to the database depending on the node configuration. Actually, even when the node is configured to not persist items the last published item is going to be persisted to the database. The reason for this is that the node may need to send the last published item to new subscribers.
- Author:
- Matt Tucker
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PublishedItem.UniqueIdentifier
A unique identifier for an item, in context of all nodes of all services in the system.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
canDelete(org.xmpp.packet.JID user)
Returns true if the user that is trying to delete an item is allowed to delete it.Date
getCreationDate()
Returns the datetime when the items was published.String
getID()
Returns the ID that uniquely identifies the published item in the node.String
getItemKey()
Deprecated.Replaced bygetUniqueIdentifier()
which generates more unique values.static String
getItemKey(String serviceId, String nodeId, String itemId)
Deprecated.Replaced bygetUniqueIdentifier(String, String, String)
which generates more unique values.static String
getItemKey(LeafNode node, String itemId)
Deprecated.Replaced bygetUniqueIdentifier(LeafNode, String)
which generates more unique values.LeafNode
getNode()
Returns theLeafNode
where this item was published.String
getNodeID()
Returns the id for theLeafNode
where this item was published.org.dom4j.Element
getPayload()
Returns the payload included when publishing the item.String
getPayloadXML()
Returns a textual representation of the payload ornull
if no payload was specified with the item.org.xmpp.packet.JID
getPublisher()
Returns the JID of the entity that published the item to the node.PublishedItem.UniqueIdentifier
getUniqueIdentifier()
Returns a value that uniquely identifies this published item in the XMPP domain.static PublishedItem.UniqueIdentifier
getUniqueIdentifier(String serviceId, String nodeId, String itemId)
Returns a value that uniquely identifies this published item in the XMPP domain.static PublishedItem.UniqueIdentifier
getUniqueIdentifier(LeafNode node, String itemId)
Returns a value that uniquely identifies this published item in the XMPP domain.
-
-
-
Method Detail
-
getNodeID
public String getNodeID()
Returns the id for theLeafNode
where this item was published.- Returns:
- the ID for the leaf node where this item was published.
-
getNode
public LeafNode getNode()
Returns theLeafNode
where this item was published.- Returns:
- the leaf node where this item was published.
-
getID
public String getID()
Returns the ID that uniquely identifies the published item in the node.- Returns:
- the ID that uniquely identifies the published item in the node.
-
getPublisher
public org.xmpp.packet.JID getPublisher()
Returns the JID of the entity that published the item to the node.- Returns:
- the JID of the entity that published the item to the node.
-
getCreationDate
public Date getCreationDate()
Returns the datetime when the items was published.- Returns:
- the datetime when the items was published.
-
getPayload
public org.dom4j.Element getPayload()
Returns the payload included when publishing the item. A published item may or may not have a payload. Transient nodes that are configured to not broadcast payloads may allow published items to have no payload.- Returns:
- the payload included when publishing the item or
null
if none was found.
-
getPayloadXML
public String getPayloadXML()
Returns a textual representation of the payload ornull
if no payload was specified with the item.- Returns:
- a textual representation of the payload or null if no payload was specified with the item.
-
canDelete
public boolean canDelete(org.xmpp.packet.JID user)
Returns true if the user that is trying to delete an item is allowed to delete it. Only the publisher or node admins (i.e. owners and sysadmins) are allowed to delete items.- Parameters:
user
- the full JID of the user trying to delete the item.- Returns:
- true if the user that is trying to delete an item is allowed to delete it.
-
getItemKey
@Deprecated public String getItemKey()
Deprecated.Replaced bygetUniqueIdentifier()
which generates more unique values.Returns a string that uniquely identifies this published item in the following format: nodeId:itemId Note that this method generates a value that's unique only in context of the node. This allows for different services to have items with identical keys. UsegetUniqueIdentifier()
to obtain an identifier that is unique for the entire XMPP domain.- Returns:
- Unique identifier for this item
-
getItemKey
@Deprecated public static String getItemKey(LeafNode node, String itemId)
Deprecated.Replaced bygetUniqueIdentifier(LeafNode, String)
which generates more unique values.Returns a string that uniquely identifies this published item in the following format: nodeId:itemId Note that this method generates a value that's unique only in context of the node. This allows for different services to have items with identical keys. UsegetUniqueIdentifier(LeafNode, String)
to obtain an identifier that is unique for the entire XMPP domain.- Parameters:
node
- Node for the published itemitemId
- Id for the published item (unique within the node)- Returns:
- Unique identifier for this item
-
getItemKey
@Deprecated public static String getItemKey(String serviceId, String nodeId, String itemId)
Deprecated.Replaced bygetUniqueIdentifier(String, String, String)
which generates more unique values.Returns a string that uniquely identifies this published item in the following format:serviceId:nodeId:itemId
. This matches the primary key of the ofPubSubItem table.- Parameters:
serviceId
- Service id for the published itemnodeId
- Node id for the published itemitemId
- Id for the published item (unique within the node)- Returns:
- Unique identifier for this item
-
getUniqueIdentifier
public PublishedItem.UniqueIdentifier getUniqueIdentifier()
Returns a value that uniquely identifies this published item in the XMPP domain.- Returns:
- Unique identifier for this item
-
getUniqueIdentifier
public static PublishedItem.UniqueIdentifier getUniqueIdentifier(LeafNode node, String itemId)
Returns a value that uniquely identifies this published item in the XMPP domain.- Parameters:
node
- Node for the published itemitemId
- Id for the published item (unique within the node)- Returns:
- Unique identifier for this item
-
getUniqueIdentifier
public static PublishedItem.UniqueIdentifier getUniqueIdentifier(String serviceId, String nodeId, String itemId)
Returns a value that uniquely identifies this published item in the XMPP domain.- Parameters:
serviceId
- Id of the service that contains the node.nodeId
- Node id for the published itemitemId
- Id for the published item (unique within the node)- Returns:
- Unique identifier for this item
-
-