04-20-2015 05:02 AM
Money.valueOf("50 EUR")
. In addition the Money class provides some static methods for comparing and calculating values.
<sequenceFlow id="checkSalary" sourceRef="1234" targetRef="4321">
<conditionExpression xsi:type="tFormalExpression">${Money.less(salary, Money.valueOf("1500 EUR")}</conditionExpression>
</sequenceFlow>
The process variable "salary" is set before reaching this sequence flow. It should be compared to the value of 1500 EUR. "less" and "valueOf" are static methods of my java class "Money". The method "less" returns a Boolean.${Money.less(Money.valueOf("50 EUR", Money.valueOf("1500 EUR"))}
I'm getting the same exception. Thats absolutly clear… because the juel expression context does not know about my class Money. It just recons "Money" to be a property. elContext.getImportHandler().importPackage("de.myexample.valuetypes");
04-20-2015 08:48 AM
<sequenceFlow id="checkSalary" sourceRef="1234" targetRef="4321">
<conditionExpression xsi:type="tFormalExpression">${javaxEL.eval("#{Money.less(salary, Money.valueOf(\"1500 EUR\")}", execution)}</conditionExpression>
</sequenceFlow>
public class ActivitiJavaxELConnector {
public Object eval(String expr, VariableScope scope) {
ExpressionFactory factory = ExpressionFactory.newInstance();
ELContext context = new StandardELContext(factory);
// import packages
context.getImportHandler().importPackage("de.myexample.valuetypes");
// add variables to context
for (Entry<String, Object> v : scope.getVariables().entrySet()) {
context.getELResolver().setValue(context, null, v.getKey(), v.getValue());
}
// evaluate
return factory.createValueExpression(context, expr, Object.class).getValue(context);
}
}
04-21-2015 04:27 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.