Author: adrianc
Date: Mon May 14 20:49:01 2012
New Revision: 1338394
URL:
http://svn.apache.org/viewvc?rev=1338394&view=revLog:
Fixed a bug in Mini-language <field-to-result> element where nested expressions were not evaluated correctly.
Modified:
ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/serviceops/FieldToResult.java
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/serviceops/FieldToResult.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/serviceops/FieldToResult.java?rev=1338394&r1=1338393&r2=1338394&view=diff==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/serviceops/FieldToResult.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/serviceops/FieldToResult.java Mon May 14 20:49:01 2012
@@ -28,7 +28,7 @@ import org.ofbiz.minilang.method.MethodO
import org.w3c.dom.Element;
/**
- * Copies a field to a service OUT attribute.
+ * Copies a field to the simple-method result Map.
*/
public final class FieldToResult extends MethodOperation {
@@ -58,9 +58,13 @@ public final class FieldToResult extends
public boolean exec(MethodContext methodContext) throws MiniLangException {
Object fieldVal = this.fieldFma.get(methodContext.getEnvMap());
if (fieldVal != null) {
- // FIXME: Needs special handling for nested expressions.
- // The result attribute might contain a reference to an environment (not result Map) variable.
- this.resultFma.put(methodContext.getResults(), fieldVal);
+ if (this.resultFma.containsNestedExpression()) {
+ String expression = (String) this.resultFma.get(methodContext.getEnvMap());
+ FlexibleMapAccessor<Object> resultFma = FlexibleMapAccessor.getInstance(expression);
+ resultFma.put(methodContext.getResults(), fieldVal);
+ } else {
+ this.resultFma.put(methodContext.getResults(), fieldVal);
+ }
}
return true;
}