use of org.camunda.bpm.engine.impl.Condition in project camunda-bpm-platform by camunda.
the class BpmnParse method parseSequenceFlowConditionExpression.
/**
* Parses a condition expression on a sequence flow.
*
* @param seqFlowElement
* The 'sequenceFlow' element that can contain a condition.
* @param seqFlow
* The sequenceFlow object representation to which the condition must
* be added.
*/
public void parseSequenceFlowConditionExpression(Element seqFlowElement, TransitionImpl seqFlow) {
Element conditionExprElement = seqFlowElement.element(CONDITION_EXPRESSION);
if (conditionExprElement != null) {
Condition condition = parseConditionExpression(conditionExprElement);
seqFlow.setProperty(PROPERTYNAME_CONDITION_TEXT, conditionExprElement.getText().trim());
seqFlow.setProperty(PROPERTYNAME_CONDITION, condition);
}
}
use of org.camunda.bpm.engine.impl.Condition 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