Class JCRTasksDAO
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.explorer.tasks.jcr.JCRTasksDAO
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
- Direct Known Subclasses:
WorkspaceTaskDAO
DAO for interacting with JCRTasks
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Simple structure used to store a list of task and some metadata. -
Field Summary
Modifier and TypeFieldDescriptionprotected CurrentUserProvider
Current user providerprotected ExplorerResourcesDAO
DAO for the explorer resourcesprotected ObservationManager
The observation managerprotected AmetysObjectResolver
Ametys object resolverprotected RightManager
The rights managerprotected UserHelper
The user helperprotected UserManager
The user managerstatic final String
Rights to add a taskstatic final String
Rights to delete_all the tasksstatic final String
Rights to delete a taskstatic final String
Rights to edit a taskstatic final String
Rights to view the tasksstatic final String
Avalon Role -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription_assignmentToJSON
(Task task) Transform assignments of a task to JSON data_setTaskParameters
(JCRTask task, Map<String, Object> parameters, Integer index, boolean setDescription) Set task's properties_subscribersToJSON
(Task task) Transform subscribers of a task to JSON dataAdd a new taskassignTasks
(List<String> taskIds, List<String> users) Assign one or more task to one or more usersdeleteTasks
(List<String> taskIds) Delete one or more tasksEdit a taskGet the data of a taskTransform a task to JSON dataprotected String
getTaskDescription
(Task task) Get the description of a task as a Stringprotected String
Get the description of a task to edit as a StringgetTaskList
(List<String> parentIds, boolean assignedToUser, boolean userSubscribed, Integer offset, Integer limit, String filter, String orderBy, Boolean orderAsc) Get the list of tasksgetTasks
(List<String> parentIds, boolean assignedToUser, boolean userSubscribed, Integer offset, Integer limit, String filter, String orderBy, Boolean orderAsc) Get the list of tasksstatic String
getTasksXpathQuery
(String rootPath, Expression tasksExpression, SortCriteria sortCriteria) Creates the XPath query corresponding to specifiedExpression
.void
service
(ServiceManager manager) protected void
setTaskDescription
(ModifiableTask task, String description) Update the description of a tasksetTasksProgress
(List<String> taskIds, Integer progress) Update the progress of one or multiple taskssetTasksStatus
(List<String> taskIds, String statusString) Update the status of one or multiple tasksMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
Avalon Role -
RIGHTS_VIEW_TASKS
Rights to view the tasks- See Also:
-
RIGHTS_ADD_TASK
Rights to add a task- See Also:
-
RIGHTS_EDIT_TASK
Rights to edit a task- See Also:
-
RIGHTS_DELETE_TASK
Rights to delete a task- See Also:
-
RIGHTS_DELETE_ALL_TASK
Rights to delete_all the tasks- See Also:
-
_resolver
Ametys object resolver -
_explorerResourcesDAO
DAO for the explorer resources -
_currentUserProvider
Current user provider -
_userManager
The user manager -
_observationManager
The observation manager -
_rightManager
The rights manager -
_userHelper
The user helper
-
-
Constructor Details
-
JCRTasksDAO
public JCRTasksDAO()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
addTask
public Map<String,Object> addTask(String parentId, Map<String, Object> parameters) throws IllegalAccessExceptionAdd a new task- Parameters:
parentId
- The parent node idparameters
- The task parameters- Returns:
- The task data
- Throws:
IllegalAccessException
- If an error occurs when checking the rights
-
editTask
public Map<String,Object> editTask(String id, Map<String, Object> parameters) throws IllegalAccessExceptionEdit a task- Parameters:
id
- The id of the task to editparameters
- The task parameters- Returns:
- The task data
- Throws:
IllegalAccessException
- If an error occurs when checking the rights
-
_setTaskParameters
protected Map<String,Object> _setTaskParameters(JCRTask task, Map<String, Object> parameters, Integer index, boolean setDescription) Set task's properties- Parameters:
task
- The task to editparameters
- The JS parametersindex
- The index of tasksetDescription
-true
to edit description- Returns:
- The map of updated values
-
setTaskDescription
Update the description of a task- Parameters:
task
- The task to updatedescription
- The description as string
-
getTaskDescription
Get the description of a task as a String- Parameters:
task
- the task- Returns:
- The content as String
- Throws:
AmetysRepositoryException
- if failed to parse description
-
getTaskDescriptionForEdition
Get the description of a task to edit as a String- Parameters:
task
- the task- Returns:
- The content as String
- Throws:
AmetysRepositoryException
- if failed to parse description
-
getTask
Get the data of a task- Parameters:
taskId
- the task idisEdition
- true to get the task in edit mode- Returns:
- The task data
-
getTaskList
public JCRTasksDAO.TaskListResult getTaskList(List<String> parentIds, boolean assignedToUser, boolean userSubscribed, Integer offset, Integer limit, String filter, String orderBy, Boolean orderAsc) throws ProcessingException Get the list of tasks- Parameters:
parentIds
- The tasks parentsassignedToUser
- Filter only the tasks assigned to the current useruserSubscribed
- Filter only the tasks for which current user subscribedoffset
- Offset the list of resultslimit
- The maximum number of results to returnfilter
- Return only tasks matching the filterorderBy
- Order the list by this property. Default to the creation dateorderAsc
- Sort the list by order ascendant or descendant. Default to ascendant.- Returns:
- The list as a
JCRTasksDAO.TaskListResult
object - Throws:
ProcessingException
- If an error occurred
-
getTasksXpathQuery
public static String getTasksXpathQuery(String rootPath, Expression tasksExpression, SortCriteria sortCriteria) throws RepositoryException Creates the XPath query corresponding to specifiedExpression
.- Parameters:
rootPath
- the path to the node containing the taskstasksExpression
- the query predicates.sortCriteria
- the sort criteria.- Returns:
- the created XPath query.
- Throws:
RepositoryException
- if an error occurred
-
getTasks
public Map<String,Object> getTasks(List<String> parentIds, boolean assignedToUser, boolean userSubscribed, Integer offset, Integer limit, String filter, String orderBy, Boolean orderAsc) throws ProcessingException Get the list of tasks- Parameters:
parentIds
- The tasks parentsassignedToUser
- Filter only the tasks assigned to the current useruserSubscribed
- Filter only the tasks for which current user subscribedoffset
- Offset the list of resultslimit
- The maximum number of results to returnfilter
- Return only tasks matching the filterorderBy
- Order the list by this property. Default to the creation dateorderAsc
- Sort the list by order ascendant or descendant. Default to ascendant.- Returns:
- The list of tasks
- Throws:
ProcessingException
- If an error occurred
-
assignTasks
public Map<String,Object> assignTasks(List<String> taskIds, List<String> users) throws IllegalAccessException Assign one or more task to one or more users- Parameters:
taskIds
- The tasks idsusers
- The users- Returns:
- The tasks data, updated
- Throws:
IllegalAccessException
- If an error occurs
-
setTasksStatus
public Map<String,Object> setTasksStatus(List<String> taskIds, String statusString) throws IllegalAccessException Update the status of one or multiple tasks- Parameters:
taskIds
- The tasks idsstatusString
- The status- Returns:
- The tasks data updated
- Throws:
IllegalAccessException
- If an error occurs
-
setTasksProgress
public Map<String,Object> setTasksProgress(List<String> taskIds, Integer progress) throws IllegalAccessException Update the progress of one or multiple tasks- Parameters:
taskIds
- The tasks idsprogress
- The progress- Returns:
- The tasks data updated
- Throws:
IllegalAccessException
- If an error occurs
-
deleteTasks
Delete one or more tasks- Parameters:
taskIds
- The tasks ids- Returns:
- The list of tasks ids
- Throws:
IllegalAccessException
- If an error occurs
-
getTask
Transform a task to JSON data- Parameters:
task
- The taskisEdition
- true to get the task in edit mode- Returns:
- The JSON data
-
_assignmentToJSON
Transform assignments of a task to JSON data- Parameters:
task
- The task- Returns:
- The JSON data
-
_subscribersToJSON
Transform subscribers of a task to JSON data- Parameters:
task
- The task- Returns:
- The JSON data
-