Smack

org.jivesoftware.smackx.pubsub
Class ConfigureForm

java.lang.Object
  extended by org.jivesoftware.smackx.Form
      extended by org.jivesoftware.smackx.pubsub.ConfigureForm

public class ConfigureForm
extends Form

A decorator for a Form to easily enable reading and updating of node configuration. All operations read or update the underlying DataForm.

Unlike the Form.setAnswer(XXX)} methods, which throw an exception if the field does not exist, all ConfigureForm.setXXX methods will create the field in the wrapped form if it does not already exist.

Author:
Robin Collier

Field Summary
 
Fields inherited from class org.jivesoftware.smackx.Form
ELEMENT, NAMESPACE, TYPE_CANCEL, TYPE_FORM, TYPE_RESULT, TYPE_SUBMIT
 
Constructor Summary
ConfigureForm(DataForm configDataForm)
          Create a decorator from an existing DataForm that has been retrieved from parsing a node configuration request.
ConfigureForm(Form nodeConfigForm)
          Create a decorator from an existing Form for node configuration.
ConfigureForm(FormType formType)
          Create a new form for configuring a node.
 
Method Summary
 AccessModel getAccessModel()
          Get the currently configured AccessModel, null if it is not set.
 java.lang.String getBodyXSLT()
          Returns the URL of an XSL transformation which can be applied to payloads in order to generate an appropriate message body element.
 java.util.Iterator<java.lang.String> getChildren()
          The id's of the child nodes associated with a collection node (both leaf and collection).
 ChildrenAssociationPolicy getChildrenAssociationPolicy()
          Returns the policy that determines who may associate children with the node.
 java.util.Iterator<java.lang.String> getChildrenAssociationWhitelist()
          Iterator of JID's that are on the whitelist that determines who can associate child nodes with the collection node.
 int getChildrenMax()
          Gets the maximum number of child nodes that can be associated with the collection node.
 java.lang.String getCollection()
          Gets the collection node which the node is affiliated with.
 java.lang.String getDataformXSLT()
          Gets the URL of an XSL transformation which can be applied to the payload format in order to generate a valid Data Forms result that the client could display using a generic Data Forms rendering engine.
 java.lang.String getDataType()
          The type of node data, usually specified by the namespace of the payload (if any).
 ItemReply getItemReply()
          Determines who should get replies to items
 int getMaxItems()
          Gets the maximum number of items to persisted to this node if isPersistItems() is true.
 int getMaxPayloadSize()
          Gets the maximum payload size in bytes.
 NodeType getNodeType()
          Gets the node type
 PublishModel getPublishModel()
          Gets the publishing model for the node, which determines who may publish to it.
 java.util.Iterator<java.lang.String> getReplyRoom()
          Iterator over the multi user chat rooms that are specified as reply rooms.
 java.util.Iterator<java.lang.String> getReplyTo()
          Gets the specific JID's for reply to.
 java.util.Iterator<java.lang.String> getRosterGroupsAllowed()
          Gets the roster groups that are allowed to subscribe and retrieve items.
 java.lang.String getTitle()
          Gets the human readable node title.
 boolean isDeliverPayloads()
          Does the node deliver payloads with event notifications.
 boolean isNotifyConfig()
          Determines if subscribers should be notified when the configuration changes.
 boolean isNotifyDelete()
          Determines whether subscribers should be notified when the node is deleted.
 boolean isNotifyRetract()
          Determines whether subscribers should be notified when items are deleted from the node.
 boolean isPersistItems()
          Determines whether items should be persisted in the node.
 boolean isPresenceBasedDelivery()
          Determines whether to deliver notifications to available users only.
 boolean isSubscibe()
          Determines if subscriptions are allowed.
 void setAccessModel(AccessModel accessModel)
          Sets the value of access model.
 void setBodyXSLT(java.lang.String bodyXslt)
          Set the URL of an XSL transformation which can be applied to payloads in order to generate an appropriate message body element.
 void setChildren(java.util.List<java.lang.String> children)
          Set the list of child node ids that are associated with a collection node.
 void setChildrenAssociationPolicy(ChildrenAssociationPolicy policy)
          Sets the policy that determines who may associate children with the node.
 void setChildrenAssociationWhitelist(java.util.List<java.lang.String> whitelist)
          Set the JID's in the whitelist of users that can associate child nodes with the collection node.
 void setChildrenMax(int max)
          Set the maximum number of child nodes that can be associated with a collection node.
 void setCollection(java.lang.String collection)
          Sets the collection node which the node is affiliated with.
 void setDataformXSLT(java.lang.String url)
          Sets the URL of an XSL transformation which can be applied to the payload format in order to generate a valid Data Forms result that the client could display using a generic Data Forms rendering engine.
 void setDataType(java.lang.String type)
          Sets the type of node data, usually specified by the namespace of the payload (if any).
 void setDeliverPayloads(boolean deliver)
          Sets whether the node will deliver payloads with event notifications.
 void setItemReply(ItemReply reply)
          Sets who should get the replies to items
 void setMaxItems(int max)
          Set the maximum number of items to persisted to this node if isPersistItems() is true.
 void setMaxPayloadSize(int max)
          Sets the maximum payload size in bytes
 void setNodeType(NodeType type)
          Sets the node type
 void setNotifyConfig(boolean notify)
          Sets whether subscribers should be notified when the configuration changes.
 void setNotifyDelete(boolean notify)
          Sets whether subscribers should be notified when the node is deleted.
 void setNotifyRetract(boolean notify)
          Sets whether subscribers should be notified when items are deleted from the node.
 void setPersistentItems(boolean persist)
          Sets whether items should be persisted in the node.
 void setPresenceBasedDelivery(boolean presenceBased)
          Sets whether to deliver notifications to available users only.
 void setPublishModel(PublishModel publish)
          Sets the publishing model for the node, which determines who may publish to it.
 void setReplyRoom(java.util.List<java.lang.String> replyRooms)
          Sets the multi user chat rooms that are specified as reply rooms.
 void setReplyTo(java.util.List<java.lang.String> replyTos)
          Sets the specific JID's for reply to.
 void setRosterGroupsAllowed(java.util.List<java.lang.String> groups)
          Sets the roster groups that are allowed to subscribe and retrieve items.
 void setSubscribe(boolean subscribe)
          Sets whether subscriptions are allowed.
 void setTitle(java.lang.String title)
          Sets a human readable title for the node.
 java.lang.String toString()
           
 
