if (flowElement != null && StringUtils.isNotEmpty(flowElement.getName())) { hasName = true;
protected void internalPopulateExecutionTree(DebugInfoExecutionTreeNode parentNode, Map<String, List<ExecutionEntity>> parentMapping) { if (parentMapping.containsKey(parentNode.getId())) { for (ExecutionEntity childExecutionEntity : parentMapping.get(parentNode.getId())) { DebugInfoExecutionTreeNode childNode = new DebugInfoExecutionTreeNode(); childNode.setId(childExecutionEntity.getId()); childNode.setActivityId(childExecutionEntity.getCurrentFlowElement() != null ? childExecutionEntity.getCurrentFlowElement().getId() : null); childNode.setActivityName(childExecutionEntity.getCurrentFlowElement() != null ? childExecutionEntity.getCurrentFlowElement().getName() : null); childNode.setProcessDefinitionId(childExecutionEntity.getProcessDefinitionId()); childNode.setParentNode(childNode); parentNode.getChildNodes().add(childNode); internalPopulateExecutionTree(childNode, parentMapping); } } }
sequenceFlow.getId(), sourceFlowElement != null ? sourceFlowElement.getId() : null, sourceFlowElement != null ? (String) sourceFlowElement.getName() : null, sourceFlowElement != null ? sourceFlowElement.getClass().getName() : null, sourceFlowElement != null ? ((FlowNode) sourceFlowElement).getBehavior() : null, targetFlowElement != null ? targetFlowElement.getId() : null, targetFlowElement != null ? targetFlowElement.getName() : null, targetFlowElement != null ? targetFlowElement.getClass().getName() : null, targetFlowElement != null ? ((FlowNode) targetFlowElement).getBehavior() : null));
protected void dispatchActivityCancelled(DelegateExecution execution, FlowElement terminateEndEvent) { Context.getProcessEngineConfiguration() .getEventDispatcher() .dispatchEvent( ActivitiEventBuilder.createActivityCancelledEvent(execution.getCurrentFlowElement().getId(), execution.getCurrentFlowElement().getName(), execution.getId(), execution.getProcessInstanceId(), execution.getProcessDefinitionId(), parseActivityType((FlowNode) execution.getCurrentFlowElement()), terminateEndEvent)); }
writeDefaultAttribute(ATTRIBUTE_ID, baseElement.getId(), xtw); if (baseElement instanceof FlowElement) { writeDefaultAttribute(ATTRIBUTE_NAME, ((FlowElement) baseElement).getName(), xtw);
protected void addError(List<ValidationError> validationErrors, String problem, Process process, BaseElement baseElement, String description, boolean isWarning) { ValidationError error = new ValidationError(); error.setWarning(isWarning); if (process != null) { error.setProcessDefinitionId(process.getId()); error.setProcessDefinitionName(process.getName()); } if (baseElement != null) { error.setXmlLineNumber(baseElement.getXmlRowNumber()); error.setXmlColumnNumber(baseElement.getXmlColumnNumber()); } error.setProblem(problem); error.setDefaultDescription(description); if (baseElement instanceof FlowElement) { FlowElement flowElement = (FlowElement) baseElement; error.setActivityId(flowElement.getId()); error.setActivityName(flowElement.getName()); } addError(validationErrors, error); }
protected HistoricActivityInstanceEntity createHistoricActivityInstanceEntity(ExecutionEntity execution) { IdGenerator idGenerator = getProcessEngineConfiguration().getIdGenerator(); String processDefinitionId = execution.getProcessDefinitionId(); String processInstanceId = execution.getProcessInstanceId(); HistoricActivityInstanceEntity historicActivityInstance = getHistoricActivityInstanceEntityManager().create(); historicActivityInstance.setId(idGenerator.getNextId()); historicActivityInstance.setProcessDefinitionId(processDefinitionId); historicActivityInstance.setProcessInstanceId(processInstanceId); historicActivityInstance.setExecutionId(execution.getId()); historicActivityInstance.setActivityId(execution.getActivityId()); if (execution.getCurrentFlowElement() != null) { historicActivityInstance.setActivityName(execution.getCurrentFlowElement().getName()); historicActivityInstance.setActivityType(parseActivityType(execution.getCurrentFlowElement())); } Date now = getClock().getCurrentTime(); historicActivityInstance.setStartTime(now); // Inherit tenant id (if applicable) if (execution.getTenantId() != null) { historicActivityInstance.setTenantId(execution.getTenantId()); } getHistoricActivityInstanceEntityManager().insert(historicActivityInstance); return historicActivityInstance; }
ActivitiEventBuilder.createActivityEvent(ActivitiEventType.ACTIVITY_COMPENSATE, flowElement.getId(), flowElement.getName(), compensatingExecution.getId(), compensatingExecution.getProcessInstanceId(), compensatingExecution.getProcessDefinitionId(), flowElement));
if (labelGraphicInfo != null && flowElement != null && StringUtils.isNotEmpty(flowElement.getName())) { xtw.writeStartElement(BPMNDI_PREFIX, ELEMENT_DI_LABEL, BPMNDI_NAMESPACE); xtw.writeStartElement(OMGDC_PREFIX, ELEMENT_DI_BOUNDS, OMGDC_NAMESPACE);
endEvent = element; } else if (element instanceof UserTask) { nodes.add(new ActivityNode(index++, element.getId(), element.getName())); throw new IllegalStateException("End element not found:" + definition); nodes.addFirst(new ActivityNode(0, startEvent.getId(), startEvent.getName())); nodes.add(new ActivityNode(index, endEvent.getId(), endEvent.getName())); this.nodes.put(definition.getKey(), nodes);
protected void internalPopulateExecutionTree(DebugInfoExecutionTreeNode parentNode, Map<String, List<ExecutionEntity>> parentMapping) { if (parentMapping.containsKey(parentNode.getId())) { for (ExecutionEntity childExecutionEntity : parentMapping.get(parentNode.getId())) { DebugInfoExecutionTreeNode childNode = new DebugInfoExecutionTreeNode(); childNode.setId(childExecutionEntity.getId()); childNode.setActivityId(childExecutionEntity.getCurrentFlowElement() != null ? childExecutionEntity.getCurrentFlowElement().getId() : null); childNode.setActivityName(childExecutionEntity.getCurrentFlowElement() != null ? childExecutionEntity.getCurrentFlowElement().getName() : null); childNode.setProcessDefinitionId(childExecutionEntity.getProcessDefinitionId()); childNode.setParentNode(childNode); parentNode.getChildNodes().add(childNode); internalPopulateExecutionTree(childNode, parentMapping); } } }
writeDefaultAttribute(ATTRIBUTE_ID, baseElement.getId(), xtw); if (baseElement instanceof FlowElement) { writeDefaultAttribute(ATTRIBUTE_NAME, ((FlowElement) baseElement).getName(), xtw);
protected void continueThroughSequenceFlow(SequenceFlow sequenceFlow) { // Execution listener. Sequenceflow only 'take' makes sense ... but we've supported all three since the beginning if (CollectionUtil.isNotEmpty(sequenceFlow.getExecutionListeners())) { executeExecutionListeners(sequenceFlow, ExecutionListener.EVENTNAME_START); executeExecutionListeners(sequenceFlow, ExecutionListener.EVENTNAME_TAKE); executeExecutionListeners(sequenceFlow, ExecutionListener.EVENTNAME_END); } // Firing event that transition is being taken if(Context.getProcessEngineConfiguration() != null && Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) { FlowElement sourceFlowElement = sequenceFlow.getSourceFlowElement(); FlowElement targetFlowElement = sequenceFlow.getTargetFlowElement(); Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent( ActivitiEventBuilder.createSequenceFlowTakenEvent( (ExecutionEntity) execution, ActivitiEventType.SEQUENCEFLOW_TAKEN, sequenceFlow.getId(), sourceFlowElement != null ? sourceFlowElement.getId() : null, sourceFlowElement != null ? (String) sourceFlowElement.getName() : null, sourceFlowElement != null ? sourceFlowElement.getClass().getName() : null, sourceFlowElement != null ? ((FlowNode) sourceFlowElement).getBehavior(): null, targetFlowElement != null ? targetFlowElement.getId() : null, targetFlowElement != null ? targetFlowElement.getName() : null, targetFlowElement != null ? targetFlowElement.getClass().getName() : null, targetFlowElement != null ? ((FlowNode) targetFlowElement).getBehavior(): null)); } FlowElement targetFlowElement = sequenceFlow.getTargetFlowElement(); execution.setCurrentFlowElement(targetFlowElement); logger.debug("Sequence flow '{}' encountered. Continuing process by following it using execution {}", sequenceFlow.getId(), execution.getId()); Context.getAgenda().planContinueProcessOperation(execution); }
public ActivityImpl createActivityOnScope(BpmnParse bpmnParse, FlowElement flowElement, String xmlLocalName, ScopeImpl scopeElement) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Parsing activity {}", flowElement.getId()); } ActivityImpl activity = scopeElement.createActivity(flowElement.getId()); bpmnParse.setCurrentActivity(activity); activity.setProperty("name", flowElement.getName()); activity.setProperty("documentation", flowElement.getDocumentation()); if (flowElement instanceof Activity) { Activity modelActivity = (Activity) flowElement; activity.setProperty("default", modelActivity.getDefaultFlow()); if(modelActivity.isForCompensation()) { activity.setProperty(PROPERTYNAME_IS_FOR_COMPENSATION, true); } } else if (flowElement instanceof Gateway) { activity.setProperty("default", ((Gateway) flowElement).getDefaultFlow()); } activity.setProperty("type", xmlLocalName); return activity; }
writeDefaultAttribute(ATTRIBUTE_ID, baseElement.getId(), xtw); if (baseElement instanceof FlowElement) { writeDefaultAttribute(ATTRIBUTE_NAME, ((FlowElement) baseElement).getName(), xtw);
protected void dispatchActivityCancelled(DelegateExecution execution, FlowElement terminateEndEvent) { Context.getProcessEngineConfiguration() .getEventDispatcher() .dispatchEvent( ActivitiEventBuilder.createActivityCancelledEvent(execution.getCurrentFlowElement().getId(), execution.getCurrentFlowElement().getName(), execution.getId(), execution.getProcessInstanceId(), execution.getProcessDefinitionId(), parseActivityType((FlowNode) execution.getCurrentFlowElement()), terminateEndEvent)); }
protected void addError(List<ValidationError> validationErrors, String problem, Process process, BaseElement baseElement, String description, boolean isWarning) { ValidationError error = new ValidationError(); error.setWarning(isWarning); if (process != null) { error.setProcessDefinitionId(process.getId()); error.setProcessDefinitionName(process.getName()); } if (baseElement != null) { error.setXmlLineNumber(baseElement.getXmlRowNumber()); error.setXmlColumnNumber(baseElement.getXmlColumnNumber()); } error.setProblem(problem); error.setDefaultDescription(description); if (baseElement instanceof FlowElement) { FlowElement flowElement = (FlowElement) baseElement; error.setActivityId(flowElement.getId()); error.setActivityName(flowElement.getName()); } addError(validationErrors, error); }
protected HistoricActivityInstanceEntity createHistoricActivityInstanceEntity(ExecutionEntity execution) { IdGenerator idGenerator = getProcessEngineConfiguration().getIdGenerator(); String processDefinitionId = execution.getProcessDefinitionId(); String processInstanceId = execution.getProcessInstanceId(); HistoricActivityInstanceEntity historicActivityInstance = getHistoricActivityInstanceEntityManager().create(); historicActivityInstance.setId(idGenerator.getNextId()); historicActivityInstance.setProcessDefinitionId(processDefinitionId); historicActivityInstance.setProcessInstanceId(processInstanceId); historicActivityInstance.setExecutionId(execution.getId()); historicActivityInstance.setActivityId(execution.getActivityId()); if (execution.getCurrentFlowElement() != null) { historicActivityInstance.setActivityName(execution.getCurrentFlowElement().getName()); historicActivityInstance.setActivityType(parseActivityType(execution.getCurrentFlowElement())); } Date now = getClock().getCurrentTime(); historicActivityInstance.setStartTime(now); // Inherit tenant id (if applicable) if (execution.getTenantId() != null) { historicActivityInstance.setTenantId(execution.getTenantId()); } getHistoricActivityInstanceEntityManager().insert(historicActivityInstance); return historicActivityInstance; }
ActivitiEventBuilder.createActivityEvent(ActivitiEventType.ACTIVITY_COMPENSATE, flowElement.getId(), flowElement.getName(), compensatingExecution.getId(), compensatingExecution.getProcessInstanceId(), compensatingExecution.getProcessDefinitionId(), flowElement));