Interface ProfilePreferencesLogic


  • public interface ProfilePreferencesLogic
    An interface for dealing with ProfilePreferences in Profile2
    Author:
    Steve Swinsburg (steve.swinsburg@gmail.com)
    • Method Detail

      • getPreferencesRecordForUser

        ProfilePreferences getPreferencesRecordForUser​(String userId)
        Retrieve the preferences record from the database for this user. If none exists, will attempt to create one for the user. If that also fails, will return null.

        Defaults to using the cached version where possible

        Parameters:
        userId - uuid of the user to retrieve the record for
        Returns:
        ProfilePreferences record or null
      • getPreferencesRecordForUser

        ProfilePreferences getPreferencesRecordForUser​(String userId,
                                                       boolean useCache)
        Retrieve the preferences record from the database for this user but the caller has the option on whether or not to use the cached version (PRFL-504)
        Parameters:
        userId - uuid of the user to retrieve the record for
        useCache - whether or not to use the cache
        Returns:
        ProfilePreferences record or null
      • savePreferencesRecord

        boolean savePreferencesRecord​(ProfilePreferences profilePreferences)
        Save the preferences record to the database
        Parameters:
        profilePreferences - the record for the user
      • isPreferenceEnabled

        boolean isPreferenceEnabled​(String userUuid,
                                    PreferenceType type)
        Does this user have the specific preference enabled? used for querying all of the preferences
        Parameters:
        userUuid - uuid of the user
        type - PreferenceType enum
        Returns:
        true if enabled, false if not
        Since:
        1.5