public class ProjectManager extends AbstractLogEnabled implements Serviceable, Component, Contextualizable, PluginAware
Modifier and Type | Field and Description |
---|---|
private static String |
__PROJECTS_PLACES_PROPERTY
Constants for places metadata
|
private static String |
__PROJECTS_ROOT_NODE_NAME
The name of the projects root node
|
private static String |
__PROJECTS_ROOT_NODE_TYPE
The type of the projects root node
|
private static String |
__PROJECTS_TAGS_PROPERTY
Constants for tags metadata
|
private static String |
__WORKSPACES_PLUGIN_NODE_NAME
Workspaces plugin node name
|
private static String |
__WORKSPACES_PLUGIN_NODE_TYPE
Workspaces plugin node name
|
protected Context |
_context
Avalon context
|
private CurrentUserProvider |
_currentUserProvider |
protected I18nUtils |
_i18nUtils
The i18n utils.
|
protected WorkspaceModuleExtensionPoint |
_moduleManagerEP
Module Managers EP
|
private ObservationManager |
_observationManager |
private String |
_pluginName |
private ProjectMemberManager |
_projectMemberManager |
private ProjectMemberManager |
_projectMembers |
private ProjectRightHelper |
_projectRightHelper |
protected AmetysObjectResolver |
_resolver
Ametys object resolver
|
protected SiteConfigurationExtensionPoint |
_siteConfiguration
Site configuration EP
|
protected SiteDAO |
_siteDao
Site DAO
|
protected SiteManager |
_siteManager
Site manager
|
static String |
ROLE
Avalon Role
|
Constructor and Description |
---|
ProjectManager() |
Modifier and Type | Method and Description |
---|---|
protected Site |
_createProjectWorkspace(Project project,
List<String> errors)
Create the project workspace for a given project.
|
private List<Object> |
_filterProjectTree(List<Object> projectTree,
Map<String,Object> filters,
String categoryId,
int depth,
int maxDepth) |
private List<Object> |
_filterProjectTreeCategory(Map<String,Object> categoryData,
List<Object> filteredProjectTree,
Map<String,Object> filters,
boolean isCategoryInFilters,
int depth,
int maxDepth) |
private <A extends AmetysObject> |
_getOrCreateObject(ModifiableTraversableAmetysObject parent,
String name,
String type)
Utility method to get or create an ametys object
|
private void |
_projectTreeAccumulator(List<Map<String,Object>> projectTree,
AmetysObject node,
int depth,
int maxDepth,
boolean includeProjects,
boolean memberOnly) |
private void |
_projectTreeNodeAccumulator(List<Object> projectTree,
AmetysObject node,
int depth,
int maxDepth,
boolean includeProjects,
boolean memberOnly) |
private void |
_removeDescendants(AmetysObject object,
List<Map<String,String>> deletedSitesInfo)
Remove descendant ametys objects.
|
void |
activateModules(Project project,
Set<String> moduleIds)
Activate the list of module of the project
|
void |
addPlaces(Collection<String> newPlaces)
Add project's places
|
void |
addTags(Collection<String> newTags)
Add project's tags
|
void |
contextualize(Context context) |
ProjectCategory |
createCategory(ModifiableTraversableAmetysObject parent,
String title,
String description)
Create a project category
|
String |
createCategory(String title,
String description)
Create a project category from the projects root node.
|
String |
createCategory(String parentId,
String title,
String description)
Create a project category
|
Project |
createProject(ModifiableTraversableAmetysObject parent,
String name,
String title,
String description,
String mailingList,
String inscriptionStatus,
String defaultProfileId,
Set<String> modulesIds,
List<String> errors)
Create a project
|
Map<String,Object> |
createProject(String name,
String title,
String description,
String mailingList,
String inscriptionStatus,
String defaultProfileId)
Create a project from the projects root node.
|
Map<String,Object> |
createProject(String parentId,
String name,
String title,
String description,
String mailingList,
String inscriptionStatus,
String defaultProfileId)
Create a project
|
String |
createProject(String parentId,
String name,
String title,
String description,
String mailingList,
String inscriptionStatus,
String defaultProfileId,
Set<String> modulesIds,
List<String> errors)
Create a project
|
void |
deactivateModules(Project project,
Set<String> moduleIds)
Remove the explorer root node of the project module, remove all events
related to that module and set it to deactivated
|
List<Map<String,String>> |
deleteCategory(List<ProjectCategory> categories)
Delete a list of project categories.
|
List<Map<String,String>> |
deleteCategory(ProjectCategory category)
Delete a list of project category
|
Map<String,Object> |
deleteCategoryByIds(List<String> ids)
Delete a list of project categories.
|
List<Map<String,String>> |
deleteProject(List<Project> projects)
Delete a project.
|
List<Map<String,String>> |
deleteProject(Project project)
Delete a project and its sites
|
Map<String,Object> |
deleteProjectsByIds(List<String> ids)
Delete a list of project.
|
void |
editCategory(ProjectCategory category,
String title,
String description)
Edit a project category
|
void |
editCategory(String id,
String title,
String description)
Edit a project category
|
void |
editProject(Project project,
String title,
String description,
String mailingList,
String inscriptionStatus,
String defaultProfileId)
Edit a project
|
void |
editProject(String id,
String title,
String description,
String mailingList,
String inscriptionStatus,
String defaultProfileId)
Edit a project
|
Map<String,Object> |
getCategoryProperties(ProjectCategory projectCategory)
Retrieves the standard information of a project category
|
Map<String,Object> |
getCategoryProperties(String categoryId)
Retrieves the standard information of a project category
|
AmetysObjectIterable<Page> |
getModulePages(Project project,
String moduleId,
String language)
Retrieves the page of the module for all available languages
|
List<WorkspaceModule> |
getModules(Project project)
Get the list of activated modules for a project
|
Project |
getParentProject(AmetysObject object)
Get the project of an ametys object inside a project.
|
Project |
getParentProject(String id)
Get the project of an ametys object inside a project.
|
List<String> |
getPlaces()
Get the project's places
|
Project |
getProject(String name)
Retrieves a project by its name
|
AmetysObjectIterable<Page> |
getProjectDashboardPage(Project project,
String language)
Get the dashboard page in the site of a given project
|
Collection<String> |
getProjectNames()
Retrieves the project names
|
AmetysObjectIterable<Page> |
getProjectPages(Project project,
String tagName,
String language)
Get a page in the site of a given project with a specific tag
|
Collection<String> |
getProjectPaths()
Retrieves the project paths of all projects.
|
Map<String,Object> |
getProjectProfiles()
Get the list of profiles configured for the workspaces' projects
|
Map<String,Object> |
getProjectProperties(Project project)
Retrieves the standard information of a project
|
Map<String,Object> |
getProjectProperties(String projectId)
Retrieves the standard information of a project
|
AmetysObjectIterable<Project> |
getProjects()
Retrieves all projects
|
List<Map<String,String>> |
getProjectsData()
Retrieves the mapping of all the projects name with their title (regarless user rights)
|
List<Project> |
getProjectsForSite(Site site)
Get the list of project for a given site
|
List<String> |
getProjectsForSite(String siteName)
Get the list of project names for a given site
|
ModifiableTraversableAmetysObject |
getProjectsRoot()
Return the root for projects
The root node will be created if necessary
|
List<Map<String,Object>> |
getProjectTree(String treeRootId,
int maxDepth,
boolean includeProjects,
boolean memberOnly,
Map<String,Object> contextOptions)
Get the tree of a project which contains information about the projects
and categories in the tree.
|
List<Map<String,Object>> |
getProjectTree(String treeRootId,
int maxDepth,
Map<String,Object> contextOptions)
Get the tree of a project which contains information about the projects
and categories in the tree.
|
List<Object> |
getProjectTreeNodes(String treeRootId,
int maxDepth)
Get the tree of a project.
|
List<Object> |
getProjectTreeNodes(String treeRootId,
int maxDepth,
boolean includeProjects,
boolean memberOnly)
Get the tree of a project.
|
List<Object> |
getProjectTreeNodes(String treeRootId,
int maxDepth,
int maxResult,
boolean includeProjects,
boolean memberOnly,
List<String> filterCategories)
Get the tree of a project.
|
List<String> |
getTags()
Get the project's tags
|
List<Project> |
getUserProjects(UserIdentity user)
Get the user's projects
|
List<Map<String,String>> |
getUserProjectsData()
Retrieves the mapping of all the projects name with their title on which the current user has access
|
boolean |
hasProject(String projectName)
Returns true if the given project exists.
|
void |
initializeModulesSitemap(Project project,
Sitemap sitemap)
Initialize the sitemap with the active module of the project
|
boolean |
isCategoryInFilters(String categoryId,
List<String> filterCategories,
boolean includeProjects)
Test if a category child is contained in the list of filters
|
boolean |
isModuleActivated(Project project,
String moduleId)
Determines if a module is activated
|
Map<String,Object> |
moveProjectTreeNode(String nodeId,
String targetId)
Move a node of the project tree into another node.
|
Map<String,Object> |
moveProjectTreeNodeObject(JCRAmetysObject objectNode,
JCRTraversableAmetysObject targetNode)
Move a node of the project tree into another node.
|
void |
service(ServiceManager manager) |
void |
setPlaces(List<String> places)
Set the places
|
void |
setPluginInfo(String pluginName,
String featureName,
String id)
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level. |
void |
setTags(List<String> tags)
Set the tags
|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
private static final String __WORKSPACES_PLUGIN_NODE_NAME
private static final String __WORKSPACES_PLUGIN_NODE_TYPE
private static final String __PROJECTS_ROOT_NODE_NAME
private static final String __PROJECTS_ROOT_NODE_TYPE
private static final String __PROJECTS_TAGS_PROPERTY
private static final String __PROJECTS_PLACES_PROPERTY
protected AmetysObjectResolver _resolver
protected I18nUtils _i18nUtils
protected SiteManager _siteManager
protected SiteConfigurationExtensionPoint _siteConfiguration
protected WorkspaceModuleExtensionPoint _moduleManagerEP
private ObservationManager _observationManager
private CurrentUserProvider _currentUserProvider
private ProjectMemberManager _projectMembers
private ProjectMemberManager _projectMemberManager
private String _pluginName
private ProjectRightHelper _projectRightHelper
public ProjectManager()
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public void setPluginInfo(String pluginName, String featureName, String id)
PluginAware
setPluginInfo
in interface PluginAware
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this componentpublic AmetysObjectIterable<Project> getProjects()
public Project getProject(String name)
name
- The project namenull
if not foundpublic List<Project> getUserProjects(UserIdentity user)
user
- the userpublic boolean hasProject(String projectName)
projectName
- the project name.public List<Map<String,String>> getUserProjectsData()
public List<Map<String,String>> getProjectsData()
public Collection<String> getProjectNames()
public Collection<String> getProjectPaths()
public ModifiableTraversableAmetysObject getProjectsRoot()
public List<Map<String,Object>> getProjectTree(String treeRootId, int maxDepth, Map<String,Object> contextOptions)
treeRootId
- The desired root node of the treemaxDepth
- The maximal depth of the tree. Set to a value of zero or
less to get the whole tree.contextOptions
- An optional map of context options. Valid context
options are: "user", which holds an user identity, the project
tree will be filtered given that user rights.public List<Map<String,Object>> getProjectTree(String treeRootId, int maxDepth, boolean includeProjects, boolean memberOnly, Map<String,Object> contextOptions)
treeRootId
- The desired root node of the treemaxDepth
- The maximal depth of the tree. Set to a value of zero or
less to get the whole tree.includeProjects
- False to only return the categories tree.memberOnly
- Only return projects for which the current user is a membercontextOptions
- An optional map of context options. Valid context
options are: "user", which holds an user identity, the project
tree will be filtered given that user rights.private void _projectTreeAccumulator(List<Map<String,Object>> projectTree, AmetysObject node, int depth, int maxDepth, boolean includeProjects, boolean memberOnly)
public Map<String,Object> getProjectProperties(String projectId)
projectId
- Identifier of the projectpublic Map<String,Object> getProjectProperties(Project project)
project
- The projectpublic List<Object> getProjectTreeNodes(String treeRootId, int maxDepth)
treeRootId
- The desired root node of the treemaxDepth
- The maximal depth of the tree. Set to a value of zero or
less to get the whole tree.public List<Object> getProjectTreeNodes(String treeRootId, int maxDepth, boolean includeProjects, boolean memberOnly)
treeRootId
- The desired root node of the treemaxDepth
- The maximal depth of the tree. Set to a value of zero or
less to get the whole tree.includeProjects
- False to only return the categories tree.memberOnly
- Only return projects for which the current user is a memberpublic List<Object> getProjectTreeNodes(String treeRootId, int maxDepth, int maxResult, boolean includeProjects, boolean memberOnly, List<String> filterCategories)
treeRootId
- The desired root node of the treemaxDepth
- The maximal depth of the tree. Set to a value of zero or
less to get the whole tree.maxResult
- Limit the number of projects returnedincludeProjects
- False to only return the categories tree.memberOnly
- Only return projects for which the current user is a memberfilterCategories
- The list of categories to filter. Can be null to ignoreprivate void _projectTreeNodeAccumulator(List<Object> projectTree, AmetysObject node, int depth, int maxDepth, boolean includeProjects, boolean memberOnly)
private List<Object> _filterProjectTree(List<Object> projectTree, Map<String,Object> filters, String categoryId, int depth, int maxDepth)
private List<Object> _filterProjectTreeCategory(Map<String,Object> categoryData, List<Object> filteredProjectTree, Map<String,Object> filters, boolean isCategoryInFilters, int depth, int maxDepth)
public boolean isCategoryInFilters(String categoryId, List<String> filterCategories, boolean includeProjects)
categoryId
- The category idfilterCategories
- The list of category id that one of the children must matchincludeProjects
- True to test filters on all category children, false to only test on sub-categoriespublic Map<String,Object> createProject(String name, String title, String description, String mailingList, String inscriptionStatus, String defaultProfileId)
name
- The project nametitle
- The project titledescription
- The project descriptionmailingList
- Project mailing listinscriptionStatus
- The inscription status of the projectdefaultProfileId
- The default profile for new memberspublic Map<String,Object> createProject(String parentId, String name, String title, String description, String mailingList, String inscriptionStatus, String defaultProfileId)
parentId
- Identifier of the parent of the project to createname
- The project nametitle
- The project titledescription
- The project descriptionmailingList
- Project mailing listinscriptionStatus
- The inscription status of the projectdefaultProfileId
- The default profile for new memberspublic String createProject(String parentId, String name, String title, String description, String mailingList, String inscriptionStatus, String defaultProfileId, Set<String> modulesIds, List<String> errors)
parentId
- Identifier of the parent of the project to createname
- The project nametitle
- The project titledescription
- The project descriptionmailingList
- Project mailing listinscriptionStatus
- The inscription status of the projectdefaultProfileId
- The default profile for new membersmodulesIds
- The list of modules to activate. Can be null to activate all moduleserrors
- A list that will be populated with the encountered errors. If null, errors will not be tracked.public Project createProject(ModifiableTraversableAmetysObject parent, String name, String title, String description, String mailingList, String inscriptionStatus, String defaultProfileId, Set<String> modulesIds, List<String> errors)
parent
- the parent of the project to createname
- The project nametitle
- The project titledescription
- The project descriptionmailingList
- Project mailing listinscriptionStatus
- The inscription status of the projectdefaultProfileId
- The default profile for new membersmodulesIds
- The list of modules to activate. Can be null to activate all moduleserrors
- A list that will be populated with the encountered errors. If null, errors will not be tracked.public void editProject(String id, String title, String description, String mailingList, String inscriptionStatus, String defaultProfileId)
id
- The project identifiertitle
- The title to setdescription
- The description to setmailingList
- Project mailing listinscriptionStatus
- The inscription status of the projectdefaultProfileId
- The default profile for new memberspublic void editProject(Project project, String title, String description, String mailingList, String inscriptionStatus, String defaultProfileId)
project
- The projecttitle
- The title to setdescription
- The description to setmailingList
- Project mailing listinscriptionStatus
- The inscription status of the projectdefaultProfileId
- The default profile for new memberspublic Map<String,Object> deleteProjectsByIds(List<String> ids)
ids
- The ids of projects to deletepublic List<Map<String,String>> deleteProject(List<Project> projects)
projects
- The list of projects to deletepublic List<Map<String,String>> deleteProject(Project project)
project
- The project to deletepublic Map<String,Object> getCategoryProperties(String categoryId)
categoryId
- Identifier of the project categorypublic Map<String,Object> getCategoryProperties(ProjectCategory projectCategory)
projectCategory
- The project categorypublic String createCategory(String title, String description)
title
- The category titledescription
- The category descriptionpublic String createCategory(String parentId, String title, String description)
parentId
- Identifier of the parent of the category to createtitle
- The category titledescription
- The category descriptionpublic ProjectCategory createCategory(ModifiableTraversableAmetysObject parent, String title, String description)
parent
- the parent of the category to createtitle
- The category titledescription
- The category descriptionpublic void editCategory(String id, String title, String description)
id
- The category identifiertitle
- The title to setdescription
- The description to setpublic void editCategory(ProjectCategory category, String title, String description)
category
- The project categorytitle
- The title to setdescription
- The description to setpublic Map<String,Object> deleteCategoryByIds(List<String> ids)
ids
- The ids of categories to deletepublic List<Map<String,String>> deleteCategory(List<ProjectCategory> categories)
categories
- The list of categories to deletepublic List<Map<String,String>> deleteCategory(ProjectCategory category)
category
- The category to deleteprivate void _removeDescendants(AmetysObject object, List<Map<String,String>> deletedSitesInfo)
object
- The project or category for which descendants must be removeddeletedSitesInfo
- list of deleted sites to be populated (each list entry contains a data map with
the id and the name of the delete site).public Map<String,Object> moveProjectTreeNode(String nodeId, String targetId) throws RepositoryException
nodeId
- The identifier of the node to movetargetId
- Identifier of the category which is the target of the move operation. Can be null if the target is the projects root node.RepositoryException
- if a repository error occurs.public Map<String,Object> moveProjectTreeNodeObject(JCRAmetysObject objectNode, JCRTraversableAmetysObject targetNode) throws RepositoryException
objectNode
- The node to move (must be a project or a category)targetNode
- The category which is the target of the move operation. Can be null if the target is the projects root node.RepositoryException
- if a repository error occurs.private <A extends AmetysObject> A _getOrCreateObject(ModifiableTraversableAmetysObject parent, String name, String type) throws AmetysRepositoryException
A
- A sub class of AmetysObjectparent
- The parent objectname
- The ametys object nametype
- The ametys object typeAmetysRepositoryException
- if an repository error occurspublic Project getParentProject(String id)
id
- The identifier of the ametys objectpublic Project getParentProject(AmetysObject object)
object
- The ametys objectpublic List<String> getProjectsForSite(String siteName)
siteName
- The site namepublic List<Project> getProjectsForSite(Site site)
site
- The siteprotected Site _createProjectWorkspace(Project project, List<String> errors)
project
- The project for which the workspace must be createderrors
- A list of possible errors to populate. Can be null if the caller is not interested in error tracking.public void addTags(Collection<String> newTags)
newTags
- The new tags to addpublic void addPlaces(Collection<String> newPlaces)
newPlaces
- The new places to addpublic void setPlaces(List<String> places)
places
- The places to setpublic List<WorkspaceModule> getModules(Project project)
project
- The projectpublic AmetysObjectIterable<Page> getModulePages(Project project, String moduleId, String language)
project
- The projectmoduleId
- The project module idlanguage
- the sitemap language or null
for all sitemap languages.public AmetysObjectIterable<Page> getProjectPages(Project project, String tagName, String language)
project
- The projecttagName
- The name of the taglanguage
- the sitemap language or null
for all sitemap languages.public AmetysObjectIterable<Page> getProjectDashboardPage(Project project, String language)
project
- The projectlanguage
- the sitemap language or null
for all sitemap languages.public void activateModules(Project project, Set<String> moduleIds)
project
- The projectmoduleIds
- The list of modules. Can be null to activate all modulespublic void initializeModulesSitemap(Project project, Sitemap sitemap)
project
- The projectsitemap
- The sitemappublic boolean isModuleActivated(Project project, String moduleId)
project
- The projectmoduleId
- The id of modulepublic void deactivateModules(Project project, Set<String> moduleIds)
project
- The projectmoduleIds
- The id of module to activatepublic Map<String,Object> getProjectProfiles()