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 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, com.xebialabs.xlrelease.features.TaskUpdateVersioningFeature taskUpdateVersioningFeature)
  • Method Details

    • addTask

      @POST @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 container
      taskForm - the information of the new task
      Returns:
      the new task
    • getTask

      @GET @Path("{taskId:[^/]*Task[^/-]*}") public TaskFullViewWithUsedVariables getTask(@PathParam("taskId") String taskId)
      Returns the details of a task.
      Parameters:
      taskId - the identifier of the task
      Returns:
      the task
    • getTasksByRelease

      @POST @Path("search") public org.springframework.data.domain.Page<com.xebialabs.xlrelease.views.tasks.TaskListRelease> getTasksByRelease(@QueryParam("page") Integer page, @QueryParam("numberbypage") @DefaultValue("50") Integer numberByPage, TasksFilters tasksFilters)
      Returns the list of tasks accessible to the current user, grouped by release.
      Parameters:
      page - next page to query
      numberByPage - releases per page
      tasksFilters - the TasksFilters criteria
      Returns:
      the matching tasks, grouped by release.
    • completeTask

      @POST @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 task
      comment - the comment to associate to the action
      Returns:
      HTTP status 200 to indicate success
    • completeTasks

      @POST @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 @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 task
      comment - the comment to associate to the action
      Returns:
      HTTP status 200 to indicate success
    • skipTasks

      @POST @Path("skip") public com.xebialabs.xlrelease.views.BulkActionResultView skipTasks(CommentTasksView comment)
      Skips tasks.
      Parameters:
      comment - the comment to associate to the action
    • failTask

      @POST @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 task
      comment - the comment to associate to the action
      Returns:
      HTTP status 200 to indicate success
    • failTasks

      @POST @Path("fail") public com.xebialabs.xlrelease.views.BulkActionResultView failTasks(CommentTasksView comment)
      Fails tasks.
      Parameters:
      comment - a comment describing the 'fail' action.
    • abortTask

      @POST @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 task
      comment - the comment to associate to the action
      Returns:
      HTTP status 200 to indicate success
    • retryTask

      @POST @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 task
      comment - the comment to associate to the action
      Returns:
      HTTP status 200 to indicate success
    • retryTasks

      @POST @Path("retry") public com.xebialabs.xlrelease.views.BulkActionResultView retryTasks(CommentTasksView comment)
      Retries tasks.
      Parameters:
      comment - the comment to associate to the action
    • abortTasks

      @POST @Path("abort") public com.xebialabs.xlrelease.views.BulkActionResultView abortTasks(CommentTasksView comment)
      Aborts tasks.
      Parameters:
      comment - the comment to associate to the action
    • startNow

      @POST @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 task
      comment - the comment to associate to the action
      Returns:
      HTTP status 200 to indicate success
    • reopenTask

      @POST @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 task
      comment - the comment to associate to the action
      Returns:
      HTTP status 200 to indicate success
    • reopenTasks

      @POST @Path("reopen") public com.xebialabs.xlrelease.views.BulkActionResultView reopenTasks(CommentTasksView comment)
      Reopens tasks.
      Parameters:
      comment - the comment to associate to the action
    • getCommentsOfTask

      @GET @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 @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 task
      commentView - the comment's data
      Returns:
      the comment
    • addCommentToTasks

      @POST @Path("comments") public com.xebialabs.xlrelease.views.BulkActionResultView addCommentToTasks(CommentTasksView commentTasksView)
    • updateInputVariables

      @PUT @Path("/{taskId:.*/Task[^/]*}/variables") public TaskFullView updateInputVariables(@PathParam("taskId") String taskId, @QueryParam("modifiedAt") Long modifiedAt, List<com.xebialabs.xlrelease.domain.variables.Variable> variables)
      Updates the variables values of a UserInputTask It doesn't remove or add new variables
      Parameters:
      taskId - the task identifier.
      modifiedAt - the time of the last update to the task
      variables - the variables with values to be updated.
      Returns:
      the updated task.
    • updateTask

      @PUT @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 task
      updatedTask - the new task values
      Returns:
      the updated task
    • changeTaskType

      @POST @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 task
      targetType - the new task type
      Returns:
      new task
    • reassignTasks

      @PUT @Path("reassign") public com.xebialabs.xlrelease.views.BulkActionResultView reassignTasks(ReassignTasksView reassignTasks)
    • reassignToOwner

      @PUT @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 task
      updatedTask - the details of the updated task, including the new owner
    • removeOwner

      @DELETE @Path("{taskId:.*Task[^/-]*}/owner") public void removeOwner(@PathParam("taskId") String taskId)
      Deletes a task owner.
      Parameters:
      taskId - the identifier of the task
    • reassignToTeam

      @PUT @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 task
      updatedTask - the details of the updated task, including the new team
    • removeTeam

      @DELETE @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

      @DELETE public com.xebialabs.xlrelease.views.BulkActionResultView deleteTasks(List<String> taskIds)
    • deleteTask

      @DELETE @Path("{taskId:.*Task[^/-]*}") public void deleteTask(@PathParam("taskId") String taskId)
      Deletes a task.
      Parameters:
      taskId - the identifier of the task
    • poll

      @POST @Path("poll") public List<TaskPollingView> poll(DomainIdsForm form)
      Returns a list of tasks.
      Parameters:
      form - the identifiers of the tasks
      Returns:
      the tasks
    • getTaskDefinitions

      @GET @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 @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 @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 @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 @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

      @GET @Path("tags") public Set<String> getAllTags()
    • addWatcher

      @Path("{taskId:.*Task[^/-]*}/watchers") @POST public Set<UserView> addWatcher(@PathParam("taskId") String taskId, UserView watcherView)
    • removeWatcher

      @Path("{taskId:.*Task[^/-]*}/watchers/{username}") @DELETE public Set<UserView> removeWatcher(@PathParam("taskId") String taskId, @PathParam("username") String username)
    • updateWatchers

      @Path("{taskId:.*Task[^/-]*}/watchers") @PUT public Set<UserView> updateWatchers(@PathParam("taskId") String taskId, Set<UserView> watchersView)
    • 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 task
      executionId - execution id of the task (This is not the same as the custom script task execution id)
    • pong

      @POST @Path("{taskId:.*Task[^/-]*}/execution/{executionId}/log/pong") public void pong(@PathParam("taskId") String taskId, @PathParam("executionId") String executionId)
    • unfollowLog

      @DELETE @Path("{taskId:.*Task[^/-]*}/execution/{executionId}/log/follow") public void unfollowLog(@PathParam("taskId") String taskId, @PathParam("executionId") String executionId)
    • 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)