Class TaskAPI


  • public class TaskAPI
    extends BaseAPI
    Tasks are used to track what work has to be done. Tasks have the following properties:
    • Tasks can be stand-alone or can be attached to other objects.
    • Tasks can be delegated to other users of Hoist.
    • Tasks can be private or public. When private, only the creator, the assignee and assignor can see the task.
    • Tasks can have a due date, which is the target date for completion. When tasks miss their due date, they become over-due.
    • Tasks can be started on or not started on. This is used to indicate to other users if the task is in progress.
    A task can be in one of the following states:
    • active: The task is active and not yet completed
    • completed: The task is completed
    The following actions can be performed on a task:
    • assign: Reassign the task to another user to make that user responsible for the task
    • update due date: Update the due date of the task
    • update text: Update the text of the task
    • update private: Make the task private or public
    • start: Indicate that worked have started on the task
    • stop: Indicate that work have been stopped
    • complete: Mark the task as completed
    • incomplete: Mark the task as being incomplete
    • Method Detail

      • getTask

        public Task getTask​(int taskId)
        Returns the task with the given id.
        Parameters:
        taskId - The id of the task to retrieve
        Returns:
        The retrieved task
      • assignTask

        public void assignTask​(int taskId,
                               int responsible)
        Assigns the task to another user. This makes the user responsible for the task and its completion.
        Parameters:
        taskId - The id of the task to assign
        responsible - The id of the user the task should be assigned to
      • completeTask

        public void completeTask​(int taskId)
        Mark the given task as completed.
        Parameters:
        taskId - The id of the task to nark as complete
      • incompleteTask

        public void incompleteTask​(int taskId)
        Mark the completed task as no longer being completed.
        Parameters:
        taskId - The id of the task to mark as incomplete
      • updateDueDate

        public void updateDueDate​(int taskId,
                                  org.joda.time.LocalDate dueDate)
        Updates the due date of the task to the given value
        Parameters:
        taskId - The id of the task
        dueDate - The new due date of the task
      • updatePrivate

        public void updatePrivate​(int taskId,
                                  boolean priv)
        Update the private flag on the given task.
        Parameters:
        taskId - The id of the task
        priv - true if the task should be private, false otherwise
      • updateText

        public void updateText​(int taskId,
                               String text)
        Updates the text of the task.
        Parameters:
        taskId - The id of the task
        text - The new text of the task
      • createTask

        public int createTask​(TaskCreate task,
                              boolean silent)
        Creates a new task with no reference to other objects.
        Parameters:
        task - The data of the task to be created
        silent - Disable notifications
        Returns:
        The id of the newly created task
      • createTask

        public int createTask​(TaskCreate task,
                              boolean silent,
                              boolean hook)
        Creates a new task with no reference to other objects.
        Parameters:
        task - The data of the task to be created
        silent - Disable notifications
        hook - Execute hooks for the change
        Returns:
        The id of the newly created task
      • createTaskWithReference

        public int createTaskWithReference​(TaskCreate task,
                                           Reference reference,
                                           boolean silent)
        Creates a new task with a reference to the given object.
        Parameters:
        task - The data of the task to be created
        reference - The reference to the object the task should be attached to
        silent - Disable notifications
        Returns:
        The id of the newly created task
      • createTaskWithReference

        public int createTaskWithReference​(TaskCreate task,
                                           Reference reference,
                                           boolean silent,
                                           boolean hook)
        Creates a new task with a reference to the given object.
        Parameters:
        task - The data of the task to be created
        reference - The reference to the object the task should be attached to
        silent - Disable notifications
        hook - Execute hooks for the change
        Returns:
        The id of the newly created task
      • getTasksWithReference

        public List<Task> getTasksWithReference​(Reference reference)
        Gets a list of tasks with a reference to the given object. This will return both active and completed tasks. The reference will not be set on the individual tasks.
        Parameters:
        reference - The object on which to return tasks
        Returns:
        The list of tasks
      • getActiveTasks

        public TasksByDue getActiveTasks()
        Returns the active tasks of the user. This is the tasks where the user is responsible. The tasks will be sorted by due date and creation time, and grouped by their due date status.
        Returns:
        The tasks grouped by due date
      • getAssignedActiveTasks

        public TasksByDue getAssignedActiveTasks()
        Returns the tasks that the user has assigned to another user.
        Returns:
        The tasks grouped by due date
      • getCompletedTasks

        public List<Task> getCompletedTasks()
        Returns the tasks that is completed and where the active user is responsible.
        Returns:
        The list of tasks ordered by date of completion