use of org.camunda.bpm.engine.rest.dto.task.CommentDto in project camunda-bpm-platform by camunda.
the class TaskCommentResourceImpl method createComment.
public CommentDto createComment(UriInfo uriInfo, CommentDto commentDto) {
ensureHistoryEnabled(Status.FORBIDDEN);
ensureTaskExists(Status.BAD_REQUEST);
Comment comment;
try {
comment = engine.getTaskService().createComment(taskId, null, commentDto.getMessage());
} catch (ProcessEngineException e) {
throw new InvalidRequestException(Status.BAD_REQUEST, e, "Not enough parameters submitted");
}
URI uri = uriInfo.getBaseUriBuilder().path(rootResourcePath).path(TaskRestService.PATH).path(taskId + "/comment/" + comment.getId()).build();
CommentDto resultDto = CommentDto.fromComment(comment);
// GET /
resultDto.addReflexiveLink(uri, HttpMethod.GET, "self");
return resultDto;
}
use of org.camunda.bpm.engine.rest.dto.task.CommentDto in project camunda-bpm-platform by camunda.
the class TaskCommentResourceImpl method getComments.
public List<CommentDto> getComments() {
if (!isHistoryEnabled()) {
return Collections.emptyList();
}
ensureTaskExists(Status.NOT_FOUND);
List<Comment> taskComments = engine.getTaskService().getTaskComments(taskId);
List<CommentDto> comments = new ArrayList<CommentDto>();
for (Comment comment : taskComments) {
comments.add(CommentDto.fromComment(comment));
}
return comments;
}
Aggregations