private void triggerProcessInstance(String userId, String processId) { List<Execution> executionsAtReceiveTask = flowableFacade.findExecutionsAtReceiveTask(processId); if (!executionsAtReceiveTask.isEmpty()) { executionsAtReceiveTask.stream() .forEach(execution -> flowableFacade.trigger(userId, execution.getId())); return; } LOGGER.warn(MessageFormat.format("Process with id {0} is in undetermined process state", processId)); }
private Execution findCurrentExecution(List<Execution> currentExecutionsForProcess) { return currentExecutionsForProcess.stream() .filter(execution -> execution.getActivityId() != null) .findFirst() .orElse(null); }
private List<HistoricActivityInstance> findCurrentActivitiesAtReceiveTask(Execution execution) { return processEngine.getHistoryService() .createHistoricActivityInstanceQuery() .activityId(execution.getActivityId()) .executionId(execution.getId()) .activityType("receiveTask") .list(); }
@Override protected void notifyInternal(DelegateExecution context) throws Exception { boolean isServiceUpdated = StepsUtil.getIsServiceUpdated(context); String serviceName = StepsUtil.getServiceToProcessName(context); if(serviceName == null) { throw new IllegalStateException("Not able to determine service update status."); } String exportedVariableName = Constants.VAR_IS_SERVICE_UPDATED_VAR_PREFIX + serviceName; RuntimeService runtimeService = Context.getProcessEngineConfiguration().getRuntimeService(); String superExecutionId = context.getParentId(); Execution superExecutionResult = runtimeService.createExecutionQuery().executionId(superExecutionId).singleResult(); superExecutionId = superExecutionResult.getSuperExecutionId(); runtimeService.setVariable(superExecutionId, exportedVariableName, isServiceUpdated); }
private List<Job> getDeadLetterJobsForExecution(Execution execution) { return processEngine.getManagementService() .createDeadLetterJobQuery() .processInstanceId(execution.getProcessInstanceId()) .list(); }
Map<String, Execution> executionMap = new HashMap<>(); for (Execution execution : executions) { executionMap.put(execution.getId(), execution); currentElements.add(executionMap.get(job.getExecutionId()).getActivityId());
@Override protected void notifyInternal(DelegateExecution context) throws Exception { boolean isServiceUpdated = StepsUtil.getIsServiceUpdated(context); String serviceName = StepsUtil.getServiceToProcessName(context); if(serviceName == null) { throw new IllegalStateException("Not able to determine service update status."); } String exportedVariableName = Constants.VAR_IS_SERVICE_UPDATED_VAR_PREFIX + serviceName; RuntimeService runtimeService = Context.getProcessEngineConfiguration().getRuntimeService(); String superExecutionId = context.getParentId(); Execution superExecutionResult = runtimeService.createExecutionQuery().executionId(superExecutionId).singleResult(); superExecutionId = superExecutionResult.getSuperExecutionId(); runtimeService.setVariable(superExecutionId, exportedVariableName, isServiceUpdated); }
private Execution findCurrentExecution(List<Execution> currentExecutionsForProcess) { return currentExecutionsForProcess.stream() .filter(execution -> execution.getActivityId() != null) .findFirst() .orElse(null); }
List<String> highLightedFlows = new ArrayList<>(); for (Execution execution : executions) { List<String> idList = runtimeService.getActiveActivityIds(execution.getId()); highLightedActivities.addAll(idList);
public Execution getProcessExecution(String processInstanceId) { return getExecutionsByProcessId(processInstanceId).stream() .filter(execution -> execution.getActivityId() != null) .findFirst() .orElse(null); }
private List<String> findFailedActivityIds(String superProcessInstanceId) { List<Execution> executionsForProcess = flowableFacade.getActiveProcessExecutions(superProcessInstanceId); return executionsForProcess.stream() .map(e -> e.getActivityId()) .collect(Collectors.toList()); }
public List<Execution> getActiveProcessExecutions(String processInstanceId) { List<Execution> allProcessExecutions = getAllProcessExecutions(processInstanceId); return allProcessExecutions.stream() .filter(e -> e.getActivityId() != null) .collect(Collectors.toList()); }
private String getCurrentTaskId(FlowableEngineEvent flowableEngineEvent) { Execution currentExecutionForProces = findCurrentExecution(flowableEngineEvent); return currentExecutionForProces != null ? currentExecutionForProces.getActivityId() : getVariable(flowableEngineEvent, Constants.TASK_ID); }
private String getCurrentTaskId(FlowableEngineEvent flowableEngineEvent) { Execution currentExecutionForProces = findCurrentExecution(flowableEngineEvent); return currentExecutionForProces != null ? currentExecutionForProces.getActivityId() : getVariable(flowableEngineEvent, Constants.TASK_ID); }
private String getCurrentActivityId(DelegateExecution context) { List<Execution> processExecutions = processEngineConfiguration.getRuntimeService() .createExecutionQuery() .processInstanceId(context.getProcessInstanceId()) .list(); List<Execution> processExecutionsWithActivityIds = processExecutions.stream() .filter(e -> e.getActivityId() != null) .collect(Collectors.toList()); if (processExecutionsWithActivityIds.isEmpty()) { // if this happen then there is a really big problem with Flowable :) throw new SLException("There are no executions for process with id: " + context.getProcessInstanceId()); } return processExecutionsWithActivityIds.get(0) .getActivityId(); }
private String getCurrentActivityId(DelegateExecution context) { List<Execution> processExecutions = processEngineConfiguration.getRuntimeService() .createExecutionQuery() .processInstanceId(context.getProcessInstanceId()) .list(); List<Execution> processExecutionsWithActivityIds = processExecutions.stream() .filter(e -> e.getActivityId() != null) .collect(Collectors.toList()); if (processExecutionsWithActivityIds.isEmpty()) { // if this happen then there is a really big problem with Flowable :) throw new SLException("There are no executions for process with id: " + context.getProcessInstanceId()); } return processExecutionsWithActivityIds.get(0) .getActivityId(); }