if (!expressionVariables.containsKey(defaultReturnVariable)) {
expressionVariables.put(defaultReturnVariable, null);
}
for (Entry<String, List<ExpressionMapping>> toListEntry : toListMap.entrySet()) {
List<Object> from_list = new ArrayList<Object>();
ExpressionMapping to_em = null;
for (ExpressionMapping from_em : toListEntry.getValue()) {
if (to_em == null) {
to_em = from_em;
}
Object from_value = run(message, from_em.getFromExpression(), expressionVariables);
if (from_value != null) {
from_list.add(from_value);
} else {
from_value = getValue(expressionVariables, from_em.getFrom());
if (from_value != null) {
from_list.add(from_value);
}
}
}
final Object output;
switch (from_list.size()) {
case 0:
output = null;
break;
case 1:
output = from_list.get(0);
break;
default:
output = from_list;
break;
}
String output_var = toVariable(output);
expressionVariables.put(output_var, output);
String output_to = to_em.getTo() + " = " + output_var;
Expression output_to_expr = ExpressionFactory.INSTANCE.create(output_to, null, to_em.getPropertyResolver());
run(message, output_to_expr, expressionVariables);
}
}
}