Class PrivacyListProvider


  • public class PrivacyListProvider
    extends Object
    Provider for the privacy lists system. Privacy lists are read and written from the ofPrivacyList database table.
    Author:
    Gaston Dombiak
    • Method Detail

      • getInstance

        public static PrivacyListProvider getInstance()
        Returns the unique instance of this class.
        Returns:
        the unique instance of this class.
      • getPrivacyLists

        public Map<String,​Boolean> getPrivacyLists​(String username)
        Returns the names of the existing privacy lists indicating which one is the default privacy list associated to a user.
        Parameters:
        username - the username of the user to get his privacy lists names.
        Returns:
        the names of the existing privacy lists with a default flag.
      • loadPrivacyList

        public PrivacyList loadPrivacyList​(String username,
                                           String listName)
        Loads the requested privacy list from the database. Returns null if a list with the specified name does not exist.
        Parameters:
        username - the username of the user to get his privacy list.
        listName - name of the list to load.
        Returns:
        the privacy list with the specified name or null if a list with the specified name does not exist.
      • loadDefaultPrivacyList

        public PrivacyList loadDefaultPrivacyList​(String username)
        Loads the default privacy list of a given user from the database. Returns null if no list was found.
        Parameters:
        username - the username of the user to get his default privacy list.
        Returns:
        the default privacy list or null if no list was found.
      • createPrivacyList

        public void createPrivacyList​(String username,
                                      PrivacyList list)
        Creates and saves the new privacy list to the database.
        Parameters:
        username - the username of the user that created a new privacy list.
        list - the PrivacyList to save.
      • updatePrivacyList

        public void updatePrivacyList​(String username,
                                      PrivacyList list)
        Updated the existing privacy list in the database.
        Parameters:
        username - the username of the user that updated a privacy list.
        list - the PrivacyList to update in the database.
      • deletePrivacyList

        public void deletePrivacyList​(String username,
                                      String listName)
        Deletes an existing privacy list from the database.
        Parameters:
        username - the username of the user that deleted a privacy list.
        listName - the name of the PrivacyList to delete.
      • deletePrivacyLists

        public void deletePrivacyLists​(String username)
        Deletes all existing privacy list from the database for the given user.
        Parameters:
        username - the username of the user whose privacy lists are going to be deleted.