Overview | Package | Class | Tree | Deprecated | Index | Help
| Openfire 3.4.3 Javadoc
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jivesoftware.openfire.pubsub
Class LeafNode

    java.lang.Object
      org.jivesoftware.openfire.pubsub.Node
          org.jivesoftware.openfire.pubsub.LeafNode

    public class LeafNode

extends Node

A type of node that contains published items only. It is NOT a container for other nodes.

Author:
  Matt Tucker

Nested Class Summary

Nested classes/interfaces inherited from class org.jivesoftware.openfire.pubsub.Node
`Node.ItemReplyPolicy`

Field Summary
`protected Map<String,PublishedItem>` | `itemsByID`
`protected List<PublishedItem>` | `publishedItems` List of items that were published to the node and that are still active.

Fields inherited from class org.jivesoftware.openfire.pubsub.Node
`accessModel, affiliates, bodyXSLT, contacts, creationDate, creator, dataformXSLT, deliverPayloads, description, language, name, nodeID, notifyConfigChanges, notifyDelete, notifyRetract, parent, payloadType, presenceBasedDelivery, publisherModel, replyPolicy, replyRooms, replyTo, rosterGroupsAllowed, service, subscriptionConfigurationRequired, subscriptionEnabled, subscriptionsByID, subscriptionsByJID`

Constructor Summary
`LeafNode(PubSubService service, CollectionNode parentNode, String nodeID, JID creator)`

Method Summary
`protected void` | `addFormFields(DataForm form, boolean isEditing)` Adds the required form fields to the specified form.
`void` | `deleteItems(List<PublishedItem> toDelete)` Deletes the list of published items from the node.
`protected void` | `deletingNode()` Notification message indicating that the node is being deleted.
`PublishedItem` | `getLastPublishedItem()` Returns the last `PublishedItem` that was published to the node or `null` if the node does not have published items.
`int` | `getMaxPayloadSize()`
`int` | `getMaxPublishedItems()`
`PublishedItem` | `getPublishedItem(String itemID)` Returns the `PublishedItem` whose ID matches the specified item ID or `null` if none was found.
`List<PublishedItem>` | `getPublishedItems()` Returns the list of `PublishedItem` that were published to the node.
`List<PublishedItem>` | `getPublishedItems(int recentItems)` Returns a list of `PublishedItem` with the most recent N items published to the node.
`boolean` | `isItemRequired()` Returns true if an item element is required to be included when publishing an item to this node.
`boolean` | `isPersistPublishedItems()`
`boolean` | `isSendItemSubscribe()` Returns true if the last published item is going to be sent to new subscribers.
`void` | `publishItems(JID publisher, List<org.dom4j.Element> itemElements)` Publishes the list of items to the node.
`void` | `purge()` Purges items that were published to the node.