Methods inherited from class org.jivesoftware.smackx.Form
addField, createAnswerForm, getDataFormToSend, getField, getFields, getFormFrom, getInstructions, getType, setAnswer, setAnswer, setAnswer, setAnswer, setAnswer, setAnswer, setAnswer, setDefaultAnswer, setInstructions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConfigureForm

public ConfigureForm(DataForm configDataForm)
Create a decorator from an existing DataForm that has been retrieved from parsing a node configuration request.

Parameters:
configDataForm -

ConfigureForm

public ConfigureForm(Form nodeConfigForm)
Create a decorator from an existing Form for node configuration. Typically, this can be used to create a decorator for an answer form by using the result of Form.createAnswerForm() as the input parameter.

Parameters:
nodeConfigForm -

ConfigureForm

public ConfigureForm(FormType formType)
Create a new form for configuring a node. This would typically only be used when creating and configuring a node at the same time via PubSubManager.createNode(String, Form), since configuration of an existing node is typically accomplished by calling Node.getNodeConfiguration() and using the resulting form to create a answer form. See ConfigureForm(Form).

Parameters:
formType -
Method Detail

getAccessModel

public AccessModel getAccessModel()
Get the currently configured AccessModel, null if it is not set.

Returns:
The current AccessModel

setAccessModel

public void setAccessModel(AccessModel accessModel)
Sets the value of access model.

Parameters:
accessModel -

getBodyXSLT

public java.lang.String getBodyXSLT()
Returns the URL of an XSL transformation which can be applied to payloads in order to generate an appropriate message body element.

Returns:
URL to an XSL

setBodyXSLT

