Package com.jalios.jcms.caddy
Class Caddy
java.lang.Object
com.jalios.jcms.caddy.Caddy
- All Implemented Interfaces:
Serializable
Repository of
Data which a JCMS member can act on.
This include the following:
PublicationCategoryWorkspaceGroupMemberandDBMember
Caddy myCaddy = Caddy.getCaddy(request);
- Since:
- jcms-2.1
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanAdd given data to this caddy.booleanaddAll(Collection<? extends Data> coll) Add given Collection of data to this caddy.booleanaddDBMemberId(String id) Add the specified DBMember's id to the caddy.booleanaddDBMemberIds(Collection<? extends String> coll) Add the specified collection of DBMember's id to the Caddy.booleanChecks if the specified member is allowed to manage the specified class of Data.static booleancheckCaddyAccess(Class<? extends Data> clazz, Member loggedMember, Workspace workspace) Check if a member is authorized to display the caddy corresponding to the specified clazz.voidclear()Clear the caddy (from all Data, Publication, Categories, Workspaces, Groups and Members).voidClear the caddy (from all the specified Data).voidClear allCategoryof the caddy.voidClear allDBMemberof the caddy.voidClear allGroupof the caddy.voidClear allMemberof the caddy.voidClear allPublicationof the caddy.voidClear allWorkspaceof the caddy.booleanCheck if the given Data is in the caddy.static CaddygetCaddy(javax.servlet.http.HttpServletRequest request) Returns a Caddy of the member using the current Session of the requestCreate and returns a new list containing allCategorycontained in the caddy.intCreate and returns a new list containing allDBMemberids contained in the caddy.intCreate and returns a new list containing allGroupcontained in the caddy.intCreate and returns a new list containing allDataof the specified class contained in the caddy.intgetListSize(Class<? extends Data> clazz) Retrieve the number ofDataof the specified class contained in the caddy.Create and returns a new list containing allMembercontained in the caddy.intCreate and returns a new list containing allPublicationcontained in the caddy (JStore and DBData).intCreate and returns a new list containing allWorkspacecontained in the caddy.intbooleanisEmpty()Returnstrueif this caddy contains no elements.booleanRemove the given data from this caddy.booleanremoveAll(Collection<? extends Data> coll) Remove given Collection of data from this caddy.booleanremoveDBMemberIds(Collection<? extends String> coll) Remove the specified collection of DBMember's id to the Caddy.
-
Method Details
-
getCaddy
Returns a Caddy of the member using the current Session of the request- Parameters:
request- current HttpServletRequest- Returns:
- the Caddy already in the session or create it if none.
-
addAll
Add given Collection of data to this caddy.- Parameters:
coll- the Collection of Data to add (can contain Publication, Category, Workspace, Group and/or Member)- Returns:
- true if the caddy was modified following this operation.
-
removeAll
Remove given Collection of data from this caddy.- Parameters:
coll- the Collection of Data to remove (can contain Publication, Category, Workspace, Group and/or Member)- Returns:
- true if the caddy was modified following this operation.
-
add
Add given data to this caddy.- Parameters:
data- the Data to add (either a Publication, a Category, a Workspace, a Group or a Member)- Returns:
- true if the caddy did not contain the data.
-
remove
Remove the given data from this caddy.- Parameters:
data- the Data to add to the caddy- Returns:
- true if the data was in the caddy
-
contains
Check if the given Data is in the caddy.- Parameters:
data- the Data to check for- Returns:
- true if the caddy contains the Data, false otherwise
-
getList
Create and returns a new list containing allDataof the specified class contained in the caddy.- Parameters:
clazz- the type of Data being worked on (Publication, Category, Workspace, Group or Member)- Returns:
- the list of Data for the specified class (from Publication, Categories, Workspaces, Groups and Members).
-
getListSize
Retrieve the number ofDataof the specified class contained in the caddy.- Parameters:
clazz- the type of Data being worked on (Publication, Category, Workspace, Group or Member)- Returns:
- the list of Data for the specified class (from Publication, Categories, Workspaces, Groups and Members).
-
clear
Clear the caddy (from all the specified Data). Retrieve the number ofDataof the specified class contained in the caddy.- Parameters:
clazz- the type of Data being worked on (Publication, Category, Workspace, Group or Member)
-
clear
public void clear()Clear the caddy (from all Data, Publication, Categories, Workspaces, Groups and Members). -
isEmpty
public boolean isEmpty()Returnstrueif this caddy contains no elements.- Returns:
trueif this caddy contains no elements.
-
canManage
Checks if the specified member is allowed to manage the specified class of Data.Implementation detail : since JCMS-5762, this method simply delegates to
checkCaddyAccess(Class, Member, Workspace).- Parameters:
clazz- the type of Data being worked on (Publication, Category, Workspace, Group or Member)loggedMember-- Returns:
- true if the member can manage the caddy, false otherwise.
-
checkCaddyAccess
public static boolean checkCaddyAccess(Class<? extends Data> clazz, Member loggedMember, Workspace workspace) Check if a member is authorized to display the caddy corresponding to the specified clazz.This method does not verify operation are authorized on Data, it only check that the user could work with some data of the specified class. CRUD right are performed later by each CaddyHandler
- Parameters:
clazz- the type of Data being worked on (Publication, Category, Workspace, Group or Member)loggedMember-workspace- the current Workspace- Returns:
- true if the member can manage the caddy, false otherwise.
- Since:
- jcms-7.0.0
-
clearPublications
public void clearPublications()Clear allPublicationof the caddy. -
getPublicationList
Create and returns a new list containing allPublicationcontained in the caddy (JStore and DBData).- Returns:
- an
ArrayListofPublication.
-
getPublicationListSize
public int getPublicationListSize()- Returns:
- the number of publication currently store in the caddy
-
clearCategories
public void clearCategories()Clear allCategoryof the caddy. -
getCategoryList
Create and returns a new list containing allCategorycontained in the caddy.- Returns:
- an
ArrayListofCategory.
-
getCategoryListSize
public int getCategoryListSize()- Returns:
- the number of Category currently store in the caddy
-
clearWorkspaces
public void clearWorkspaces()Clear allWorkspaceof the caddy. -
getWorkspaceList
Create and returns a new list containing allWorkspacecontained in the caddy.- Returns:
- an
ArrayListofWorkspace.
-
getWorkspaceListSize
public int getWorkspaceListSize()- Returns:
- the number of Workspace currently store in the caddy
-
clearGroups
public void clearGroups()Clear allGroupof the caddy. -
getGroupList
Create and returns a new list containing allGroupcontained in the caddy.- Returns:
- an
ArrayListofGroup.
-
getGroupListSize
public int getGroupListSize()- Returns:
- the number of
Groupcurrently store in the caddy
-
clearMembers
public void clearMembers()Clear allMemberof the caddy. -
getMemberList
Create and returns a new list containing allMembercontained in the caddy.- Returns:
- an
ArrayListofMember.
-
getMemberListSize
public int getMemberListSize()- Returns:
- the number of
Membercurrently store in the caddy
-
clearDBMembers
public void clearDBMembers()Clear allDBMemberof the caddy. -
getDBMemberList
Create and returns a new list containing allDBMemberids contained in the caddy.- Returns:
- an
ArrayListofString.
-
getDBMemberListSize
public int getDBMemberListSize()- Returns:
- the number of
DBMembercurrently store in the caddy
-
addDBMemberIds
Add the specified collection of DBMember's id to the Caddy.- Parameters:
coll- a Collection of String (DBMember's id), must not be null.- Returns:
- true if the caddy was modified following this operation.
-
removeDBMemberIds
Remove the specified collection of DBMember's id to the Caddy.- Parameters:
coll- a Collection of String (DBMember's id), must not be null.- Returns:
- true if the caddy was modified following this operation.
-
addDBMemberId
Add the specified DBMember's id to the caddy.- Parameters:
id- a DBMember id- Returns:
- true if the caddy did not contain the DBMember.
-