use of org.activiti.engine.impl.bpmn.behavior.BusinessRuleTaskActivityBehavior in project Activiti by Activiti.
the class DefaultActivityBehaviorFactory method createBusinessRuleTaskActivityBehavior.
public ActivityBehavior createBusinessRuleTaskActivityBehavior(BusinessRuleTask businessRuleTask) {
BusinessRuleTaskDelegate ruleActivity = null;
if (StringUtils.isNotEmpty(businessRuleTask.getClassName())) {
try {
Class<?> clazz = Class.forName(businessRuleTask.getClassName());
ruleActivity = (BusinessRuleTaskDelegate) clazz.newInstance();
} catch (Exception e) {
throw new ActivitiException("Could not instantiate businessRuleTask (id:" + businessRuleTask.getId() + ") class: " + businessRuleTask.getClassName(), e);
}
} else {
ruleActivity = new BusinessRuleTaskActivityBehavior();
}
for (String ruleVariableInputObject : businessRuleTask.getInputVariables()) {
ruleActivity.addRuleVariableInputIdExpression(expressionManager.createExpression(ruleVariableInputObject.trim()));
}
for (String rule : businessRuleTask.getRuleNames()) {
ruleActivity.addRuleIdExpression(expressionManager.createExpression(rule.trim()));
}
ruleActivity.setExclude(businessRuleTask.isExclude());
if (businessRuleTask.getResultVariableName() != null && businessRuleTask.getResultVariableName().length() > 0) {
ruleActivity.setResultVariable(businessRuleTask.getResultVariableName());
} else {
ruleActivity.setResultVariable("org.activiti.engine.rules.OUTPUT");
}
return ruleActivity;
}
Aggregations