Class TaskResource


  • @Path("/tasks")
    @Consumes("application/json")
    @Produces("application/json")
    @Controller
    public class TaskResource
    extends java.lang.Object
    A task in a release.
    • Method Detail

      • addTask

        @POST
        @Timed
        @Path("{containerId:.*(Phase|Task)[^/-]*}")
        public TaskFullView addTask​(@PathParam("containerId")
                                    java.lang.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
        @Timed
        @Path("{taskId:[^/]*Task[^/-]*}")
        public TaskFullView getTask​(@PathParam("taskId")
                                    java.lang.String taskId)
        Returns the details of a task.
        Parameters:
        taskId - the identifier of the task
        Returns:
        the task
      • getTasksByRelease

        @POST
        @Timed
        @Path("search")
        public TaskSearchView getTasksByRelease​(TasksFilters tasksFilters,
                                                @QueryParam("limitTasksHint")
                                                java.lang.Integer limitTasksHint)
        Returns the list of tasks accessible to the current user, grouped by release.
        Parameters:
        tasksFilters - the TasksFilters criteria
        limitTasksHint - the number of tasks after which search will be aborted (actual number of tasks may be more than requested), optional, the default value is 100.
        Returns:
        the matching tasks, grouped by release.
      • completeTask

        @POST
        @Timed
        @Path("{taskId:.*Task[^/-]*}/complete")
        public javax.ws.rs.core.Response completeTask​(@PathParam("taskId")
                                                      java.lang.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
        @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 javax.ws.rs.core.Response skipTask​(@PathParam("taskId")
                                                  java.lang.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
        @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 javax.ws.rs.core.Response failTask​(@PathParam("taskId")
                                                  java.lang.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
        @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 javax.ws.rs.core.Response abortTask​(@PathParam("taskId")
                                                   java.lang.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
        @Timed
        @Path("{taskId:.*Task[^/-]*}/retry")
        public javax.ws.rs.core.Response retryTask​(@PathParam("taskId")
                                                   java.lang.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
        @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 javax.ws.rs.core.Response startNow​(@PathParam("taskId")
                                                  java.lang.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
        @Timed
        @Path("{taskId:.*Task[^/-]*}/reopen")
        public javax.ws.rs.core.Response reopenTask​(@PathParam("taskId")
                                                    java.lang.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
        @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 java.util.List<CommentView> getCommentsOfTask​(@PathParam("taskId")
                                                             java.lang.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")
                                      java.lang.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
        @Timed
        @Path("comments")
        public com.xebialabs.xlrelease.views.BulkActionResultView addCommentToTasks​(CommentTasksView commentTasksView)
      • updateTask

        @PUT
        @Timed
        @Path("{taskId:.*Task[^/-]*}")
        public TaskFullView updateTask​(@PathParam("taskId")
                                       java.lang.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
        @Timed
        @Path("{taskId:.*Task[^/-]*}/changeType")
        public TaskFullView changeTaskType​(@PathParam("taskId")
                                           java.lang.String taskId,
                                           @QueryParam("targetType")
                                           java.lang.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
        @Timed
        @Path("reassign")
        public com.xebialabs.xlrelease.views.BulkActionResultView reassignTasks​(ReassignTasksView reassignTasks)
      • reassignToOwner

        @PUT
        @Timed
        @Path("{taskId:.*Task[^/-]*}/owner")
        public void reassignToOwner​(@PathParam("taskId")
                                    java.lang.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
        @Timed
        @Path("{taskId:.*Task[^/-]*}/owner")
        public void removeOwner​(@PathParam("taskId")
                                java.lang.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")
                                   java.lang.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
        @Timed
        @Path("{taskId:.*Task[^/-]*}/team")
        public void removeTeam​(@PathParam("taskId")
                               java.lang.String taskId)
        Removes the team of a task.
        Parameters:
        taskId - the identifier of the task
      • deleteTasks

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

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

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

        @GET
        @Timed
        @Path("task-definitions")
        public java.util.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")
                                                                                                     java.lang.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 java.util.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​(java.util.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")
                                              java.lang.String taskId)
        Returns a release view for given task.
        Parameters:
        taskId - the task identifier
        Returns:
        task release view
      • getAllTags

        @GET
        @Path("tags")
        public java.util.Set<java.lang.String> getAllTags()
      • getWatchers

        @Path("{taskId:.*Task[^/-]*}/watchers")
        @GET
        public java.util.Set<UserView> getWatchers​(@PathParam("taskId")
                                                   java.lang.String taskId)
      • addWatcher

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

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

        @Path("{taskId:.*Task[^/-]*}/watchers")
        @PUT
        public java.util.Set<UserView> updateWatchers​(@PathParam("taskId")
                                                      java.lang.String taskId,
                                                      java.util.Set<UserView> watchersView)
      • followLog

        @GET
        @Path("{taskId:.*Task[^/-]*}/execution/{executionId}/log/follow")
        @Produces("text/event-stream")
        public void followLog​(@PathParam("taskId")
                              java.lang.String taskId,
                              @PathParam("executionId")
                              java.lang.String executionId,
                              @Context
                              javax.ws.rs.sse.SseEventSink sink,
                              @Context
                              javax.ws.rs.sse.Sse sse)
        Streams entries for a given task execution.

        IMPORTANT: streamed events MAY BE DUPLICATED if fromStart is true

        Parameters:
        executionId - execution id of the task (This is not the same as the custom script task execution id)
        sink - injected sink
        sse - injected sse
      • log

        @GET
        @Path("{taskId:.*Task[^/-]*}/execution/{executionId}/log")
        @Produces("text/plain")
        public javax.ws.rs.core.Response log​(@PathParam("taskId")
                                             java.lang.String taskId,
                                             @PathParam("executionId")
                                             java.lang.String executionId,
                                             @QueryParam("job") @DefaultValue("9223372036854775807")
                                             java.lang.Long job,
                                             @QueryParam("chunk") @DefaultValue("9223372036854775807")
                                             java.lang.Long chunk)
      • getTaskExecutions

        @GET
        @Path("{taskId:.*Task[^/-]*}/executions")
        public java.util.List<TaskExecutionLogView> getTaskExecutions​(@PathParam("taskId")
                                                                      java.lang.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