Class ProjectsCatalogueManager
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.plugins.workspaces.project.ProjectsCatalogueManager
-
- All Implemented Interfaces:
Component
,Contextualizable
,LogEnabled
,Serviceable
public class ProjectsCatalogueManager extends AbstractLogEnabled implements Serviceable, Component, Contextualizable
Manager for the Projects Catalogue service
-
-
Field Summary
Fields Modifier and Type Field Description private static String[]
__ALLOWED_FORM_DATA
List of allowed field received from the frontprivate CategoryHelper
_categoryHelper
protected CategoryProviderExtensionPoint
_categoryProviderEP
The extension point for project's categoriesprotected Context
_context
The avalon contextprotected CurrentUserProvider
_currentUserProvider
Current user providerprotected GroupDirectoryContextHelper
_groupDirectoryContextHelper
Helper for group directory's contextprotected I18nUtils
_i18nUtils
Utils for i18nprotected KeywordProviderExtensionPoint
_keywordProviderEP
The extension point for project's keywordsprivate KeywordsDAO
_keywordsDAO
protected LanguagesManager
_languagesManager
The language managerprotected WorkspaceModuleExtensionPoint
_moduleManagerEP
The extension point for workspace's modulesprotected ObservationManager
_observationManager
The observation managerprotected PopulationContextHelper
_populationContextHelper
Helper for user populationprotected ProfileAssignmentStorageExtensionPoint
_profileAssignmentStorageExtensionPoint
The extension point for profiles' storageprotected ProjectManager
_projectManager
The project managerprotected ProjectMemberManager
_projectMemberManager
The project members' managerprivate ProjectMemberManager
_projectMembers
protected ProjectRightHelper
_projectRightHelper
Helper for project's rightsprotected ProjectTagProviderExtensionPoint
_projectTagProviderEP
The extension point for project's tagsprotected AmetysObjectResolver
_resolver
Ametys Object Resolverprotected RightManager
_rightManager
The right managerprotected SiteConfigurationManager
_siteConfigurationManager
The site's configuration managerprotected SiteDAO
_siteDAO
The site daoprotected SourceResolver
_sourceResolver
The source resolverprivate UserHelper
_userHelper
protected UserManager
_userManager
The user managerstatic Set<String>
DEFAULT_MODULES
The identifier of modules that are always activestatic String
ROLE
Avalon Role
-
Constructor Summary
Constructors Constructor Description ProjectsCatalogueManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
_assignManagers(Project project, List<String> managers, String defaultManagerProfile)
private void
_assignPopulations(Project project, Site catalogSite)
private Pair<List<String>,List<Map<String,Object>>>
_createMissingKeywords(List<Object> keywords)
private Map<String,Object>
_detailedMyProject2json(Project project)
private String
_findName(String title)
private Object
_getIllustrationSource(Object illustration)
private void
_sendAskToJoinMail(String message, Project project, UserIdentity joiningUser)
private void
_setIllustration(Site site, Object illustration)
private void
_updateModules(Project project, Set<String> modules)
private void
_updateSiteInfos(Project project, String urlPrefix, String skin, String forceAcceptCookie, Site catalogSite, Object illustration, String language)
private Set<String>
_withDefaultModules(List<String> modules)
Map<String,Object>
askToJoinProject(String projectId, String message)
Send a demand to join a project to the project's manager, if the project's inscriptions are moderatedvoid
contextualize(Context context)
Map<String,Object>
createProject(String zoneItemId, String title, String description, Object illustration, String category, List<Object> keywords, Integer visibility, String defaultProfile, String language, List<String> managers, List<String> modules)
Create a projectMap<String,Object>
deleteProject(String projectId)
Delete a projectMap<String,Object>
detailedProject2json(Project project)
Transform aProject
into a json mapMap<String,Object>
editProject(String projectId, String title, String description, Object illustration, String category, List<Object> keywords, Integer visibility, String defaultProfile, List<String> managers, List<String> modules)
Edit an existing projectprotected String
getAddUserUrl(Project project, UserIdentity user)
Get the absolute url to add a user to a projectprotected String[]
getAllowedFormData()
Get the list of allowed data in the formMap<String,Object>
getUserAndPublicProjects()
Callable to get projects of the user and the public projects he can subscribe.List<Map<String,Object>>
getUserProjects()
Callable to get projects of the user.Map<String,Object>
joinProject(String projectId)
Add the current user to the project, if the project's inscriptions are openedvoid
saxProject(ContentHandler contentHandler, Project project)
SAX a projectvoid
service(ServiceManager manager)
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
DEFAULT_MODULES
public static final Set<String> DEFAULT_MODULES
The identifier of modules that are always active
-
__ALLOWED_FORM_DATA
private static final String[] __ALLOWED_FORM_DATA
List of allowed field received from the front
-
_resolver
protected AmetysObjectResolver _resolver
Ametys Object Resolver
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
Current user provider
-
_projectMemberManager
protected ProjectMemberManager _projectMemberManager
The project members' manager
-
_rightManager
protected RightManager _rightManager
The right manager
-
_projectManager
protected ProjectManager _projectManager
The project manager
-
_projectRightHelper
protected ProjectRightHelper _projectRightHelper
Helper for project's rights
-
_languagesManager
protected LanguagesManager _languagesManager
The language manager
-
_sourceResolver
protected SourceResolver _sourceResolver
The source resolver
-
_siteConfigurationManager
protected SiteConfigurationManager _siteConfigurationManager
The site's configuration manager
-
_populationContextHelper
protected PopulationContextHelper _populationContextHelper
Helper for user population
-
_moduleManagerEP
protected WorkspaceModuleExtensionPoint _moduleManagerEP
The extension point for workspace's modules
-
_profileAssignmentStorageExtensionPoint
protected ProfileAssignmentStorageExtensionPoint _profileAssignmentStorageExtensionPoint
The extension point for profiles' storage
-
_userManager
protected UserManager _userManager
The user manager
-
_i18nUtils
protected I18nUtils _i18nUtils
Utils for i18n
-
_observationManager
protected ObservationManager _observationManager
The observation manager
-
_groupDirectoryContextHelper
protected GroupDirectoryContextHelper _groupDirectoryContextHelper
Helper for group directory's context
-
_projectTagProviderEP
protected ProjectTagProviderExtensionPoint _projectTagProviderEP
The extension point for project's tags
-
_categoryProviderEP
protected CategoryProviderExtensionPoint _categoryProviderEP
The extension point for project's categories
-
_keywordProviderEP
protected KeywordProviderExtensionPoint _keywordProviderEP
The extension point for project's keywords
-
_categoryHelper
private CategoryHelper _categoryHelper
-
_projectMembers
private ProjectMemberManager _projectMembers
-
_userHelper
private UserHelper _userHelper
-
_keywordsDAO
private KeywordsDAO _keywordsDAO
-
-
Constructor Detail
-
ProjectsCatalogueManager
public ProjectsCatalogueManager()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
_createMissingKeywords
private Pair<List<String>,List<Map<String,Object>>> _createMissingKeywords(List<Object> keywords) throws IllegalAccessException
- Throws:
IllegalAccessException
-
createProject
public Map<String,Object> createProject(String zoneItemId, String title, String description, Object illustration, String category, List<Object> keywords, Integer visibility, String defaultProfile, String language, List<String> managers, List<String> modules) throws IllegalAccessException
Create a project- Parameters:
zoneItemId
- The id of the zoneitem holding the catalog servicetitle
- The titledescription
- The description (can be empty)illustration
- The illustration (can be a File or a local path)category
- The categorykeywords
- The project keywordsvisibility
- The visibilitydefaultProfile
- For public projects, profile for self registered userslanguage
- The language codemanagers
- The managers urlmodules
- The selected modules- Returns:
- Information about the new project
- Throws:
IllegalAccessException
- If user has no right to create tags and ask to
-
_assignPopulations
private void _assignPopulations(Project project, Site catalogSite)
-
_assignManagers
private void _assignManagers(Project project, List<String> managers, String defaultManagerProfile)
-
_updateSiteInfos
private void _updateSiteInfos(Project project, String urlPrefix, String skin, String forceAcceptCookie, Site catalogSite, Object illustration, String language)
-
_setIllustration
private void _setIllustration(Site site, Object illustration)
-
_getIllustrationSource
private Object _getIllustrationSource(Object illustration) throws IOException
- Throws:
IOException
-
_withDefaultModules
private Set<String> _withDefaultModules(List<String> modules)
-
editProject
public Map<String,Object> editProject(String projectId, String title, String description, Object illustration, String category, List<Object> keywords, Integer visibility, String defaultProfile, List<String> managers, List<String> modules) throws IllegalAccessException
Edit an existing project- Parameters:
projectId
- The id of the projecttitle
- New titledescription
- New descriptionillustration
- New illustrationcategory
- New categorykeywords
- The project keywordsvisibility
- New visibilitydefaultProfile
- New default profilemanagers
- New managersmodules
- New modules- Returns:
- The success map with project description
- Throws:
IllegalAccessException
- if user has not the convenient rights
-
_updateModules
private void _updateModules(Project project, Set<String> modules)
-
deleteProject
public Map<String,Object> deleteProject(String projectId) throws IllegalAccessException
Delete a project- Parameters:
projectId
- The project id- Returns:
- The result
- Throws:
IllegalAccessException
- if an error occurred
-
joinProject
public Map<String,Object> joinProject(String projectId) throws javax.mail.MessagingException
Add the current user to the project, if the project's inscriptions are opened- Parameters:
projectId
- The project id- Returns:
- The result
- Throws:
javax.mail.MessagingException
- If an error occurred sending a notification mail to the project manager
-
askToJoinProject
public Map<String,Object> askToJoinProject(String projectId, String message) throws javax.mail.MessagingException
Send a demand to join a project to the project's manager, if the project's inscriptions are moderated- Parameters:
projectId
- The project to joinmessage
- A message to send to the project's manager.- Returns:
- The result
- Throws:
javax.mail.MessagingException
- If an error occurred sending the email to the project's manager
-
_sendAskToJoinMail
private void _sendAskToJoinMail(String message, Project project, UserIdentity joiningUser) throws javax.mail.MessagingException
- Throws:
javax.mail.MessagingException
-
getAddUserUrl
protected String getAddUserUrl(Project project, UserIdentity user)
Get the absolute url to add a user to a project- Parameters:
project
- The projectuser
- the identity of user to add- Returns:
- the absolute page url
-
getAllowedFormData
protected String[] getAllowedFormData()
Get the list of allowed data in the form- Returns:
- the list of allowed data in the form
-
getUserAndPublicProjects
public Map<String,Object> getUserAndPublicProjects()
Callable to get projects of the user and the public projects he can subscribe.- Returns:
- A map with three entries an entry for user projects, another one for public projects and finally one for the project's creation right
-
getUserProjects
public List<Map<String,Object>> getUserProjects()
Callable to get projects of the user.- Returns:
- A map with the user projects
-
_detailedMyProject2json
private Map<String,Object> _detailedMyProject2json(Project project)
-
detailedProject2json
public Map<String,Object> detailedProject2json(Project project)
Transform aProject
into a json map- Parameters:
project
- the project to parse- Returns:
- a json map
-
saxProject
public void saxProject(ContentHandler contentHandler, Project project) throws SAXException
SAX a project- Parameters:
contentHandler
- The content handler to sax intoproject
- the project- Throws:
SAXException
- if an error occurred while saxing
-
-