Search in sources :

Example 6 with Condition

use of org.activiti.engine.impl.Condition in project Activiti by Activiti.

the class ConditionUtil method hasTrueCondition.

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;
    }
}
Also used : UelExpressionCondition(org.activiti.engine.impl.el.UelExpressionCondition) Condition(org.activiti.engine.impl.Condition) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) Expression(org.activiti.engine.delegate.Expression) UelExpressionCondition(org.activiti.engine.impl.el.UelExpressionCondition)

Aggregations

Expression (org.activiti.engine.delegate.Expression)6 Condition (org.activiti.engine.impl.Condition)6 ActivitiException (org.activiti.engine.ActivitiException)3 UelExpressionCondition (org.activiti.engine.impl.el.UelExpressionCondition)3 PvmTransition (org.activiti.engine.impl.pvm.PvmTransition)3 ArrayList (java.util.ArrayList)2 ExecutionEntity (org.activiti.engine.impl.persistence.entity.ExecutionEntity)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 AdhocSubProcess (org.activiti.bpmn.model.AdhocSubProcess)1 ExpressionManager (org.activiti.engine.impl.el.ExpressionManager)1 PvmActivity (org.activiti.engine.impl.pvm.PvmActivity)1 ActivityExecution (org.activiti.engine.impl.pvm.delegate.ActivityExecution)1 ActivityImpl (org.activiti.engine.impl.pvm.process.ActivityImpl)1 ScopeImpl (org.activiti.engine.impl.pvm.process.ScopeImpl)1 TransitionImpl (org.activiti.engine.impl.pvm.process.TransitionImpl)1 InterpretableExecution (org.activiti.engine.impl.pvm.runtime.InterpretableExecution)1