test_class.file: modules/flowable-rest/src/test/java/org/flowable/rest/service/api/history/HistoricProcessInstanceCommentResourceTest.java
test_class.identifier: HistoricProcessInstanceCommentResourceTest
test_class.superclass: extends BaseSpringRestTestCase
test_case.body: @Test
      @Deployment(resources = { "org/flowable/rest/service/api/repository/oneTaskProcess.bpmn20.xml" })
      public void testCreateComment() throws Exception {
          ProcessInstance pi = null;
  
          try {
              pi = runtimeService.startProcessInstanceByKey("oneTaskProcess");
  
              HttpPost httpPost = new HttpPost(
                      SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_HISTORIC_PROCESS_INSTANCE_COMMENT_COLLECTION, pi.getId()));
              ObjectNode requestNode = objectMapper.createObjectNode();
              requestNode.put("message", "This is a comment...");
              httpPost.setEntity(new StringEntity(requestNode.toString()));
  
              CloseableHttpResponse response = executeRequest(httpPost, HttpStatus.SC_CREATED);
  
              assertThat(response.getStatusLine().getStatusCode()).isEqualTo(HttpStatus.SC_CREATED);
  
              List<Comment> commentsOnProcess = taskService.getProcessInstanceComments(pi.getId());
              assertThat(commentsOnProcess).isNotNull();
              assertThat(commentsOnProcess).hasSize(1);
  
              JsonNode responseNode = objectMapper.readTree(response.getEntity().getContent());
              closeResponse(response);
              assertThat(responseNode).isNotNull();
              assertThatJson(responseNode)
                      .when(Option.IGNORING_EXTRA_FIELDS)
                      .isEqualTo(" {"
                              + "   id: '" + commentsOnProcess.get(0).getId() + "',"
                              + "   author: 'kermit',"
                              + "   message: 'This is a comment...',"
                              + "   taskId: null,"
                              + "   taskUrl: null,"
                              + "   processInstanceId: '" + pi.getProcessInstanceId() + "',"
                              + "   processInstanceUrl: '" + SERVER_URL_PREFIX + RestUrls
                              .createRelativeResourceUrl(RestUrls.URL_HISTORIC_PROCESS_INSTANCE_COMMENT, pi.getId(), commentsOnProcess.get(0).getId()) + "'"
                              + "}");
  
          } finally {
              if (pi != null) {
                  List<Comment> comments = taskService.getProcessInstanceComments(pi.getId());
                  for (Comment c : comments) {
                      taskService.deleteComment(c.getId());
                  }
              }
          }
      }
