/** * Return a given task definition resource. * * @param name the name of an existing task definition (required) * @return the task definition */ @RequestMapping(value = "/{name}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public TaskDefinitionResource display(@PathVariable("name") String name) { TaskDefinition definition = this.repository.findById(name) .orElseThrow(() -> new NoSuchTaskDefinitionException(name)); final TaskExecution taskExecution = this.explorer.getLatestTaskExecutionForTaskName(name); if (taskExecution != null) { return taskAssembler.toResource(new TaskExecutionAwareTaskDefinition(definition, taskExecution)); } else { return taskAssembler.toResource(new TaskExecutionAwareTaskDefinition(definition)); } }
/** * Return a given task definition resource. * * @param name the name of an existing task definition (required) * @return the task definition */ @RequestMapping(value = "/{name}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public TaskDefinitionResource display(@PathVariable("name") String name) { TaskDefinition definition = repository.findOne(name); if (definition == null) { throw new NoSuchTaskDefinitionException(name); } final TaskExecution taskExecution = this.explorer.getLatestTaskExecutionForTaskName(name); if (taskExecution != null) { return taskAssembler.toResource(new TaskExecutionAwareTaskDefinition(definition, taskExecution)); } else { return taskAssembler.toResource(new TaskExecutionAwareTaskDefinition(definition)); } }