Java Code Examples for org.activiti.bpmn.model.SequenceFlow#getConditionExpression()
The following examples show how to use
org.activiti.bpmn.model.SequenceFlow#getConditionExpression() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConditionUtil.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
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; } }
Example 2
Source File: SequenceFlowParseHandler.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
protected void executeParse(BpmnParse bpmnParse, SequenceFlow sequenceFlow) { ScopeImpl scope = bpmnParse.getCurrentScope(); ActivityImpl sourceActivity = scope.findActivity(sequenceFlow.getSourceRef()); ActivityImpl destinationActivity = scope.findActivity(sequenceFlow.getTargetRef()); Expression skipExpression; if (StringUtils.isNotEmpty(sequenceFlow.getSkipExpression())) { ExpressionManager expressionManager = bpmnParse.getExpressionManager(); skipExpression = expressionManager.createExpression(sequenceFlow.getSkipExpression()); } else { skipExpression = null; } TransitionImpl transition = sourceActivity.createOutgoingTransition(sequenceFlow.getId(), skipExpression); bpmnParse.getSequenceFlows().put(sequenceFlow.getId(), transition); transition.setProperty("name", sequenceFlow.getName()); transition.setProperty("documentation", sequenceFlow.getDocumentation()); transition.setDestination(destinationActivity); if (StringUtils.isNotEmpty(sequenceFlow.getConditionExpression())) { Condition expressionCondition = new UelExpressionCondition(sequenceFlow.getConditionExpression()); transition.setProperty(PROPERTYNAME_CONDITION_TEXT, sequenceFlow.getConditionExpression()); transition.setProperty(PROPERTYNAME_CONDITION, expressionCondition); } createExecutionListenersOnTransition(bpmnParse, sequenceFlow.getExecutionListeners(), transition); }
Example 3
Source File: ExclusiveGatewayValidator.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
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)"); } } }