Search in sources :

Example 1 with TaskInfoJson

use of com.enonic.xp.task.TaskInfoJson in project xp by enonic.

the class TaskResource method getTask.

@GET
@Path("/{taskId}")
public TaskInfoJson getTask(@PathParam("taskId") final String taskIdString) {
    final TaskId taskId = TaskId.from(taskIdString);
    final TaskInfo taskInfo = taskService.getTaskInfo(taskId);
    if (taskInfo == null) {
        throw new WebApplicationException(String.format("Task [%s] was not found", taskIdString), Response.Status.NOT_FOUND);
    }
    return new TaskInfoJson(taskInfo);
}
Also used : TaskInfo(com.enonic.xp.task.TaskInfo) TaskInfoJson(com.enonic.xp.task.TaskInfoJson) TaskId(com.enonic.xp.task.TaskId) WebApplicationException(javax.ws.rs.WebApplicationException) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Aggregations

TaskId (com.enonic.xp.task.TaskId)1 TaskInfo (com.enonic.xp.task.TaskInfo)1 TaskInfoJson (com.enonic.xp.task.TaskInfoJson)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 WebApplicationException (javax.ws.rs.WebApplicationException)1