Class WorkspaceTaskDAO
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.explorer.tasks.jcr.JCRTasksDAO
-
- org.ametys.plugins.workspaces.tasks.WorkspaceTaskDAO
-
- All Implemented Interfaces:
LogEnabled
,PluginAware
,Component
,Contextualizable
,Serviceable
public class WorkspaceTaskDAO extends JCRTasksDAO implements PluginAware, Contextualizable
DAO for interacting with tasks of a project
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.ametys.plugins.explorer.tasks.jcr.JCRTasksDAO
JCRTasksDAO.TaskListResult
-
-
Field Summary
Fields Modifier and Type Field Description private Context
_context
private HTMLTransformer
_htmlTransformer
private WorkspaceModuleExtensionPoint
_moduleEP
private String
_pluginName
private ProjectManager
_projectManager
private SourceResolver
_sourceResolver
static String
ROLE
The Avalon role-
Fields inherited from class org.ametys.plugins.explorer.tasks.jcr.JCRTasksDAO
_currentUserProvider, _explorerResourcesDAO, _observationManager, _resolver, _rightManager, _userHelper, _userManager, RIGHTS_ADD_TASK, RIGHTS_DELETE_ALL_TASK, RIGHTS_DELETE_TASK, RIGHTS_EDIT_TASK, RIGHTS_VIEW_TASKS
-
-
Constructor Summary
Constructors Constructor Description WorkspaceTaskDAO()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private String
_getProjectFromRequest()
protected Map<String,String>
_projectToJson(Project project)
Retrieve the project JSON dataprivate List<String>
_projectToTaskList(List<String> projectNames)
Retrieves the list ofTasksList
Map<String,Object>
addTask(Map<String,Object> parameters)
Add a new task to the current projectvoid
contextualize(Context context)
protected Project
getParentProject(Task task)
Get the parent project of a taskJCRTasksDAO.TaskListResult
getProjectTaskList(List<String> projectNames, boolean assignedToUser, boolean userSubscribed, Integer offset, Integer limit, String filter, String orderBy, Boolean orderAsc)
Get the list of tasksMap<String,Object>
getProjectTasks(boolean assignedToUser, boolean userSubscribed, Integer offset, Integer limit, String filter, String orderBy, Boolean orderAsc)
Get the tasks of the current projectMap<String,Object>
getProjectTasks(List<String> projectNames, boolean assignedToUser, boolean userSubscribed, Integer offset, Integer limit, String filter, String orderBy, Boolean orderAsc)
Get the list of tasksprotected Map<String,Object>
getTask(Task task, boolean isEdition)
Transform a task to JSON dataprotected String
getTaskDescription(Task task)
Get the description of a task as a Stringprotected String
getTaskDescriptionForEdition(Task task)
Get the description of a task to edit as a StringLong
getTasksCount(Project project)
Get the total number of tasks of the projectvoid
service(ServiceManager manager)
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.protected void
setTaskDescription(ModifiableTask task, String description)
Update the description of a task-
Methods inherited from class org.ametys.plugins.explorer.tasks.jcr.JCRTasksDAO
_assignmentToJSON, _setTaskParameters, _subscribersToJSON, addTask, assignTasks, deleteTasks, editTask, getTask, getTaskList, getTasks, getTasksXpathQuery, setTasksProgress, setTasksStatus
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_htmlTransformer
private HTMLTransformer _htmlTransformer
-
_sourceResolver
private SourceResolver _sourceResolver
-
_projectManager
private ProjectManager _projectManager
-
_pluginName
private String _pluginName
-
_moduleEP
private WorkspaceModuleExtensionPoint _moduleEP
-
-
Constructor Detail
-
WorkspaceTaskDAO
public WorkspaceTaskDAO()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classJCRTasksDAO
- Throws:
ServiceException
-
setPluginInfo
public void setPluginInfo(String pluginName, String featureName, String id)
Description copied from interface:PluginAware
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.- Specified by:
setPluginInfo
in interfacePluginAware
- Parameters:
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this component
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
addTask
public Map<String,Object> addTask(Map<String,Object> parameters) throws IllegalAccessException
Add a new task to the current project- Parameters:
parameters
- The task parameters- Returns:
- The task data
- Throws:
IllegalAccessException
- If an error occurs
-
getProjectTaskList
public JCRTasksDAO.TaskListResult getProjectTaskList(List<String> projectNames, boolean assignedToUser, boolean userSubscribed, Integer offset, Integer limit, String filter, String orderBy, Boolean orderAsc) throws ProcessingException
Get the list of tasks- Parameters:
projectNames
- The project that contain the tasks. Can be null to search in all project.assignedToUser
- 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
-
getProjectTasks
public Map<String,Object> getProjectTasks(List<String> projectNames, boolean assignedToUser, boolean userSubscribed, Integer offset, Integer limit, String filter, String orderBy, Boolean orderAsc) throws ProcessingException
Get the list of tasks- Parameters:
projectNames
- The project that contain the tasks. Can be null to search in all project.assignedToUser
- 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
-
_projectToTaskList
private List<String> _projectToTaskList(List<String> projectNames)
Retrieves the list ofTasksList
- Parameters:
projectNames
- The project names- Returns:
- list of task list identifiers
-
getProjectTasks
public Map<String,Object> getProjectTasks(boolean assignedToUser, boolean userSubscribed, Integer offset, Integer limit, String filter, String orderBy, Boolean orderAsc) throws IllegalAccessException, ProcessingException
Get the tasks of the current project- Parameters:
assignedToUser
- True to filter only the tasks assigned to the current useruserSubscribed
- Filter only the tasks for which current user subscribedoffset
- Start the list of tasks at the Nth task, used for paginationlimit
- Only return a maximum of N tasks, used for paginationfilter
- 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:
IllegalAccessException
- If the user is not authorizedProcessingException
- If an error occurred
-
setTaskDescription
protected void setTaskDescription(ModifiableTask task, String description)
Description copied from class:JCRTasksDAO
Update the description of a task- Overrides:
setTaskDescription
in classJCRTasksDAO
- Parameters:
task
- The task to updatedescription
- The description as string
-
getTaskDescription
protected String getTaskDescription(Task task) throws AmetysRepositoryException
Description copied from class:JCRTasksDAO
Get the description of a task as a String- Overrides:
getTaskDescription
in classJCRTasksDAO
- Parameters:
task
- the task- Returns:
- The content as String
- Throws:
AmetysRepositoryException
- if failed to parse description
-
getTaskDescriptionForEdition
protected String getTaskDescriptionForEdition(Task task) throws AmetysRepositoryException
Description copied from class:JCRTasksDAO
Get the description of a task to edit as a String- Overrides:
getTaskDescriptionForEdition
in classJCRTasksDAO
- Parameters:
task
- the task- Returns:
- The content as String
- Throws:
AmetysRepositoryException
- if failed to parse description
-
getTask
protected Map<String,Object> getTask(Task task, boolean isEdition)
Description copied from class:JCRTasksDAO
Transform a task to JSON data- Overrides:
getTask
in classJCRTasksDAO
- Parameters:
task
- The taskisEdition
- true to get the task in edit mode- Returns:
- The JSON data
-
getParentProject
protected Project getParentProject(Task task)
Get the parent project of a task- Parameters:
task
- The task- Returns:
- the project or
null
if not found
-
_projectToJson
protected Map<String,String> _projectToJson(Project project)
Retrieve the project JSON data- Parameters:
project
- The project- Returns:
- The data
-
_getProjectFromRequest
private String _getProjectFromRequest()
-
getTasksCount
public Long getTasksCount(Project project)
Get the total number of tasks of the project- Parameters:
project
- The project- Returns:
- The number of tasks, or null if the module is not activated
-
-