public class ProjectsCatalogueManager extends AbstractLogEnabled implements Serviceable, Component, Contextualizable
Modifier and Type | Field and Description |
---|---|
private static String[] |
__ALLOWED_FORM_DATA
List of allowed field received from the front
|
private static String |
__RIGHT_PROJECT_CREATE |
private static String |
__RIGHT_PROJECT_DELETE |
private static String |
__RIGHT_PROJECT_EDIT |
private static String |
__RIGHT_PROJECT_FO_CREATE |
private static String |
__RIGHT_PROJECT_FO_DELETE |
private static String |
__RIGHT_PROJECT_FO_EDIT |
protected Context |
_context
The avalon context
|
protected CurrentUserProvider |
_currentUserProvider
Current user provider
|
protected GroupDirectoryContextHelper |
_groupDirectoryContextHelper
Helper for group directory's context
|
protected I18nUtils |
_i18nUtils
Utils for i18n
|
protected LanguagesManager |
_languagesManager
The language manager
|
protected WorkspaceModuleExtensionPoint |
_moduleManagerEP
The extension point for workspace's modules
|
protected ObservationManager |
_observationManager
The observation manager
|
protected PopulationContextHelper |
_populationContextHelper
Helper for user population
|
protected ProfileAssignmentStorageExtensionPoint |
_profileAssignmentStorageExtensionPoint
The extension point for profiles' storage
|
protected ProjectManager |
_projectManager
The project manager
|
protected ProjectMemberManager |
_projectMemberManager
The project members' manager
|
protected ProjectRightHelper |
_projectRightHelper
Helper for project's rights
|
protected AmetysObjectResolver |
_resolver
Ametys Object Resolver
|
protected RightManager |
_rightManager
The right manager
|
protected SiteConfigurationExtensionPoint |
_siteConfigurationEP
The site's configuration handler
|
protected SiteDAO |
_siteDAO
The site dao
|
protected SourceResolver |
_sourceResolver
The source resolver
|
protected UserManager |
_userManager
The user manager
|
static String |
ROLE
Avalon Role
|
Constructor and Description |
---|
ProjectsCatalogueManager() |
Modifier and Type | Method and Description |
---|---|
private void |
_assignPopulationsAndManager(Project project,
Map<String,Object> formData) |
private Project |
_createProject(String parentId,
Map<String,Object> formData,
ModelAwareDataHolder serviceDataHolder,
Map<String,Object> siteConfiguration,
List<String> errors) |
private Map<String,Object> |
_getNewSiteConfiguration(Map<String,Object> formData,
ModelAwareDataHolder serviceDataHolder) |
protected Map<String,Object> |
_getProjectParameters(String projectId,
ModelAwareDataHolder serviceDataHolder)
Retrieves the parameters of the given project
|
private Map<String,Object> |
_getSiteConfiguration(Site site) |
private Map<String,Object> |
_node2Json(Object treeNode,
boolean includeProjects,
List<String> filterCategories) |
protected Project |
_postProjectCreation(Project project,
Map<String,Object> formData,
ModelAwareDataHolder serviceDataHolder,
Map<String,Object> siteConfiguration,
List<String> errors)
some post action when the project is created in the repo
|
private void |
_sendAskToJoinMail(String message,
Project project,
UserIdentity joiningUser) |
private void |
_setProjectCoverImage(Project project,
Map<String,Object> formData,
Part coverImage) |
private void |
_setProjectIllustration(Project project,
Map<String,Object> formData,
Part illustration) |
private void |
_updateCategory(Project project,
Map<String,Object> formData) |
private void |
_updateModules(Project project,
Map<String,Object> formData) |
protected void |
_updateProject(Project project,
Map<String,Object> formData,
ModelAwareDataHolder serviceDataHolder)
Update a project
|
private void |
_updateSiteConfiguration(Project project,
Map<String,Object> formData,
ModelAwareDataHolder serviceDataHolder,
List<String> errors) |
private void |
_validateImageUpload(String error,
Part illustration,
Part coverImage) |
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 moderated
|
void |
contextualize(Context context) |
Map<String,Object> |
createProject(Map<String,Object> formData,
String zoneItemId)
Create a new project
|
Map<String,Object> |
createProject(Part image,
Map<String,Object> formData,
String zoneItemId)
Create a new project
|
Map<String,Object> |
createProject(Part illustration,
Part coverImage,
Map<String,Object> formData,
String zoneItemId)
Create a new project
|
Map<String,Object> |
deleteProject(String projectId)
Delete a project
|
Map<String,Object> |
editProject(Part illustration,
Part coverImage,
String projectId,
Map<String,Object> formData,
String zoneItemId)
edit a project
|
Map<String,Object> |
editProject(Part image,
String projectId,
Map<String,Object> formData,
String zoneItemId)
Edit a project
|
Map<String,Object> |
editProject(String projectId,
Map<String,Object> formData,
String zoneItemId)
Edit a project
|
protected String |
getAddUserUrl(Project project,
UserIdentity user)
Get the absolute url to add a user to a project
|
protected String[] |
getAllowedFormData()
Get the list of allowed data in the form
|
List<Map<String,Object>> |
getCategoriesTree(String id)
Get the categories tree
|
Map<String,Object> |
getNewProjectData(String zoneItemId)
Retrieve the data required to create a new project
|
Map<String,Object> |
getProjectData(String projectId,
String zoneItemId)
Retrieve the data of a project to edit, or the data for a new project
|
List<Map<String,Object>> |
getProjectTreeNode(String id,
boolean includeProjects)
Get the node information of a specific project or category from the project tree
|
List<Map<String,Object>> |
getProjectTreeNode(String id,
boolean includeProjects,
boolean memberOnly)
Get the node information of a specific project or category from the project tree
|
List<Map<String,Object>> |
getProjectTreeNode(String id,
boolean includeProjects,
boolean memberOnly,
List<String> filterCategories)
Get the node information of a specific project or category from the project tree
|
List<Map<String,Object>> |
getProjectTreeNode(String id,
String zoneItemId,
boolean includeProjects)
Get the node information of a specific project or category from the project tree
|
Map<String,Object> |
getRights()
Get the rights to create, edit or delete projects, for the current user
|
Map<String,Object> |
joinProject(String projectId)
Add the current user to the project, if the project's inscriptions are opened
|
void |
service(ServiceManager manager) |
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
private static final String __RIGHT_PROJECT_CREATE
private static final String __RIGHT_PROJECT_EDIT
private static final String __RIGHT_PROJECT_DELETE
private static final String __RIGHT_PROJECT_FO_CREATE
private static final String __RIGHT_PROJECT_FO_EDIT
private static final String __RIGHT_PROJECT_FO_DELETE
private static final String[] __ALLOWED_FORM_DATA
protected AmetysObjectResolver _resolver
protected CurrentUserProvider _currentUserProvider
protected ProjectMemberManager _projectMemberManager
protected RightManager _rightManager
protected ProjectManager _projectManager
protected ProjectRightHelper _projectRightHelper
protected LanguagesManager _languagesManager
protected SourceResolver _sourceResolver
protected SiteConfigurationExtensionPoint _siteConfigurationEP
protected PopulationContextHelper _populationContextHelper
protected WorkspaceModuleExtensionPoint _moduleManagerEP
protected ProfileAssignmentStorageExtensionPoint _profileAssignmentStorageExtensionPoint
protected UserManager _userManager
protected I18nUtils _i18nUtils
protected ObservationManager _observationManager
protected GroupDirectoryContextHelper _groupDirectoryContextHelper
public ProjectsCatalogueManager()
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
public Map<String,Object> getRights()
public List<Map<String,Object>> getCategoriesTree(String id)
id
- The tree root. Can be nullpublic List<Map<String,Object>> getProjectTreeNode(String id, boolean includeProjects)
id
- The category or project idincludeProjects
- False to only get the categories treepublic List<Map<String,Object>> getProjectTreeNode(String id, String zoneItemId, boolean includeProjects)
id
- The category or project idzoneItemId
- The zone item of the project catalogueincludeProjects
- False to only get the categories treepublic List<Map<String,Object>> getProjectTreeNode(String id, boolean includeProjects, boolean memberOnly)
id
- The category or project idincludeProjects
- False to only get the categories treememberOnly
- Only return projects for which the current user is a memberpublic List<Map<String,Object>> getProjectTreeNode(String id, boolean includeProjects, boolean memberOnly, List<String> filterCategories)
id
- The category or project idincludeProjects
- False to only get the categories treememberOnly
- Only return projects for which the current user is a memberfilterCategories
- The list of categories to filter. Can be null to ignoreprivate Map<String,Object> _node2Json(Object treeNode, boolean includeProjects, List<String> filterCategories)
public Map<String,Object> getNewProjectData(String zoneItemId)
zoneItemId
- The zone item of the project cataloguepublic Map<String,Object> getProjectData(String projectId, String zoneItemId)
projectId
- The project id. Can be null.zoneItemId
- The zone item of the project catalogprotected Map<String,Object> _getProjectParameters(String projectId, ModelAwareDataHolder serviceDataHolder)
projectId
- Identifier of the projectserviceDataHolder
- data holder of the project catalog servicepublic Map<String,Object> createProject(Map<String,Object> formData, String zoneItemId) throws IllegalAccessException, AmetysRepositoryException, IOException
formData
- The project datazoneItemId
- The zone item of the project catalogueIllegalAccessException
- If an error occurredIOException
- If an error occurredAmetysRepositoryException
- If an error occurredpublic Map<String,Object> createProject(Part image, Map<String,Object> formData, String zoneItemId) throws IllegalAccessException, AmetysRepositoryException, IOException
image
- An image, can be either the illustration or the coverImage, which can be identify through formDataformData
- The project datazoneItemId
- The zone item of the project catalogueIllegalAccessException
- If an error occurredIOException
- If an error occurredAmetysRepositoryException
- If an error occurredpublic Map<String,Object> createProject(Part illustration, Part coverImage, Map<String,Object> formData, String zoneItemId) throws IllegalAccessException, AmetysRepositoryException, IOException
illustration
- The project illustration file. Can be nullcoverImage
- The cover image. Can be nullformData
- The project datazoneItemId
- The zone item of the project catalogueIllegalAccessException
- If an error occurredIOException
- If an error occurredAmetysRepositoryException
- If an error occurredprivate void _validateImageUpload(String error, Part illustration, Part coverImage)
private Map<String,Object> _getNewSiteConfiguration(Map<String,Object> formData, ModelAwareDataHolder serviceDataHolder)
private Project _createProject(String parentId, Map<String,Object> formData, ModelAwareDataHolder serviceDataHolder, Map<String,Object> siteConfiguration, List<String> errors)
protected Project _postProjectCreation(Project project, Map<String,Object> formData, ModelAwareDataHolder serviceDataHolder, Map<String,Object> siteConfiguration, List<String> errors)
project
- the projectformData
- the forms dataserviceDataHolder
- service data holdersiteConfiguration
- site configurationerrors
- list of errorsprivate void _assignPopulationsAndManager(Project project, Map<String,Object> formData)
public Map<String,Object> editProject(String projectId, Map<String,Object> formData, String zoneItemId) throws IllegalAccessException, AmetysRepositoryException, RepositoryException, IOException
projectId
- the project idformData
- The project datazoneItemId
- The zone item of the project catalogueIllegalAccessException
- If an error occurredRepositoryException
- If an error occurredAmetysRepositoryException
- If an error occurredIOException
- If an error occurredpublic Map<String,Object> editProject(Part image, String projectId, Map<String,Object> formData, String zoneItemId) throws IllegalAccessException, AmetysRepositoryException, RepositoryException, IOException
image
- An image, can be either the illustration or the coverImage, which can be identify through formDataprojectId
- the project idformData
- The project datazoneItemId
- The zone item of the project catalogueIllegalAccessException
- If an error occurredRepositoryException
- If an error occurredAmetysRepositoryException
- If an error occurredIOException
- If an error occurredpublic Map<String,Object> editProject(Part illustration, Part coverImage, String projectId, Map<String,Object> formData, String zoneItemId) throws IllegalAccessException, AmetysRepositoryException, RepositoryException, IOException
illustration
- The project illustration file. Can be nullcoverImage
- The cover image. Can be nullprojectId
- the project idformData
- The project datazoneItemId
- The zone item of the project catalogueIllegalAccessException
- If an error occurredRepositoryException
- If an error occurredAmetysRepositoryException
- If an error occurredIOException
- If an error occurredprotected void _updateProject(Project project, Map<String,Object> formData, ModelAwareDataHolder serviceDataHolder)
project
- the project to updateformData
- form dataserviceDataHolder
- service parametersprivate void _updateSiteConfiguration(Project project, Map<String,Object> formData, ModelAwareDataHolder serviceDataHolder, List<String> errors)
private Map<String,Object> _getSiteConfiguration(Site site)
private void _updateCategory(Project project, Map<String,Object> formData) throws AmetysRepositoryException, RepositoryException
private void _updateModules(Project project, Map<String,Object> formData)
private void _setProjectIllustration(Project project, Map<String,Object> formData, Part illustration) throws AmetysRepositoryException, IOException
AmetysRepositoryException
IOException
private void _setProjectCoverImage(Project project, Map<String,Object> formData, Part coverImage) throws AmetysRepositoryException, IOException
AmetysRepositoryException
IOException
public Map<String,Object> deleteProject(String projectId) throws IllegalAccessException
projectId
- The project idIllegalAccessException
- if an error occurredpublic Map<String,Object> joinProject(String projectId) throws javax.mail.MessagingException
projectId
- The project idjavax.mail.MessagingException
- If an error occurred sending a notification mail to the project managerpublic Map<String,Object> askToJoinProject(String projectId, String message) throws javax.mail.MessagingException
projectId
- The project to joinmessage
- A message to send to the project's manager.javax.mail.MessagingException
- If an error occurred sending the email to the project's managerprivate void _sendAskToJoinMail(String message, Project project, UserIdentity joiningUser) throws javax.mail.MessagingException
javax.mail.MessagingException
protected String getAddUserUrl(Project project, UserIdentity user)
project
- The projectuser
- the identity of user to addprotected String[] getAllowedFormData()