Class 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
    • Method Detail

      • getNodeID

        public String getNodeID()
        Returns the id for the LeafNode where this item was published.
        Returns:
        the ID for the leaf node where this item was published.
      • getNode

        public LeafNode getNode()
        Returns the LeafNode 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 or null 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.
      • 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 item
        itemId - 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 item
        itemId - Id for the published item (unique within the node)
        Returns:
        Unique identifier for this item