Java Code Examples for org.activiti.engine.history.HistoricProcessInstance#getId()
The following examples show how to use
org.activiti.engine.history.HistoricProcessInstance#getId() .
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: 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 2
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 3
Source File: ActivitiTypeConverter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
public WorkflowInstance convertToInstanceAndSetVariables(HistoricProcessInstance historicProcessInstance, Map<String, Object> collectedVariables) { String processInstanceId = historicProcessInstance.getId(); String id = processInstanceId; ProcessDefinition procDef = activitiUtil.getProcessDefinition(historicProcessInstance.getProcessDefinitionId()); WorkflowDefinition definition = convert(procDef); // Set process variables based on historic detail query Map<String, Object> variables = propertyConverter.getHistoricProcessVariables(processInstanceId); Date startDate = historicProcessInstance.getStartTime(); Date endDate = historicProcessInstance.getEndTime(); // Copy all variables to map, if not null if(collectedVariables != null) { collectedVariables.putAll(variables); } boolean isActive = endDate == null; return factory.createInstance(id, definition, variables, isActive, startDate, endDate); }
Example 4
Source File: ProcessInstanceRepresentation.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public ProcessInstanceRepresentation(HistoricProcessInstance processInstance, boolean graphicalNotation, User startedBy) { this.id = processInstance.getId(); this.name = processInstance.getName(); this.businessKey = processInstance.getBusinessKey(); this.processDefinitionId = processInstance.getProcessDefinitionId(); this.tenantId = processInstance.getTenantId(); this.graphicalNotationDefined = graphicalNotation; this.started = processInstance.getStartTime(); this.ended = processInstance.getEndTime(); this.startedBy = new UserRepresentation(startedBy); }
Example 5
Source File: ProcessInfo.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 5 votes |
public ProcessInfo(HistoricProcessInstance processInstance) { this.id = processInstance.getId(); this.processDefinitionId = processInstance.getProcessDefinitionId(); this.startedAt = processInstance.getStartTime(); this.endedAt = processInstance.getEndTime(); this.durationInMs = processInstance.getDurationInMillis(); this.deleteReason = processInstance.getDeleteReason(); this.startUserId = processInstance.getStartUserId(); this.startActivityId = processInstance.getStartActivityId(); this.endActivityId = processInstance.getEndActivityId(); this.businessKey = processInstance.getBusinessKey(); this.superProcessInstanceId = processInstance.getSuperProcessInstanceId(); this.completed = (processInstance.getEndTime() != null); }
Example 6
Source File: AbstractActivitiTestCase.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
protected void validateHistoryData() { if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) { List<HistoricProcessInstance> historicProcessInstances = historyService.createHistoricProcessInstanceQuery().finished().list(); for (HistoricProcessInstance historicProcessInstance : historicProcessInstances) { assertNotNull("Historic process instance has no process definition id", historicProcessInstance.getProcessDefinitionId()); assertNotNull("Historic process instance has no process definition key", historicProcessInstance.getProcessDefinitionKey()); assertNotNull("Historic process instance has no process definition version", historicProcessInstance.getProcessDefinitionVersion()); assertNotNull("Historic process instance has no process definition key", historicProcessInstance.getDeploymentId()); assertNotNull("Historic process instance has no start activiti id", historicProcessInstance.getStartActivityId()); assertNotNull("Historic process instance has no start time", historicProcessInstance.getStartTime()); assertNotNull("Historic process instance has no end time", historicProcessInstance.getEndTime()); String processInstanceId = historicProcessInstance.getId(); // tasks List<HistoricTaskInstance> historicTaskInstances = historyService.createHistoricTaskInstanceQuery() .processInstanceId(processInstanceId).list(); if (historicTaskInstances != null && historicTaskInstances.size() > 0) { for (HistoricTaskInstance historicTaskInstance : historicTaskInstances) { assertEquals(processInstanceId, historicTaskInstance.getProcessInstanceId()); if (historicTaskInstance.getClaimTime() != null) { assertNotNull("Historic task " + historicTaskInstance.getTaskDefinitionKey() + " has no work time", historicTaskInstance.getWorkTimeInMillis()); } assertNotNull("Historic task " + historicTaskInstance.getTaskDefinitionKey() + " has no id", historicTaskInstance.getId()); assertNotNull("Historic task " + historicTaskInstance.getTaskDefinitionKey() + " has no process instance id", historicTaskInstance.getProcessInstanceId()); assertNotNull("Historic task " + historicTaskInstance.getTaskDefinitionKey() + " has no execution id", historicTaskInstance.getExecutionId()); assertNotNull("Historic task " + historicTaskInstance.getTaskDefinitionKey() + " has no process definition id", historicTaskInstance.getProcessDefinitionId()); assertNotNull("Historic task " + historicTaskInstance.getTaskDefinitionKey() + " has no task definition key", historicTaskInstance.getTaskDefinitionKey()); assertNotNull("Historic task " + historicTaskInstance.getTaskDefinitionKey() + " has no create time", historicTaskInstance.getCreateTime()); assertNotNull("Historic task " + historicTaskInstance.getTaskDefinitionKey() + " has no start time", historicTaskInstance.getStartTime()); assertNotNull("Historic task " + historicTaskInstance.getTaskDefinitionKey() + " has no end time", historicTaskInstance.getEndTime()); } } // activities List<HistoricActivityInstance> historicActivityInstances = historyService.createHistoricActivityInstanceQuery() .processInstanceId(processInstanceId).list(); if (historicActivityInstances != null && historicActivityInstances.size() > 0) { for (HistoricActivityInstance historicActivityInstance : historicActivityInstances) { assertEquals(processInstanceId, historicActivityInstance.getProcessInstanceId()); assertNotNull("Historic activity instance " + historicActivityInstance.getActivityId() + " has no activity id", historicActivityInstance.getActivityId()); assertNotNull("Historic activity instance " + historicActivityInstance.getActivityId() + " has no activity type", historicActivityInstance.getActivityType()); assertNotNull("Historic activity instance " + historicActivityInstance.getActivityId() + " has no process definition id", historicActivityInstance.getProcessDefinitionId()); assertNotNull("Historic activity instance " + historicActivityInstance.getActivityId() + " has no process instance id", historicActivityInstance.getProcessInstanceId()); assertNotNull("Historic activity instance " + historicActivityInstance.getActivityId() + " has no execution id", historicActivityInstance.getExecutionId()); assertNotNull("Historic activity instance " + historicActivityInstance.getActivityId() + " has no start time", historicActivityInstance.getStartTime()); assertNotNull("Historic activity instance " + historicActivityInstance.getActivityId() + " has no end time", historicActivityInstance.getEndTime()); } } } } }
Example 7
Source File: ActivitiTypeConverter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
private WorkflowTask getVirtualStartTask(HistoricProcessInstance historicProcessInstance) { if(historicProcessInstance == null) { return null; } String processInstanceId = historicProcessInstance.getId(); if (!activitiUtil.isMultiTenantWorkflowDeploymentEnabled() && false == isCorrectTenantHistoric(processInstanceId)) { return null; } String id = ActivitiConstants.START_TASK_PREFIX + processInstanceId; // Since the process instance is complete the Start Task must be complete! WorkflowTaskState state = WorkflowTaskState.COMPLETED; // We use the process-instance ID as execution-id. It's ended anyway WorkflowPath path = buildCompletedPath(processInstanceId, processInstanceId); if(path == null) { return null; } // Convert start-event to start-task Node ReadOnlyProcessDefinition procDef = activitiUtil.getDeployedProcessDefinition(historicProcessInstance.getProcessDefinitionId()); WorkflowNode startNode = convert(procDef.getInitial(), true); String taskDefId = activitiUtil.getStartFormKey(historicProcessInstance.getProcessDefinitionId()); WorkflowTaskDefinition taskDef = factory.createTaskDefinition(taskDefId, startNode, taskDefId, true); boolean completed = historicProcessInstance.getEndTime() != null; Map<QName, Serializable> properties = propertyConverter.getStartTaskProperties(historicProcessInstance, taskDefId, completed); // TODO: Figure out what name/description should be used for the start-task, start event's name? String defaultTitle = null; String defaultDescription = null; return factory.createTask(id, taskDef, taskDef.getId(), defaultTitle, defaultDescription, state, path, properties); }