java.lang.Object
io.goobi.viewer.api.rest.model.tasks.Task

public class Task extends Object
A process triggered by a REST call using POST and may be monitored via the TasksResource. Each task has a unique id of type long given during object construcion. A Task has an Task.Accessibility property defining which calls are allowed to access the task, and a TaskType defining the actual process to use. Parameters of the execution as well as the type itself are determined by a TaskParameter object given at task creation. Also each task has a status property signaling he current state of the task. A task starts out as Task.TaskStatus.CREATED. Once processing starts (which may be delayed by the limited thread pool if other tasks are running) the status changes to Task.TaskStatus.STARTED. After processing ends the task is set to either Task.TaskStatus.COMPLETE or Task.TaskStatus.ERROR depedning on whether an error occured which may be recorded in the exception property.
Author:
florian
  • Constructor Details

  • Method Details

    • doTask

      public void doTask(javax.servlet.http.HttpServletRequest request)
      Parameters:
      request -
    • setError

      public void setError(String error)
      Parameters:
      error -
    • getAccessibility

      public static Task.Accessibility getAccessibility(TaskType type)
      Parameters:
      type -
      Returns:
      Task.Accessibility
    • getId

      public long getId()
      Returns:
      the id
    • getType

      public TaskType getType()
      Returns:
      the type
    • getException

      public Optional<String> getException()
      Returns:
      the exception
    • setException

      public void setException(Optional<String> exception)
      Parameters:
      exception - the exception to set
    • getSessionId

      public Optional<String> getSessionId()
      Returns:
      the sessionId
    • setSessionId

      public void setSessionId(Optional<String> sessionId)
      Parameters:
      sessionId - the sessionId to set
    • getTimeCreated

      public LocalDateTime getTimeCreated()
      Returns:
      the timeCreated
    • getWork

      public BiConsumer<javax.servlet.http.HttpServletRequest,Task> getWork()
      Returns:
      the work
    • getParams

      public TaskParameter getParams()
      Returns:
      the params
    • setStatus

      public void setStatus(Task.TaskStatus status)
      Parameters:
      status - the status to set
    • getStatus

      public Task.TaskStatus getStatus()
      Returns:
      the status
    • getErrorMessage

      public String getErrorMessage()
    • toString

      public String toString()
      Overrides:
      toString in class Object