Smack

org.jivesoftware.smackx.pubsub
Class ItemsExtension

java.lang.Object
  extended by org.jivesoftware.smackx.pubsub.NodeExtension
      extended by org.jivesoftware.smackx.pubsub.ItemsExtension
All Implemented Interfaces:
PacketExtension, EmbeddedPacketExtension

public class ItemsExtension
extends NodeExtension
implements EmbeddedPacketExtension

This class is used to for multiple purposes.

  • It can represent an event containing a list of items that have been published
  • It can represent an event containing a list of retracted (deleted) items.
  • It can represent a request to delete a list of items.
  • It can represent a request to get existing items.

    Please note, this class is used for internal purposes, and is not required for usage of pubsub functionality.

    Author:
    Robin Collier

    Nested Class Summary
    static class ItemsExtension.ItemsElementType
               
     
    Field Summary
    protected  List<? extends PacketExtension> items
               
    protected  Boolean notify
               
    protected  ItemsExtension.ItemsElementType type
               
     
    Constructor Summary
    ItemsExtension(ItemsExtension.ItemsElementType itemsType, String nodeId, List<? extends PacketExtension> items)
              Construct an instance with a list representing items that have been published or deleted.
    ItemsExtension(String nodeId, List<? extends PacketExtension> items, boolean notify)
              Construct an instance with a list representing items that have been published or deleted.
     
    Method Summary
     List<PacketExtension> getExtensions()
              Get the list of embedded PacketExtension objects.
     List<? extends PacketExtension> getItems()
              Gets the items related to the type of request or event.
     ItemsExtension.ItemsElementType getItemsElementType()
              Get the type of element
     boolean getNotify()
              Gets the value of the optional attribute related to the ItemsExtension.ItemsElementType.
     String toString()
               
     String toXML()
              Returns the XML representation of the PacketExtension.
     
    Methods inherited from class org.jivesoftware.smackx.pubsub.NodeExtension
    getElementName, getNamespace, getNode
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
     
    Methods inherited from interface org.jivesoftware.smack.packet.PacketExtension
    getElementName, getNamespace
     

    Field Detail

    type

    protected ItemsExtension.ItemsElementType type

    notify

    protected Boolean notify

    items

    protected List<? extends PacketExtension> items
    Constructor Detail

    ItemsExtension

    public ItemsExtension(ItemsExtension.ItemsElementType itemsType,
                          String nodeId,
                          List<? extends PacketExtension> items)
    Construct an instance with a list representing items that have been published or deleted.

    Valid scenarios are:

  • Request items from node - itemsType = ItemsExtension.ItemsElementType.items, items = list of Item and an optional value for the max_items attribute.
  • Request to delete items - itemsType = ItemsExtension.ItemsElementType.retract, items = list of Item containing only id's and an optional value for the notify attribute.
  • Items published event - itemsType = ItemsExtension.ItemsElementType.items, items = list of Item and attributeValue = null
  • Items deleted event - itemsType = ItemsExtension.ItemsElementType.items, items = list of RetractItem and attributeValue = null

    Parameters:
    itemsType - Type of representation
    nodeId - The node to which the items are being sent or deleted
    items - The list of Item or RetractItem
    attributeValue - The value of the max_items

  • ItemsExtension

    public ItemsExtension(String nodeId,
                          List<? extends PacketExtension> items,
                          boolean notify)
    Construct an instance with a list representing items that have been published or deleted.

    Valid scenarios are:

  • Request items from node - itemsType = ItemsExtension.ItemsElementType.items, items = list of Item and an optional value for the max_items attribute.
  • Request to delete items - itemsType = ItemsExtension.ItemsElementType.retract, items = list of Item containing only id's and an optional value for the notify attribute.
  • Items published event - itemsType = ItemsExtension.ItemsElementType.items, items = list of Item and attributeValue = null
  • Items deleted event - itemsType = ItemsExtension.ItemsElementType.items, items = list of RetractItem and attributeValue = null

    Parameters:
    itemsType - Type of representation
    nodeId - The node to which the items are being sent or deleted
    items - The list of Item or RetractItem
    attributeValue - The value of the max_items
  • Method Detail

    getItemsElementType

    public ItemsExtension.ItemsElementType getItemsElementType()
    Get the type of element

    Returns:
    The element type

    getExtensions

    public List<PacketExtension> getExtensions()
    Description copied from interface: EmbeddedPacketExtension
    Get the list of embedded PacketExtension objects.

    Specified by:
    getExtensions in interface EmbeddedPacketExtension
    Returns:
    List of embedded PacketExtension

    getItems

    public List<? extends PacketExtension> getItems()
    Gets the items related to the type of request or event. return List of Item, RetractItem, or null


    getNotify

    public boolean getNotify()
    Gets the value of the optional attribute related to the ItemsExtension.ItemsElementType.

    Returns:
    The attribute value

    toXML

    public String toXML()
    Description copied from interface: PacketExtension
    Returns the XML representation of the PacketExtension.

    Specified by:
    toXML in interface PacketExtension
    Overrides:
    toXML in class NodeExtension
    Returns:
    the packet extension as XML.

    toString

    public String toString()
    Overrides:
    toString in class NodeExtension

    Smack

    Copyright © 2003-2007 Jive Software.