Class TaskResource
java.lang.Object
com.xebialabs.xlrelease.api.internal.TaskResource
@Path("/tasks")
@Consumes("application/json")
@Produces("application/json")
@Controller
public class TaskResource
extends Object
A task in a release.
-
Constructor Summary
ConstructorsConstructorDescriptionTaskResource(com.xebialabs.xlrelease.api.v1.TaskApi taskApi, ReleaseService releaseService, TaskService taskService, com.xebialabs.xlrelease.security.PermissionChecker permissions, TaskAccessService taskAccessService, com.xebialabs.xlrelease.service.TaskSearchService taskSearchService, com.xebialabs.xlrelease.actors.ReleaseActorService releaseActorService, TasksViewConverter tasksViewConverter, UserViewConverter userViewConverter, CommentViewConverter commentViewConverter, TaskGranularPermissions taskPermissionChecker, com.xebialabs.xlrelease.scheduler.logs.TaskExecutionLogService taskExecutionLogService, com.xebialabs.xlrelease.service.SseService sseService) -
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.ResponseabortTask(String taskId, CommentView comment) Aborts a task.com.xebialabs.xlrelease.views.BulkActionResultViewabortTasks(CommentTasksView comment) Aborts tasks.addComment(String taskId, CommentView commentView) Adds a comment to a task.com.xebialabs.xlrelease.views.BulkActionResultViewaddCommentToTasks(CommentTasksView commentTasksView) Adds a new task to a container (phase or task group).addWatcher(String taskId, UserView watcherView) changeTaskType(String taskId, String targetType) Change task type to the target task type.jakarta.ws.rs.core.ResponsecompleteTask(String taskId, CommentView comment) Completes a running task manually.com.xebialabs.xlrelease.views.BulkActionResultViewcompleteTasks(CommentTasksView commentTasksView) Completes tasks manually.voiddeleteTask(String taskId) Deletes a task.com.xebialabs.xlrelease.views.BulkActionResultViewdeleteTasks(List<String> taskIds) jakarta.ws.rs.core.ResponsefailTask(String taskId, CommentView comment) Fails a task.com.xebialabs.xlrelease.views.BulkActionResultViewfailTasks(CommentTasksView comment) Fails tasks.voidStreams entries for a given task execution.voidfollowTask(String taskId) getCommentsOfTask(String taskId) Returns the comments associated with a task.com.xebialabs.xlrelease.domain.TaskWithPropertiesDefinitiongetCustomScriptProperties(String scriptDefinitionType) Returns the properties used to configure a custom task type.Returns the details of a task.List<com.xebialabs.xlrelease.api.v1.views.TaskAccessView>Returns all task accesses.Collection<com.xebialabs.xlrelease.domain.TaskDefinition>Returns the custom task definitions created through Digital.ai Release's extensibility mechanism.getTaskExecutions(String taskId) Retrieve list of task executions.getTaskRelease(String taskId) Returns a release view for given task.org.springframework.data.domain.Page<com.xebialabs.xlrelease.views.tasks.TaskListRelease>getTasksByRelease(Integer page, Integer numberByPage, TasksFilters tasksFilters) Returns the list of tasks accessible to the current user, grouped by release.jakarta.ws.rs.core.Responsepoll(DomainIdsForm form) Returns a list of tasks.com.xebialabs.xlrelease.views.BulkActionResultViewreassignTasks(ReassignTasksView reassignTasks) voidreassignToOwner(String taskId, TaskFullView updatedTask) Reassigns a task to a different owner.voidreassignToTeam(String taskId, TaskFullView updatedTask) Reassigns a task to a different team.voidremoveOwner(String taskId) Deletes a task owner.voidremoveTeam(String taskId) Removes the team of a task.removeWatcher(String taskId, String username) jakarta.ws.rs.core.ResponsereopenTask(String taskId, CommentView comment) Reopens a task that had been completed in advance.com.xebialabs.xlrelease.views.BulkActionResultViewreopenTasks(CommentTasksView comment) Reopens tasks.jakarta.ws.rs.core.ResponseretryTask(String taskId, CommentView comment) Retries a task.com.xebialabs.xlrelease.views.BulkActionResultViewretryTasks(CommentTasksView comment) Retries tasks.jakarta.ws.rs.core.ResponseskipTask(String taskId, CommentView comment) Skips a manual task.com.xebialabs.xlrelease.views.BulkActionResultViewskipTasks(CommentTasksView comment) Skips tasks.jakarta.ws.rs.core.ResponsestartNow(String taskId, CommentView comment) Forces a pending task to start immediately.voidunfollowLog(String taskId, String executionId) voidunfollowTask(String taskId) updateTask(String taskId, TaskFullView updatedTask) Updates a task and notifies the new owner if the task has been reassigned.voidupdateTaskAccesses(List<com.xebialabs.xlrelease.api.v1.views.TaskAccessView> taskAccesses) Update task accesses.updateWatchers(String taskId, Set<UserView> watchersView)
-
Constructor Details
-
TaskResource
@Autowired public TaskResource(com.xebialabs.xlrelease.api.v1.TaskApi taskApi, ReleaseService releaseService, TaskService taskService, com.xebialabs.xlrelease.security.PermissionChecker permissions, TaskAccessService taskAccessService, com.xebialabs.xlrelease.service.TaskSearchService taskSearchService, com.xebialabs.xlrelease.actors.ReleaseActorService releaseActorService, TasksViewConverter tasksViewConverter, UserViewConverter userViewConverter, CommentViewConverter commentViewConverter, TaskGranularPermissions taskPermissionChecker, com.xebialabs.xlrelease.scheduler.logs.TaskExecutionLogService taskExecutionLogService, com.xebialabs.xlrelease.service.SseService sseService)
-
-
Method Details
-
addTask
@POST @Timed @Path("{containerId:.*(Phase|Task)[^/-]*}") public TaskFullView addTask(@PathParam("containerId") String containerId, TaskForm taskForm) Adds a new task to a container (phase or task group).- Parameters:
containerId- the identifier of the containertaskForm- the information of the new task- Returns:
- the new task
-
getTask
@GET @Timed @Path("{taskId:[^/]*Task[^/-]*}") public TaskFullView getTask(@PathParam("taskId") String taskId) Returns the details of a task.- Parameters:
taskId- the identifier of the task- Returns:
- the task
-
getTasksByRelease
@POST @Timed @Path("search") public org.springframework.data.domain.Page<com.xebialabs.xlrelease.views.tasks.TaskListRelease> getTasksByRelease(@QueryParam("page") Integer page, @QueryParam("numberbypage") Integer numberByPage, TasksFilters tasksFilters) Returns the list of tasks accessible to the current user, grouped by release.- Parameters:
tasksFilters- the TasksFilters criteriapage- next page to querynumberByPage- releases per page- Returns:
- the matching tasks, grouped by release.
-
completeTask
@POST @Timed @Path("{taskId:.*Task[^/-]*}/complete") public jakarta.ws.rs.core.Response completeTask(@PathParam("taskId") String taskId, CommentView comment) Completes a running task manually.- Parameters:
taskId- the identifier of the taskcomment- the comment to associate to the action- Returns:
- HTTP status 200 to indicate success
-
completeTasks
@POST @Timed @Path("complete") public com.xebialabs.xlrelease.views.BulkActionResultView completeTasks(CommentTasksView commentTasksView) Completes tasks manually.- Parameters:
commentTasksView- the comment view to associate to the action- Returns:
- HTTP status 200 to indicate success
-
skipTask
@POST @Timed @Path("{taskId:.*Task[^/-]*}/skip") public jakarta.ws.rs.core.Response skipTask(@PathParam("taskId") String taskId, CommentView comment) Skips a manual task.- Parameters:
taskId- the identifier of the taskcomment- the comment to associate to the action- Returns:
- HTTP status 200 to indicate success
-
skipTasks
@POST @Timed @Path("skip") public com.xebialabs.xlrelease.views.BulkActionResultView skipTasks(CommentTasksView comment) Skips tasks.- Parameters:
comment- the comment to associate to the action
-
failTask
@POST @Timed @Path("{taskId:.*Task[^/-]*}/fail") public jakarta.ws.rs.core.Response failTask(@PathParam("taskId") String taskId, CommentView comment) Fails a task.- Parameters:
taskId- the identifier of the taskcomment- the comment to associate to the action- Returns:
- HTTP status 200 to indicate success
-
failTasks
@POST @Timed @Path("fail") public com.xebialabs.xlrelease.views.BulkActionResultView failTasks(CommentTasksView comment) Fails tasks.- Parameters:
comment- a comment describing the 'fail' action.
-
abortTask
@POST @Timed @Path("{taskId:.*Task[^/-]*}/abort") public jakarta.ws.rs.core.Response abortTask(@PathParam("taskId") String taskId, CommentView comment) Aborts a task.- Parameters:
taskId- the identifier of the taskcomment- the comment to associate to the action- Returns:
- HTTP status 200 to indicate success
-
retryTask
@POST @Timed @Path("{taskId:.*Task[^/-]*}/retry") public jakarta.ws.rs.core.Response retryTask(@PathParam("taskId") String taskId, CommentView comment) Retries a task.- Parameters:
taskId- the identifier of the taskcomment- the comment to associate to the action- Returns:
- HTTP status 200 to indicate success
-
retryTasks
@POST @Timed @Path("retry") public com.xebialabs.xlrelease.views.BulkActionResultView retryTasks(CommentTasksView comment) Retries tasks.- Parameters:
comment- the comment to associate to the action
-
abortTasks
@POST @Timed @Path("abort") public com.xebialabs.xlrelease.views.BulkActionResultView abortTasks(CommentTasksView comment) Aborts tasks.- Parameters:
comment- the comment to associate to the action
-
startNow
@POST @Timed @Path("{taskId:.*Task[^/-]*}/startNow") public jakarta.ws.rs.core.Response startNow(@PathParam("taskId") String taskId, CommentView comment) Forces a pending task to start immediately.- Parameters:
taskId- the identifier of the taskcomment- the comment to associate to the action- Returns:
- HTTP status 200 to indicate success
-
reopenTask
@POST @Timed @Path("{taskId:.*Task[^/-]*}/reopen") public jakarta.ws.rs.core.Response reopenTask(@PathParam("taskId") String taskId, CommentView comment) Reopens a task that had been completed in advance.- Parameters:
taskId- the identifier of the taskcomment- the comment to associate to the action- Returns:
- HTTP status 200 to indicate success
-
reopenTasks
@POST @Timed @Path("reopen") public com.xebialabs.xlrelease.views.BulkActionResultView reopenTasks(CommentTasksView comment) Reopens tasks.- Parameters:
comment- the comment to associate to the action
-
getCommentsOfTask
@GET @Timed @Path("{taskId:.*Task[^/-]*}/comments") public List<CommentView> getCommentsOfTask(@PathParam("taskId") String taskId) Returns the comments associated with a task.- Parameters:
taskId- the identifier of the task- Returns:
- the comments
-
addComment
@POST @Timed @Path("{taskId:.*Task[^/-]*}/comments") public CommentView addComment(@PathParam("taskId") String taskId, CommentView commentView) Adds a comment to a task.- Parameters:
taskId- the identifier of the taskcommentView- the comment's data- Returns:
- the comment
-
addCommentToTasks
@POST @Timed @Path("comments") public com.xebialabs.xlrelease.views.BulkActionResultView addCommentToTasks(CommentTasksView commentTasksView) -
updateTask
@PUT @Timed @Path("{taskId:.*Task[^/-]*}") public TaskFullView updateTask(@PathParam("taskId") String taskId, TaskFullView updatedTask) Updates a task and notifies the new owner if the task has been reassigned.- Parameters:
taskId- the identifier of the taskupdatedTask- the new task values- Returns:
- the updated task
-
changeTaskType
@POST @Timed @Path("{taskId:.*Task[^/-]*}/changeType") public TaskFullView changeTaskType(@PathParam("taskId") String taskId, @QueryParam("targetType") String targetType) Change task type to the target task type.- Parameters:
taskId- the identifier of the tasktargetType- the new task type- Returns:
- new task
-
reassignTasks
@PUT @Timed @Path("reassign") public com.xebialabs.xlrelease.views.BulkActionResultView reassignTasks(ReassignTasksView reassignTasks) -
reassignToOwner
@PUT @Timed @Path("{taskId:.*Task[^/-]*}/owner") public void reassignToOwner(@PathParam("taskId") String taskId, TaskFullView updatedTask) Reassigns a task to a different owner.- Parameters:
taskId- the identifier of the taskupdatedTask- the details of the updated task, including the new owner
-
removeOwner
@DELETE @Timed @Path("{taskId:.*Task[^/-]*}/owner") public void removeOwner(@PathParam("taskId") String taskId) Deletes a task owner.- Parameters:
taskId- the identifier of the task
-
reassignToTeam
@PUT @Timed @Path("{taskId:.*Task[^/-]*}/team") public void reassignToTeam(@PathParam("taskId") String taskId, TaskFullView updatedTask) Reassigns a task to a different team.- Parameters:
taskId- the identifier of the taskupdatedTask- the details of the updated task, including the new team
-
removeTeam
@DELETE @Timed @Path("{taskId:.*Task[^/-]*}/team") public void removeTeam(@PathParam("taskId") String taskId) Removes the team of a task.- Parameters:
taskId- the identifier of the task
-
deleteTasks
-
deleteTask
@DELETE @Timed @Path("{taskId:.*Task[^/-]*}") public void deleteTask(@PathParam("taskId") String taskId) Deletes a task.- Parameters:
taskId- the identifier of the task
-
poll
Returns a list of tasks.- Parameters:
form- the identifiers of the tasks- Returns:
- the tasks
-
getTaskDefinitions
@GET @Timed @Path("task-definitions") public Collection<com.xebialabs.xlrelease.domain.TaskDefinition> getTaskDefinitions()Returns the custom task definitions created through Digital.ai Release's extensibility mechanism.- Returns:
- the definitions
-
getCustomScriptProperties
@GET @Timed @Path("task-definitions/{scriptDefinitionType}") public com.xebialabs.xlrelease.domain.TaskWithPropertiesDefinition getCustomScriptProperties(@PathParam("scriptDefinitionType") String scriptDefinitionType) Returns the properties used to configure a custom task type.- Parameters:
scriptDefinitionType- the task type- Returns:
- the definition of the type, which includes the properties
-
getTaskAccesses
@GET @Timed @Path("types-access") public List<com.xebialabs.xlrelease.api.v1.views.TaskAccessView> getTaskAccesses()Returns all task accesses. It's necessary to have the 'security#edit' permission to call this end point.- Returns:
- the task accesses
-
updateTaskAccesses
@PUT @Timed @Path("types-access") public void updateTaskAccesses(List<com.xebialabs.xlrelease.api.v1.views.TaskAccessView> taskAccesses) Update task accesses. It's necessary to have the 'security#edit' permission to call this end point.- Parameters:
taskAccesses- the task accesses to save
-
getTaskRelease
@GET @Timed @Path("{taskId:.*Task[^/-]*}/release") public TaskReleaseView getTaskRelease(@PathParam("taskId") String taskId) Returns a release view for given task.- Parameters:
taskId- the task identifier- Returns:
- task release view
-
getAllTags
-
addWatcher
-
removeWatcher
-
updateWatchers
-
followLog
@POST @Path("{taskId:.*Task[^/-]*}/execution/{executionId}/log/follow") public void followLog(@PathParam("taskId") String taskId, @PathParam("executionId") String executionId) Streams entries for a given task execution.IMPORTANT: streamed events MAY BE DUPLICATED if fromStart is true
- Parameters:
taskId- task id of the taskexecutionId- execution id of the task (This is not the same as the custom script task execution id)
-
unfollowLog
-
log
@GET @Path("{taskId:.*Task[^/-]*}/execution/{executionId}/log") @Produces("text/plain") public jakarta.ws.rs.core.Response log(@PathParam("taskId") String taskId, @PathParam("executionId") String executionId, @QueryParam("job") @DefaultValue("9223372036854775807") Long job, @QueryParam("chunk") @DefaultValue("9223372036854775807") Long chunk) -
getTaskExecutions
@GET @Path("{taskId:.*Task[^/-]*}/executions") public List<TaskExecutionLogView> getTaskExecutions(@PathParam("taskId") String taskId) Retrieve list of task executions. It's a starting point of execution flows to display task execution logs.execution flow 1:
- UI hits `GET getTaskExecutions` and in response gets all task executions
- UI gets back information: (id - execution id, executionNo - order, modified date, end date, latest_job_id, latest_chunk)
- UI decides to ask `GET followLog` to stream log entries - and it will get event with current status: (status, latest_job_id, latest_chunk_id)
- status can be: 'in_progress', 'closed' or 'unknown'
- if status is 'unknown' latest_job_id is -1 and latest_chunk is -1
- IN PARALLEL: UI invokes `GET log` endpoint with 'latest_job_id' and 'latest_chunk' parameters and fetches content up until that point (100s of streamed megabytes) - if needed backend can also discard everything but latest 40KB of data (or whatever we choose)
- UI decides how to present this data AND any incoming events to the user
execution flow 2:
- UI hits `GET getTaskExecutions` and in response gets all task executions
- UI gets back information: (id - execution id, executionNo - order, modified date, end date, latest_job_id, latest_chunk)
- UI decides to ask `GET followLog` to stream log entries - and it will get event with current status: (status, latest_job_id, latest_chunk_id)
- status can be: 'in_progress', 'closed' or 'unknown'
- if status is 'unknown' latest_job_id is -1 and latest_chunk is -1
- Parameters:
taskId- task id- Returns:
- list of task execution data
-
followTask
@POST @Path("{taskId:.*Task[^/-]*}/follow") public void followTask(@PathParam("taskId") String taskId) -
unfollowTask
@DELETE @Path("{taskId:.*Task[^/-]*}/follow") public void unfollowTask(@PathParam("taskId") String taskId)
-