protected void ensureSequenceFlowIdSet(SequenceFlow sequenceFlow) { // We really must have ids for sequence flow to be able to generate // stuff if (sequenceFlow.getId() == null) { sequenceFlow.setId("sequenceFlow-" + UUID.randomUUID().toString()); } }
protected void handleSequenceFlow(SequenceFlow sequenceFlow) { ensureSequenceFlowIdSet(sequenceFlow); sequenceFlows.put(sequenceFlow.getId(), sequenceFlow); }
public void validateExclusiveGateway(Process process, ExclusiveGateway exclusiveGateway, List<ValidationError> errors) { if (exclusiveGateway.getOutgoingFlows().isEmpty()) { addError(errors, Problems.EXCLUSIVE_GATEWAY_NO_OUTGOING_SEQ_FLOW, process, exclusiveGateway, "Exclusive gateway has no outgoing sequence flow"); } else if (exclusiveGateway.getOutgoingFlows().size() == 1) { SequenceFlow sequenceFlow = exclusiveGateway.getOutgoingFlows().get(0); if (StringUtils.isNotEmpty(sequenceFlow.getConditionExpression())) { addError(errors, Problems.EXCLUSIVE_GATEWAY_CONDITION_NOT_ALLOWED_ON_SINGLE_SEQ_FLOW, process, exclusiveGateway, "Exclusive gateway has only one outgoing sequence flow. This is not allowed to have a condition."); } } else { String defaultSequenceFlow = exclusiveGateway.getDefaultFlow(); List<SequenceFlow> flowsWithoutCondition = new ArrayList<SequenceFlow>(); for (SequenceFlow flow : exclusiveGateway.getOutgoingFlows()) { String condition = flow.getConditionExpression(); boolean isDefaultFlow = flow.getId() != null && flow.getId().equals(defaultSequenceFlow); boolean hasConditon = StringUtils.isNotEmpty(condition); if (!hasConditon && !isDefaultFlow) { flowsWithoutCondition.add(flow); } if (hasConditon && isDefaultFlow) { addError(errors, Problems.EXCLUSIVE_GATEWAY_CONDITION_ON_DEFAULT_SEQ_FLOW, process, exclusiveGateway, "Default sequenceflow has a condition, which is not allowed"); } } if (!flowsWithoutCondition.isEmpty()) { addWarning(errors, Problems.EXCLUSIVE_GATEWAY_SEQ_FLOW_WITHOUT_CONDITIONS, process, exclusiveGateway, "Exclusive gateway has at least one outgoing sequence flow without a condition (which isn't the default one)"); } } }
ObjectNode flowNode = BpmnJsonConverterUtil.createChildShape(sequenceFlow.getId(), STENCIL_SEQUENCE_FLOW, 172, 212, 128, 212); ArrayNode dockersArrayNode = objectMapper.createArrayNode(); ObjectNode dockNode = objectMapper.createObjectNode(); dockersArrayNode.add(dockNode); if (model.getFlowLocationGraphicInfo(sequenceFlow.getId()).size() > 2) { for (int i = 1; i < model.getFlowLocationGraphicInfo(sequenceFlow.getId()).size() - 1; i++) { GraphicInfo graphicInfo = model.getFlowLocationGraphicInfo(sequenceFlow.getId()).get(i); dockNode = objectMapper.createObjectNode(); dockNode.put(EDITOR_BOUNDS_X, graphicInfo.getX()); propertiesNode.put(PROPERTY_OVERRIDE_ID, sequenceFlow.getId()); if (StringUtils.isNotEmpty(sequenceFlow.getName())) { propertiesNode.put(PROPERTY_NAME, sequenceFlow.getName()); if (defaultFlowId != null && defaultFlowId.equals(sequenceFlow.getId())) { propertiesNode.put(PROPERTY_SEQUENCEFLOW_DEFAULT, true);
public static boolean hasTrueCondition(SequenceFlow sequenceFlow, DelegateExecution execution) { String conditionExpression = null; if (Context.getProcessEngineConfiguration().isEnableProcessDefinitionInfoCache()) { ObjectNode elementProperties = Context.getBpmnOverrideElementProperties(sequenceFlow.getId(), execution.getProcessDefinitionId()); conditionExpression = getActiveValue(sequenceFlow.getConditionExpression(), DynamicBpmnConstants.SEQUENCE_FLOW_CONDITION, elementProperties); } else { conditionExpression = sequenceFlow.getConditionExpression(); } if (StringUtils.isNotEmpty(conditionExpression)) { Expression expression = Context.getProcessEngineConfiguration().getExpressionManager().createExpression(conditionExpression); Condition condition = new UelExpressionCondition(expression); if (condition.evaluate(sequenceFlow.getId(), execution)) { return true; } return false; } else { return true; } }
execution) && (defaultSequenceFlowId == null || !defaultSequenceFlowId.equals(sequenceFlow.getId())))) { outgoingSequenceFlows.add(sequenceFlow); if (defaultSequenceFlowId != null) { for (SequenceFlow sequenceFlow : flowNode.getOutgoingFlows()) { if (defaultSequenceFlowId.equals(sequenceFlow.getId())) { outgoingSequenceFlows.add(sequenceFlow); break;
JsonNode edgeNode = edgeMap.get(sequenceFlow.getId()); if (edgeNode != null) { boolean isDefault = JsonConverterUtil.getPropertyValueAsBoolean(PROPERTY_SEQUENCEFLOW_DEFAULT, if (isDefault) { if (sourceFlowElement instanceof Activity) { ((Activity) sourceFlowElement).setDefaultFlow(sequenceFlow.getId()); } else if (sourceFlowElement instanceof Gateway) { ((Gateway) sourceFlowElement).setDefaultFlow(sequenceFlow.getId());
if (!SkipExpressionUtil.isSkipExpressionEnabled(execution, skipExpressionString)) { boolean conditionEvaluatesToTrue = ConditionUtil.hasTrueCondition(sequenceFlow, execution); if (conditionEvaluatesToTrue && (defaultSequenceFlowId == null || !defaultSequenceFlowId.equals(sequenceFlow.getId()))) { if (log.isDebugEnabled()) { log.debug("Sequence flow '{}'selected as outgoing sequence flow.", sequenceFlow.getId()); if (defaultSequenceFlowId != null && defaultSequenceFlowId.equals(sequenceFlow.getId())) { defaultSequenceFlow = sequenceFlow;
boolean highLighted = (highLightedFlows.contains(sequenceFlow.getId())); String defaultFlow = null; if (flowNode instanceof Activity) { if (defaultFlow != null && defaultFlow.equalsIgnoreCase(sequenceFlow.getId())) { isDefault = true; FlowElement sourceElement = bpmnModel.getFlowElement(sourceRef); FlowElement targetElement = bpmnModel.getFlowElement(targetRef); List<GraphicInfo> graphicInfoList = bpmnModel.getFlowLocationGraphicInfo(sequenceFlow.getId()); if (graphicInfoList != null && graphicInfoList.size() > 0) { graphicInfoList = connectionPerfectionizer(processDiagramCanvas, GraphicInfo labelGraphicInfo = bpmnModel.getLabelGraphicInfo(sequenceFlow.getId()); if (labelGraphicInfo != null) { processDiagramCanvas.drawLabel(sequenceFlow.getName(),
(ExecutionEntity) execution, ActivitiEventType.SEQUENCEFLOW_TAKEN, sequenceFlow.getId(), sourceFlowElement != null ? sourceFlowElement.getId() : null, sourceFlowElement != null ? (String) sourceFlowElement.getName() : null, sequenceFlow.getId(), execution.getId()); Context.getAgenda().planContinueProcessOperation(execution);
if (subShapesMap.containsKey(sequenceFlow.getSourceRef())) { SubProcess subProcess = subShapesMap.get(sequenceFlow.getSourceRef()); if (subProcess.getFlowElement(sequenceFlow.getId()) == null) { subProcess.addFlowElement(sequenceFlow); removeSubFlowsList.add(sequenceFlow.getId()); if (allFlowMap.containsKey(flowValue)) { FlowWithContainer flowWithContainer = allFlowMap.get(flowValue); flowWithContainer.getFlowContainer().removeFlowElement(flowWithContainer.getSequenceFlow().getId()); flowWithContainer.getFlowContainer().addFlowElement(flowWithContainer.getSequenceFlow());
FlowNode flowNode = (FlowNode) baseElement; for (SequenceFlow sequenceFlow : flowNode.getOutgoingFlows()) { outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(sequenceFlow.getId()));
List<GraphicInfo> graphicInfoList = bpmnModel.getFlowLocationGraphicInfo(sequenceFlow.getId()); if (graphicInfoList != null) { for (GraphicInfo graphicInfo : graphicInfoList) {
boolean highLighted = (highLightedFlows.contains(sequenceFlow.getId())); String defaultFlow = null; if (flowNode instanceof Activity) { if (defaultFlow != null && defaultFlow.equalsIgnoreCase(sequenceFlow.getId())) { isDefault = true; FlowElement sourceElement = bpmnModel.getFlowElement(sourceRef); FlowElement targetElement = bpmnModel.getFlowElement(targetRef); List<GraphicInfo> graphicInfoList = bpmnModel.getFlowLocationGraphicInfo(sequenceFlow.getId()); if (graphicInfoList != null && graphicInfoList.size() > 0) { graphicInfoList = connectionPerfectionizer(processDiagramCanvas, bpmnModel, sourceElement, targetElement, graphicInfoList); GraphicInfo labelGraphicInfo = bpmnModel.getLabelGraphicInfo(sequenceFlow.getId()); if (labelGraphicInfo != null) { processDiagramCanvas.drawLabel(sequenceFlow.getName(), labelGraphicInfo, false);
protected void ensureSequenceFlowIdSet(SequenceFlow sequenceFlow) { // We really must have ids for sequence flow to be able to generate stuff if (sequenceFlow.getId() == null) { sequenceFlow.setId("sequenceFlow-" + UUID.randomUUID().toString()); } }
protected void handleSequenceFlow(SequenceFlow sequenceFlow) { ensureSequenceFlowIdSet(sequenceFlow); sequenceFlows.put(sequenceFlow.getId(), sequenceFlow); }
protected void createDiagramInterchangeInformation(SequenceFlow sequenceFlow, List<mxPoint> waypoints) { List<GraphicInfo> graphicInfoForWaypoints = new ArrayList<GraphicInfo>(); for (mxPoint waypoint : waypoints) { GraphicInfo graphicInfo = new GraphicInfo(); graphicInfo.setElement(sequenceFlow); graphicInfo.setX(waypoint.getX()); graphicInfo.setY(waypoint.getY()); graphicInfoForWaypoints.add(graphicInfo); } bpmnModel.addFlowGraphicInfoList(sequenceFlow.getId(), graphicInfoForWaypoints); }
protected void processSequenceFlows() { for (SequenceFlow sequenceFlow : sequenceFlows) { Node sourceNode = nodeMap.get(sequenceFlow.getSourceRef()); Node targetNode = nodeMap.get(sequenceFlow.getTargetRef()); Relationship sequenceflowRelationship = sourceNode.createRelationshipTo(targetNode, RelTypes.SEQ_FLOW); sequenceflowRelationship.setProperty("id", sequenceFlow.getId()); if (sequenceFlow.getConditionExpression() != null) { sequenceflowRelationship.setProperty("condition", sequenceFlow.getConditionExpression()); } } }
public static boolean hasTrueCondition(SequenceFlow sequenceFlow, DelegateExecution execution) { String conditionExpression = null; if (Context.getProcessEngineConfiguration().isEnableProcessDefinitionInfoCache()) { ObjectNode elementProperties = Context.getBpmnOverrideElementProperties(sequenceFlow.getId(), execution.getProcessDefinitionId()); conditionExpression = getActiveValue(sequenceFlow.getConditionExpression(), DynamicBpmnConstants.SEQUENCE_FLOW_CONDITION, elementProperties); } else { conditionExpression = sequenceFlow.getConditionExpression(); } if (StringUtils.isNotEmpty(conditionExpression)) { Expression expression = Context.getProcessEngineConfiguration().getExpressionManager().createExpression(conditionExpression); Condition condition = new UelExpressionCondition(expression); if (condition.evaluate(sequenceFlow.getId(), execution)) { return true; } return false; } else { return true; } }