Package com.jalios.jcms.workspace
Class FavoriteWorkspaceManager
- java.lang.Object
-
- com.jalios.jcms.workspace.FavoriteWorkspaceManager
-
public final class FavoriteWorkspaceManager extends java.lang.Object
Manager to get/set Member's favorite workspaces.- Since:
- jcms-10.0.0
- Author:
- Sylvain Devaux
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
FAVORITE_WORKSPACES_MEMBERPREFS_KEY
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Member member, Workspace... workspaces)
Adds given workspace(s) as favorite for given member.void
clear(Member member)
Clears all member's favorite workspaces.java.util.List<Workspace>
get(Member member)
Return ordered list of favorite Workspaces for given member.static FavoriteWorkspaceManager
getInstance()
Get the manager.boolean
hasFavorites(Member member)
Returns true if member has at least one favorite workspace.boolean
isFavorite(Member member, Workspace workspace)
void
remove(Member member, Workspace workspace)
Removes given workspace from member's favorite workspaces.void
set(Member member, Workspace... workspaces)
Sets given workspace(s) as favorite for given member, and replaces current ones if any.
-
-
-
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 memberworkspaces
- 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 memberworkspaces
- 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 memberworkspace
- 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 memberworkspace
- 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.
-
-