java.lang.Object
com.pragmatickm.task.servlet.TaskUtil
-
Method Summary
Modifier and TypeMethodDescriptiongetAllTasks(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page rootPage, User user) getBlockedTasks(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page rootPage, User user) getDoAfters(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Task task) Finds all tasks that must be done after this task.getFutureTasks(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page rootPage, User user) static TaskLog.EntrygetMostRecentEntry(TaskLog taskLog, String statuses) getMultipleDoAfters(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Collection<? extends Task> tasks) Finds all tasks that must be done after each of the provided tasks.static Map<Task, StatusResult> getMultipleStatuses(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Collection<? extends Task> tasks) static Map<Task, StatusResult> getMultipleStatuses(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Collection<? extends Task> tasks, Cache cache) getReadyTasks(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page rootPage, User user) static StatusResultgetStatus(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Task task) Gets a human-readable description of the task status as well as an associated class.static StatusResultgetStatus(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Task task, Cache cache) static TaskLoggetTaskLog(ServletContext servletContext, HttpServletRequest request, String page, String taskId) static TaskLoggetTaskLogInBook(ServletContext servletContext, HttpServletRequest request, String book, String page, String taskId) static UsergetUser(HttpServletRequest request, HttpServletResponse response) static booleanhasAssignedTask(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page page, User user) prioritizeTasks(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Collection<? extends Task> tasks, boolean dateFirst)
-
Method Details
-
getTaskLogInBook
public static TaskLog getTaskLogInBook(ServletContext servletContext, HttpServletRequest request, String book, String page, String taskId) throws ServletException, IOException - Throws:
ServletExceptionIOException
-
getTaskLog
public static TaskLog getTaskLog(ServletContext servletContext, HttpServletRequest request, String page, String taskId) throws ServletException, IOException - Throws:
ServletExceptionIOException
-
getMostRecentEntry
- Throws:
IOException
-
getStatus
public static StatusResult getStatus(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Task task) throws TaskException, ServletException, IOException Gets a human-readable description of the task status as well as an associated class. The status of a task, without any specific qualifying date, is:For non-scheduled tasks (with no "on" date and no "recurring"), the status is:
- The status of the most recent log entry with no "scheduledOn" value
- "New"
For a scheduled, non-recurring task, the status is:
- If the status of the most recent log entry with a "scheduledOn" value equaling the task "on" date is of a "completedSchedule" type - use the status.
- If in the past, "Late YYYY-MM-DD"
- If today, "Due Today"
- If there is a status of the most recent log entry with a "scheduledOn" value equaling the task "on" date - use the status.
- Is in the future, "Waiting until YYYY-MM-DD"
For a recurring task, the status is:
- Find the first incomplete scheduledOn date (based on most recent log entries per scheduled date, in time order
- If the first incomplete is in the past, "Late YYYY-MM-DD"
- If the first incomplete is today, "Due Today"
- If the first incomplete is in the future, "Waiting until YYYY-MM-DD"
Status only available once frozen.
- Throws:
TaskExceptionServletExceptionIOException
-
getStatus
public static StatusResult getStatus(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Task task, Cache cache) throws TaskException, ServletException, IOException - Throws:
TaskExceptionServletExceptionIOException
-
getMultipleStatuses
public static Map<Task,StatusResult> getMultipleStatuses(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Collection<? extends Task> tasks) throws TaskException, ServletException, IOException - Throws:
TaskExceptionServletExceptionIOException
-
getMultipleStatuses
public static Map<Task,StatusResult> getMultipleStatuses(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Collection<? extends Task> tasks, Cache cache) throws TaskException, ServletException, IOException - Throws:
TaskExceptionServletExceptionIOException
-
getDoAfters
public static List<Task> getDoAfters(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Task task) throws ServletException, IOException Finds all tasks that must be done after this task. This requires a capture of the entire page tree meta data to find any task that has a doBefore pointing to this task.- Throws:
ServletExceptionIOException
-
getMultipleDoAfters
public static Map<Task,List<Task>> getMultipleDoAfters(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Collection<? extends Task> tasks) throws ServletException, IOException Finds all tasks that must be done after each of the provided tasks. This requires a capture of the entire page tree meta data to find any task that has a doBefore pointing to each task.- Returns:
- The map of doAfters, in the same iteration order as the provided tasks. If no doAfters for a given task, will contain an empty list.
- Throws:
ServletExceptionIOException
-
getUser
-
getAllUsers
-
prioritizeTasks
public static List<Task> prioritizeTasks(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Collection<? extends Task> tasks, boolean dateFirst) throws TaskException, ServletException, IOException - Throws:
TaskExceptionServletExceptionIOException
-
getAllTasks
public static List<Task> getAllTasks(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page rootPage, User user) throws IOException, ServletException - Throws:
IOExceptionServletException
-
hasAssignedTask
public static boolean hasAssignedTask(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page page, User user) throws ServletException, IOException - Throws:
ServletExceptionIOException
-
getReadyTasks
public static List<Task> getReadyTasks(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page rootPage, User user) throws IOException, ServletException - Throws:
IOExceptionServletException
-
getBlockedTasks
public static List<Task> getBlockedTasks(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page rootPage, User user) throws IOException, ServletException - Throws:
IOExceptionServletException
-
getFutureTasks
public static List<Task> getFutureTasks(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, Page rootPage, User user) throws IOException, ServletException - Throws:
IOExceptionServletException
-
