Class PrivacyListManager

java.lang.Object
org.jivesoftware.openfire.privacy.PrivacyListManager

public class PrivacyListManager extends Object
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 Details

    • getInstance

      public static PrivacyListManager 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

      public void deletePrivacyList(String username, String listName)
      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

      public void deletePrivacyLists(String username)
      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

      public PrivacyList getDefaultPrivacyList(String username)
      Returns the default privacy list of the specified user or null 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

      public PrivacyList getPrivacyList(String username, String listName)
      Returns a specific privacy list of the specified user or null 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

      public void changeDefaultList(String username, PrivacyList newDefault, PrivacyList oldDefault)
      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 or null if no default list existed.
    • addListener

      public void addListener(PrivacyListEventListener listener)
      Registers a listener to receive events when a privacy list is created, updated or deleted.
      Parameters:
      listener - the listener.
    • removeListener

      public void removeListener(PrivacyListEventListener listener)
      Unregisters a listener to receive events.
      Parameters:
      listener - the listener.