Java Code Examples for org.activiti.engine.task.Comment#getProcessInstanceId()
The following examples show how to use
org.activiti.engine.task.Comment#getProcessInstanceId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommentEntityManagerImpl.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Override public void insert(CommentEntity commentEntity) { checkHistoryEnabled(); insert(commentEntity, false); Comment comment = (Comment) commentEntity; if (getEventDispatcher().isEnabled()) { // Forced to fetch the process-instance to associate the right // process definition String processDefinitionId = null; String processInstanceId = comment.getProcessInstanceId(); if (comment.getProcessInstanceId() != null) { ExecutionEntity process = getExecutionEntityManager().findById(comment.getProcessInstanceId()); if (process != null) { processDefinitionId = process.getProcessDefinitionId(); } } getEventDispatcher().dispatchEvent( ActivitiEventBuilder.createEntityEvent(ActivitiEventType.ENTITY_CREATED, commentEntity, processInstanceId, processInstanceId, processDefinitionId)); getEventDispatcher().dispatchEvent( ActivitiEventBuilder.createEntityEvent(ActivitiEventType.ENTITY_INITIALIZED, commentEntity, processInstanceId, processInstanceId, processDefinitionId)); } }
Example 2
Source File: CommentEntityManagerImpl.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Override public void delete(CommentEntity commentEntity) { checkHistoryEnabled(); delete(commentEntity, false); Comment comment = (Comment) commentEntity; if (getEventDispatcher().isEnabled()) { // Forced to fetch the process-instance to associate the right // process definition String processDefinitionId = null; String processInstanceId = comment.getProcessInstanceId(); if (comment.getProcessInstanceId() != null) { ExecutionEntity process = getExecutionEntityManager().findById(comment.getProcessInstanceId()); if (process != null) { processDefinitionId = process.getProcessDefinitionId(); } } getEventDispatcher().dispatchEvent( ActivitiEventBuilder.createEntityEvent(ActivitiEventType.ENTITY_DELETED, commentEntity, processInstanceId, processInstanceId, processDefinitionId)); } }
Example 3
Source File: RestResponseFactory.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public CommentResponse createRestComment(Comment comment, RestUrlBuilder urlBuilder) { CommentResponse result = new CommentResponse(); result.setAuthor(comment.getUserId()); result.setMessage(comment.getFullMessage()); result.setId(comment.getId()); result.setTime(comment.getTime()); result.setTaskId(comment.getTaskId()); result.setProcessInstanceId(comment.getProcessInstanceId()); if (comment.getTaskId() != null) { result.setTaskUrl(urlBuilder.buildUrl(RestUrls.URL_TASK_COMMENT, comment.getTaskId(), comment.getId())); } if (comment.getProcessInstanceId() != null) { result.setProcessInstanceUrl(urlBuilder.buildUrl(RestUrls.URL_HISTORIC_PROCESS_INSTANCE_COMMENT, comment.getProcessInstanceId(), comment.getId())); } return result; }
Example 4
Source File: HistoricProcessInstanceCommentResource.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@ApiOperation(value = "Get a comment on a historic process instance", tags = { "History" }, 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 doesn’t have a comment with the given ID.") }) @RequestMapping(value = "/history/historic-process-instances/{processInstanceId}/comments/{commentId}", method = RequestMethod.GET, produces = "application/json") public CommentResponse getComment(@ApiParam(name="processInstanceId", value="The id of the historic process instance to get the comment for.") @PathVariable("processInstanceId") String processInstanceId,@ApiParam(name="commentId", value="The id of the comment.") @PathVariable("commentId") String commentId, HttpServletRequest request) { HistoricProcessInstance instance = getHistoricProcessInstanceFromRequest(processInstanceId); Comment comment = taskService.getComment(commentId); if (comment == null || comment.getProcessInstanceId() == null || !comment.getProcessInstanceId().equals(instance.getId())) { throw new ActivitiObjectNotFoundException("Process instance '" + instance.getId() + "' doesn't have a comment with id '" + commentId + "'.", Comment.class); } return restResponseFactory.createRestComment(comment); }
Example 5
Source File: HistoricProcessInstanceCommentResource.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@ApiOperation(value = "Delete a comment on a historic process instance", tags = { "History" }, 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 doesn’t have a comment with the given ID.") }) @RequestMapping(value = "/history/historic-process-instances/{processInstanceId}/comments/{commentId}", method = RequestMethod.DELETE) public void deleteComment(@ApiParam(name="processInstanceId", value="The id of the historic process instance to delete the comment for.") @PathVariable("processInstanceId") String processInstanceId, @ApiParam(name="commentId", value="The id of the comment.") @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 ActivitiObjectNotFoundException("Process instance '" + instance.getId() + "' doesn't have a comment with id '" + commentId + "'.", Comment.class); } taskService.deleteComment(commentId); response.setStatus(HttpStatus.NO_CONTENT.value()); }
Example 6
Source File: CommentEntityManager.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public void delete(PersistentObject persistentObject) { checkHistoryEnabled(); super.delete(persistentObject); Comment comment = (Comment) persistentObject; if (getProcessEngineConfiguration().getEventDispatcher().isEnabled()) { // Forced to fetch the process-instance to associate the right process definition String processDefinitionId = null; String processInstanceId = comment.getProcessInstanceId(); if (comment.getProcessInstanceId() != null) { ExecutionEntity process = getProcessInstanceManager().findExecutionById(comment.getProcessInstanceId()); if (process != null) { processDefinitionId = process.getProcessDefinitionId(); } } getProcessEngineConfiguration().getEventDispatcher().dispatchEvent( ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_DELETED, persistentObject, processInstanceId, processInstanceId, processDefinitionId)); } }
Example 7
Source File: CommentEntityManager.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public void insert(PersistentObject persistentObject) { checkHistoryEnabled(); super.insert(persistentObject); Comment comment = (Comment) persistentObject; if (getProcessEngineConfiguration().getEventDispatcher().isEnabled()) { // Forced to fetch the process-instance to associate the right process definition String processDefinitionId = null; String processInstanceId = comment.getProcessInstanceId(); if (comment.getProcessInstanceId() != null) { ExecutionEntity process = getProcessInstanceManager().findExecutionById(comment.getProcessInstanceId()); if (process != null) { processDefinitionId = process.getProcessDefinitionId(); } } getProcessEngineConfiguration().getEventDispatcher().dispatchEvent( ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_CREATED, persistentObject, processInstanceId, processInstanceId, processDefinitionId)); getProcessEngineConfiguration().getEventDispatcher().dispatchEvent( ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_INITIALIZED, persistentObject, processInstanceId, processInstanceId, processDefinitionId)); } }