Class Bookmarks
- java.lang.Object
-
- org.jivesoftware.smackx.bookmarks.Bookmarks
-
- All Implemented Interfaces:
PrivateData
public class Bookmarks extends Object implements PrivateData
Bookmarks is used for storing and retrieving URLS and Conference rooms. Bookmark Storage (XEP-0048) defined a protocol for the storage of bookmarks to conference rooms and other entities in a Jabber user's account. See the following code sample for saving Bookmarks:XMPPConnection con = new XMPPTCPConnection("jabber.org"); con.login("john", "doe"); Bookmarks bookmarks = new Bookmarks(); // Bookmark a URL BookmarkedURL url = new BookmarkedURL(); url.setName("Google"); url.setURL("http://www.jivesoftware.com"); bookmarks.addURL(url); // Bookmark a Conference room. BookmarkedConference conference = new BookmarkedConference(); conference.setName("My Favorite Room"); conference.setAutoJoin("true"); conference.setJID("dev@conference.jivesoftware.com"); bookmarks.addConference(conference); // Save Bookmarks using PrivateDataManager. PrivateDataManager manager = new PrivateDataManager(con); manager.setPrivateData(bookmarks); LastActivity activity = LastActivity.getLastActivity(con, "xray@jabber.org");
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Bookmarks.Provider
The IQ Provider for BookmarkStorage.
-
Constructor Summary
Constructors Constructor Description Bookmarks()
Required Empty Constructor to use Bookmarks.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBookmarkedConference(BookmarkedConference bookmarkedConference)
Add a BookmarkedConference to bookmarks.void
addBookmarkedURL(BookmarkedURL bookmarkedURL)
Adds a BookmarkedURL.void
clearBookmarkedConferences()
Removes all BookmarkedConferences from Bookmarks.void
clearBookmarkedURLS()
Removes all BookmarkedURLs from user's bookmarks.List<BookmarkedConference>
getBookmarkedConferences()
Returns a Collection of all Bookmarked Conference for this user.List<BookmarkedURL>
getBookmarkedURLS()
Returns a Collection of all Bookmarked URLs for this user.String
getElementName()
Returns the root element name.String
getNamespace()
Returns the root element XML namespace.void
removeBookmarkedConference(BookmarkedConference bookmarkedConference)
Removes a BookmarkedConference.void
removeBookmarkedURL(BookmarkedURL bookmarkedURL)
Removes a bookmarked bookmarkedURL.XmlStringBuilder
toXML()
Returns the XML representation of the PrivateData.
-
-
-
Field Detail
-
NAMESPACE
public static final String NAMESPACE
- See Also:
- Constant Field Values
-
ELEMENT
public static final String ELEMENT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Bookmarks
public Bookmarks()
Required Empty Constructor to use Bookmarks.
-
-
Method Detail
-
addBookmarkedURL
public void addBookmarkedURL(BookmarkedURL bookmarkedURL)
Adds a BookmarkedURL.- Parameters:
bookmarkedURL
- the bookmarked bookmarkedURL.
-
removeBookmarkedURL
public void removeBookmarkedURL(BookmarkedURL bookmarkedURL)
Removes a bookmarked bookmarkedURL.- Parameters:
bookmarkedURL
- the bookmarked bookmarkedURL to remove.
-
clearBookmarkedURLS
public void clearBookmarkedURLS()
Removes all BookmarkedURLs from user's bookmarks.
-
addBookmarkedConference
public void addBookmarkedConference(BookmarkedConference bookmarkedConference)
Add a BookmarkedConference to bookmarks.- Parameters:
bookmarkedConference
- the conference to remove.
-
removeBookmarkedConference
public void removeBookmarkedConference(BookmarkedConference bookmarkedConference)
Removes a BookmarkedConference.- Parameters:
bookmarkedConference
- the BookmarkedConference to remove.
-
clearBookmarkedConferences
public void clearBookmarkedConferences()
Removes all BookmarkedConferences from Bookmarks.
-
getBookmarkedURLS
public List<BookmarkedURL> getBookmarkedURLS()
Returns a Collection of all Bookmarked URLs for this user.- Returns:
- a collection of all Bookmarked URLs.
-
getBookmarkedConferences
public List<BookmarkedConference> getBookmarkedConferences()
Returns a Collection of all Bookmarked Conference for this user.- Returns:
- a collection of all Bookmarked Conferences.
-
getElementName
public String getElementName()
Returns the root element name.- Specified by:
getElementName
in interfacePrivateData
- Returns:
- the element name.
-
getNamespace
public String getNamespace()
Returns the root element XML namespace.- Specified by:
getNamespace
in interfacePrivateData
- Returns:
- the namespace.
-
toXML
public XmlStringBuilder toXML()
Returns the XML representation of the PrivateData.- Specified by:
toXML
in interfacePrivateData
- Returns:
- the private data as XML.
-
-