public void setBodyXSLT(java.lang.String bodyXslt)
Set the URL of an XSL transformation which can be applied to payloads in order to generate an appropriate message body element.

Parameters:
bodyXslt - The URL of an XSL

getChildren

public java.util.Iterator<java.lang.String> getChildren()
The id's of the child nodes associated with a collection node (both leaf and collection).

Returns:
Iterator over the list of child nodes.

setChildren

public void setChildren(java.util.List<java.lang.String> children)
Set the list of child node ids that are associated with a collection node.

Parameters:
children -

getChildrenAssociationPolicy

public ChildrenAssociationPolicy getChildrenAssociationPolicy()
Returns the policy that determines who may associate children with the node.

Returns:
The current policy

setChildrenAssociationPolicy

public void setChildrenAssociationPolicy(ChildrenAssociationPolicy policy)
Sets the policy that determines who may associate children with the node.

Parameters:
policy - The policy being set

getChildrenAssociationWhitelist

public java.util.Iterator<java.lang.String> getChildrenAssociationWhitelist()
Iterator of JID's that are on the whitelist that determines who can associate child nodes with the collection node. This is only relevant if getChildrenAssociationPolicy() is set to ChildrenAssociationPolicy.whitelist.

Returns:
Iterator over whitelist

setChildrenAssociationWhitelist

public void setChildrenAssociationWhitelist(java.util.List<java.lang.String> whitelist)
Set the JID's in the whitelist of users that can associate child nodes with the collection node. This is only relevant if getChildrenAssociationPolicy() is set to ChildrenAssociationPolicy.whitelist.

Parameters:
whitelist - The list of JID's

getChildrenMax

public int getChildrenMax()
Gets the maximum number of child nodes that can be associated with the collection node.

Returns:
The maximum number of child nodes

setChildrenMax

public void setChildrenMax(int max)
Set the maximum number of child nodes that can be associated with a collection node.

Parameters:
max - The maximum number of child nodes.

getCollection

public java.lang.String getCollection()
Gets the collection node which the node is affiliated with.

Returns:
The collection node id

setCollection

public void setCollection(java.lang.String collection)
Sets the collection node which the node is affiliated with.

Parameters:
collection - The node id of the collection node

getDataformXSLT

public java.lang.String getDataformXSLT()
Gets the URL of an XSL transformation which can be applied to the payload format in order to generate a valid Data Forms result that the client could display using a generic Data Forms rendering engine.

Returns:
The URL of an XSL transformation

setDataformXSLT

public void setDataformXSLT(java.lang.String url)
Sets the URL of an XSL transformation which can be applied to the payload format in order to generate a valid Data Forms result that the client could display using a generic Data Forms rendering engine.

Parameters:
url - The URL of an XSL transformation

isDeliverPayloads

public boolean isDeliverPayloads()
Does the node deliver payloads with event notifications.

Returns:
true if it does, false otherwise

setDeliverPayloads

public void setDeliverPayloads(boolean deliver)
Sets whether the node will deliver payloads with event notifications.

Parameters:
deliver - true if the payload will be delivered, false otherwise

getItemReply

public ItemReply getItemReply()
Determines who should get replies to items

Returns:
Who should get the reply

setItemReply

public void setItemReply(ItemReply reply)
Sets who should get the replies to items

Parameters:
reply - Defines who should get the reply

getMaxItems

public int getMaxItems()
Gets the maximum number of items to persisted to this node if isPersistItems() is true.

Returns:
The maximum number of items to persist

setMaxItems

public void setMaxItems(int max)
Set the maximum number of items to persisted to this node if isPersistItems() is true.

Parameters:
max - The maximum number of items to persist

getMaxPayloadSize

public int getMaxPayloadSize()
Gets the maximum payload size in bytes.

Returns:
The maximum payload size

setMaxPayloadSize

public void setMaxPayloadSize(int max)
Sets the maximum payload size in bytes

Parameters:
max - The maximum payload size

getNodeType

public NodeType getNodeType()
Gets the node type

Returns:
The node type

setNodeType

public void setNodeType(NodeType type)
Sets the node type

Parameters:
type - The node type

isNotifyConfig

