Class PublishOptions
- java.lang.Object
-
- rocks.xmpp.extensions.pubsub.model.PublishOptions
-
- All Implemented Interfaces:
StandardizedDataForm
public final class PublishOptions extends Object implements StandardizedDataForm
Represents a standardizedDataForm
with form typehttp://jabber.org/protocol/pubsub#publish-options
, which can be used to retrieve node meta data.Usage
To wrap an existingDataForm
to retrieve standard data from it, use:
To build a form:PublishOptions publishOptions = new PublishOptions(dataForm);
PublishOptions publishOptions = PublishOptions.builder() .accessModel(AccessModel.AUTHORIZE) .persistItems(true) .rosterGroupsAllowed(Collections.singleton("Friends")) .sendLastPublishedItem(SendLastPublishedItem.ON_SUB) .build();
Persistent Storage of Public Data via PubSub
PublishOptions publishOptions = PublishOptions.forStorageOfPublicData();
Persistent Storage of Public Private via PubSub
PublishOptions publishOptions = PublishOptions.forStorageOfPrivateData();
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PublishOptions.Builder
A builder class to build the publish options form.
-
Constructor Summary
Constructors Constructor Description PublishOptions(DataForm dataForm)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PublishOptions.Builder
builder()
Creates the builder to build a meta data form.static PublishOptions
forStorageOfPrivateData()
Creates publish options for use of persistent storage of private data via pubsub.static PublishOptions
forStorageOfPublicData(AccessModel accessModel)
Creates publish options for use of persistent storage of public data via pubsub.AccessModel
getAccessModel()
Gets the access model.DataForm
getDataForm()
Gets the underlying data form.String
getFormType()
Gets the form type of the data form.List<String>
getRosterGroupsAllowed()
Gets the allowed roster groups.SendLastPublishedItem
getSendLastPublishedItem()
Gets the value which specifies when to send the last published item.Boolean
isPersistItems()
Whether items are persisted.PublishOptions.Builder
toBuilder()
Converts this (immutable) data form to a builder, so that a modified form can be created.
-
-
-
Constructor Detail
-
PublishOptions
public PublishOptions(DataForm dataForm)
-
-
Method Detail
-
builder
public static PublishOptions.Builder builder()
Creates the builder to build a meta data form.- Returns:
- The builder.
-
forStorageOfPublicData
public static PublishOptions forStorageOfPublicData(AccessModel accessModel)
Creates publish options for use of persistent storage of public data via pubsub.- Parameters:
accessModel
- The access model.- Returns:
- The publish options.
- See Also:
- XEP-0222: Persistent Storage of Public Data via PubSub
-
forStorageOfPrivateData
public static PublishOptions forStorageOfPrivateData()
Creates publish options for use of persistent storage of private data via pubsub.- Returns:
- The publish options.
- See Also:
- XEP-0223: Persistent Storage of Private Data via PubSub
-
getFormType
public final String getFormType()
Description copied from interface:StandardizedDataForm
Gets the form type of the data form.- Specified by:
getFormType
in interfaceStandardizedDataForm
- Returns:
- The form type.
-
getDataForm
public final DataForm getDataForm()
Gets the underlying data form.- Specified by:
getDataForm
in interfaceStandardizedDataForm
- Returns:
- The underlying data form.
-
getAccessModel
public final AccessModel getAccessModel()
Gets the access model.- Returns:
- The access model.
-
isPersistItems
public final Boolean isPersistItems()
Whether items are persisted.- Returns:
- Whether items are persisted.
-
getSendLastPublishedItem
public final SendLastPublishedItem getSendLastPublishedItem()
Gets the value which specifies when to send the last published item.- Returns:
- When to send the last published item.
-
getRosterGroupsAllowed
public final List<String> getRosterGroupsAllowed()
Gets the allowed roster groups.- Returns:
- The allowed roster groups.
-
toBuilder
public final PublishOptions.Builder toBuilder()
Converts this (immutable) data form to a builder, so that a modified form can be created.- Returns:
- The builder.
-
-