@Override protected void writeAdditionalChildElements(BaseElement element, BpmnModel model, XMLStreamWriter xtw) throws Exception { SequenceFlow sequenceFlow = (SequenceFlow) element; if (StringUtils.isNotEmpty(sequenceFlow.getConditionExpression())) { xtw.writeStartElement(ELEMENT_FLOW_CONDITION); xtw.writeAttribute(XSI_PREFIX, XSI_NAMESPACE, "type", "tFormalExpression"); xtw.writeCData(sequenceFlow.getConditionExpression()); xtw.writeEndElement(); } } }
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)"); } } }
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; } }
if (StringUtils.isNotEmpty(sequenceFlow.getConditionExpression())) { propertiesNode.put(PROPERTY_SEQUENCEFLOW_CONDITION, sequenceFlow.getConditionExpression());
isDefault = true; boolean drawConditionalIndicator = sequenceFlow.getConditionExpression() != null && !(flowNode instanceof Gateway);
isDefault = true; boolean drawConditionalIndicator = sequenceFlow.getConditionExpression() != null && !(flowNode instanceof Gateway);
@Override protected void writeAdditionalChildElements(BaseElement element, XMLStreamWriter xtw) throws Exception { SequenceFlow sequenceFlow = (SequenceFlow) element; if (StringUtils.isNotEmpty(sequenceFlow.getConditionExpression())) { xtw.writeStartElement(ELEMENT_FLOW_CONDITION); xtw.writeAttribute(XSI_PREFIX, XSI_NAMESPACE, "type", "tFormalExpression"); xtw.writeCData(sequenceFlow.getConditionExpression()); xtw.writeEndElement(); } } }
@Override protected void writeAdditionalChildElements(BaseElement element, BpmnModel model, XMLStreamWriter xtw) throws Exception { SequenceFlow sequenceFlow = (SequenceFlow) element; if (StringUtils.isNotEmpty(sequenceFlow.getConditionExpression())) { xtw.writeStartElement(ELEMENT_FLOW_CONDITION); xtw.writeAttribute(XSI_PREFIX, XSI_NAMESPACE, "type", "tFormalExpression"); xtw.writeCData(sequenceFlow.getConditionExpression()); xtw.writeEndElement(); } } }
UserTask taskNode = null; if(node instanceof UserTask) { taskNode = (UserTask)node; } if(taskNode != null) { List<SequenceFlow> sequenceFlows = taskNode.getOutgoingFlows(); for(SequenceFlow sequenceFlow : sequenceFlows) { System.out.println(sequenceFlow.getName()+" "+sequenceFlow.getConditionExpression()); } }
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 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)"); } } }
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; } }
if (StringUtils.isNotEmpty(sequenceFlow.getConditionExpression())) { propertiesNode.put(PROPERTY_SEQUENCEFLOW_CONDITION, sequenceFlow.getConditionExpression());
transition.setDestination(destinationActivity); if (StringUtils.isNotEmpty(sequenceFlow.getConditionExpression())) { Condition expressionCondition = new UelExpressionCondition(bpmnParse.getExpressionManager().createExpression(sequenceFlow.getConditionExpression())); transition.setProperty(PROPERTYNAME_CONDITION_TEXT, sequenceFlow.getConditionExpression()); transition.setProperty(PROPERTYNAME_CONDITION, expressionCondition);
boolean drawConditionalIndicator = (i == 1) && sequenceFlow.getConditionExpression() != null && !(flowNode instanceof Gateway);