Package org.jivesoftware.smackx.pubsub
Class ItemsExtension
- java.lang.Object
-
- org.jivesoftware.smackx.pubsub.NodeExtension
-
- org.jivesoftware.smackx.pubsub.ItemsExtension
-
- All Implemented Interfaces:
Element
,ExtensionElement
,FullyQualifiedElement
,NamedElement
,XmlLangElement
,EmbeddedPacketExtension
public class ItemsExtension extends NodeExtension implements EmbeddedPacketExtension
This class is used 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ItemsExtension.ItemsElementType
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<? extends NamedElement>
items
protected java.lang.Boolean
notify
protected ItemsExtension.ItemsElementType
type
-
Constructor Summary
Constructors Constructor Description ItemsExtension(java.lang.String nodeId, java.util.List<? extends ExtensionElement> items, boolean notify)
Construct an instance with a list representing items that have been published or deleted.ItemsExtension(ItemsExtension.ItemsElementType itemsType, java.lang.String nodeId, java.util.List<? extends NamedElement> items)
Construct an instance with a list representing items that have been published or deleted.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addXml(XmlStringBuilder xml)
java.util.List<ExtensionElement>
getExtensions()
Get the list of embeddedExtensionElement
objects.java.util.List<? extends NamedElement>
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 theItemsExtension.ItemsElementType
.java.lang.String
toString()
-
Methods inherited from class org.jivesoftware.smackx.pubsub.NodeExtension
getElementName, getNamespace, getNode, getPubSubNamespace, toXML
-
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.FullyQualifiedElement
getLanguage, getNamespace, getQName
-
Methods inherited from interface org.jivesoftware.smack.packet.NamedElement
getElementName
-
-
-
-
Field Detail
-
type
protected ItemsExtension.ItemsElementType type
-
notify
protected java.lang.Boolean notify
-
items
protected java.util.List<? extends NamedElement> items
-
-
Constructor Detail
-
ItemsExtension
public ItemsExtension(ItemsExtension.ItemsElementType itemsType, java.lang.String nodeId, java.util.List<? extends NamedElement> 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 ofItem
and an optional value for the max_items attribute. - Request to delete items - itemsType =
ItemsExtension.ItemsElementType.retract
, items = list ofItem
containing only id's and an optional value for the notify attribute. - Items published event - itemsType =
ItemsExtension.ItemsElementType.items
, items = list ofItem
and attributeValue =null
- Items deleted event - itemsType =
ItemsExtension.ItemsElementType.items
, items = list ofRetractItem
and attributeValue =null
- Parameters:
itemsType
- Type of representationnodeId
- The node to which the items are being sent or deleteditems
- The list ofItem
orRetractItem
- Request items from node - itemsType =
-
ItemsExtension
public ItemsExtension(java.lang.String nodeId, java.util.List<? extends ExtensionElement> 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 ofItem
and an optional value for the max_items attribute. - Request to delete items - itemsType =
ItemsExtension.ItemsElementType.retract
, items = list ofItem
containing only id's and an optional value for the notify attribute. - Items published event - itemsType =
ItemsExtension.ItemsElementType.items
, items = list ofItem
and attributeValue =null
- Items deleted event - itemsType =
ItemsExtension.ItemsElementType.items
, items = list ofRetractItem
and attributeValue =null
- Parameters:
nodeId
- The node to which the items are being sent or deleteditems
- The list ofItem
orRetractItem
notify
- TODO javadoc me please
- Request items from node - itemsType =
-
-
Method Detail
-
getItemsElementType
public ItemsExtension.ItemsElementType getItemsElementType()
Get the type of element.- Returns:
- The element type
-
getExtensions
public java.util.List<ExtensionElement> getExtensions()
Description copied from interface:EmbeddedPacketExtension
Get the list of embeddedExtensionElement
objects.- Specified by:
getExtensions
in interfaceEmbeddedPacketExtension
- Returns:
- List of embedded
ExtensionElement
-
getItems
public java.util.List<? extends NamedElement> getItems()
Gets the items related to the type of request or event.- Returns:
- List of
Item
,RetractItem
, or null
-
getNotify
public boolean getNotify()
Gets the value of the optional attribute related to theItemsExtension.ItemsElementType
.- Returns:
- The attribute value
-
addXml
protected void addXml(XmlStringBuilder xml)
- Overrides:
addXml
in classNodeExtension
-
toString
public java.lang.String toString()
- Overrides:
toString
in classNodeExtension
-
-