Methods inherited from class org.jivesoftware.openfire.pubsub.Node
`addNoneAffiliation, addOutcast, addOwner, addPublisher, approveSubscription, broadcastNodeEvent, cancelSubscription, changeParent, configure, createSubscription, delete, getAccessModel, getAffiliate, getBodyXSLT, getConfigurationForm, getContacts, getCreationDate, getCreator, getDataformXSLT, getDescription, getLanguage, getMetadataForm, getModificationDate, getName, getNodeID, getNodes, getOwners, getParent, getParents, getPayloadType, getPendingSubscriptions, getPublisherModel, getPublishers, getReplyPolicy, getReplyRooms, getReplyTo, getRosterGroupsAllowed, getSubscription, getSubscriptions, isAdmin, isChildNode, isCollectionNode, isDescendantNode, isMultipleSubscriptionsEnabled, isNotifiedOfConfigChanges, isNotifiedOfDelete, isNotifiedOfRetract, isPayloadDelivered, isPresenceBasedDelivery, isPresenceBasedDelivery, isRootCollectionNode, isSubscriptionConfigurationRequired, isSubscriptionEnabled, removeOutcast, removeOwner, removePublisher, saveToDB, sendEventNotification, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### publishedItems

    protected final List<PublishedItem> publishedItems

  List of items that were published to the node and that are still active. If the node is not configured to persist items then the last published item will be kept. The list is sorted cronologically.

### itemsByID

    protected Map<String,PublishedItem> itemsByID

Constructor Detail

### LeafNode

    public LeafNode(PubSubService service,
                    CollectionNode parentNode,
                    String nodeID,
                    JID creator)

Method Detail

### addFormFields

    protected void addFormFields(DataForm form,
                                 boolean isEditing)

  Description copied from class: `Node`
  Adds the required form fields to the specified form. When editing is true the field type and a label is included in each fields. The form being completed will contain the current node configuration. This information can be used for editing the node or for notifing that the node configuration has changed.

  Overrides:
    `addFormFields` in class `Node`
  Parameters:
    `form` - the form containing the node configuration.
    `isEditing` - true when the form will be used to edit the node configuration.

### deletingNode

    protected void deletingNode()

  Description copied from class: `Node`
  Notification message indicating that the node is being deleted. Subclasses should implement this method to delete any subclass specific information.

  Specified by:
    `deletingNode` in class `Node`

### getMaxPayloadSize

    public int getMaxPayloadSize()

### isPersistPublishedItems

    public boolean isPersistPublishedItems()

### getMaxPublishedItems

    public int getMaxPublishedItems()

### isItemRequired

    public boolean isItemRequired()

  Returns true if an item element is required to be included when publishing an item to this node. When an item is included then the item will have an item ID that will be included when sending items to node subscribers.

  Leaf nodes that are transient and do not deliver payloads with event notifications do not require an item element. If a user tries to publish an item to a node that does not require items then an error will be returned.

  Returns:
    true if an item element is required to be included when publishing an item to this node.

### publishItems

    public void publishItems(JID publisher,
                             List<org.dom4j.Element> itemElements)

  Publishes the list of items to the node. Event notifications will be sent to subscribers for the new published event. The published event may or may not include an item. When the node is not persistent and does not require payloads then an item is not going to be created nore included in the event notification.

  When an affiliate has many subscriptions to the node, the affiliate will get a notification for each set of items that affected the same list of subscriptions.

  When an item is included in the published event then a new `PublishedItem` is going to be created and added to the list of published item. Each published item will have a unique ID in the node scope. The new published item will be added to the end of the published list to keep the cronological order. When the max number of published items is exceeded then the oldest published items will be removed.

  For performance reasons the newly added published items and the deleted items (if any) are saved to the database using a background thread. Sending event notifications to node subscribers may also use another thread to ensure good performance.

  Parameters:
    `publisher` - the full JID of the user that sent the new published event.
    `itemElements` - list of dom4j elements that contain info about the published items.

### deleteItems

    public void deleteItems(List<PublishedItem> toDelete)

  Deletes the list of published items from the node. Event notifications may be sent to subscribers for the deleted items. When an affiliate has many subscriptions to the node, the affiliate will get a notification for each set of items that affected the same list of subscriptions.

  For performance reasons the deleted published items are saved to the database using a background thread. Sending event notifications to node subscribers may also use another thread to ensure good performance.

  Parameters:
    `toDelete` - list of items that were deleted from the node.

### getPublishedItem

    public PublishedItem getPublishedItem(String itemID)

  Description copied from class: `Node`
  Returns the `PublishedItem` whose ID matches the specified item ID or `null` if none was found. Item ID may or may not exist and it depends on the node's configuration. When the node is configured to not include payloads in event notifications and published items are not persistent then item ID is not used. In this case a `null` value will always be returned.

  Overrides:
    `getPublishedItem` in class `Node`
  Parameters:
    `itemID` - the ID of the item to retrieve.
  Returns:
    the PublishedItem whose ID matches the specified item ID or null if none was found.

### getPublishedItems

    public List<PublishedItem> getPublishedItems()

  Description copied from class: `Node`
  Returns the list of `PublishedItem` that were published to the node. The returned collection cannot be modified. Collection nodes does not support publishing of items so an empty list will be returned in that case.

  Overrides:
    `getPublishedItems` in class `Node`
  Returns:
    the list of PublishedItem that were published to the node.

### getPublishedItems

    public List<PublishedItem> getPublishedItems(int recentItems)

  Description copied from class: `Node`
  Returns a list of `PublishedItem` with the most recent N items published to the node. The returned collection cannot be modified. Collection nodes does not support publishing of items so an empty list will be returned in that case.

  Overrides:
    `getPublishedItems` in class `Node`
  Parameters:
    `recentItems` - number of recent items to retrieve.
  Returns:
    a list of PublishedItem with the most recent N items published to the node.

### getLastPublishedItem

    public PublishedItem getLastPublishedItem()

  Description copied from class: `Node`
  Returns the last `PublishedItem` that was published to the node or `null` if the node does not have published items. Collection nodes does not support publishing of items so a `null` will be returned in that case.

  Overrides:
    `getLastPublishedItem` in class `Node`
  Returns:
    the PublishedItem that was published to the node or `null` if the node does not have published items.

### isSendItemSubscribe

    public boolean isSendItemSubscribe()

  Returns true if the last published item is going to be sent to new subscribers.

  Overrides:
    `isSendItemSubscribe` in class `Node`
  Returns:
    true if the last published item is going to be sent to new subscribers.

### purge

    public void purge()

  Purges items that were published to the node. Only owners can request this operation. This operation is only available for nodes configured to store items in the database. All published items will be deleted with the exception of the last published item.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Openfire 3.4.3 Javadoc
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2007 Jive Software.