use of org.camunda.bpm.engine.impl.scripting.ScriptCondition in project camunda-bpm-platform by camunda.
the class BpmnParse method parseConditionExpression.
protected Condition parseConditionExpression(Element conditionExprElement) {
String expression = conditionExprElement.getText().trim();
String type = conditionExprElement.attributeNS(XSI_NS, TYPE);
String language = conditionExprElement.attribute(PROPERTYNAME_LANGUAGE);
String resource = conditionExprElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, PROPERTYNAME_RESOURCE);
if (type != null) {
String value = type.contains(":") ? resolveName(type) : BpmnParser.BPMN20_NS + ":" + type;
if (!value.equals(ATTRIBUTEVALUE_T_FORMAL_EXPRESSION)) {
addError("Invalid type, only tFormalExpression is currently supported", conditionExprElement);
}
}
Condition condition = null;
if (language == null) {
condition = new UelExpressionCondition(expressionManager.createExpression(expression));
} else {
try {
ExecutableScript script = ScriptUtil.getScript(language, expression, resource, expressionManager);
condition = new ScriptCondition(script);
} catch (ProcessEngineException e) {
addError("Unable to process condition expression:" + e.getMessage(), conditionExprElement);
}
}
return condition;
}
Aggregations