test_case.class_method_signature: HistoricProcessInstanceCommentResourceTest.testCreateComment()
test_case.full_signature: @Test @Deployment(resources = { "org/flowable/rest/service/api/repository/oneTaskProcess.bpmn20.xml" }) public void testCreateComment()
test_case.identifier: testCreateComment
test_case.invocations: startProcessInstanceByKey createRelativeResourceUrl getId createObjectNode put setEntity toString executeRequest isEqualTo assertThat getStatusCode getStatusLine getProcessInstanceComments getId isNotNull assertThat hasSize assertThat readTree getContent getEntity closeResponse isNotNull assertThat isEqualTo when assertThatJson getId get getProcessInstanceId createRelativeResourceUrl getId getId get getProcessInstanceComments getId deleteComment getId
test_case.modifiers: @Test @Deployment(resources = { "org/flowable/rest/service/api/repository/oneTaskProcess.bpmn20.xml" }) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCreateComment()
focal_class.declarator: restResponseFactory
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected RestResponseFactory restResponseFactory;
focal_class.type: RestResponseFactory
focal_class.var_name: restResponseFactory
focal_class.declarator: historyService
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected HistoryService historyService;
focal_class.type: HistoryService
focal_class.var_name: historyService
focal_class.declarator: taskService
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected TaskService taskService;
focal_class.type: TaskService
focal_class.var_name: taskService
focal_class.file: modules/flowable-rest/src/main/java/org/flowable/rest/service/api/history/HistoricProcessInstanceCommentResource.java
focal_class.identifier: HistoricProcessInstanceCommentResource
focal_class.class_method_signature: HistoricProcessInstanceCommentResource.getComment(@ApiParam(name = "processInstanceId") @PathVariable("processInstanceId") String processInstanceId, @ApiParam(name = "commentId") @PathVariable("commentId") String commentId, HttpServletRequest request)
focal_class.full_signature: @ApiOperation(value = "Get a comment on a historic process instance", tags = { "History Process" }, notes = "") @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the historic process instance and comment were found and the comment is returned."), @ApiResponse(code = 404, message = "Indicates the requested historic process instance was not found or the historic process instance does not have a comment with the given ID.") }) @GetMapping(value = "/history/historic-process-instances/{processInstanceId}/comments/{commentId}", produces = "application/json") public CommentResponse getComment(@ApiParam(name = "processInstanceId") @PathVariable("processInstanceId") String processInstanceId, @ApiParam(name = "commentId") @PathVariable("commentId") String commentId, HttpServletRequest request)
focal_class.identifier: getComment
focal_class.modifiers: @ApiOperation(value = "Get a comment on a historic process instance", tags = { "History Process" }, notes = "") @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the historic process instance and comment were found and the comment is returned."), @ApiResponse(code = 404, message = "Indicates the requested historic process instance was not found or the historic process instance does not have a comment with the given ID.") }) @GetMapping(value = "/history/historic-process-instances/{processInstanceId}/comments/{commentId}", produces = "application/json") public
focal_class.parameters: (@ApiParam(name = "processInstanceId") @PathVariable("processInstanceId") String processInstanceId, @ApiParam(name = "commentId") @PathVariable("commentId") String commentId, HttpServletRequest request)
focal_class.return: CommentResponse
focal_class.signature: CommentResponse getComment(@ApiParam(name = "processInstanceId") @PathVariable("processInstanceId") String processInstanceId, @ApiParam(name = "commentId") @PathVariable("commentId") String commentId, HttpServletRequest request)
focal_class.class_method_signature: HistoricProcessInstanceCommentResource.deleteComment(@ApiParam(name = "processInstanceId") @PathVariable("processInstanceId") String processInstanceId, @ApiParam(name = "commentId") @PathVariable("commentId") String commentId, HttpServletRequest request,
              HttpServletResponse response)
focal_class.full_signature: @ApiOperation(value = "Delete a comment on a historic process instance", tags = { "History Process" }, notes = "") @ApiResponses(value = { @ApiResponse(code = 204, message = "Indicates the historic process instance and comment were found and the comment is deleted. Response body is left empty intentionally."), @ApiResponse(code = 404, message = "Indicates the requested historic process instance was not found or the historic process instance does not have a comment with the given ID.") }) @DeleteMapping(value = "/history/historic-process-instances/{processInstanceId}/comments/{commentId}") public void deleteComment(@ApiParam(name = "processInstanceId") @PathVariable("processInstanceId") String processInstanceId, @ApiParam(name = "commentId") @PathVariable("commentId") String commentId, HttpServletRequest request,
              HttpServletResponse response)
focal_class.identifier: deleteComment
focal_class.modifiers: @ApiOperation(value = "Delete a comment on a historic process instance", tags = { "History Process" }, notes = "") @ApiResponses(value = { @ApiResponse(code = 204, message = "Indicates the historic process instance and comment were found and the comment is deleted. Response body is left empty intentionally."), @ApiResponse(code = 404, message = "Indicates the requested historic process instance was not found or the historic process instance does not have a comment with the given ID.") }) @DeleteMapping(value = "/history/historic-process-instances/{processInstanceId}/comments/{commentId}") public
focal_class.parameters: (@ApiParam(name = "processInstanceId") @PathVariable("processInstanceId") String processInstanceId, @ApiParam(name = "commentId") @PathVariable("commentId") String commentId, HttpServletRequest request,
              HttpServletResponse response)
