User Preference Service

From AlfrescoWiki

Jump to: navigation, search


[edit] Preference Service

/**
 * Get all preferences for a particular user
 * 
 * @param  userName                     the user name
 * @return Map<String, Serializable>    a map containing the preference values, empty if none
 */
 Map<String, Serializable> getPreferences(String userName);
/**
 * Get the preferences for a particular user.
 * <p>
 * If no filter if provided all preferences are returned.
 * <p>
 * If a filter is provided it's used to filter the results.  For example the filter
 * "alfresco.myComp" will only return filters that are in the "namespace" alfresco.myComp.
 * 
 * @param userName                      the user name
 * @param preferenceFilter              the preference filter
 * @return Map<String, Serializable>    a map containing the preference values, empty if none
 */
Map<String, Serializable> getPreferences(String userName, String preferenceFilter);
    
/**
 * Sets the preference values for a user.
 * 
 * Values provided overlay those already present.
 * 
 * Preference value names can be "namespaced" by using package notation.  For example 
 * "alfresc.myComp.myValue".
 *
 * @param userName      the user name
 * @param preferences   the preference values
 */
void setPreferences(String userName, Map<String, Serializable> preferences);
/**
 * Clears all the preferences for a particular user.
 * 
 * @param userName      the user name
 */
void clearPreferences(String userName);
/**
 * Clears the preferences for a particular user that match the filter optionally provided.
 *  
 * If no filter if present then all preferences are cleared.
 * 
 * @param userName          the user name
 * @param preferenceFilter  the preference filter
*/
void clearPreferences(String userName, String preferenceFilter);

[edit] Preferences Aspect

<aspect name="cm:preferences">
    <title>Preferences</title>
    <properties>
       <property name="cm:preferenceValues">
          <type>d:content</type>
       </property>
    <properties>
</aspect>