示例#1
0
        public virtual CommentDto createComment(UriInfo uriInfo, CommentDto commentDto)
        {
            ensureHistoryEnabled(Status.FORBIDDEN);
            ensureTaskExists(Status.BAD_REQUEST);

            Comment comment;

            try
            {
                comment = engine.TaskService.createComment(taskId, null, commentDto.Message);
            }
            catch (ProcessEngineException e)
            {
                throw new InvalidRequestException(Status.BAD_REQUEST, e, "Not enough parameters submitted");
            }

            URI uri = uriInfo.BaseUriBuilder.path(rootResourcePath).path(org.camunda.bpm.engine.rest.TaskRestService_Fields.PATH).path(taskId + "/comment/" + comment.Id).build();

            CommentDto resultDto = CommentDto.fromComment(comment);

            // GET /
            resultDto.addReflexiveLink(uri, HttpMethod.GET, "self");

            return(resultDto);
        }
示例#2
0
        public virtual CommentDto getComment(string commentId)
        {
            ensureHistoryEnabled(Status.NOT_FOUND);

            Comment comment = engine.TaskService.getTaskComment(taskId, commentId);

            if (comment == null)
            {
                throw new InvalidRequestException(Status.NOT_FOUND, "Task comment with id " + commentId + " does not exist for task id '" + taskId + "'.");
            }

            return(CommentDto.fromComment(comment));
        }