Class PreferencesMgr


  • public class PreferencesMgr
    extends java.lang.Object
    This is the entry point to the preferences functionality in the Web API. The PreferencesMgr is essentially a facade to the ApplicationPreferences subsystem. It hides from the application details of preferences management, such as the caching layer.
    Since:
    MicroStrategy Web 7.3.1 or earlier
    • Method Detail

      • getInstance

        public static PreferencesMgr getInstance()
        Obtain the PreferencesMgr singleton instance.
        Returns:
        The PreferenceMgr instance.
      • getSysDefaultPreferences

        public Preferences getSysDefaultPreferences​(java.lang.String serverName)
                                             throws PreferencesException

        Obtain the system preferences for a given server. Specifying "" as the server name returns the default preferences object for all servers.

        The SysDefaultPrefType object corresponding to the serverName is then used to define properties such as the file name. To change the file paths associated with the server, change the relevant SysDefaultPrefType instance before invoking this method. Caveat: changing the file name can confuse other processes concurrently accessing the same default preferences.

        Parameters:
        serverName - The name of the Intelligence Server.
        Returns:
        The system default preferences.
        Throws:
        PreferencesException
        See Also:
        SysDefaultPrefType
      • getIPASysDefaultPreferences

        public Preferences getIPASysDefaultPreferences​(java.lang.String serverName,
                                                       java.lang.String templateName)
                                                throws PreferencesException

        Obtain the system preferences for a given server name and template name . Specifying "" as the server name returns the preferences based on the template name

        Parameters:
        serverName - The name of the Intelligence Server.
        templateName - The name of the preferences template
        Returns:
        The system preferences.
        Throws:
        PreferencesException
        See Also:
        SysDefaultPrefType
      • getSysDefaultPreferences

        public Preferences getSysDefaultPreferences​(java.lang.String serverName,
                                                    java.lang.String projectName)
                                             throws PreferencesException

        Obtain the system preferences for a given server. Specifying "" as the server name returns the default preferences object for all servers.

        The SysDefaultPrefType object corresponding to the serverName is then used to define properties such as the file name. To change the file paths associated with the server, change the relevant SysDefaultPrefType instance before invoking this method.

        Parameters:
        serverName - name of the Intelligence Server
        projectName - name of project in server
        Returns:
        the system default preferences
        Throws:
        PreferencesException
        Since:
        MicroStrategy Web 7.5.3
        See Also:
        SysDefaultPrefType
      • getSysDefaultPreferences

        public Preferences getSysDefaultPreferences​(WebIServerSession session)
                                             throws PreferencesException

        Obtain the system preferences for a given server. Specifying "" as the server name returns the default preferences object for all servers.

        The SysDefaultPrefType object corresponding to the serverName is then used to define properties such as the file name. To change the file paths associated with the server, change the relevant SysDefaultPrefType instance before invoking this method.

        Parameters:
        session - a session containing the server name, server port, project name or project DSS ID.
        Returns:
        the system default preferences
        Throws:
        PreferencesException
        Since:
        MicroStrategy Web 9.0.0
        See Also:
        SysPrefType.getDefault(WebIServerSession)
      • getUserPreferences

        public Preferences getUserPreferences​(WebIServerSession session)
                                       throws PreferencesException

        Before this call is made, ensure the system definitions file has been specified: SysPrefType.getDefinition().setFilePath(String).

        Obtain a user's preferences. User level preferences are keyed of the user's session, hence it is necessary to login to an Intelligence Server before a user's preferences may be retrieved.

        Parameters:
        session - The user's web session.
        Returns:
        The preferences.
        Throws:
        PreferencesException
        See Also:
        WebIServerSession
      • getUserDefaultPreferences

        public Preferences getUserDefaultPreferences()
                                              throws PreferencesException
        Returns Preferences with only default level values populated. Useful for initialization.
        Returns:
        Preferences with only default level values.
        Throws:
        PreferencesException
        Since:
        MicroStrategy Web 9.0.1
      • isConfigured

        public boolean isConfigured()
        Returns:
        whether preferences is properly setup, ie. SysPrefType.getDefinition().setFilePath(String) has been configured.
        Since:
        MicroStrategy Web 8.0.0
      • getBooleanValue

        public static boolean getBooleanValue​(Preferences pref,
                                              java.lang.String name)
        Returns preference value as boolean. Returns false if pref object is null or preference doesn't exist within this preferences collection
        Parameters:
        pref - preferences object
        name - preference name
        Returns:
        preference value
      • getBooleanValue

        public static boolean getBooleanValue​(Preferences pref,
                                              java.lang.String name,
                                              boolean defaultValue)
        Returns preference value as boolean. Returns defaultValue if pref object is null or preference doesn't exist within this preferences collection
        Parameters:
        pref - preferences object
        name - preference name
        defaultValue - defaulr value
        Returns:
        preference value