Class Workspace

All Implemented Interfaces:
EditableData, JcmsConstants, ImportConstants, MashupConstants, Storable, JaliosConstants, LangPropertyArgument, TreeNode, Cloneable, Comparable<BasicStorable>

public class Workspace extends Data implements EditableData, TreeNode
This class represents a Workspace
Since:
jcms-4.1
Author:
Jean-Philippe Encausse
  • Field Details

  • Constructor Details

    • Workspace

      public Workspace()
    • Workspace

      public Workspace(Workspace other)
  • Method Details

    • checkWrite

      public ControllerStatus checkWrite(int op, Member mbr, boolean checkIntegrity, Map context)
      Description copied from class: Data
      Checks if the given write operation can be performed
      Overrides:
      checkWrite in class Data
      Parameters:
      op - the operation (OP_CREATE, OP_UPDATE, ...)
      mbr - the member which requests the write operation
      checkIntegrity - if true, requires the constraints integrity to be checked
      context - a map which contains context parameters (may be null)
      Returns:
      a ControllerStatus
    • performAfterWrite

      protected void performAfterWrite(int op, Member mbr, Map context)
      Description copied from class: Data
      Called to perform some action after the write.
      Overrides:
      performAfterWrite in class Data
      Parameters:
      op - the operation (OP_CREATE, OP_UPDATE, ...)
      mbr - the member which requests the write operation
      context - a map which contains context parameters (may be null)
    • getRootWorkspaces

      public static Set<Workspace> getRootWorkspaces(Comparator<Workspace> comparator)
      All Workspaces with no parent, sorted with comparator if not null.
      Parameters:
      comparator - the comparator
      Returns:
      All orphean WS
      Since:
      jcms-7.0.0
    • getRootWorkspaces

      public static Set<Workspace> getRootWorkspaces(Comparator<Workspace> comparator, Member loggedMember)
      All Workspaces with no parent the loggedMember in parameter belongs to, sorted with comparator if not null.
      Parameters:
      comparator - the comparator
      loggedMember - the loggedMember
      Returns:
      All orphean WS, as seen for loggedMember
      Since:
      jcms-7.0.0
    • getParent

      public Workspace getParent(Member loggedMember)
      Get the Parent workspace from the one in parameter, if loggedMember is not null, the WS is return only if he is worker of it.
      Parameters:
      loggedMember - the logged member
      Returns:
      The Parent WS if loggedMember is worker of it
    • setDefaultGroup

      public void setDefaultGroup(Group defaultGroup)
      Set the default group for this workspace.
      Parameters:
      defaultGroup - the default group.
      Since:
      jcms-7.0.0
    • getDefaultGroup

      public Group getDefaultGroup()
      Returns the default group for this workspace. If there is no default group, returns the group with lesser DataRight.
      Returns:
      the default group for this workspace.
      Since:
      jcms-7.0.0
    • getDefaultGroup

      public Group getDefaultGroup(boolean search)
      Returns the default group for this workspace.
      Parameters:
      search - if true and if there is no default group, returns the group with lesser DataRight.
      Returns:
      the default group for this workspace.
      Since:
      jcms-7.0.0
    • getSubWorkspaces

      public Set<Workspace> getSubWorkspaces()
      Gives the set of all WS just under the ws in parameter.
      Returns:
      All children ws in a Set.
    • getSubWorkspaces

      public Set<Workspace> getSubWorkspaces(Member loggedMember)
      Return the workspaces just under the workspace in parameter. If the loggedMember parameter is not null, only workspaces for which the loggedMember is worker are returned.
      Parameters:
      loggedMember - Only Workspaces for which the loggedMember is Worker are returned
      Returns:
      All the ws sons of the workspace in parameter for which the loggedMember is worker.
    • getAllSubWorkspaces

      public Set<Workspace> getAllSubWorkspaces()
      Return all the descendant Workspaces of the current Workspace.
      Returns:
      All descendant Workspaces in a Set.
    • getAllSubWorkspaces

      public Set<Workspace> getAllSubWorkspaces(Member loggedMember)
      Return all the descendant Workspaces of the current Workspace.
      If the loggedMember parameter is not null, only Workspaces for which the Member is Worker are returned.
      Parameters:
      loggedMember - Only Workspaces for which this Member is Worker are returned
      Returns:
      All the descendant Workspaces of the current Workspace for which the loggedMember is Worker.
    • getTreeParent

      public Workspace getTreeParent()
      Description copied from interface: TreeNode
      Returns parent of the current node
      Specified by:
      getTreeParent in interface TreeNode
      Returns:
      TreeNode parent Node
    • isTreeLeaf

      public boolean isTreeLeaf()
      Description copied from interface: TreeNode
      Returns boolean true if the TreeNode is a leaf
      Specified by:
      isTreeLeaf in interface TreeNode
      Returns:
      boolean indicating if node is leaf or node
    • isTreeNode

      public boolean isTreeNode()
      Description copied from interface: TreeNode
      Returns boolean true if the TreeNode is a node
      Specified by:
      isTreeNode in interface TreeNode
      Returns:
      boolean indicating if node is leaf or node
    • getTreeRoot

      public TreeNode getTreeRoot()
      Description copied from interface: TreeNode
      Returns the root of the current node
      Specified by:
      getTreeRoot in interface TreeNode
      Returns:
      TreeNode root Node
    • getTreeChildren

      public Collection<? extends TreeNode> getTreeChildren()
      Description copied from interface: TreeNode
      Returns a Collection of TreeNode children of the current node
      Specified by:
      getTreeChildren in interface TreeNode
      Returns:
      Collection of TreeNode
    • toString

      public String toString()
      Overrides:
      toString in class Data
    • exportXmlField

      public void exportXmlField(StringBuffer sb, int indentLevel)
      Description copied from class: Data
      Fills the given StringBuffer with Xml export of fields of this data.
      Overrides:
      exportXmlField in class Data
      Parameters:
      sb - the StringBuffer
      indentLevel - the indent level
    • toCSV

      public String toCSV(String lang)
      Returns a CSV view of this object
      Overrides:
      toCSV in class Data
      Parameters:
      lang - the output language
      Returns:
      a CSV view of this object
      Since:
      jcms-5.0.0
    • getCSVHeader

      public static String getCSVHeader(String lang)
      Returns the CSV header of this object
      Parameters:
      lang - the output language
      Returns:
      the CSV header of this object
      Since:
      jcms-5.0.0
    • getIcon

      public String getIcon()
      Returns the image path icon for the given workspace
      Returns:
      String image relative path
      Since:
      jcms-5.5.0
    • getDataIcon

      public String getDataIcon()
      Description copied from class: Data
      Returns source information for the icon associated to this Data, either a relative path or sprite classes name.

      If this method behavior has not been overriden by subclass, the default icon can be declared using property types.{Type}.icon, where {Type} is the short class name of the type concerned.

      • Either by specifying a relative image path :
        types.Article.icon: images/jalios/icon/abstract.gif 
      • or else by using a sprite icon :
        types.Article.icon: ss_sprite ss_date
      Overrides:
      getDataIcon in class Data
      Returns:
      a relative path (eg images/jalios/icon/abstract.gif) or sprite classes name (eg ss_sprite ss_date).
      See Also:
    • getDataIconAlt

      public String getDataIconAlt(String lang)
      Description copied from class: Data
      Returns the alternative text (alt attribute) to use in the HTML IMG tag of this Data's icon.

      If this method behavior has not been overriden by subclass, the default alternative text can be declared using language property types.{Type}.alt, where {Type} is the short class name of the type concerned.

      For example :

      • [en.prop] types.Workspace.alt: Workspace
      • [fr.prop] types.Workspace.alt: Espace de travail
      Overrides:
      getDataIconAlt in class Data
      Parameters:
      lang - the user language
      Returns:
      the alt Html attribute for the IMG Html tag, or empty string if non alternative text was define in property.
      See Also:
    • flushHomeUrl

      public void flushHomeUrl()
      Reset the cache of the home category. Should only be called by category, publication and workspace listeners
    • getHomePortal

      public PortalInterface getHomePortal()
      Retrieves the home portal for current Workspace by searching through its PortalInterface which could be a Portal, a PortalJspCollection or a CollaborativeSpace
      Returns:
      the home portal of current Workspace
      Since:
      jcms-9.0.0
    • getHomeUrl

      public String getHomeUrl(Locale userLocale)
      Returns the home url for the given workspace calculated from portal categories that belongs to workspace
      Parameters:
      userLocale - the user local
      Returns:
      String
    • getHomeUrlVisitor

      protected Category getHomeUrlVisitor(Collection<Category> collect, Set<Publication> portalSet)
      Internal methods to check home url
      Parameters:
      collect - a collection of category to check
      portalSet - the portal set
      Returns:
      Category the hoem category
    • isWorkspaceCat

      public boolean isWorkspaceCat(Category cat)
      Checks if the given category is a workspace category or a descendent of worspace categories.
      Parameters:
      cat - the child category
      Returns:
      true if the given category is a workspace category or a descendent of worspace categories.
      Since:
      jcms 4.1
    • getFirstWorkspaceCat

      public Category getFirstWorkspaceCat(Category cat)
      Returns first workspace category mathching (or parent) given category.
      Parameters:
      cat - the child category
      Returns:
      category the workspace category.
      Since:
      jcms 5.7.4
    • getAllWorkspaceSet

      public static Set<Workspace> getAllWorkspaceSet()
      Returns a Set with all workspace, model or not. CAUTION: DO NOT alter the returned set, clone prior modification.
      Returns:
      Set of Workspace
      Since:
      jcms-5.5.0
    • getAllWorkspaceSet

      public static Set<Workspace> getAllWorkspaceSet(Member member)
      Returns a Set of workspace, for the given member. If the Member is an Admin return all workspace (model or not) If member is not null return workspace's member otherwise return empty TreeSet.
      Parameters:
      member - the working member
      Returns:
      Set of Workspace
      Since:
      jcms-5.5.0
    • getAllWorkspaceSetWithoutModel

      public static Set<Workspace> getAllWorkspaceSetWithoutModel()
      Returns a Set with all workspace without workspace model.
      Returns:
      Set of Workspace
      Since:
      jcms-5.5.0
    • getAllWorkspaceSetModel

      public static Set<Workspace> getAllWorkspaceSetModel()
      Returns a Set with all workspace model.
      Returns:
      Set of Workspace
      Since:
      jcms-5.5.0
    • getAllWorkingWorkspaceSet

      public static SortedSet<Workspace> getAllWorkingWorkspaceSet(Member loggedMember, JcmsContext jcmsContext)
      Gives the list of workspaces for which the current loggedMember is a worker.
      Parameters:
      loggedMember - the current logged member
      jcmsContext - the current jcmsContext
      Returns:
      the sorted, regarding to the title in the current language, set of workspace for which the logged member is worker
    • getWorkflow

      public Workflow getWorkflow(Class clazz)
      Find the Worflow associated to the given class. This method also check for super class.
      Parameters:
      clazz - the class
      Returns:
      the workflow linked to the given class.
      Since:
      jcms-4.1
      See Also:
    • getWorkflow

      public Workflow getWorkflow(Class clazz, boolean useParentWFOnEmpty)
      Find the Worflow associated to the given class. This method also check for super class if useParentWFOnEmpty is true.
      Parameters:
      clazz - the class
      useParentWFOnEmpty - true if parent class should be checked when typeMap doesn't have the configuration for the type or if "inherit" is used
      Returns:
      the workflow linked to the given class.
    • getWorkflowId

      public String getWorkflowId(Class clazz, boolean useParentWFOnEmpty)
      Find the Worflow Id associated to the given class. This method also check for super class if useParentWFOnEmpty is true.
      Parameters:
      clazz - the class
      useParentWFOnEmpty - true if parent class should be checked when typeMap doesn't have the configuration for the type or if "inherit" is used
      Returns:
      the workflow id linked to the given class.
    • getConfiguredWorkflowId

      protected String getConfiguredWorkflowId(Class clazz)
      return the configured workflow id for this type, don't resolve inheritage if value is WorkflowConstants.INHERIT_WORKFLOW
      Parameters:
      clazz - the class
      Returns:
      the workflow id, may be null if type is not activated in the workspace
    • getWSTypeEntry

      public WSTypeEntry getWSTypeEntry(Class clazz)
      Returns a WSTypeEntry describing custom properties for a given type in a given workspace. WARNING: If Workspace doesn't handle a WSTypeEntry for this class it will return a fake WSTypeEntry.
      Parameters:
      clazz - the target class
      Returns:
      WSTypeEntry the type description or null if it doesn't exists
      Since:
      jcms-5.5.0
    • getWSTypeEntry

      public WSTypeEntry getWSTypeEntry(String className)
      Returns a WSTypeEntry describing custom properties for a given type in a given workspace. WARNING: If Workspace doesn't handle a WSTypeEntry for this class it will return a fake WSTypeEntry.
      Parameters:
      className - the target class name
      Returns:
      WSTypeEntry the type description or null if it doesn't exists
      Since:
      jcms-5.5.0
    • getTypeLabel

      public String getTypeLabel(Class clazz, String lang)
      Returns the label for the given type (class) in the given language.
      Parameters:
      clazz - the class
      lang - the language
      Returns:
      the label for the given type in the given language.
    • getTypeDescription

      public String getTypeDescription(Class clazz, String lang)
      Returns the description for the given type (class) in the given language.
      Parameters:
      clazz - the class
      lang - the language
      Returns:
      the description for the given type (class) in the given language.
    • hasWorkflow

      public boolean hasWorkflow(Class clazz)
      Check if the type is linked to a workflow for this workspace
      Parameters:
      clazz - the class to check
      Returns:
      true if the type is linked to a workflow
      Since:
      jcms-4.1
    • getTypeSet

      public Set<Class<?>> getTypeSet()
      Returns a Set of all visible types
      Returns:
      a Set of all visible types (String)
      Since:
      jcms-4.1
    • getSubTypeSet

      public <T> Set<Class<? extends T>> getSubTypeSet(Class<T> clazz, Member mbr)
      Returns a set of types used in this Workspace, extending the given class and that the given member can publish.
      Parameters:
      clazz - the class
      mbr - the member
      Returns:
      a set of types used in this Workspace, extending the given class and that the given member can publish.
      Since:
      jcms-9.0.0
    • getSubTypeSet

      public <T> Set<Class<? extends T>> getSubTypeSet(Class<T> clazz, Member mbr, Map<String,?> contextMap)
      Returns a set of types used in this Workspace, extending the given class and that the given member can publish.
      Parameters:
      clazz - the class
      mbr - the member
      contextMap - an optional context map providing information on publish request context, may be null
      Returns:
      a set of types used in this Workspace, extending the given class and that the given member can publish.
      Since:
      jcms-10.0.6 / JCMS-8882
    • getSubTypeSet

      public <T> Set<Class<? extends T>> getSubTypeSet(Class<T> clazz)
      Returns a set of types used in this Workspace, extending the given class.
      Parameters:
      clazz - the class
      Returns:
      a set of types used in this Workspace, extending the given class.
      Since:
      jcms-10.0.5
    • canPublish

      public boolean canPublish(Class clazz)
      Checks if the given class can be published in this workspace.
      Parameters:
      clazz - the Class for which publication authorization should be verified
      Returns:
      true if the given class can be published in this workspace
      Since:
      jcms-4.1
    • getWorkflowSet

      public Set<Workflow> getWorkflowSet()
      Returns a Set of all workflow used by calling getWorkflow(clazz,false) on all clazz.
      Returns:
      a Set of all workflow used
      Since:
      jcms-4.1
    • setTypeWorkflow

      public void setTypeWorkflow(Class<?> clazz, Workflow wf)
      Link a Workflow to a given Class. Warning since jcms-5.5.0 Workspace may use a WSTypeEntry. You may also use setWSTypeEntry(Class,WSTypeEntry) If the given class is linked to a WSTypeEntry then this method will throw a RuntimeException.
      Parameters:
      clazz - the clazz to link
      wf - the workflow to link
      Since:
      jcms-5.5.0
      See Also:
    • setWSTypeEntry

      public boolean setWSTypeEntry(Class<?> clazz, WSTypeEntry wste)
      Link a WSTypeEntry to a given Class. If WSTypeEntry.isSameProperties() than channel properties then do not store the WSTypeEntry. Warning: Caller must create, update or delete the WSTypeEntry this method is only a convenient setter
      Parameters:
      clazz - the clazz to link
      wste - the WSTypeEntry to link with
      Returns:
      boolean true if the WSTypeEntry is used or false if it is same
      Since:
      jcms-5.5.0
    • getPublicationSet

      public Set<Publication> getPublicationSet(Workflow workflow)
      Return all publication for a given Workflow
      Parameters:
      workflow - the workflow
      Returns:
      a Set of publication
      Since:
      jcms-4.1
    • getPublicationSet

      public Set<Publication> getPublicationSet(Workflow workflow, boolean specialState)
      Return all the publication in/not a special state for the given Workflow
      Parameters:
      workflow - the workflow
      specialState - the state
      Returns:
      a Set of publication
      Since:
      jcms-4.1
    • getPubSet

      public TreeSet<Publication> getPubSet()
      Returns:
      Returns the pubSet.
      Since:
      jcms-4.1
    • updatePubSet

      public void updatePubSet(Publication pub, boolean add)
      Update pubSet index
      Parameters:
      pub - the publication to be added or removed
      add - add if true, remove if false
      Since:
      jcms-5.0.1
    • getClassPubSetMap

      public HashMap<Class<?>,Set<Publication>> getClassPubSetMap()
      Returns:
      map(class, pubSet)
      Since:
      jcms-4.1
    • getPublicationSet

      public <T extends Publication> Set<T> getPublicationSet(Class<?> clazz, boolean specialState)
      Return all the publication in/not a special state for the given class
      Type Parameters:
      T - a Publication type
      Parameters:
      clazz - the class
      specialState - the state
      Returns:
      a Set of publication
      Since:
      jcms-4.1
    • getPublicationSet

      public <T extends Publication> Set<T> getPublicationSet(Class<?> clazz)
      Return all publication for a given Clazz
      Type Parameters:
      T - a Publication type
      Parameters:
      clazz - the class
      Returns:
      a Set of publication
      Since:
      jcms-4.1
    • getWFRole

      public WFRole getWFRole(WKRole wkRole)
      Returns the WFRole bound to the given WKRole.
      Parameters:
      wkRole - the WKRole to look for.
      Returns:
      the WFRole bound to the given WKRole.
      Since:
      jcms-5.0.5
    • getRole

      public WKRole getRole(WFRole wfRole)
      Get the WKRole linked to a WFRole for a given Workflow
      Parameters:
      wfRole - the role
      Returns:
      WKRole associated to the given WFRole
      Since:
      jcms-4.1
    • setRole

      public void setRole(WFRole wfRole, WKRole wkRole)
      Binds a WKRole to a WFRole
      Parameters:
      wfRole - the WFRole
      wkRole - the WKRole
      Since:
      jcms-5.5.0
    • getRole

      public WKRole getRole(String wfRoleId)
      Get the WKRole linked to a WFRole for a given Workflow
      Parameters:
      wfRoleId - the role id
      Returns:
      WKRole associated to the given WFRole
      Since:
      jcms-4.1
    • hasWKRole

      public boolean hasWKRole(String wfRoleId)
      Check if a WKRole exists in this workspace for the specified WFRole id
      Parameters:
      wfRoleId - the id of the WFRole to check
      Returns:
      true if the wfRoleID have associated WKRole
      Since:
      jcms-4.1
    • hasWKRole

      public boolean hasWKRole(WFRole wfRole)
      Check if a WKRole exists in this workspace for the specified WFRole
      Parameters:
      wfRole - the WFRole to check
      Returns:
      true if the wfRole have associated WKRole
      Since:
      jcms-4.1
    • getWFRoleIdSet

      public Set<String> getWFRoleIdSet()
      Return a set of all WFRoleId
      Returns:
      a set of WFRoleId
      Since:
      jcms-4.1
    • getWFRoleSet

      public Set<WFRole> getWFRoleSet()
      Return a set of all WFRole
      Returns:
      a set of WFRole
      Since:
      jcms-4.1
    • getWKRoleSet

      public Set<WKRole> getWKRoleSet()
      Return a set of all WKRole
      Returns:
      a set of WKRole
      Since:
      jcms-4.1
    • getWKRoleSet

      public Set<WKRole> getWKRoleSet(Workflow wf)
      Return all the WKRole for a given Workflow
      Parameters:
      wf - the workflow
      Returns:
      a Set of WKRole
      Since:
      jcms-4.1
    • getWKRoleSet

      public Set<WKRole> getWKRoleSet(Class clazz)
      Return all the WKRole for a given Class
      Parameters:
      clazz - the class
      Returns:
      a Set of WKRole
      Since:
      jcms-4.1
    • linkRole

      public void linkRole(WFRole wfRole, WKRole wkRole)
      Link into the workspace a WFRole to a WKRole
      Parameters:
      wfRole - the WFRole
      wkRole - the WKRole
      Since:
      jcms-4.1
    • isAdmin

      public boolean isAdmin(Member member)
      Check if the member is an administrator of the workspace or of the channel
      Parameters:
      member - the member
      Returns:
      true if the member is an administrator
      Since:
      jcms-4.1
    • isMember

      public boolean isMember(Member member)
      Returns true if the given member belongs tho this workspace.
      Parameters:
      member - the member
      Returns:
      true if the given member belongs tho this workspace.
      Since:
      jcms-7.1.0
    • getComparator

      @Deprecated public static Comparator<Workspace> getComparator(String str, boolean reverse)
      Deprecated.
      Since:
      jcms-5.0.0
    • getNameComparator

      public static Comparator<Workspace> getNameComparator(String lang)
      Returns a new Comparator instance to compare workspace based on their title.
      Parameters:
      lang - the language in which to compare workspace
      Returns:
      a new NameComparator instance
      Since:
      jcms-5.6.1
    • getOrderComparator

      public static Comparator<Workspace> getOrderComparator(String lang)
      Returns a new Comparator instance to compare workspace based on their order.
      Parameters:
      lang - the language in which to compare workspaces'title when order is the same.
      Returns:
      a new OrderComparator instance
      Since:
      jcms-5.6.1
    • getGroupSizeComparator

      public static Comparator<Workspace> getGroupSizeComparator(String lang)
      Returns a new Comparator instance to compare workspace based on the number of groups in each workspace.
      Parameters:
      lang - the language in which to compare workspaces'title when number of groups is the same.
      Returns:
      a new GroupSizeComparator instance
      Since:
      jcms-5.6.1
    • getMemberSizeComparator

      public static Comparator<Workspace> getMemberSizeComparator(String lang)
      Returns a new Comparator instance to compare workspace based on the number of members in each workspace.
      Parameters:
      lang - the language in which to compare workspaces'title when number of members is the same.
      Returns:
      a new MemberSizeComparator instance
      Since:
      jcms-5.6.1
    • getFavoriteComparator

      public static Comparator<Workspace> getFavoriteComparator(Member mbr, String lang)
      Returns a new Comparator instance to compare workspace based on member engagement.

      Parameters:
      mbr - the member
      lang - the language in which to compare workspaces' title as default order criteria.
      Returns:
      a new Workspace.FavoriteComparator instance
      Since:
      jcms-9.0.0
      See Also:
    • getActiveWorkspaceSelector

      public static DataSelector getActiveWorkspaceSelector()
      Returns the selector for active Workspaces (Not a model, and not closed)
      Returns:
      the selector to filter active workspaces
      Since:
      jcms-10.0.0
    • getMemberSet

      @Deprecated public Set<Member> getMemberSet()
      Deprecated.
      since JCMS-5751, use AllMemberQueryHandler
      Returns a set of members that belongs to groups of this workspace. This method only returns Member (no DBMember).
      Returns:
      a new Set containing all members of this Workspace
    • getMemberSet

      @Deprecated public Set<Member> getMemberSet(boolean includeDBMember)
      Deprecated.
      since JCMS-5751, use AllMemberQueryHandler
      Returns a set of members that belongs to groups of this workspace.
      Parameters:
      includeDBMember - if true it includes for DBMember (up to HibernateManager.getDefaultMaxResults()).
      Returns:
      a new Set containing all members of this Workspace
      Since:
      jcms-7.0.0
    • getMemberCount

      public int getMemberCount(boolean includeDBMember)
      Returns the member count for this workspace.
      Parameters:
      includeDBMember - if true it includes for DBMember.
      Returns:
      the member count for this workspace.
      Since:
      jcms-8.0.0
    • hasDBMember

      public boolean hasDBMember()
      Returns true if DBMembers belong to this workspace
      Returns:
      true if DBMembers belong to this workspace
      Since:
      jcms-7.1.1
    • invalidateHasDBMember

      public void invalidateHasDBMember()
      Invalidate the cache for hasDBMember method.
      Since:
      jcms-7.1.1
    • setSessionWorkspace

      public static void setSessionWorkspace(javax.servlet.http.HttpSession session, Workspace workspace)
      Set the given workspace to the session.
      Parameters:
      session - the session
      workspace - the workspace
      Since:
      jcms-4.1
    • getSessionWorkspace

      public static Workspace getSessionWorkspace(javax.servlet.http.HttpSession session)
      Get the workspace stored in the session
      Parameters:
      session - the session
      Returns:
      the workspace in the session
      Since:
      jcms-4.1
    • setRequestWorkspace

      public static void setRequestWorkspace(javax.servlet.http.HttpServletRequest request, Workspace workspace)
      Set the given workspace to the request.
      Parameters:
      request - the request
      workspace - the workspace
      Since:
      jcms-5.0
    • getRequestWorkspace

      public static Workspace getRequestWorkspace(javax.servlet.http.HttpServletRequest request)
      Get the workspace stored in the request
      Parameters:
      request - the request
      Returns:
      the workspace in the request
      Since:
      jcms-5.0
    • getDataName

      public String getDataName(String language)
      Description copied from class: Data
      Return the name of this Data, every sub class Data which will be displayed to user should implements this method already.
      • The Title (multi-language) for a Publication.
      • The Name (multi-language) for a Category.
      • The Name for a Group, a Member.
      • The Title (multi-language) for a Workspace.
      Can be seen as a smart multi-language toString(), but never returning null.
      Default behaviour is to return toFullString() of Data or empty string if toFullString is null.
      Overrides:
      getDataName in class Data
      Parameters:
      language - the language in which to return the name if multilang available for the data.
      Returns:
      title of Workspace in given language or empty String if not specified.
      Since:
      jcms-5.1
      See Also:
    • getTitle

      public String getTitle(String lang)
      Get the value of title bound to the given language.
      Parameters:
      lang - the language to get the title
      Returns:
      title in the given language.
      Since:
      jcms-4.1
    • getTitle

      public String getTitle(String lang, boolean useDefault)
      Get the value of title bound to the given language.
      Parameters:
      lang - the language to get the title
      useDefault - should main language used as default language if title does not exist in the given language
      Returns:
      title in the given language.
      Since:
      jcms-4.1
    • getTitle

      public String getTitle()
      Get the value of title.
      Returns:
      Value of title.
      Since:
      jcms-4.1
    • setTitle

      public void setTitle(String v)
      Set the value of title.
      Parameters:
      v - Value to assign to title.
      Since:
      jcms-4.1
    • getTitleML

      public HashMap<String,String> getTitleML()
      Retrieve the HashMap containing the titles of this Workspace in language other than the main site language.
      Returns:
      an HashMap of String.
      Since:
      jcms-4.1
    • setTitleML

      public void setTitleML(HashMap<String,String> v)
      Set the HashMap containing the titles of this Workspace in language other than the main site language.
      Parameters:
      v - Value to assign to titleML.
      Since:
      jcms-4.1
    • setTitle

      public void setTitle(String lang, String value)
      Convenient method to set the value of the title field in any language (default site language or any other).
      This method will set the proper field value (setTitle(String) or setTitleML(HashMap)) depending on the specified language.
      Parameters:
      lang - the language (ISO 639 code) in which to set the value
      value - the value to set.
      Since:
      jcms-10.0.1
      See Also:
    • isModel

      public boolean isModel()
      Getter for model
      Returns:
      model is workspace is a model
    • setModel

      public void setModel(boolean model)
      Setter for model
      Parameters:
      model - is workspace is a model
    • isClosed

      public boolean isClosed()
      Getter for isClosed. Is a workspace is closed, no contribution, no modification on groups are allowed.
      Returns:
      isClosed is workspace is Closed For Contribution
    • setClosed

      public void setClosed(boolean closed)
      Setter for isClosed
      Parameters:
      closed - to close this workspace for contribution
    • isOpen

      public boolean isOpen()
    • getRoleMap

      public HashMap<String,WKRole> getRoleMap()
      Getter of RoleMap
      Returns:
      the association: Workflow / WfRoleSet
      Since:
      jcms-4.1
    • setRoleMap

      public void setRoleMap(HashMap<String,WKRole> roleMap)
      Setter of RoleMap
      Parameters:
      roleMap - the RoleMap
      Since:
      jcms-4.1
    • getTypeMap

      public HashMap<Class<?>,Object> getTypeMap()
      Getter of TypeMap
      Returns:
      a Map Class / Workflow Id
      Since:
      jcms-4.1
    • setTypeMap

      public void setTypeMap(HashMap<Class<?>,Object> typeMap)
      Setter of TypeMap
      Parameters:
      typeMap - the TypeMap
      Since:
      jcms-4.1
    • getOrder

      public int getOrder()
      Returns:
      Returns the order.
      Since:
      jcms-4.1
    • setOrder

      public void setOrder(int order)
      Parameters:
      order - The order to set.
      Since:
      jcms-4.1
    • getGroupSet

      public TreeSet<Group> getGroupSet()
      Returns:
      Returns the groupSet.
      Since:
      jcms-4.1
    • updateGroupSet

      public void updateGroupSet(Group grp, boolean add)
      Update the groupSet index
      Parameters:
      grp - the group to be added or removed
      add - add if true, remove if false
      Since:
      jcms-5.0.1
    • getAdministrators

      public ArrayList<Member> getAdministrators()
      Retrieve administrators of this workspace (including DBMember).

      Returns:
      Returns the administrators.
      CAUTION: DO NOT alter the returned List, clone prior modification.
      Since:
      jcms-4.1
      See Also:
    • getAdministrators

      public ArrayList<Member> getAdministrators(boolean queryDB)
      Retrieve administrators of this workspace.

      Including or not DBMember.

      Parameters:
      queryDB - whether to query Database to retrieve any DBMember specified as administrators of this workspace
      Returns:
      an ArrayList of Members, may return null and may contains null value when queryDB is set to false
      Since:
      JCMS-6331
    • setAdministrators

      public void setAdministrators(ArrayList<Member> administrators)
      Parameters:
      administrators - The administrators to set.
      Since:
      jcms-4.1
    • setAdministratorsDBID

      public void setAdministratorsDBID(ArrayList<String> dbMbrIds)
      Set the ids of DBMember to configure as administrators of this workspace.
      Parameters:
      dbMbrIds - an ArrayList of DBMember ids, may be null
      Since:
      JCMS-6331
      See Also:
    • getAdministratorsDBID

      public ArrayList<String> getAdministratorsDBID()
      Retrieve the ids of DBMember configured as administrators of this workspace.
      Returns:
      an ArrayList of DBMember ids, may be null
      Since:
      JCMS-6331
      See Also:
    • splitHybridCollections

      protected void splitHybridCollections(Data previousData)
      Description copied from class: Data
      This method must be overrided by sub-classes that are persisted in JStore and that have hybrid collection/array.
      Overrides:
      splitHybridCollections in class Data
      Parameters:
      previousData - the previous data (provided for update only)
    • cleanHybridCollections

      protected void cleanHybridCollections()
      Description copied from class: Data
      This method must be overrided by sub-classes that are persisted in JStore and that have hybrid collection/array.
      Overrides:
      cleanHybridCollections in class Data
    • getCatSet

      public HashSet<Category> getCatSet()
      Returns:
      Returns the catSet.
      Since:
      jcms-4.1
    • setCatSet

      public void setCatSet(HashSet<Category> catSet)
      Parameters:
      catSet - The catSet to set.
      Since:
      jcms-4.1
    • getTagRoot

      public Category getTagRoot()
      Returns:
      the tag root.
      Since:
      jcms-7.1.0
    • setTagRoot

      public void setTagRoot(Category tagRoot)
      Parameters:
      tagRoot - the tag root to set.
      Since:
      jcms-7.1.0
    • getLanguage

      public String getLanguage()
      Returns:
      Returns the main Language of the workspace if it is specified. null otherwise.
      Since:
      jcms-5.7.3
    • setLanguage

      public void setLanguage(String language)
      Parameters:
      language - The language to set.
      Since:
      jcms-5.7.3
    • getParent

      public Workspace getParent()
      Returns:
      Returns the parent Workspace of the current workspace if it has one. null otherwise.
      Since:
      jcms-7.0.0
    • setParent

      public void setParent(Workspace parent)
      Parameters:
      parent - The parent workspace to set.
      Since:
      jcms-7.0.0
    • isIncomingMailEnabled

      public boolean isIncomingMailEnabled()
      Returns:
      true if the incoming mail is enabled in this Workspace.
      Since:
      jcms-9.0.0
    • setIncomingMailEnabled

      public void setIncomingMailEnabled(boolean enable)
      Parameters:
      enable - true to enable the incoming mail in this Workspace.
      Since:
      jcms-9.0.0
    • getIncomingMailLocalPart

      public String getIncomingMailLocalPart()
      Returns:
      the localPart of the incoming E-mail address.
      Since:
      jcms-9.0.0
    • getIncomingMailDefaultLocalPart

      public String getIncomingMailDefaultLocalPart()
      Returns:
      a default, generated, not already used, incoming Mail LocalPart, built on Workspace's title in its main language.
      Since:
      jcms-9.0.0
    • setIncomingMailLocalPart

      public void setIncomingMailLocalPart(String localPart)
      Parameters:
      localPart - the incoming Mail Address' localPart to set
      Since:
      jcms-9.0.0
    • getIncomingAddress

      public String getIncomingAddress(Member member)
      Computes an incoming e-mail for given Member.

      Output is like:

      "space_email+mbr_authkey@server.com"
      Parameters:
      member - the member for who generate the E-mail address.
      Returns:
      an incoming Email address for this Workspace and Member, or null if incoming mail is disabled.
      Since:
      jcms-9.0.0
      See Also:
    • getIncomingAddress

      public String getIncomingAddress(Member member, boolean useLabel)
      Computes an incoming e-mail for given Member.

      If label is used, output is like:

      "Space title <space_email+mbr_authkey@server.com>"

      Else, output is like:
      "space_email+mbr_authkey@server.com"
      Parameters:
      member - the member for who generate the E-mail address.
      useLabel - weither to use Workspace title as label.
      Returns:
      an incoming Email address for this Workspace and Member, or null if incoming mail is disabled.
      Since:
      jcms-9.0.0
      See Also:
    • checkIntegrity

      public ControllerStatus checkIntegrity()
      Checks whether or not data integrity constraints are respected.
      Overrides:
      checkIntegrity in class Data
      Returns:
      a ControllerStatus
      Since:
      jcms-5.0.0
    • checkMember

      public ControllerStatus checkMember(int op, Member mbr, Map context)
      Checks if the given member can perform the given operation.
      Overrides:
      checkMember in class Data
      Parameters:
      op - the operation (OP_CREATE, OP_UPDATE, ...)
      mbr - the member which requests the write operation
      context - a map which contains context parameters (may be null)
      Returns:
      a ControllerStatus
      Since:
      jcms-5.0.0
    • checkCreate

      public ControllerStatus checkCreate(Member mbr, Map context)
      Checks if the creation can be performed
      Overrides:
      checkCreate in class Data
      Parameters:
      mbr - the member which requests the write operation
      context - a map which contains context parameters (may be null)
      Returns:
      a ControllerStatus
      Since:
      jcms-5.0.0
    • checkUpdate

      public ControllerStatus checkUpdate(Member mbr, Map context)
      Checks if the update can be performed
      Overrides:
      checkUpdate in class Data
      Parameters:
      mbr - the member which requests the write operation
      context - a map which contains context parameters (may be null)
      Returns:
      a ControllerStatus
      Since:
      jcms-5.0.0
    • checkDelete

      public ControllerStatus checkDelete(Member mbr, Map context)
      Checks if the deletion can be performed
      Overrides:
      checkDelete in class Data
      Parameters:
      mbr - the member which requests the write operation
      context - a map which contains context parameters (may be null)
      Returns:
      a ControllerStatus
      Since:
      jcms-5.0.0
    • performUpdate

      public void performUpdate(Member mbr, Map context)
      Description copied from class: Data
      Performs data update.
      Overrides:
      performUpdate in class Data
      Parameters:
      mbr - the member which requests the write operation
      context - a map which contains context parameters (may be null)
      Since:
      jcms-5.5.0
      See Also:
    • performDelete

      public void performDelete(Member mbr, Map context)
      Performs data deletion
      Overrides:
      performDelete in class Data
      Parameters:
      mbr - the member which requests the write operation
      context - a map which contains context parameters (may be null)
      Since:
      jcms-5.0.0
    • getCatSet

      public Set<Category> getCatSet(Member mbr)
      Gives the root categories for this Workspace, that the given member may read.
      Parameters:
      mbr - the member. May be null.
      Returns:
      a sub set of getCatSet()
      Since:
      JCMS-6.1
    • exportXmlRelated

      protected void exportXmlRelated(StringBuffer sb, String related, int indentLevel)
      Overrides:
      exportXmlRelated in class Data
    • isCollaborativeSpace

      public boolean isCollaborativeSpace()
      Returns true if this workspace is a CollaborativeSpace (i.e. generated with the Collaborative Spaces Plugin).
      Returns:
      true if this workspace is a CollaborativeSpace (i.e. generated with the Collaborative Spaces Plugin).
      Since:
      jcms-6.1.0
    • getCollaborativeSpace

      public PortletCollection getCollaborativeSpace()
      Returns the CollaborativeSpace associated to this workspace (or null if none).
      Returns:
      the CollaborativeSpace associated to this workspace (or null if none).
      Since:
      jcms-10.0.5
    • invalidateCollaborativeSpaceCache

      public void invalidateCollaborativeSpaceCache()
      Invalidate the internal cache used by isCollaborativeSpace() getCollaborativeSpace()
      Since:
      JCMS-11732
    • isFavorite

      public boolean isFavorite(Member member)
      Returns true if this workspace is a favorite workspace for given Member.
      Parameters:
      member - the member
      Returns:
      true if this workspace is a favorite workspace for given Member.
      Since:
      jcms-10.0.0
    • getFileSizeMap

      public ObjectLongTreeMap getFileSizeMap(boolean refresh)
      Returns the map file size for each content-type. To improve the performances, the map is cached unless it is requested to refresh it.

      This method retrieve the underlying ObjectLongTreeMap which is NOT thread safe.
      Always synchronize iteration or modification on the returned map.

      Parameters:
      refresh - if true refresh the map
      Returns:
      the map file size for each content-type.
      Since:
      jcms-7.0.0
    • getPreviousFileAnalyzer

      public WorkspaceFileSizeResult getPreviousFileAnalyzer()
      returns previous WorkspaceFileSizeResult instance associated with this workspace if any. This method doesn't do any refresh nor computation like getFileAnalyzer(boolean)
      Returns:
      previous WorkspaceFileSizeResult instance associated with this workspace if any.
    • getFileAnalyzer

      public WorkspaceFileSizeResult getFileAnalyzer(boolean refresh)
      returns WorkspaceFileSizeResult instance associated with this workspace. Note that as file analyze is down asynchronously, this method should returns null if an analyze is in progress (or if refresh is asked). In this case, user should ask getCurrentAnalyzerThread() to retrieve the analyze thread. getCompleteness() method on the thread can be used to know the state of the thread.
      Parameters:
      refresh - force to ignore data previously present in cache
      Returns:
      WorkspaceFileSizeResult instance associated with this workspace or null if an analyze is in progress (or if refresh is asked).
    • getCurrentAnalyzerThread

      public FileAnalyzerThread getCurrentAnalyzerThread()
      Return the current analyzer thread if analyze is in progress
      Returns:
      the FileAnalyzerThread or null if no analyze is running
    • handleFileAnalyzeEnd

      public void handleFileAnalyzeEnd(WorkspaceFileSizeResult fileAnalyzer)
      This method is called when global file analyzer has end
      Parameters:
      fileAnalyzer - the file analyzer
    • getWfByInstanceMap

      public HashMap<Class<?>,Boolean> getWfByInstanceMap()
    • setWfByInstanceMap

      public void setWfByInstanceMap(HashMap<Class<?>,Boolean> wfByInstanceMap)
    • getInstanceWorkflowIdMap

      public HashMap<Class<?>,Set<String>> getInstanceWorkflowIdMap()
    • setInstanceWorkflowIdMap

      public void setInstanceWorkflowIdMap(HashMap<Class<?>,Set<String>> instanceWorkflowIdMap)
    • getInstanceWorkflowGroupMap

      public HashMap<Class<?>,Set<String>> getInstanceWorkflowGroupMap()
    • setInstanceWorkflowGroupMap

      public void setInstanceWorkflowGroupMap(HashMap<Class<?>,Set<String>> instanceWorkflowGroupMap)
    • getAlertThreshold

      public int getAlertThreshold()
    • setAlertThreshold

      public void setAlertThreshold(int alertThreshold)
    • getQuota

      public long getQuota()
    • setQuota

      public void setQuota(long quota)
    • getLastQuotaNotificationDate

      public long getLastQuotaNotificationDate()
    • setLastQuotaNotificationDate

      public void setLastQuotaNotificationDate(long lastQuotaNotificationDate)
    • getQuotaAlert

      public QuotaElement getQuotaAlert()
    • setQuotaAlert

      public void setQuotaAlert(QuotaElement quotaAlert)
    • getUseDefaultQuota

      public boolean getUseDefaultQuota()
    • setUseDefaultQuota

      public void setUseDefaultQuota(boolean useDefaultQuota)
    • getMainPortal

      public PortalInterface getMainPortal()
    • setMainPortal

      public void setMainPortal(PortalInterface mainPortal)
    • canBeReadBy

      public boolean canBeReadBy(Member member, boolean searchInGroups, RightInfo rightInfo)
      Description copied from class: Data
      Checks if the specified member is authorized to read this Data.
      Overrides:
      canBeReadBy in class Data
      Parameters:
      member - the member to check (may be null for anonymous user)
      searchInGroups - set to true to check for read right authorization using Member's group(s).
      rightInfo - a RightInfo instance in which explanation of read right authorization acceptance or refusal will be indicated. Value is required and cannot be null.
      Returns:
      true if the member can read this Data, false otherwise
    • internalCanBeReadBy

      protected boolean internalCanBeReadBy(Member member, boolean searchInGroups, RightInfo rightInfo)
    • getOtherWorkspaceContentList

      public List<Content> getOtherWorkspaceContentList(Member mbr, int firstResult, int maxResults)
      Returns the list of contents of other workspaces shared in this workspace.
      Parameters:
      mbr - the member (to filter according the read rights)
      firstResult - the first result
      maxResults - the max results
      Returns:
      the list of contents of other workspaces shared in this workspace.
      Since:
      jcms-10.0.2
    • getSharedContentList

      public List<Content> getSharedContentList(Member mbr, int firstResult, int maxResults)
      Returns the list of content of this workspace shared with other workspaces.
      Parameters:
      mbr - the member (to filter according the read rights)
      firstResult - the first result
      maxResults - the max results
      Returns:
      the list of content of this workspace shared with other workspaces.
      Since:
      jcms-10.0.2
    • getEffectiveClassificationLevel

      public int getEffectiveClassificationLevel()
      Retrieve the effective classification level of this workspace using baseline classification level configured on site.

      If this workspace classification was not specified (getClassificationLevel() is zero), the effective level used for read right, feature access and constraint required is the baseline level ClassificationManager.getBaselineLevel().

      Returns:
      a value from 1 (if baseline is 1) to ClassificationManager.getMaximumLevel() (if baseline is the maximum level)
      Since:
      10.0.8 / JCMS-10746
      See Also:
    • getClassificationLevel

      public int getClassificationLevel()
      Retrieve the classification level of this workspace.
      Returns:
      a value from 0 for unclassified workspace to ClassificationManager.getMaximumLevel() (included) for highly classified workspace
      Since:
      10.0.8 / JCMS-10746
      See Also:
    • setClassificationLevel

      public void setClassificationLevel(Integer level)
      Set the classification level of this workspace.
      Parameters:
      level - a value from 0 for unclassified workspace to ClassificationManager.getMaximumLevel() (included) for highly classified workspace. 0 if used if null is specified.
      Since:
      10.0.8 / JCMS-10746
      See Also:
    • isClassified

      public boolean isClassified()
      Check if this workspace is classified.
      Returns:
      true if this workspace has a its effective classification level higher than 1 (and classification is enabled), false otherwise
      Since:
      10.0.8 / JCMS-10746
      See Also:
    • getMinClassificationLevel

      public int getMinClassificationLevel()
      Retrieve the minimum classification level of publication authorized in this workspace.
      Returns:
      a value from 0 to getClassificationLevel() (included)
      Since:
      10.0.8 / JCMS-10746
      See Also:
    • setMinClassificationLevel

      public void setMinClassificationLevel(Integer level)
      Set the minimum classification level of publication authorized in this workspace.
      Parameters:
      level - a value from 0 to getClassificationLevel() (included)
      Since:
      10.0.8 / JCMS-10746