public boolean isNotifyConfig()
Determines if subscribers should be notified when the configuration changes.

Returns:
true if they should be notified, false otherwise

setNotifyConfig

public void setNotifyConfig(boolean notify)
Sets whether subscribers should be notified when the configuration changes.

Parameters:
notify - true if subscribers should be notified, false otherwise

isNotifyDelete

public boolean isNotifyDelete()
Determines whether subscribers should be notified when the node is deleted.

Returns:
true if subscribers should be notified, false otherwise

setNotifyDelete

public void setNotifyDelete(boolean notify)
Sets whether subscribers should be notified when the node is deleted.

Parameters:
notify - true if subscribers should be notified, false otherwise

isNotifyRetract

public boolean isNotifyRetract()
Determines whether subscribers should be notified when items are deleted from the node.

Returns:
true if subscribers should be notified, false otherwise

setNotifyRetract

public void setNotifyRetract(boolean notify)
Sets whether subscribers should be notified when items are deleted from the node.

Parameters:
notify - true if subscribers should be notified, false otherwise

isPersistItems

public boolean isPersistItems()
Determines whether items should be persisted in the node.

Returns:
true if items are persisted

setPersistentItems

public void setPersistentItems(boolean persist)
Sets whether items should be persisted in the node.

Parameters:
persist - true if items should be persisted, false otherwise

isPresenceBasedDelivery

public boolean isPresenceBasedDelivery()
Determines whether to deliver notifications to available users only.

Returns:
true if users must be available

setPresenceBasedDelivery

public void setPresenceBasedDelivery(boolean presenceBased)
Sets whether to deliver notifications to available users only.

Parameters:
presenceBased - true if user must be available, false otherwise

getPublishModel

public PublishModel getPublishModel()
Gets the publishing model for the node, which determines who may publish to it.

Returns:
The publishing model

setPublishModel

public void setPublishModel(PublishModel publish)
Sets the publishing model for the node, which determines who may publish to it.

Parameters:
publish - The enum representing the possible options for the publishing model

getReplyRoom

public java.util.Iterator<java.lang.String> getReplyRoom()
Iterator over the multi user chat rooms that are specified as reply rooms.

Returns:
The reply room JID's

setReplyRoom

public void setReplyRoom(java.util.List<java.lang.String> replyRooms)
Sets the multi user chat rooms that are specified as reply rooms.

Parameters:
replyRooms - The multi user chat room to use as reply rooms

getReplyTo

public java.util.Iterator<java.lang.String> getReplyTo()
Gets the specific JID's for reply to.

Returns:
The JID's

setReplyTo

public void setReplyTo(java.util.List<java.lang.String> replyTos)
Sets the specific JID's for reply to.

Parameters:
replyTos - The JID's to reply to

getRosterGroupsAllowed

public java.util.Iterator<java.lang.String> getRosterGroupsAllowed()
Gets the roster groups that are allowed to subscribe and retrieve items.

Returns:
The roster groups

setRosterGroupsAllowed

public void setRosterGroupsAllowed(java.util.List<java.lang.String> groups)
Sets the roster groups that are allowed to subscribe and retrieve items.

Parameters:
groups - The roster groups

isSubscibe

public boolean isSubscibe()
Determines if subscriptions are allowed.

Returns:
true if subscriptions are allowed, false otherwise

setSubscribe

public void setSubscribe(boolean subscribe)
Sets whether subscriptions are allowed.

Parameters:
subscribe - true if they are, false otherwise

getTitle

public java.lang.String getTitle()
Gets the human readable node title.

Overrides:
getTitle in class Form
Returns:
The node title

setTitle

public void setTitle(java.lang.String title)
Sets a human readable title for the node.

Overrides:
setTitle in class Form
Parameters:
title - The node title

getDataType

public java.lang.String getDataType()
The type of node data, usually specified by the namespace of the payload (if any).

Returns:
The type of node data

setDataType

public void setDataType(java.lang.String type)
Sets the type of node data, usually specified by the namespace of the payload (if any).

Parameters:
type - The type of node data

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Smack

Copyright © 2003-2007 Jive Software.