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
depedning on
whether an error occured which may be recorded in the exception
property.- Author:
- florian
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionTask
(TaskParameter params, BiConsumer<javax.servlet.http.HttpServletRequest, Task> work) -
Method Summary
Modifier and TypeMethodDescriptionvoid
doTask
(javax.servlet.http.HttpServletRequest request) static Task.Accessibility
getAccessibility
(TaskType type) long
getId()
getType()
BiConsumer<javax.servlet.http.HttpServletRequest,
Task> getWork()
void
void
setException
(Optional<String> exception) void
setSessionId
(Optional<String> sessionId) void
setStatus
(Task.TaskStatus status) toString()
-
Constructor Details
-
Task
- Parameters:
params
-work
-
-
-
Method Details
-
doTask
public void doTask(javax.servlet.http.HttpServletRequest request) - Parameters:
request
-
-
setError
- Parameters:
error
-
-
getAccessibility
- Parameters:
type
-- Returns:
Task.Accessibility
-
getId
public long getId()- Returns:
- the id
-
getType
- Returns:
- the type
-
getException
- Returns:
- the exception
-
setException
- Parameters:
exception
- the exception to set
-
getSessionId
- Returns:
- the sessionId
-
setSessionId
- Parameters:
sessionId
- the sessionId to set
-
getTimeCreated
- Returns:
- the timeCreated
-
getWork
- Returns:
- the work
-
getParams
- Returns:
- the params
-
setStatus
- Parameters:
status
- the status to set
-
getStatus
- Returns:
- the status
-
getErrorMessage
-
toString
-