Package com.jalios.jcms.workspace
Class WorkspaceManager
- java.lang.Object
-
- com.jalios.jcms.workspace.WorkspaceManager
-
public final class WorkspaceManager extends java.lang.Object
A manager forWorkspace
that provides utility methods.- Author:
- Jean-Philippe Encausse
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
MAIL_PATTERN_INFO
An extraInfo that stores the Workspace Incoming Mail pattern if any.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static boolean
canReadWorkspace(Workspace workspace, Member member)
protected static void
createDuplicateCategories(WorkspaceWizardContext context)
Duplicate all categories specified for the given WizardContext.protected static void
createGroups(WorkspaceWizardContext context)
Duplicate all groups specified for the given WizardContext.protected static void
createOtherPortlets(WorkspaceWizardContext context)
Duplicate remaining portlets that have not yet been duplicated from portals, and which are specified for the given WizardContext.protected static void
createPortals(WorkspaceWizardContext context)
Duplicate all portals specified for the given WizardContext.protected static boolean
createWorkspace(WorkspaceWizardContext context)
Creates the workspace instance from the given modelstatic WorkspaceWizardContext
deepDuplicate(Workspace model, Member author, java.lang.String prefix, java.lang.String title)
Deprecated.static WorkspaceWizardContext
deepDuplicate(Workspace model, Member author, java.lang.String prefix, java.lang.String title, boolean collaborativeSpace)
Deprecated.static WorkspaceWizardContext
deepDuplicate(Workspace model, Member author, java.lang.String prefix, java.lang.String title, Workspace parent)
Deprecated.static WorkspaceWizardContext
deepDuplicate(Workspace model, Member author, java.lang.String prefix, java.lang.String title, Workspace parent, boolean collaborativeSpace)
Deprecated.static WorkspaceWizardContext
deepDuplicate(Workspace model, Member author, java.lang.String prefix, java.lang.String title, java.lang.String wsemail, java.util.List adminList, java.util.Collection typeCollec, Category[] categories, Group[] groups, PortalInterface[] portals, Workspace parent, boolean collaborativeSpace)
Deprecated.static WorkspaceWizardContext
deepDuplicate(Workspace model, Member author, java.lang.String prefix, java.lang.String title, java.lang.String wsemail, java.util.List adminList, java.util.Collection typeCollec, java.util.Collection catCollec, java.util.Collection groupCollec, java.util.Collection portalCollec, boolean collaborativeSpace)
Deprecated.static WorkspaceWizardContext
deepDuplicate(Workspace model, Member author, java.lang.String prefix, java.lang.String title, java.lang.String wsemail, java.util.List adminList, java.util.Collection typeCollec, java.util.Collection catCollec, java.util.Collection groupCollec, java.util.Collection portalCollec, Workspace parent, boolean collaborativeSpace)
Deprecated.static WorkspaceWizardContext
deepDuplicate(Workspace model, Member author, java.lang.String prefix, java.lang.String title, java.util.Map<java.lang.String,java.lang.String> titleML)
Deep duplicate the Workspace model using given configuration for duplication.static WorkspaceWizardContext
deepDuplicate(Workspace model, Member author, java.lang.String prefix, java.lang.String title, java.util.Map<java.lang.String,java.lang.String> titleML, Workspace parent, boolean collaborativeSpace)
Deep duplicate the Workspace model using given configuration for duplication.static WorkspaceWizardContext
deepDuplicate(Workspace model, Member author, java.lang.String prefix, java.lang.String title, java.util.Map<java.lang.String,java.lang.String> titleML, java.lang.String wsemail, java.util.List adminList, java.util.Collection typeCollec, Category[] categories, Group[] groups, PortalInterface[] portals, Workspace parent, boolean collaborativeSpace)
Deep duplicate the Workspace model using given configuration for duplication.static WorkspaceWizardContext
deepDuplicate(Workspace model, Member author, java.lang.String prefix, java.lang.String title, java.util.Map<java.lang.String,java.lang.String> titleML, java.lang.String wsemail, java.util.List adminList, java.util.Collection typeCollec, java.util.Collection catCollec, java.util.Collection groupCollec, java.util.Collection portalCollec, boolean collaborativeSpace)
Deep duplicate the Workspace model using given configuration for duplication.static WorkspaceWizardContext
deepDuplicate(Workspace model, Member author, java.lang.String prefix, java.lang.String title, java.util.Map<java.lang.String,java.lang.String> titleML, java.lang.String wsemail, java.util.List adminList, java.util.Collection typeCollec, java.util.Collection catCollec, java.util.Collection groupCollec, java.util.Collection portalCollec, Workspace parent, boolean collaborativeSpace)
Deep duplicate the Workspace model using given configuration for duplication.static WorkspaceWizardContext
deepDuplicate(WorkspaceWizardContext context)
Deep duplicate the Workspace model referenced by given WorkspaceWizardContext using context configuration for duplication.static java.util.Collection<java.lang.String>
getAllIncomingMailLocalPart()
static int
getCollaborativeSpaceCount()
Returns the count of workspaces used as CollaborativeSpace.static Workspace
getIncomingMailLocalPartWorkspace(java.lang.String localPart)
static java.lang.String
getIncomingMailPattern(Workspace ws)
Computes the incoming mail pattern given the Workspace.static int
getNonCollaborativeWorkspaceCount()
Returns the count of workspaces which are not used as CollaborativeSpace.static java.util.Set<Workspace>
getOtherWorkspaceSet(Member member, java.lang.String userLang, java.util.Set<Workspace> workspaceToExcludeSet, boolean belongsToWorkspace, boolean isWorker, boolean withPortal)
static java.util.Set<Workspace>
getSearchedWorkspaceSet(Member mbr, java.lang.String userLang, java.lang.String query, boolean withPortal, boolean showModel)
Returns the set of workspace which : Matches the query Is a model the member can work on Has a portal (If withPortal is set to true) And the member can read the portalstatic void
initIncomingMails()
If site incoming mail is enabled, initializes Workspaces' incoming mail Patterns.static void
updateIncomingMailPattern(Workspace workspace, Workspace oldWorkspace)
Updates given Workspace incoming Mail Pattern inIncomingMailListener
.
IfoldWs
is not null, checks if localPart changed.protected static void
updateWorkspace(WorkspaceWizardContext context)
Update duplicated Workspace Duplicate WSTypeEntry Duplicate WKRoles Instance Workflow Groups
-
-
-
Field Detail
-
MAIL_PATTERN_INFO
public static final java.lang.String MAIL_PATTERN_INFO
An extraInfo that stores the Workspace Incoming Mail pattern if any.- Since:
- jcms-9.0.0
- See Also:
- Constant Field Values
-
-
Method Detail
-
deepDuplicate
@Deprecated public static WorkspaceWizardContext deepDuplicate(Workspace model, Member author, java.lang.String prefix, java.lang.String title)
Deprecated.Deep duplicate the Workspace model using given configuration for duplication. Then returns the context with correctly filled binding maps.- Parameters:
model
- the Workspace to duplicateauthor
- the author of all duplicationprefix
- the prefix to use on all duplicated itemstitle
- the new workspace title- Returns:
- WorkspaceWizardContext the filled context
-
deepDuplicate
public static WorkspaceWizardContext deepDuplicate(Workspace model, Member author, java.lang.String prefix, java.lang.String title, java.util.Map<java.lang.String,java.lang.String> titleML)
Deep duplicate the Workspace model using given configuration for duplication. Then returns the context with correctly filled binding maps.- Parameters:
model
- the Workspace to duplicateauthor
- the author of all duplicationprefix
- the prefix to use on all duplicated itemstitle
- the new workspace titletitleML
- the multilingual workspace titles- Returns:
- WorkspaceWizardContext the filled context
- Since:
- jcms-9.0.0
-
deepDuplicate
@Deprecated public static WorkspaceWizardContext deepDuplicate(Workspace model, Member author, java.lang.String prefix, java.lang.String title, boolean collaborativeSpace)
Deprecated.Deep duplicate the Workspace model using given configuration for duplication. Then returns the context with correctly filled binding maps.- Parameters:
model
- the Workspace to duplicateauthor
- the author of all duplicationprefix
- the prefix to use on all duplicated itemstitle
- the new workspace titlecollaborativeSpace
- tell if the duplication is to create a collaborative space- Returns:
- WorkspaceWizardContext the filled context
-
deepDuplicate
@Deprecated public static WorkspaceWizardContext deepDuplicate(Workspace model, Member author, java.lang.String prefix, java.lang.String title, java.lang.String wsemail, java.util.List adminList, java.util.Collection typeCollec, java.util.Collection catCollec, java.util.Collection groupCollec, java.util.Collection portalCollec, boolean collaborativeSpace)
Deprecated.Deep duplicate the Workspace model using given configuration for duplication. Then returns the context with correctly filled binding maps.- Parameters:
model
- the Workspace to duplicateauthor
- the author of all duplicationprefix
- the prefix to use on all duplicated itemstitle
- the workspace titlewsemail
- the workspace emailadminList
- a List of workspace administratorstypeCollec
- a Set of classes to define WSTypeEntry to retrieve from modelcatCollec
- Workspace root categories to duplicategroupCollec
- to duplicateportalCollec
- to duplicatecollaborativeSpace
- tell if the duplication is to create a collaborative space- Returns:
- WorkspaceWizardContext the filled context
-
deepDuplicate
public static WorkspaceWizardContext deepDuplicate(Workspace model, Member author, java.lang.String prefix, java.lang.String title, java.util.Map<java.lang.String,java.lang.String> titleML, java.lang.String wsemail, java.util.List adminList, java.util.Collection typeCollec, java.util.Collection catCollec, java.util.Collection groupCollec, java.util.Collection portalCollec, boolean collaborativeSpace)
Deep duplicate the Workspace model using given configuration for duplication. Then returns the context with correctly filled binding maps.- Parameters:
model
- the Workspace to duplicateauthor
- the author of all duplicationprefix
- the prefix to use on all duplicated itemstitle
- the workspace titletitleML
- the multilingual workspace titleswsemail
- the workspace emailadminList
- a List of workspace administratorstypeCollec
- a Set of classes to define WSTypeEntry to retrieve from modelcatCollec
- Workspace root categories to duplicategroupCollec
- to duplicateportalCollec
- to duplicatecollaborativeSpace
- tell if the duplication is to create a collaborative space- Returns:
- WorkspaceWizardContext the filled context
- Since:
- jcms-9.0.0
-
deepDuplicate
@Deprecated public static WorkspaceWizardContext deepDuplicate(Workspace model, Member author, java.lang.String prefix, java.lang.String title, Workspace parent)
Deprecated.Deep duplicate the Workspace model using given configuration for duplication. Then returns the context with correctly filled binding maps.- Parameters:
model
- the Workspace to duplicateauthor
- the author of all duplicationprefix
- the prefix to use on all duplicated itemstitle
- the new workspace titleparent
- the parent workspace- Returns:
- WorkspaceWizardContext the filled context
-
deepDuplicate
@Deprecated public static WorkspaceWizardContext deepDuplicate(Workspace model, Member author, java.lang.String prefix, java.lang.String title, Workspace parent, boolean collaborativeSpace)
Deprecated.Deep duplicate the Workspace model using given configuration for duplication. Then returns the context with correctly filled binding maps.- Parameters:
model
- the Workspace to duplicateauthor
- the author of all duplicationprefix
- the prefix to use on all duplicated itemstitle
- the new workspace titleparent
- the parent workspacecollaborativeSpace
- tell if the duplication is to create a collaborative space- Returns:
- WorkspaceWizardContext the filled context
-
deepDuplicate
public static WorkspaceWizardContext deepDuplicate(Workspace model, Member author, java.lang.String prefix, java.lang.String title, java.util.Map<java.lang.String,java.lang.String> titleML, Workspace parent, boolean collaborativeSpace)
Deep duplicate the Workspace model using given configuration for duplication. Then returns the context with correctly filled binding maps.- Parameters:
model
- the Workspace to duplicateauthor
- the author of all duplicationprefix
- the prefix to use on all duplicated itemstitle
- the new workspace titletitleML
- the multilingual workspace titlesparent
- the parent workspacecollaborativeSpace
- tell if the duplication is to create a collaborative space- Returns:
- WorkspaceWizardContext the filled context
- Since:
- jcms-9.0.0
-
deepDuplicate
@Deprecated public static WorkspaceWizardContext deepDuplicate(Workspace model, Member author, java.lang.String prefix, java.lang.String title, java.lang.String wsemail, java.util.List adminList, java.util.Collection typeCollec, java.util.Collection catCollec, java.util.Collection groupCollec, java.util.Collection portalCollec, Workspace parent, boolean collaborativeSpace)
Deprecated.Deep duplicate the Workspace model using given configuration for duplication. Then returns the context with correctly filled binding maps.- Parameters:
model
- the Workspace to duplicateauthor
- the author of all duplicationprefix
- the prefix to use on all duplicated itemstitle
- the workspace titlewsemail
- the workspace emailadminList
- a List of workspace administratorstypeCollec
- a Set of classes to define WSTypeEntry to retrieve from modelcatCollec
- Workspace root categories to duplicategroupCollec
- to duplicateparent
- the parent workspaceportalCollec
- to duplicatecollaborativeSpace
- tell if the duplication is to create a collaborative space- Returns:
- WorkspaceWizardContext the filled context
-
deepDuplicate
public static WorkspaceWizardContext deepDuplicate(Workspace model, Member author, java.lang.String prefix, java.lang.String title, java.util.Map<java.lang.String,java.lang.String> titleML, java.lang.String wsemail, java.util.List adminList, java.util.Collection typeCollec, java.util.Collection catCollec, java.util.Collection groupCollec, java.util.Collection portalCollec, Workspace parent, boolean collaborativeSpace)
Deep duplicate the Workspace model using given configuration for duplication. Then returns the context with correctly filled binding maps.- Parameters:
model
- the Workspace to duplicateauthor
- the author of all duplicationprefix
- the prefix to use on all duplicated itemstitle
- the workspace titletitleML
- the multilingual workspace titleswsemail
- the workspace emailadminList
- a List of workspace administratorstypeCollec
- a Set of classes to define WSTypeEntry to retrieve from modelcatCollec
- Workspace root categories to duplicategroupCollec
- to duplicateparent
- the parent workspaceportalCollec
- to duplicatecollaborativeSpace
- tell if the duplication is to create a collaborative space- Returns:
- WorkspaceWizardContext the filled context
- Since:
- jcms-9.0.0
-
deepDuplicate
@Deprecated public static WorkspaceWizardContext deepDuplicate(Workspace model, Member author, java.lang.String prefix, java.lang.String title, java.lang.String wsemail, java.util.List adminList, java.util.Collection typeCollec, Category[] categories, Group[] groups, PortalInterface[] portals, Workspace parent, boolean collaborativeSpace)
Deprecated.Deep duplicate the Workspace model using given configuration for duplication. Then returns the context with correctly filled binding maps.- Parameters:
model
- the Workspace to duplicateauthor
- the author of all duplicationprefix
- the prefix to use on all duplicated itemstitle
- the workspace titlewsemail
- the workspace emailadminList
- a List of workspace administratorstypeCollec
- a Set of classes to define WSTypeEntry to retrieve from modelcategories
- Workspace root categories to duplicategroups
- to duplicateportals
- to duplicateparent
- the parent workspacecollaborativeSpace
- tell if the duplication is to create a collaborative space- Returns:
- WorkspaceWizardContext the filled context
-
deepDuplicate
public static WorkspaceWizardContext deepDuplicate(Workspace model, Member author, java.lang.String prefix, java.lang.String title, java.util.Map<java.lang.String,java.lang.String> titleML, java.lang.String wsemail, java.util.List adminList, java.util.Collection typeCollec, Category[] categories, Group[] groups, PortalInterface[] portals, Workspace parent, boolean collaborativeSpace)
Deep duplicate the Workspace model using given configuration for duplication. Then returns the context with correctly filled binding maps.- Parameters:
model
- the Workspace to duplicateauthor
- the author of all duplicationprefix
- the prefix to use on all duplicated itemstitle
- the workspace titletitleML
- the multilingual workspace titleswsemail
- the workspace emailadminList
- a List of workspace administratorstypeCollec
- a Set of classes to define WSTypeEntry to retrieve from modelcategories
- Workspace root categories to duplicategroups
- to duplicateportals
- to duplicateparent
- the parent workspacecollaborativeSpace
- tell if the duplication is to create a collaborative space- Returns:
- WorkspaceWizardContext the filled context
- Since:
- jcms-9.0.0
-
deepDuplicate
public static WorkspaceWizardContext deepDuplicate(WorkspaceWizardContext context)
Deep duplicate the Workspace model referenced by given WorkspaceWizardContext using context configuration for duplication. Then returns the context with correctly filled binding maps.1. Create Workspace (Check create) 2.1 Create Category (no checks) => Map with previous categories 2.2 Update Workspace with categories (1) 3.1 Create Groups (no checks) => Link with workspace (1) and Map with previous groups 3.2 Update Groups (no checks) => Link with parents group (3.1) 3.3 Update Category (no checks) => Link with groups (3.1) for rights 4.1 Create PortalElement (no checks) => Map with previous portal element, workspace (1), groups (3.1), categories (1) 4.2 Recursive duplicate (no checks) 5.1 Create WSTypeEntry (no checks) => Link with categories (2), groups (3.1) 5.2 Create WKRole (not stored) => Link with groups (3.1) 5.3 Update Workspace (no checks) => Link with (5.1) and (5.2)
- Parameters:
context
- the WorkspaceWizardContext- Returns:
- WorkspaceWizardContext the filled context
-
createDuplicateCategories
protected static void createDuplicateCategories(WorkspaceWizardContext context)
Duplicate all categories specified for the given WizardContext. Fills the WizardContext Category Map to retrieve binding old/new category- Parameters:
context
- the WizardContext
-
createWorkspace
protected static boolean createWorkspace(WorkspaceWizardContext context)
Creates the workspace instance from the given model- Parameters:
context
- the WizardContext- Returns:
- true when creation succeeds
-
createGroups
protected static void createGroups(WorkspaceWizardContext context)
Duplicate all groups specified for the given WizardContext. Fills the WizardContext Group Map to retrieve binding old/new groups- Parameters:
context
- the WizardContext
-
createPortals
protected static void createPortals(WorkspaceWizardContext context)
Duplicate all portals specified for the given WizardContext. Fills the WizardContext Portal Map to retrieve binding old/new portals- Parameters:
context
- the WizardContext
-
createOtherPortlets
protected static void createOtherPortlets(WorkspaceWizardContext context)
Duplicate remaining portlets that have not yet been duplicated from portals, and which are specified for the given WizardContext. Fills the WizardContext PublicationMap to retrieve binding old/new portlets.- Parameters:
context
- the WizardContext- Since:
- jcms-10.0.3
-
updateWorkspace
protected static void updateWorkspace(WorkspaceWizardContext context)
Update duplicated Workspace- Duplicate WSTypeEntry
- Duplicate WKRoles
- Instance Workflow Groups
- Parameters:
context
- the WizardContext
-
getNonCollaborativeWorkspaceCount
public static int getNonCollaborativeWorkspaceCount()
Returns the count of workspaces which are not used as CollaborativeSpace.- Returns:
- the count of workspaces which are not used as CollaborativeSpace.
- Since:
- jcms-6.0.0
-
getCollaborativeSpaceCount
public static int getCollaborativeSpaceCount()
Returns the count of workspaces used as CollaborativeSpace.- Returns:
- the count of workspaces used as CollaborativeSpace.
- Since:
- jcms-6.0.0
-
getAllIncomingMailLocalPart
public static java.util.Collection<java.lang.String> getAllIncomingMailLocalPart()
- Returns:
- all existing Workspace's incoming mail local parts.
- Since:
- jcms-9.0.0
-
getIncomingMailLocalPartWorkspace
public static Workspace getIncomingMailLocalPartWorkspace(java.lang.String localPart)
- Parameters:
localPart
- the local part to retrieve the associated Workspace.- Returns:
- the Workspace using the given local part, if any. Null otherwise.
- Since:
- jcms-9.0.0
-
getIncomingMailPattern
public static java.lang.String getIncomingMailPattern(Workspace ws)
Computes the incoming mail pattern given the Workspace.
Example:
Given a Workspace which incoming mail local part islocal-part
and site incoming mail suffix is@jcms.company.com
, the output will be:local-part\+.*@jcms.company.com
- Parameters:
ws
- the Workspace to compute its incoming mail pattern.- Returns:
- an incoming mail pattern or null;
- Since:
- jcms-9.0.0
-
initIncomingMails
public static void initIncomingMails()
If site incoming mail is enabled, initializes Workspaces' incoming mail Patterns.- Since:
- jcms-9.0.0
-
updateIncomingMailPattern
public static void updateIncomingMailPattern(Workspace workspace, Workspace oldWorkspace)
Updates given Workspace incoming Mail Pattern inIncomingMailListener
.
IfoldWs
is not null, checks if localPart changed.- Parameters:
workspace
- the Workspace after update (must be null in delete case)oldWorkspace
- the Workspace before update (may be null in create case)- Since:
- jcms-9.0.0
- See Also:
IncomingMailListener.addMailPattern(String, IncomingMailCriteria)
-
getSearchedWorkspaceSet
public static java.util.Set<Workspace> getSearchedWorkspaceSet(Member mbr, java.lang.String userLang, java.lang.String query, boolean withPortal, boolean showModel)
Returns the set of workspace which :- Matches the query
- Is a model the member can work on
- Has a portal (If withPortal is set to true)
- And the member can read the portal
- Parameters:
mbr
- theMember
userLang
- the user languagequery
- workspace title to search forwithPortal
- if set to true, only workspaces with a portal will be added to the setshowModel
- if set to true, models the member can work on will be displayed. If false, models will be removed from set- Returns:
- a
Set
ofWorkspace
- Since:
- jcms-10.0.0
-
getOtherWorkspaceSet
public static java.util.Set<Workspace> getOtherWorkspaceSet(Member member, java.lang.String userLang, java.util.Set<Workspace> workspaceToExcludeSet, boolean belongsToWorkspace, boolean isWorker, boolean withPortal)
- Parameters:
member
- theMember
userLang
- the user languageworkspaceToExcludeSet
- the Set ofWorkspace
to exclude from setbelongsToWorkspace
- weither to include only space attendees or notisWorker
- weither to include only space workers or notwithPortal
- weither to include only space with an accessible Portal or not- Returns:
- the set of workspace for given member without the set of excluded workspace
- Since:
- jcms-10.0.0
-
-