Class FavoriteWorkspaceManager


  • public final class FavoriteWorkspaceManager
    extends java.lang.Object
    Manager to get/set Member's favorite workspaces.
    Since:
    jcms-10.0.0
    Version:
    $Revision: 107554 $
    Author:
    Sylvain Devaux
    • Field Detail

      • FAVORITE_WORKSPACES_MEMBERPREFS_KEY

        public static final java.lang.String FAVORITE_WORKSPACES_MEMBERPREFS_KEY
        See Also:
        Constant Field Values
    • Method Detail

      • getInstance

        public static FavoriteWorkspaceManager getInstance()
        Get the manager.
        Returns:
        FavoriteWorkspaceManager the singleton instance
      • add

        public void add​(Member member,
                        Workspace... workspaces)
        Adds given workspace(s) as favorite for given member.
        Parameters:
        member - the member
        workspaces - the favorite workspace(s) to add
      • set

        public void set​(Member member,
                        Workspace... workspaces)
        Sets given workspace(s) as favorite for given member, and replaces current ones if any.
        Parameters:
        member - the member
        workspaces - the favorite workspace(s) to add
      • get

        public java.util.List<Workspace> get​(Member member)
        Return ordered list of favorite Workspaces for given member.
        Parameters:
        member - the member
        Returns:
        a Workspace Collection, or an empty collection
      • remove

        public void remove​(Member member,
                           Workspace workspace)
        Removes given workspace from member's favorite workspaces.
        Parameters:
        member - the member
        workspace - the workspace to remove from the member's favorites
      • clear

        public void clear​(Member member)
        Clears all member's favorite workspaces.
        Parameters:
        member - the member
      • isFavorite

        public boolean isFavorite​(Member member,
                                  Workspace workspace)
        Parameters:
        member - the member
        workspace - the workspace to test if it is a favorite
        Returns:
        true if given workspace is a favorite workspace for given member
      • hasFavorites

        public boolean hasFavorites​(Member member)
        Returns true if member has at least one favorite workspace.
        Parameters:
        member - the member
        Returns:
        true if member has at least one favorite workspace.