Class WorkspaceThreadDAO
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.workspaces.AbstractWorkspaceDAO
org.ametys.plugins.workspaces.forum.AbstractWorkspaceThreadDAO
org.ametys.plugins.workspaces.forum.WorkspaceThreadDAO
- All Implemented Interfaces:
LogEnabled
,Component
,Contextualizable
,Serviceable
DAO for manipulating thread of a project
-
Field Summary
Modifier and TypeFieldDescriptionprotected ProjectTagProviderExtensionPoint
The tag provider extension pointprotected UserPreferencesManager
The user preferencesstatic final String
Rights to contribute to threadsstatic final String
Rights to create thread and edit his own threadstatic final String
Rights to delete his own threadstatic final String
Rights to delete answers in his own threadstatic final String
Rights to handle all threadsstatic final String
Rights to handle reportsstatic final String
Rights to handle reports in his own threadstatic final String
Avalon RoleFields inherited from class org.ametys.plugins.workspaces.forum.AbstractWorkspaceThreadDAO
_threadJSONHelper, _workspaceThreadUserPrefDAO
Fields inherited from class org.ametys.plugins.workspaces.AbstractWorkspaceDAO
_context, _currentUserProvider, _observationManager, _projectManager, _projectTagsDAO, _resolver, _richTextTransformer, _rightManager, _userManager, _workflowHelper, _workflowProvider, _workspaceHelper, _workspaceModuleEP
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddThread
(Map<String, Object> parameters, String search, String category, String tag, Boolean closed, List<Part> newFiles, List<String> newFileNames, Boolean accepted, Boolean hasNotification) Add a new thread to the threads listdeleteThread
(String id) Delete a threadeditThread
(Map<String, Object> parameters, String search, String category, String tag, Boolean closed, List<Part> newFiles, List<String> newFileNames, List<String> deleteFiles, Boolean accepted, Boolean hasNotification) Edit a threadgetCategoryThreadCount
(String category) Get the list of threads of a projectgetProjectThreads
(Project project, boolean sortByCreationDate) Get all thread's threads from given projetsGet the threads from projectgetThreadIds
(String search, String category, String tag, Boolean closed, Boolean accepted, Boolean hasNotification) Get the threads of current projectgetThreadsByIds
(List<String> threadIds) Get the threads of current projectgetThreadsCount
(Project project) Get the total number of threads of the projectGet tags used in any threadsGet user rights from project namevoid
service
(ServiceManager manager) Methods inherited from class org.ametys.plugins.workspaces.forum.AbstractWorkspaceThreadDAO
_checkUserRights, _getModuleRoot, _getModuleRoot, _getThreadByID, _getThreadRoot
Methods inherited from class org.ametys.plugins.workspaces.AbstractWorkspaceDAO
_checkUserReadingRights, _checkUserRights, _getProject, _getProjectName, _getSitemapLanguage, _getSiteName, _handleTags, _hasAfterSubComments, _setAttachments, answerComment, contextualize, createComment, deleteComment, editComment, likeOrUnlikeComment
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
Avalon Role -
RIGHTS_HANDLE_ALL_THREAD
Rights to handle all threads- See Also:
-
RIGHTS_REPORT_NOTIFICATION
Rights to handle reports- See Also:
-
RIGHTS_CREATE_THREAD
Rights to create thread and edit his own thread- See Also:
-
RIGHTS_CONTRIBUTE_THREAD
Rights to contribute to threads- See Also:
-
RIGHTS_DELETE_OWN_THREAD
Rights to delete his own thread- See Also:
-
RIGHTS_DELETE_OWN_THREAD_ANSWERS
Rights to delete answers in his own thread- See Also:
-
RIGHTS_REPORT_NOTIFICATION_OWN_THREAD
Rights to handle reports in his own thread- See Also:
-
_tagProviderExtPt
The tag provider extension point -
_userPrefsManager
The user preferences
-
-
Constructor Details
-
WorkspaceThreadDAO
public WorkspaceThreadDAO()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractWorkspaceThreadDAO
- Throws:
ServiceException
-
addThread
public Map<String,Object> addThread(Map<String, Object> parameters, String search, String category, String tag, Boolean closed, List<Part> newFiles, List<String> newFileNames, Boolean accepted, Boolean hasNotification) throws IllegalAccessExceptionAdd a new thread to the threads list- Parameters:
parameters
- The thread parameterssearch
- filter by search querycategory
- filter by categroy idtag
- filter by tag idclosed
- filter by closeInfo fieldnewFiles
- the new file to addnewFileNames
- the file names to addaccepted
- filter by accepted answerhasNotification
- filter by whether subjects have notification- Returns:
- The thread data
- Throws:
IllegalAccessException
- If an error occurs when checking the rights
-
editThread
public Map<String,Object> editThread(Map<String, Object> parameters, String search, String category, String tag, Boolean closed, List<Part> newFiles, List<String> newFileNames, List<String> deleteFiles, Boolean accepted, Boolean hasNotification) throws IllegalAccessExceptionEdit a thread- Parameters:
parameters
- The thread parameterssearch
- filter by search querycategory
- filter by categroy idtag
- filter by tag idclosed
- filter by closeInfo fieldnewFiles
- the new file to addnewFileNames
- the file names to adddeleteFiles
- the file to deleteaccepted
- filter by accepted answerhasNotification
- filter by whether subjects have notification- Returns:
- The thread data
- Throws:
IllegalAccessException
- If an error occurs when checking the rights
-
deleteThread
Delete a thread- Parameters:
id
- The thread id- Returns:
- The thread data
- Throws:
IllegalAccessException
- If an error occurs when checking the rights
-
getCategoryThreadCount
Get the list of threads of a project- Parameters:
category
- The category to filter- Returns:
- The list of threads
- Throws:
IllegalAccessException
- If an error occurs when checking the rights
-
getThreadIds
public List<String> getThreadIds(String search, String category, String tag, Boolean closed, Boolean accepted, Boolean hasNotification) throws IllegalAccessException Get the threads of current project- Parameters:
search
- filter by search querycategory
- filter by categroy idtag
- filter by tag idclosed
- filter by closeInfo fieldaccepted
- filter by accepted answerhasNotification
- filter by whether subjects have notification- Returns:
- the list of threads
- Throws:
IllegalAccessException
- If an error occurs when checking the rights
-
getThreadsByIds
public List<Map<String,Object>> getThreadsByIds(List<String> threadIds) throws IllegalAccessException Get the threads of current project- Parameters:
threadIds
- list of threads id- Returns:
- the list of threads
- Throws:
IllegalAccessException
- If an error occurs when checking the rights
-
getThread
Get the threads from project- Parameters:
id
- the id of the page- Returns:
- the list of threads
- Throws:
IllegalAccessException
- If an error occurs when checking the rights
-
getProjectThreads
Get all thread's threads from given projets- Parameters:
project
- the projectsortByCreationDate
- true to sort by creation date- Returns:
- All threads as JSON
-
getThreadsCount
Get the total number of threads of the project- Parameters:
project
- The project- Returns:
- The number of threads, or null if the module is not activated
-
getUserRights
Get user rights from project name- Returns:
- the user rights
-
getUsedTags
Get tags used in any threads- Returns:
- the tags (id and label)
-