Class PrivacyListManager
java.lang.Object
org.jivesoftware.openfire.privacy.PrivacyListManager
A Privacy list manager creates, gets, updates and removes privacy lists. Loaded lists
are kept in memory using a cache that will keep them at most for 6 hours.
- Author:
- Gaston Dombiak
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(PrivacyListEventListener listener) Registers a listener to receive events when a privacy list is created, updated or deleted.void
changeDefaultList
(String username, PrivacyList newDefault, PrivacyList oldDefault) Sets a given privacy list as the new default list of the user.createPrivacyList
(String username, String listName, org.dom4j.Element listElement) Creates a new privacy list for the specified user.void
deletePrivacyList
(String username, String listName) Deletes an existing privacy list of a user.void
deletePrivacyLists
(String username) Deletes all privacy lists of a user.getDefaultPrivacyList
(String username) Returns the default privacy list of the specified user ornull
if none was found.static PrivacyListManager
Returns the unique instance of this class.getPrivacyList
(String username, String listName) Returns a specific privacy list of the specified user ornull
if none was found.void
removeListener
(PrivacyListEventListener listener) Unregisters a listener to receive events.
-
Method Details
-
getInstance
Returns the unique instance of this class.- Returns:
- the unique instance of this class.
-
createPrivacyList
public PrivacyList createPrivacyList(String username, String listName, org.dom4j.Element listElement) Creates a new privacy list for the specified user.- Parameters:
username
- the username of the list owner.listName
- the name of the new privacy list.listElement
- the XML that specifies the list and its items.- Returns:
- the newly created PrivacyList.
-
deletePrivacyList
Deletes an existing privacy list of a user. If the privacy list being deleted was the default list then the user will end up with no default list. Therefore, the user will have to set a new default list.- Parameters:
username
- the username of the list owner.listName
- the name of the list being deleted.
-
deletePrivacyLists
Deletes all privacy lists of a user. This may be necessary when a user is being deleted from the system.- Parameters:
username
- the username of the list owner.
-
getDefaultPrivacyList
Returns the default privacy list of the specified user ornull
if none was found.- Parameters:
username
- the name of the user to get his default list.- Returns:
- the default privacy list of the specified user or
null
if none was found.
-
getPrivacyList
Returns a specific privacy list of the specified user ornull
if none was found.- Parameters:
username
- the name of the user to get his privacy list.listName
- the name of the list to get.- Returns:
- a privacy list of the specified user or
null
if none was found.
-
changeDefaultList
Sets a given privacy list as the new default list of the user.- Parameters:
username
- the name of the user that is setting a new default list.newDefault
- the new default privacy list.oldDefault
- the previous privacy list ornull
if no default list existed.
-
addListener
Registers a listener to receive events when a privacy list is created, updated or deleted.- Parameters:
listener
- the listener.
-
removeListener
Unregisters a listener to receive events.- Parameters:
listener
- the listener.
-