Class Task
java.lang.Object
io.goobi.viewer.api.rest.model.tasks.Task
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 depending on
whether an error occurred which may be recorded in the exception property.
- Author:
- Florian Alpers
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddoTask(HttpServletRequest request) static Task.AccessibilitygetAccessibility(ITaskType type) longgetId()getType()getWork()voidvoidsetException(Optional<String> exception) voidsetSessionId(Optional<String> sessionId) voidsetStatus(Task.TaskStatus status) toString()
-
Constructor Details
-
Task
- Parameters:
params- task parameters including the task typework- the actual work to execute when task is run
-
-
Method Details
-
doTask
- Parameters:
request- HTTP servlet request used to execute the task
-
setError
- Parameters:
error- error message describing the task failure
-
getAccessibility
- Parameters:
type- the task type to determine accessibility for- Returns:
Task.Accessibility
-
getId
public long getId() -
getType
-
getException
-
setException
-
getSessionId
-
setSessionId
-
getTimeCreated
-
getWork
-
getParams
-
setStatus
-
getStatus
-
getErrorMessage
-
toString
-