com.jalios.jcms.caddy
Class Caddy

java.lang.Object
  extended by com.jalios.jcms.caddy.Caddy
All Implemented Interfaces:
Serializable

public class Caddy
extends Object
implements Serializable

Repository of Data which a JCMS member can act on. This include the following:

  • Publication
  • Category
  • Workspace
  • Group
  • Member and DBMember
  • One Caddy object is available per J2EE session. Use the following code to get access to the Caddy object of the current session.
      Caddy myCaddy = Caddy.getCaddy(request);
     

    Since:
    jcms-2.1
    Version:
    $Revision: 28658 $
    Author:
    Olivier Jaquemet
    See Also:
    Serialized Form

    Field Summary
    static String REVISION
               
     
    Method Summary
     boolean add(Data data)
              Add given data to this caddy.
     boolean addAll(Collection<? extends Data> coll)
              Add given Collection of data to this caddy.
     boolean addDBMemberId(String id)
              Add the specified DBMember's id to the caddy.
     boolean addDBMemberIds(Collection<? extends String> coll)
              Add the specified collection of DBMember's id to the Caddy.
     boolean canManage(Class<? extends Data> clazz, Member loggedMember)
              Checks if the specified member is allowed to manage at least one Data in the Caddy.
    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.
     void clear()
              Clear the caddy (from all Data, Publication, Categories, Workspaces, Groups and Members).
     void clearCategories()
              Clear all Category of the caddy.
     void clearDBMembers()
              Clear all DBMember of the caddy.
     void clearGroups()
              Clear all Group of the caddy.
     void clearMembers()
              Clear all Member of the caddy.
     void clearPublications()
              Clear all Publication of the caddy.
     void clearWorkspaces()
              Clear all Workspace of the caddy.
     boolean contains(Data data)
              Check if the given Data is in the caddy.
    static Caddy getCaddy(javax.servlet.http.HttpServletRequest request)
              Returns a Caddy of the member using the current Session of the request
     ArrayList<Category> getCategoryList()
              Create and returns a new list containing all Category contained in the caddy.
     int getCategoryListSize()
               
     ArrayList<String> getDBMemberList()
              Create and returns a new list containing all DBMember ids contained in the caddy.
     int getDBMemberListSize()
               
     ArrayList<Group> getGroupList()
              Create and returns a new list containing all Group contained in the caddy.
     int getGroupListSize()
               
     ArrayList<? extends Object> getList(Class<? extends Data> clazz)
               
     ArrayList<Member> getMemberList()
              Create and returns a new list containing all Member contained in the caddy.
     int getMemberListSize()
               
     ArrayList<Publication> getPublicationList()
              Create and returns a new list containing all Publication contained in the caddy.
     int getPublicationListSize()
               
     ArrayList<Workspace> getWorkspaceList()
              Create and returns a new list containing all Workspace contained in the caddy.
     int getWorkspaceListSize()
               
     boolean isEmpty()
              Returns true if this caddy contains no elements.
     boolean remove(Data data)
              Remove the given data from this caddy.
     boolean removeAll(Collection<? extends Data> coll)
              Remove given Collection of data from this caddy.
     boolean removeDBMemberIds(Collection<? extends String> coll)
              Remove the specified collection of DBMember's id to the Caddy.
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    REVISION

    public static final String REVISION
    See Also:
    Constant Field Values
    Method Detail

    getCaddy

    public static Caddy getCaddy(javax.servlet.http.HttpServletRequest request)
    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

    public boolean addAll(Collection<? extends Data> coll)
    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

    public boolean removeAll(Collection<? extends Data> coll)
    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

    public boolean add(Data data)
    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

    public boolean remove(Data data)
    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

    public boolean contains(Data data)
    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

    public ArrayList<? extends Object> getList(Class<? extends Data> clazz)
    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

    public void clear()
    Clear the caddy (from all Data, Publication, Categories, Workspaces, Groups and Members).


    isEmpty

    public boolean isEmpty()
    Returns true if this caddy contains no elements.

    Returns:
    true if this caddy contains no elements.

    canManage

    public boolean canManage(Class<? extends Data> clazz,
                             Member loggedMember)
    Checks if the specified member is allowed to manage at least one Data in the Caddy.

    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 all Publication of the caddy.


    getPublicationList

    public ArrayList<Publication> getPublicationList()
    Create and returns a new list containing all Publication contained in the caddy.

    Returns:
    an ArrayList of Publication.

    getPublicationListSize

    public int getPublicationListSize()
    Returns:
    the number of publication currently store in the caddy

    clearCategories

    public void clearCategories()
    Clear all Category of the caddy.


    getCategoryList

    public ArrayList<Category> getCategoryList()
    Create and returns a new list containing all Category contained in the caddy.

    Returns:
    an ArrayList of Category.

    getCategoryListSize

    public int getCategoryListSize()
    Returns:
    the number of Category currently store in the caddy

    clearWorkspaces

    public void clearWorkspaces()
    Clear all Workspace of the caddy.


    getWorkspaceList

    public ArrayList<Workspace> getWorkspaceList()
    Create and returns a new list containing all Workspace contained in the caddy.

    Returns:
    an ArrayList of Workspace.

    getWorkspaceListSize

    public int getWorkspaceListSize()
    Returns:
    the number of Workspace currently store in the caddy

    clearGroups

    public void clearGroups()
    Clear all Group of the caddy.


    getGroupList

    public ArrayList<Group> getGroupList()
    Create and returns a new list containing all Group contained in the caddy.

    Returns:
    an ArrayList of Group.

    getGroupListSize

    public int getGroupListSize()
    Returns:
    the number of Group currently store in the caddy

    clearMembers

    public void clearMembers()
    Clear all Member of the caddy.


    getMemberList

    public ArrayList<Member> getMemberList()
    Create and returns a new list containing all Member contained in the caddy.

    Returns:
    an ArrayList of Member.

    getMemberListSize

    public int getMemberListSize()
    Returns:
    the number of Member currently store in the caddy

    clearDBMembers

    public void clearDBMembers()
    Clear all DBMember of the caddy.


    getDBMemberList

    public ArrayList<String> getDBMemberList()
    Create and returns a new list containing all DBMember ids contained in the caddy.

    Returns:
    an ArrayList of String.

    getDBMemberListSize

    public int getDBMemberListSize()
    Returns:
    the number of DBMember currently store in the caddy

    addDBMemberIds

    public boolean addDBMemberIds(Collection<? extends String> coll)
    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

    public boolean removeDBMemberIds(Collection<? extends String> coll)
    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

    public boolean addDBMemberId(String id)
    Add the specified DBMember's id to the caddy.

    Parameters:
    id - a DBMember id
    Returns:
    true if the caddy did not contain the DBMember.


    Copyright © 2001-2010 Jalios SA. All Rights Reserved.