Class PreferencesManager


  • public class PreferencesManager
    extends java.lang.Object
    Class encapsulating the logic for reading user preferences in and out of the DB.
    Author:
    Alex Kalderimis
    • Constructor Detail

      • PreferencesManager

        protected PreferencesManager​(ObjectStoreWriter osw)
        Constructor
        Parameters:
        osw - objectstore writer
    • Method Detail

      • getPreferences

        protected java.util.Map<java.lang.String,​java.lang.String> getPreferences​(Profile profile)
                                                                                 throws java.sql.SQLException
        Parameters:
        profile - userprofile
        Returns:
        user preferences
        Throws:
        java.sql.SQLException - if userprofile is unavailable
      • setPreference

        protected void setPreference​(Profile profile,
                                     java.lang.String key,
                                     java.lang.String value)
                              throws java.sql.SQLException
        Parameters:
        profile - userprofile
        key - key
        value - value
        Throws:
        java.sql.SQLException - if something goes wrong
      • deletePreference

        protected void deletePreference​(Profile profile,
                                        java.lang.String key)
                                 throws java.sql.SQLException
        Parameters:
        profile - userprofile
        key - key
        Throws:
        java.sql.SQLException - if something goes wrong
      • deleteAllPreferences

        public void deleteAllPreferences​(Profile profile)
                                  throws java.sql.SQLException
        Parameters:
        profile - userprofile
        Throws:
        java.sql.SQLException - if something goes wrong
      • mappingExists

        public boolean mappingExists​(java.lang.String key,
                                     java.lang.String value)
                              throws java.sql.SQLException
        Parameters:
        key - key
        value - value
        Returns:
        true if mapping exists
        Throws:
        java.sql.SQLException - if something goes wrong
      • getUserWithUniqueMapping

        public java.lang.Integer getUserWithUniqueMapping​(java.lang.String key,
                                                          java.lang.String value)
                                                   throws java.sql.SQLException
        Parameters:
        key - key
        value - value
        Returns:
        user id
        Throws:
        java.sql.SQLException - something goes wrong