@Override public void setCurrentFlowElement(FlowElement currentFlowElement) { this.currentFlowElement = currentFlowElement; if (currentFlowElement != null) { this.activityId = currentFlowElement.getId(); } else { this.activityId = null; } }
@Override public void removeFlowElement(String elementId) { FlowElement element = flowElementMap.get(elementId); if (element != null) { flowElementList.remove(element); flowElementMap.remove(element.getId()); } }
@Override public void removeFlowElement(String elementId) { FlowElement element = flowElementMap.get(elementId); if (element != null) { flowElementList.remove(element); flowElementMap.remove(element.getId()); } }
@Override public void setCurrentFlowElement(FlowElement currentFlowElement) { this.currentFlowElement = currentFlowElement; if (currentFlowElement != null) { this.activityId = currentFlowElement.getId(); this.activityName = currentFlowElement.getName(); } else { this.activityId = null; this.activityName = null; } }
@Override public ObjectNode parseElement(FlowElement flowElement, ObjectNode flowElementNode, ObjectMapper mapper) { ObjectNode resultNode = mapper.createObjectNode(); resultNode.put(ELEMENT_ID, flowElement.getId()); resultNode.put(ELEMENT_TYPE, flowElement.getClass().getSimpleName()); if (supports(flowElement)) { resultNode.set(ELEMENT_PROPERTIES, createPropertiesNode(flowElement, flowElementNode, mapper)); } return resultNode; }
protected void logLoopDetails(DelegateExecution execution, String custom, int loopCounter, int nrOfCompletedInstances, int nrOfActiveInstances, int nrOfInstances) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Multi-instance '{}' {}. Details: loopCounter={}, nrOrCompletedInstances={},nrOfActiveInstances={},nrOfInstances={}", execution.getCurrentFlowElement() != null ? execution.getCurrentFlowElement().getId() : "", custom, loopCounter, nrOfCompletedInstances, nrOfActiveInstances, nrOfInstances); } }
protected void createGatewayVertex(FlowElement flowElement) { // Add styling for gateways if needed if (graph.getStylesheet().getStyles().containsKey(STYLE_GATEWAY)) { Hashtable<String, Object> style = new Hashtable<>(); style.put(mxConstants.STYLE_SHAPE, mxConstants.SHAPE_RHOMBUS); graph.getStylesheet().putCellStyle(STYLE_GATEWAY, style); } // Create gateway node Object gatewayVertex = graph.insertVertex(cellParent, flowElement.getId(), "", 0, 0, gatewaySize, gatewaySize, STYLE_GATEWAY); generatedVertices.put(flowElement.getId(), gatewayVertex); }
protected void createEventVertex(FlowElement flowElement) { // Add styling for events if needed if (!graph.getStylesheet().getStyles().containsKey(STYLE_EVENT)) { Hashtable<String, Object> eventStyle = new Hashtable<>(); eventStyle.put(mxConstants.STYLE_SHAPE, mxConstants.SHAPE_ELLIPSE); graph.getStylesheet().putCellStyle(STYLE_EVENT, eventStyle); } // Add vertex representing event to graph Object eventVertex = graph.insertVertex(cellParent, flowElement.getId(), "", 0, 0, eventSize, eventSize, STYLE_EVENT); generatedVertices.put(flowElement.getId(), eventVertex); }
private void fillSubShapes(Map<String, SubProcess> subShapesMap, SubProcess subProcess) { for (FlowElement flowElement : subProcess.getFlowElements()) { if (flowElement instanceof SubProcess) { SubProcess childSubProcess = (SubProcess) flowElement; subShapesMap.put(childSubProcess.getId(), subProcess); fillSubShapes(subShapesMap, childSubProcess); } else { subShapesMap.put(flowElement.getId(), subProcess); } } }
protected Collection<BoundaryEvent> findBoundaryEventsForFlowNode(final String processDefinitionId, final FlowElement flowElement) { Process process = getProcessDefinition(processDefinitionId); // This could be cached or could be done at parsing time List<BoundaryEvent> results = new ArrayList<>(1); Collection<BoundaryEvent> boundaryEvents = process.findFlowElementsOfType(BoundaryEvent.class, true); for (BoundaryEvent boundaryEvent : boundaryEvents) { if (boundaryEvent.getAttachedToRefId() != null && boundaryEvent.getAttachedToRefId().equals(flowElement.getId())) { results.add(boundaryEvent); } } return results; }
protected Collection<BoundaryEvent> findBoundaryEventsForFlowNode(final String processDefinitionId, final FlowElement flowElement) { Process process = getProcessDefinition(processDefinitionId); // This could be cached or could be done at parsing time List<BoundaryEvent> results = new ArrayList<>(1); Collection<BoundaryEvent> boundaryEvents = process.findFlowElementsOfType(BoundaryEvent.class, true); for (BoundaryEvent boundaryEvent : boundaryEvents) { if (boundaryEvent.getAttachedToRefId() != null && boundaryEvent.getAttachedToRefId().equals(flowElement.getId())) { results.add(boundaryEvent); } } return results; }
protected String getCurrentFlowElementId() { FlowElement flowElement = getExecutionEntity().getCurrentFlowElement(); if (flowElement instanceof SequenceFlow) { SequenceFlow sequenceFlow = (SequenceFlow) flowElement; return sequenceFlow.getSourceRef() + " -> " + sequenceFlow.getTargetRef(); } else if (flowElement != null) { return flowElement.getId() + " (" + flowElement.getClass().getSimpleName(); } else { return ""; } }
protected String getActivityIdForExecution(ExecutionEntity execution) { String activityId = null; if (execution.getCurrentFlowElement() instanceof FlowNode) { activityId = execution.getCurrentFlowElement().getId(); } else if (execution.getCurrentFlowElement() instanceof SequenceFlow && execution.getCurrentFlowableListener() == null) { // while executing sequence flow listeners, we don't want historic activities activityId = ((SequenceFlow) execution.getCurrentFlowElement()).getSourceFlowElement().getId(); } return activityId; }
protected String getActivityIdForExecution(ExecutionEntity execution) { String activityId = null; if (execution.getCurrentFlowElement() instanceof FlowNode) { activityId = execution.getCurrentFlowElement().getId(); } else if (execution.getCurrentFlowElement() instanceof SequenceFlow && execution.getCurrentFlowableListener() == null) { // while executing sequence flow listeners, we don't want historic activities activityId = ((SequenceFlow) execution.getCurrentFlowElement()).getSourceFlowElement().getId(); } return activityId; }
protected String getPrecedingEventBasedGateway(BpmnParse bpmnParse, IntermediateCatchEvent event) { String eventBasedGatewayId = null; for (SequenceFlow sequenceFlow : event.getIncomingFlows()) { FlowElement sourceElement = bpmnParse.getBpmnModel().getFlowElement(sequenceFlow.getSourceRef()); if (sourceElement instanceof EventGateway) { eventBasedGatewayId = sourceElement.getId(); break; } } return eventBasedGatewayId; }
protected GraphicInfo createDiagramInterchangeInformation(FlowElement flowElement, int x, int y, int width, int height) { GraphicInfo graphicInfo = new GraphicInfo(); graphicInfo.setX(x); graphicInfo.setY(y); graphicInfo.setWidth(width); graphicInfo.setHeight(height); graphicInfo.setElement(flowElement); bpmnModel.addGraphicInfo(flowElement.getId(), graphicInfo); return graphicInfo; }
protected FlowableMultiInstanceActivityCompletedEvent buildCompletedEvent(DelegateExecution execution, FlowableEngineEventType eventType) { FlowElement flowNode = execution.getCurrentFlowElement(); return FlowableEventBuilder.createMultiInstanceActivityCompletedEvent(eventType, (int) execution.getVariable(NUMBER_OF_INSTANCES), (int) execution.getVariable(NUMBER_OF_ACTIVE_INSTANCES), (int) execution.getVariable(NUMBER_OF_COMPLETED_INSTANCES), flowNode.getId(), flowNode.getName(), execution.getId(), execution.getProcessInstanceId(), execution.getProcessDefinitionId(), flowNode); }
protected void dispatchMultiInstanceActivityCancelled(ExecutionEntity execution, FlowElement cancelActivity) { CommandContextUtil.getProcessEngineConfiguration() .getEventDispatcher() .dispatchEvent( FlowableEventBuilder.createMultiInstanceActivityCancelledEvent(execution.getCurrentFlowElement().getId(), execution.getCurrentFlowElement().getName(), execution.getId(), execution.getProcessInstanceId(), execution.getProcessDefinitionId(), getActivityType((FlowNode) execution.getCurrentFlowElement()), cancelActivity)); }