use of org.activiti.engine.impl.el.UelExpressionCondition in project Activiti by Activiti.
the class SequenceFlowParseHandler method executeParse.
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);
}
use of org.activiti.engine.impl.el.UelExpressionCondition in project Activiti by Activiti.
the class TakeOutgoingSequenceFlowsOperation method handleAdhocSubProcess.
protected void handleAdhocSubProcess(FlowNode flowNode) {
boolean completeAdhocSubProcess = false;
AdhocSubProcess adhocSubProcess = (AdhocSubProcess) flowNode.getParentContainer();
if (adhocSubProcess.getCompletionCondition() != null) {
Expression expression = Context.getProcessEngineConfiguration().getExpressionManager().createExpression(adhocSubProcess.getCompletionCondition());
Condition condition = new UelExpressionCondition(expression);
if (condition.evaluate(adhocSubProcess.getId(), execution)) {
completeAdhocSubProcess = true;
}
}
if (flowNode.getOutgoingFlows().size() > 0) {
leaveFlowNode(flowNode);
} else {
commandContext.getExecutionEntityManager().deleteExecutionAndRelatedData(execution, null);
}
if (completeAdhocSubProcess) {
boolean endAdhocSubProcess = true;
if (!adhocSubProcess.isCancelRemainingInstances()) {
List<ExecutionEntity> childExecutions = commandContext.getExecutionEntityManager().findChildExecutionsByParentExecutionId(execution.getParentId());
for (ExecutionEntity executionEntity : childExecutions) {
if (!executionEntity.getId().equals(execution.getId())) {
endAdhocSubProcess = false;
break;
}
}
}
if (endAdhocSubProcess) {
Context.getAgenda().planEndExecutionOperation(execution.getParent());
}
}
}
use of org.activiti.engine.impl.el.UelExpressionCondition 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;
}
}
Aggregations