focal_class.return: void
focal_class.signature: void deleteComment(@ApiParam(name = "processInstanceId") @PathVariable("processInstanceId") String processInstanceId, @ApiParam(name = "commentId") @PathVariable("commentId") String commentId, HttpServletRequest request,
              HttpServletResponse response)
focal_class.superclass: extends HistoricProcessInstanceBaseResource
focal_method.body: @ApiOperation(value = "Delete a comment on a historic process instance", tags = { "History Process" }, notes = "")
      @ApiResponses(value = {
              @ApiResponse(code = 204, message = "Indicates the historic process instance and comment were found and the comment is deleted. Response body is left empty intentionally."),
              @ApiResponse(code = 404, message = "Indicates the requested historic process instance was not found or the historic process instance does not have a comment with the given ID.") })
      @DeleteMapping(value = "/history/historic-process-instances/{processInstanceId}/comments/{commentId}")
      public void deleteComment(@ApiParam(name = "processInstanceId") @PathVariable("processInstanceId") String processInstanceId, @ApiParam(name = "commentId") @PathVariable("commentId") String commentId, HttpServletRequest request,
              HttpServletResponse response) {
  
          HistoricProcessInstance instance = getHistoricProcessInstanceFromRequest(processInstanceId);
  
          Comment comment = taskService.getComment(commentId);
          if (comment == null || comment.getProcessInstanceId() == null || !comment.getProcessInstanceId().equals(instance.getId())) {
              throw new FlowableObjectNotFoundException("Process instance '" + instance.getId() + "' does not have a comment with id '" + commentId + "'.", Comment.class);
          }
  
          taskService.deleteComment(commentId);
          response.setStatus(HttpStatus.NO_CONTENT.value());
      }
focal_method.class_method_signature: HistoricProcessInstanceCommentResource.deleteComment(@ApiParam(name = "processInstanceId") @PathVariable("processInstanceId") String processInstanceId, @ApiParam(name = "commentId") @PathVariable("commentId") String commentId, HttpServletRequest request,
              HttpServletResponse response)
focal_method.full_signature: @ApiOperation(value = "Delete a comment on a historic process instance", tags = { "History Process" }, notes = "") @ApiResponses(value = { @ApiResponse(code = 204, message = "Indicates the historic process instance and comment were found and the comment is deleted. Response body is left empty intentionally."), @ApiResponse(code = 404, message = "Indicates the requested historic process instance was not found or the historic process instance does not have a comment with the given ID.") }) @DeleteMapping(value = "/history/historic-process-instances/{processInstanceId}/comments/{commentId}") public void deleteComment(@ApiParam(name = "processInstanceId") @PathVariable("processInstanceId") String processInstanceId, @ApiParam(name = "commentId") @PathVariable("commentId") String commentId, HttpServletRequest request,
              HttpServletResponse response)
focal_method.identifier: deleteComment
focal_method.invocations: getHistoricProcessInstanceFromRequest getComment getProcessInstanceId equals getProcessInstanceId getId getId deleteComment setStatus value
focal_method.modifiers: @ApiOperation(value = "Delete a comment on a historic process instance", tags = { "History Process" }, notes = "") @ApiResponses(value = { @ApiResponse(code = 204, message = "Indicates the historic process instance and comment were found and the comment is deleted. Response body is left empty intentionally."), @ApiResponse(code = 404, message = "Indicates the requested historic process instance was not found or the historic process instance does not have a comment with the given ID.") }) @DeleteMapping(value = "/history/historic-process-instances/{processInstanceId}/comments/{commentId}") public
focal_method.parameters: (@ApiParam(name = "processInstanceId") @PathVariable("processInstanceId") String processInstanceId, @ApiParam(name = "commentId") @PathVariable("commentId") String commentId, HttpServletRequest request,
              HttpServletResponse response)
focal_method.return: void
focal_method.signature: void deleteComment(@ApiParam(name = "processInstanceId") @PathVariable("processInstanceId") String processInstanceId, @ApiParam(name = "commentId") @PathVariable("commentId") String commentId, HttpServletRequest request,
              HttpServletResponse response)