You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by sa...@apache.org on 2012/06/13 20:01:10 UTC

svn commit: r1349976 [4/6] - in /ofbiz/branches/jackrabbit20120501: ./ applications/accounting/config/ applications/content/servicedef/ applications/content/src/org/ofbiz/content/ applications/product/ applications/product/config/ applications/product/...

Modified: ofbiz/branches/jackrabbit20120501/framework/minilang/src/META-INF/services/org.ofbiz.minilang.method.MethodOperation$Factory
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/minilang/src/META-INF/services/org.ofbiz.minilang.method.MethodOperation%24Factory?rev=1349976&r1=1349975&r2=1349976&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/minilang/src/META-INF/services/org.ofbiz.minilang.method.MethodOperation$Factory (original)
+++ ofbiz/branches/jackrabbit20120501/framework/minilang/src/META-INF/services/org.ofbiz.minilang.method.MethodOperation$Factory Wed Jun 13 18:01:08 2012
@@ -86,7 +86,6 @@ org.ofbiz.minilang.method.envops.OrderMa
 org.ofbiz.minilang.method.envops.SetCalendar$SetCalendarFactory
 org.ofbiz.minilang.method.envops.SetOperation$SetOperationFactory
 org.ofbiz.minilang.method.envops.StringAppend$StringAppendFactory
-org.ofbiz.minilang.method.envops.StringToField$StringToFieldFactory
 org.ofbiz.minilang.method.envops.StringToList$StringToListFactory
 org.ofbiz.minilang.method.envops.ToString$ToStringFactory
 org.ofbiz.minilang.method.envops.While$WhileFactory

Modified: ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveValue.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveValue.java?rev=1349976&r1=1349975&r2=1349976&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveValue.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveValue.java Wed Jun 13 18:01:08 2012
@@ -34,7 +34,7 @@ import org.w3c.dom.Element;
 /**
  * Implements the <remove-value> element.
  */
-public class RemoveValue extends MethodOperation {
+public final class RemoveValue extends MethodOperation {
 
     public static final String module = RemoveValue.class.getName();
 

Modified: ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetCurrentUserLogin.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetCurrentUserLogin.java?rev=1349976&r1=1349975&r2=1349976&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetCurrentUserLogin.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetCurrentUserLogin.java Wed Jun 13 18:01:08 2012
@@ -18,35 +18,41 @@
  *******************************************************************************/
 package org.ofbiz.minilang.method.entityops;
 
-import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.collections.FlexibleMapAccessor;
+import org.ofbiz.base.util.string.FlexibleStringExpander;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.minilang.MiniLangException;
+import org.ofbiz.minilang.MiniLangRuntimeException;
+import org.ofbiz.minilang.MiniLangValidate;
 import org.ofbiz.minilang.SimpleMethod;
-import org.ofbiz.minilang.method.ContextAccessor;
 import org.ofbiz.minilang.method.MethodContext;
 import org.ofbiz.minilang.method.MethodOperation;
 import org.w3c.dom.Element;
 
 /**
- * Uses the delegator to create the specified value object entity in the datasource
+ * Implements the <set-current-user-login> element.
  */
-public class SetCurrentUserLogin extends MethodOperation {
+public final class SetCurrentUserLogin extends MethodOperation {
 
-    public static final String module = SetCurrentUserLogin.class.getName();
-
-    ContextAccessor<GenericValue> valueAcsr;
+    private final FlexibleMapAccessor<GenericValue> valueFma;
 
     public SetCurrentUserLogin(Element element, SimpleMethod simpleMethod) throws MiniLangException {
         super(element, simpleMethod);
-        valueAcsr = new ContextAccessor<GenericValue>(element.getAttribute("value-field"), element.getAttribute("value-name"));
+        if (MiniLangValidate.validationOn()) {
+            MiniLangValidate.handleError("Deprecated - use the called service's userLogin IN attribute", simpleMethod, element);
+            MiniLangValidate.attributeNames(simpleMethod, element, "value-field");
+            MiniLangValidate.requiredAttributes(simpleMethod, element, "value-field");
+            MiniLangValidate.expressionAttributes(simpleMethod, element, "value-field");
+            MiniLangValidate.noChildElements(simpleMethod, element);
+        }
+        valueFma = FlexibleMapAccessor.getInstance(element.getAttribute("value-field"));
     }
 
     @Override
     public boolean exec(MethodContext methodContext) throws MiniLangException {
-        GenericValue userLogin = valueAcsr.get(methodContext);
+        GenericValue userLogin = valueFma.get(methodContext.getEnvMap());
         if (userLogin == null) {
-            Debug.logWarning("In SetCurrentUserLogin a value was not found with the specified valueName: " + valueAcsr + ", not setting", module);
-            return true;
+            throw new MiniLangRuntimeException("Entity value not found with name: " + valueFma, this);
         }
         methodContext.setUserLogin(userLogin, this.simpleMethod.getUserLoginEnvName());
         return true;
@@ -54,21 +60,31 @@ public class SetCurrentUserLogin extends
 
     @Override
     public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+        return FlexibleStringExpander.expandString(toString(), methodContext.getEnvMap());
     }
 
     @Override
     public String rawString() {
-        // TODO: something more than the empty tag
-        return "<set-current-user-login/>";
+        return toString();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder("<set-current-user-login ");
+        sb.append("value-field=\"").append(this.valueFma).append("\" />");
+        return sb.toString();
     }
 
+    /**
+     * A factory for the &lt;set-current-user-login&gt; element.
+     */
     public static final class SetCurrentUserLoginFactory implements Factory<SetCurrentUserLogin> {
+        @Override
         public SetCurrentUserLogin createMethodOperation(Element element, SimpleMethod simpleMethod) throws MiniLangException {
             return new SetCurrentUserLogin(element, simpleMethod);
         }
 
+        @Override
         public String getName() {
             return "set-current-user-login";
         }

Modified: ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetNonpkFields.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetNonpkFields.java?rev=1349976&r1=1349975&r2=1349976&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetNonpkFields.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetNonpkFields.java Wed Jun 13 18:01:08 2012
@@ -20,76 +20,86 @@ package org.ofbiz.minilang.method.entity
 
 import java.util.Map;
 
-import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.collections.FlexibleMapAccessor;
+import org.ofbiz.base.util.string.FlexibleStringExpander;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.minilang.MiniLangException;
+import org.ofbiz.minilang.MiniLangRuntimeException;
+import org.ofbiz.minilang.MiniLangValidate;
 import org.ofbiz.minilang.SimpleMethod;
-import org.ofbiz.minilang.method.ContextAccessor;
 import org.ofbiz.minilang.method.MethodContext;
 import org.ofbiz.minilang.method.MethodOperation;
 import org.w3c.dom.Element;
 
 /**
- * Looks for each non-PK field in the named map and if it exists there it will copy it into the named value object.
+ * Implements the &lt;set-nonpk-fields&gt; element.
  */
-public class SetNonpkFields extends MethodOperation {
+public final class SetNonpkFields extends MethodOperation {
 
-    public static final String module = SetNonpkFields.class.getName();
-
-    ContextAccessor<Map<String, ? extends Object>> mapAcsr;
-    String setIfNullStr;
-    ContextAccessor<GenericValue> valueAcsr;
+    private final FlexibleMapAccessor<Map<String, ? extends Object>> mapFma;
+    private final FlexibleStringExpander setIfNullFse;
+    private final FlexibleMapAccessor<GenericValue> valueFma;
 
     public SetNonpkFields(Element element, SimpleMethod simpleMethod) throws MiniLangException {
         super(element, simpleMethod);
-        valueAcsr = new ContextAccessor<GenericValue>(element.getAttribute("value-field"), element.getAttribute("value-name"));
-        mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map"), element.getAttribute("map-name"));
-        setIfNullStr = element.getAttribute("set-if-null");
+        if (MiniLangValidate.validationOn()) {
+            MiniLangValidate.attributeNames(simpleMethod, element, "value-field", "set-if-null", "map");
+            MiniLangValidate.requiredAttributes(simpleMethod, element, "value-field", "map");
+            MiniLangValidate.expressionAttributes(simpleMethod, element, "value-field", "map");
+            MiniLangValidate.noChildElements(simpleMethod, element);
+        }
+        valueFma = FlexibleMapAccessor.getInstance(element.getAttribute("value-field"));
+        setIfNullFse = FlexibleStringExpander.getInstance(element.getAttribute("set-if-null"));
+        mapFma = FlexibleMapAccessor.getInstance(element.getAttribute("map"));
     }
 
     @Override
     public boolean exec(MethodContext methodContext) throws MiniLangException {
-        // if anything but false it will be true
-        boolean setIfNull = !"false".equals(methodContext.expandString(setIfNullStr));
-        GenericValue value = valueAcsr.get(methodContext);
+        GenericValue value = valueFma.get(methodContext.getEnvMap());
         if (value == null) {
-            String errMsg = "In set-nonpk-fields a value was not found with the specified valueAcsr: " + valueAcsr + ", not setting fields";
-            Debug.logWarning(errMsg, module);
-            if (methodContext.getMethodType() == MethodContext.EVENT) {
-                methodContext.putEnv(simpleMethod.getEventErrorMessageName(), errMsg);
-                methodContext.putEnv(simpleMethod.getEventResponseCodeName(), simpleMethod.getDefaultErrorCode());
-            } else if (methodContext.getMethodType() == MethodContext.SERVICE) {
-                methodContext.putEnv(simpleMethod.getServiceErrorMessageName(), errMsg);
-                methodContext.putEnv(simpleMethod.getServiceResponseMessageName(), simpleMethod.getDefaultErrorCode());
-            }
-            return false;
+            throw new MiniLangRuntimeException("Entity value not found with name: " + valueFma, this);
         }
-        Map<String, ? extends Object> theMap = mapAcsr.get(methodContext);
+        Map<String, ? extends Object> theMap = mapFma.get(methodContext.getEnvMap());
         if (theMap == null) {
-            Debug.logWarning("In set-nonpk-fields could not find map with name " + mapAcsr + ", not setting any fields", module);
-        } else {
-            value.setNonPKFields(theMap, setIfNull);
+            throw new MiniLangRuntimeException("Map not found with name: " + mapFma, this);
         }
+        boolean setIfNull = !"false".equals(setIfNullFse.expand(methodContext.getEnvMap()));
+        value.setNonPKFields(theMap, setIfNull);
         return true;
     }
 
     @Override
     public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+        return FlexibleStringExpander.expandString(toString(), methodContext.getEnvMap());
     }
 
     @Override
     public String rawString() {
-        // TODO: something more than the empty tag
-        return "<set-nonpk-fields/>";
+        return toString();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder("<set-nonpk-fields ");
+        sb.append("value-field=\"").append(this.valueFma).append("\" ");
+        sb.append("map=\"").append(this.mapFma).append("\" ");
+        if (!setIfNullFse.isEmpty()) {
+            sb.append("set-if-null=\"").append(this.setIfNullFse).append("\" ");
+        }
+        sb.append("/>");
+        return sb.toString();
     }
 
+    /**
+     * A factory for the &lt;set-nonpk-fields&gt; element.
+     */
     public static final class SetNonpkFieldsFactory implements Factory<SetNonpkFields> {
+        @Override
         public SetNonpkFields createMethodOperation(Element element, SimpleMethod simpleMethod) throws MiniLangException {
             return new SetNonpkFields(element, simpleMethod);
         }
 
+        @Override
         public String getName() {
             return "set-nonpk-fields";
         }

Modified: ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetPkFields.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetPkFields.java?rev=1349976&r1=1349975&r2=1349976&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetPkFields.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetPkFields.java Wed Jun 13 18:01:08 2012
@@ -20,77 +20,86 @@ package org.ofbiz.minilang.method.entity
 
 import java.util.Map;
 
-import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.collections.FlexibleMapAccessor;
+import org.ofbiz.base.util.string.FlexibleStringExpander;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.minilang.MiniLangException;
+import org.ofbiz.minilang.MiniLangRuntimeException;
+import org.ofbiz.minilang.MiniLangValidate;
 import org.ofbiz.minilang.SimpleMethod;
-import org.ofbiz.minilang.method.ContextAccessor;
 import org.ofbiz.minilang.method.MethodContext;
 import org.ofbiz.minilang.method.MethodOperation;
 import org.w3c.dom.Element;
 
 /**
- * Looks for each PK field in the named map and if it exists there it will copy it into the named value object.
+ * Implements the &lt;set-pk-fields&gt; element.
  */
-public class SetPkFields extends MethodOperation {
+public final class SetPkFields extends MethodOperation {
 
-    public static final String module = SetPkFields.class.getName();
-
-    ContextAccessor<Map<String, ? extends Object>> mapAcsr;
-    String setIfNullStr;
-    ContextAccessor<GenericValue> valueAcsr;
+    private final FlexibleMapAccessor<Map<String, ? extends Object>> mapFma;
+    private final FlexibleStringExpander setIfNullFse;
+    private final FlexibleMapAccessor<GenericValue> valueFma;
 
     public SetPkFields(Element element, SimpleMethod simpleMethod) throws MiniLangException {
         super(element, simpleMethod);
-        valueAcsr = new ContextAccessor<GenericValue>(element.getAttribute("value-field"), element.getAttribute("value-name"));
-        mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map"), element.getAttribute("map-name"));
-        setIfNullStr = element.getAttribute("set-if-null");
+        if (MiniLangValidate.validationOn()) {
+            MiniLangValidate.attributeNames(simpleMethod, element, "value-field", "set-if-null", "map");
+            MiniLangValidate.requiredAttributes(simpleMethod, element, "value-field", "map");
+            MiniLangValidate.expressionAttributes(simpleMethod, element, "value-field", "map");
+            MiniLangValidate.noChildElements(simpleMethod, element);
+        }
+        valueFma = FlexibleMapAccessor.getInstance(element.getAttribute("value-field"));
+        setIfNullFse = FlexibleStringExpander.getInstance(element.getAttribute("set-if-null"));
+        mapFma = FlexibleMapAccessor.getInstance(element.getAttribute("map"));
     }
 
     @Override
     public boolean exec(MethodContext methodContext) throws MiniLangException {
-        // if anything but false it will be true
-        boolean setIfNull = !"false".equals(methodContext.expandString(setIfNullStr));
-        GenericValue value = valueAcsr.get(methodContext);
+        GenericValue value = valueFma.get(methodContext.getEnvMap());
         if (value == null) {
-            String errMsg = "In set-pk-fields a value was not found with the specified valueAcsr: " + valueAcsr + ", not setting fields";
-
-            Debug.logWarning(errMsg, module);
-            if (methodContext.getMethodType() == MethodContext.EVENT) {
-                methodContext.putEnv(simpleMethod.getEventErrorMessageName(), errMsg);
-                methodContext.putEnv(simpleMethod.getEventResponseCodeName(), simpleMethod.getDefaultErrorCode());
-            } else if (methodContext.getMethodType() == MethodContext.SERVICE) {
-                methodContext.putEnv(simpleMethod.getServiceErrorMessageName(), errMsg);
-                methodContext.putEnv(simpleMethod.getServiceResponseMessageName(), simpleMethod.getDefaultErrorCode());
-            }
-            return false;
+            throw new MiniLangRuntimeException("Entity value not found with name: " + valueFma, this);
         }
-        Map<String, ? extends Object> theMap = mapAcsr.get(methodContext);
+        Map<String, ? extends Object> theMap = mapFma.get(methodContext.getEnvMap());
         if (theMap == null) {
-            Debug.logWarning("In set-pk-fields could not find map with name " + mapAcsr + ", not setting any fields", module);
-        } else {
-            value.setPKFields(theMap, setIfNull);
+            throw new MiniLangRuntimeException("Map not found with name: " + mapFma, this);
         }
+        boolean setIfNull = !"false".equals(setIfNullFse.expand(methodContext.getEnvMap()));
+        value.setPKFields(theMap, setIfNull);
         return true;
     }
 
     @Override
     public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+        return FlexibleStringExpander.expandString(toString(), methodContext.getEnvMap());
     }
 
     @Override
     public String rawString() {
-        // TODO: something more than the empty tag
-        return "<set-pk-fields/>";
+        return toString();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder("<set-pk-fields ");
+        sb.append("value-field=\"").append(this.valueFma).append("\" ");
+        sb.append("map=\"").append(this.mapFma).append("\" ");
+        if (!setIfNullFse.isEmpty()) {
+            sb.append("set-if-null=\"").append(this.setIfNullFse).append("\" ");
+        }
+        sb.append("/>");
+        return sb.toString();
     }
 
+    /**
+     * A factory for the &lt;set-pk-fields&gt; element.
+     */
     public static final class SetPkFieldsFactory implements Factory<SetPkFields> {
+        @Override
         public SetPkFields createMethodOperation(Element element, SimpleMethod simpleMethod) throws MiniLangException {
             return new SetPkFields(element, simpleMethod);
         }
 
+        @Override
         public String getName() {
             return "set-pk-fields";
         }

Modified: ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreList.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreList.java?rev=1349976&r1=1349975&r2=1349976&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreList.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreList.java Wed Jun 13 18:01:08 2012
@@ -21,51 +21,53 @@ package org.ofbiz.minilang.method.entity
 import java.util.List;
 
 import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.collections.FlexibleMapAccessor;
+import org.ofbiz.base.util.string.FlexibleStringExpander;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.minilang.MiniLangException;
+import org.ofbiz.minilang.MiniLangRuntimeException;
+import org.ofbiz.minilang.MiniLangValidate;
 import org.ofbiz.minilang.SimpleMethod;
-import org.ofbiz.minilang.method.ContextAccessor;
 import org.ofbiz.minilang.method.MethodContext;
 import org.ofbiz.minilang.method.MethodOperation;
 import org.w3c.dom.Element;
 
 /**
- * Uses the delegator to store the specified value object list in the datasource
+ * Implements the &lt;store-list&gt; element.
  */
-public class StoreList extends MethodOperation {
+public final class StoreList extends MethodOperation {
 
     public static final String module = StoreList.class.getName();
 
-    String doCacheClearStr;
-    ContextAccessor<List<GenericValue>> listAcsr;
+    private final FlexibleStringExpander doCacheClearFse;
+    private final FlexibleMapAccessor<List<GenericValue>> listFma;
 
     public StoreList(Element element, SimpleMethod simpleMethod) throws MiniLangException {
         super(element, simpleMethod);
-        listAcsr = new ContextAccessor<List<GenericValue>>(element.getAttribute("list"), element.getAttribute("list-name"));
-        doCacheClearStr = element.getAttribute("do-cache-clear");
+        if (MiniLangValidate.validationOn()) {
+            MiniLangValidate.attributeNames(simpleMethod, element, "list", "do-cache-clear");
+            MiniLangValidate.requiredAttributes(simpleMethod, element, "list");
+            MiniLangValidate.expressionAttributes(simpleMethod, element, "list");
+            MiniLangValidate.noChildElements(simpleMethod, element);
+        }
+        listFma = FlexibleMapAccessor.getInstance(element.getAttribute("list"));
+        doCacheClearFse = FlexibleStringExpander.getInstance(element.getAttribute("do-cache-clear"));
     }
 
     @Override
     public boolean exec(MethodContext methodContext) throws MiniLangException {
-        boolean doCacheClear = !"false".equals(methodContext.expandString(doCacheClearStr));
-        List<GenericValue> values = listAcsr.get(methodContext);
+        List<GenericValue> values = listFma.get(methodContext.getEnvMap());
         if (values == null) {
-            String errMsg = "In store-list a value list was not found with the specified listAcsr: " + listAcsr + ", not storing";
-            Debug.logInfo(errMsg, module);
+            throw new MiniLangRuntimeException("Entity value list not found with name: " + listFma, this);
         }
+        boolean doCacheClear = !"false".equals(doCacheClearFse.expandString(methodContext.getEnvMap()));
         try {
             methodContext.getDelegator().storeAll(values, doCacheClear);
         } catch (GenericEntityException e) {
-            Debug.logError(e, module);
-            String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process [problem storing the " + listAcsr + " value list: " + e.getMessage() + "]";
-            if (methodContext.getMethodType() == MethodContext.EVENT) {
-                methodContext.putEnv(simpleMethod.getEventErrorMessageName(), errMsg);
-                methodContext.putEnv(simpleMethod.getEventResponseCodeName(), simpleMethod.getDefaultErrorCode());
-            } else if (methodContext.getMethodType() == MethodContext.SERVICE) {
-                methodContext.putEnv(simpleMethod.getServiceErrorMessageName(), errMsg);
-                methodContext.putEnv(simpleMethod.getServiceResponseMessageName(), simpleMethod.getDefaultErrorCode());
-            }
+            String errMsg = "Exception thrown while storing entities: " + e.getMessage();
+            Debug.logWarning(e, errMsg, module);
+            simpleMethod.addErrorMessage(methodContext, errMsg);
             return false;
         }
         return true;
@@ -73,21 +75,35 @@ public class StoreList extends MethodOpe
 
     @Override
     public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+        return FlexibleStringExpander.expandString(toString(), methodContext.getEnvMap());
     }
 
     @Override
     public String rawString() {
-        // TODO: something more than the empty tag
-        return "<store-list/>";
+        return toString();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder("<store-list ");
+        sb.append("list=\"").append(this.listFma).append("\" ");
+        if (!doCacheClearFse.isEmpty()) {
+            sb.append("do-cache-clear=\"").append(this.doCacheClearFse).append("\" ");
+        }
+        sb.append("/>");
+        return sb.toString();
     }
 
+    /**
+     * A factory for the &lt;store-list&gt; element.
+     */
     public static final class StoreListFactory implements Factory<StoreList> {
+        @Override
         public StoreList createMethodOperation(Element element, SimpleMethod simpleMethod) throws MiniLangException {
             return new StoreList(element, simpleMethod);
         }
 
+        @Override
         public String getName() {
             return "store-list";
         }

Modified: ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreValue.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreValue.java?rev=1349976&r1=1349975&r2=1349976&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreValue.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreValue.java Wed Jun 13 18:01:08 2012
@@ -19,55 +19,53 @@
 package org.ofbiz.minilang.method.entityops;
 
 import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.collections.FlexibleMapAccessor;
+import org.ofbiz.base.util.string.FlexibleStringExpander;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.minilang.MiniLangException;
+import org.ofbiz.minilang.MiniLangRuntimeException;
+import org.ofbiz.minilang.MiniLangValidate;
 import org.ofbiz.minilang.SimpleMethod;
-import org.ofbiz.minilang.method.ContextAccessor;
 import org.ofbiz.minilang.method.MethodContext;
 import org.ofbiz.minilang.method.MethodOperation;
 import org.w3c.dom.Element;
 
 /**
- * Uses the delegator to store the specified value object entity in the datasource
+ * Implements the &lt;store-value&gt; element.
  */
-public class StoreValue extends MethodOperation {
+public final class StoreValue extends MethodOperation {
 
     public static final String module = StoreValue.class.getName();
 
-    String doCacheClearStr;
-    ContextAccessor<GenericValue> valueAcsr;
+    private final FlexibleStringExpander doCacheClearFse;
+    private final FlexibleMapAccessor<GenericValue> valueFma;
 
     public StoreValue(Element element, SimpleMethod simpleMethod) throws MiniLangException {
         super(element, simpleMethod);
-        valueAcsr = new ContextAccessor<GenericValue>(element.getAttribute("value-field"), element.getAttribute("value-name"));
-        doCacheClearStr = element.getAttribute("do-cache-clear");
+        if (MiniLangValidate.validationOn()) {
+            MiniLangValidate.attributeNames(simpleMethod, element, "value-field", "do-cache-clear");
+            MiniLangValidate.requiredAttributes(simpleMethod, element, "value-field");
+            MiniLangValidate.expressionAttributes(simpleMethod, element, "value-field");
+            MiniLangValidate.noChildElements(simpleMethod, element);
+        }
+        valueFma = FlexibleMapAccessor.getInstance(element.getAttribute("value-field"));
+        doCacheClearFse = FlexibleStringExpander.getInstance(element.getAttribute("do-cache-clear"));
     }
 
     @Override
     public boolean exec(MethodContext methodContext) throws MiniLangException {
-        boolean doCacheClear = !"false".equals(methodContext.expandString(doCacheClearStr));
-        GenericValue value = null;
-        try {
-            value = valueAcsr.get(methodContext);
-        } catch (ClassCastException e) {
-            String errMsg = "In store-value the value specified by valueAcsr [" + valueAcsr + "] was not an instance of GenericValue, not storing";
-            Debug.logError(errMsg, module);
-            methodContext.setErrorReturn(errMsg, simpleMethod);
-            return false;
-        }
+        GenericValue value = valueFma.get(methodContext.getEnvMap());
         if (value == null) {
-            String errMsg = "In store-value a value was not found with the specified valueAcsr: " + valueAcsr + ", not storing";
-            Debug.logWarning(errMsg, module);
-            methodContext.setErrorReturn(errMsg, simpleMethod);
-            return false;
+            throw new MiniLangRuntimeException("Entity value not found with name: " + valueFma, this);
         }
+        boolean doCacheClear = !"false".equals(doCacheClearFse.expandString(methodContext.getEnvMap()));
         try {
             methodContext.getDelegator().store(value, doCacheClear);
         } catch (GenericEntityException e) {
-            Debug.logError(e, module);
-            String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process [problem storing the " + valueAcsr + " value: " + e.getMessage() + "]";
-            methodContext.setErrorReturn(errMsg, simpleMethod);
+            String errMsg = "Exception thrown while storing entity value: " + e.getMessage();
+            Debug.logWarning(e, errMsg, module);
+            simpleMethod.addErrorMessage(methodContext, errMsg);
             return false;
         }
         return true;
@@ -75,21 +73,35 @@ public class StoreValue extends MethodOp
 
     @Override
     public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+        return FlexibleStringExpander.expandString(toString(), methodContext.getEnvMap());
     }
 
     @Override
     public String rawString() {
-        // TODO: something more than the empty tag
-        return "<store-value/>";
+        return toString();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder("<store-value ");
+        sb.append("value-field=\"").append(this.valueFma).append("\" ");
+        if (!doCacheClearFse.isEmpty()) {
+            sb.append("do-cache-clear=\"").append(this.doCacheClearFse).append("\" ");
+        }
+        sb.append("/>");
+        return sb.toString();
     }
 
+    /**
+     * A factory for the &lt;store-value&gt; element.
+     */
     public static final class StoreValueFactory implements Factory<StoreValue> {
+        @Override
         public StoreValue createMethodOperation(Element element, SimpleMethod simpleMethod) throws MiniLangException {
             return new StoreValue(element, simpleMethod);
         }
 
+        @Override
         public String getName() {
             return "store-value";
         }

Modified: ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionBegin.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionBegin.java?rev=1349976&r1=1349975&r2=1349976&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionBegin.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionBegin.java Wed Jun 13 18:01:08 2012
@@ -19,27 +19,34 @@
 package org.ofbiz.minilang.method.entityops;
 
 import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.collections.FlexibleMapAccessor;
+import org.ofbiz.base.util.string.FlexibleStringExpander;
 import org.ofbiz.entity.transaction.GenericTransactionException;
 import org.ofbiz.entity.transaction.TransactionUtil;
 import org.ofbiz.minilang.MiniLangException;
+import org.ofbiz.minilang.MiniLangValidate;
 import org.ofbiz.minilang.SimpleMethod;
-import org.ofbiz.minilang.method.ContextAccessor;
 import org.ofbiz.minilang.method.MethodContext;
 import org.ofbiz.minilang.method.MethodOperation;
 import org.w3c.dom.Element;
 
 /**
- * Begins a transaction if one is not already in place; if does begin one puts true in the began-transaction-name env variable, otherwise it returns false.
+ * Implements the &lt;transaction-begin&gt; element.
  */
-public class TransactionBegin extends MethodOperation {
+public final class TransactionBegin extends MethodOperation {
 
     public static final String module = TransactionBegin.class.getName();
 
-    ContextAccessor<Boolean> beganTransactionAcsr;
+    private final FlexibleMapAccessor<Boolean> beganTransactionFma;
 
     public TransactionBegin(Element element, SimpleMethod simpleMethod) throws MiniLangException {
         super(element, simpleMethod);
-        beganTransactionAcsr = new ContextAccessor<Boolean>(element.getAttribute("began-transaction-name"), "beganTransaction");
+        if (MiniLangValidate.validationOn()) {
+            MiniLangValidate.attributeNames(simpleMethod, element, "began-transaction-name");
+            MiniLangValidate.expressionAttributes(simpleMethod, element, "began-transaction-name");
+            MiniLangValidate.noChildElements(simpleMethod, element);
+        }
+        beganTransactionFma = FlexibleMapAccessor.getInstance(MiniLangValidate.checkAttribute(element.getAttribute("began-transaction-name"), "beganTransaction"));
     }
 
     @Override
@@ -48,32 +55,42 @@ public class TransactionBegin extends Me
         try {
             beganTransaction = TransactionUtil.begin();
         } catch (GenericTransactionException e) {
-            Debug.logError(e, "Could not begin transaction in simple-method, returning error.", module);
-            String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process [error beginning a transaction: " + e.getMessage() + "]";
-            methodContext.setErrorReturn(errMsg, simpleMethod);
+            String errMsg = "Exception thrown while beginning transaction: " + e.getMessage();
+            Debug.logWarning(e, errMsg, module);
+            simpleMethod.addErrorMessage(methodContext, errMsg);
             return false;
         }
-        beganTransactionAcsr.put(methodContext, beganTransaction);
+        beganTransactionFma.put(methodContext.getEnvMap(), beganTransaction);
         return true;
     }
 
     @Override
     public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+        return FlexibleStringExpander.expandString(toString(), methodContext.getEnvMap());
     }
 
     @Override
     public String rawString() {
-        // TODO: something more than the empty tag
-        return "<transaction-begin/>";
+        return toString();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder("<transaction-begin ");
+        sb.append("began-transaction-name=\"").append(this.beganTransactionFma).append("\" />");
+        return sb.toString();
     }
 
+    /**
+     * A factory for the &lt;transaction-begin&gt; element.
+     */
     public static final class TransactionBeginFactory implements Factory<TransactionBegin> {
+        @Override
         public TransactionBegin createMethodOperation(Element element, SimpleMethod simpleMethod) throws MiniLangException {
             return new TransactionBegin(element, simpleMethod);
         }
 
+        @Override
         public String getName() {
             return "transaction-begin";
         }

Modified: ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionCommit.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionCommit.java?rev=1349976&r1=1349975&r2=1349976&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionCommit.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionCommit.java Wed Jun 13 18:01:08 2012
@@ -19,65 +19,82 @@
 package org.ofbiz.minilang.method.entityops;
 
 import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.collections.FlexibleMapAccessor;
+import org.ofbiz.base.util.string.FlexibleStringExpander;
 import org.ofbiz.entity.transaction.GenericTransactionException;
 import org.ofbiz.entity.transaction.TransactionUtil;
 import org.ofbiz.minilang.MiniLangException;
+import org.ofbiz.minilang.MiniLangValidate;
 import org.ofbiz.minilang.SimpleMethod;
-import org.ofbiz.minilang.method.ContextAccessor;
 import org.ofbiz.minilang.method.MethodContext;
 import org.ofbiz.minilang.method.MethodOperation;
 import org.w3c.dom.Element;
 
 /**
- * Commits a transaction if beganTransaction is true, otherwise does nothing.
+ * Implements the &lt;transaction-commit&gt; element.
  */
-public class TransactionCommit extends MethodOperation {
+public final class TransactionCommit extends MethodOperation {
 
     public static final String module = TransactionCommit.class.getName();
 
-    ContextAccessor<Boolean> beganTransactionAcsr;
+    private final FlexibleMapAccessor<Boolean> beganTransactionFma;
 
     public TransactionCommit(Element element, SimpleMethod simpleMethod) throws MiniLangException {
         super(element, simpleMethod);
-        beganTransactionAcsr = new ContextAccessor<Boolean>(element.getAttribute("began-transaction-name"), "beganTransaction");
+        if (MiniLangValidate.validationOn()) {
+            MiniLangValidate.attributeNames(simpleMethod, element, "began-transaction-name");
+            MiniLangValidate.expressionAttributes(simpleMethod, element, "began-transaction-name");
+            MiniLangValidate.noChildElements(simpleMethod, element);
+        }
+        beganTransactionFma = FlexibleMapAccessor.getInstance(MiniLangValidate.checkAttribute(element.getAttribute("began-transaction-name"), "beganTransaction"));
     }
 
     @Override
     public boolean exec(MethodContext methodContext) throws MiniLangException {
         boolean beganTransaction = false;
-        Boolean beganTransactionBoolean = beganTransactionAcsr.get(methodContext);
+        Boolean beganTransactionBoolean = beganTransactionFma.get(methodContext.getEnvMap());
         if (beganTransactionBoolean != null) {
             beganTransaction = beganTransactionBoolean.booleanValue();
         }
         try {
             TransactionUtil.commit(beganTransaction);
         } catch (GenericTransactionException e) {
-            Debug.logError(e, "Could not commit transaction in simple-method, returning error.", module);
-            String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process [error committing a transaction: " + e.getMessage() + "]";
-            methodContext.setErrorReturn(errMsg, simpleMethod);
+            String errMsg = "Exception thrown while committing transaction: " + e.getMessage();
+            Debug.logWarning(e, errMsg, module);
+            simpleMethod.addErrorMessage(methodContext, errMsg);
             return false;
         }
-        beganTransactionAcsr.remove(methodContext);
+        beganTransactionFma.remove(methodContext.getEnvMap());
         return true;
     }
 
     @Override
     public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+        return FlexibleStringExpander.expandString(toString(), methodContext.getEnvMap());
     }
 
     @Override
     public String rawString() {
-        // TODO: something more than the empty tag
-        return "<transaction-commit/>";
+        return toString();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder("<transaction-commit ");
+        sb.append("began-transaction-name=\"").append(this.beganTransactionFma).append("\" />");
+        return sb.toString();
     }
 
+    /**
+     * A factory for the &lt;transaction-commit&gt; element.
+     */
     public static final class TransactionCommitFactory implements Factory<TransactionCommit> {
+        @Override
         public TransactionCommit createMethodOperation(Element element, SimpleMethod simpleMethod) throws MiniLangException {
             return new TransactionCommit(element, simpleMethod);
         }
 
+        @Override
         public String getName() {
             return "transaction-commit";
         }

Modified: ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionRollback.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionRollback.java?rev=1349976&r1=1349975&r2=1349976&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionRollback.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionRollback.java Wed Jun 13 18:01:08 2012
@@ -19,65 +19,82 @@
 package org.ofbiz.minilang.method.entityops;
 
 import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.collections.FlexibleMapAccessor;
+import org.ofbiz.base.util.string.FlexibleStringExpander;
 import org.ofbiz.entity.transaction.GenericTransactionException;
 import org.ofbiz.entity.transaction.TransactionUtil;
 import org.ofbiz.minilang.MiniLangException;
+import org.ofbiz.minilang.MiniLangValidate;
 import org.ofbiz.minilang.SimpleMethod;
-import org.ofbiz.minilang.method.ContextAccessor;
 import org.ofbiz.minilang.method.MethodContext;
 import org.ofbiz.minilang.method.MethodOperation;
 import org.w3c.dom.Element;
 
 /**
- * Rolls back a transaction if beganTransaction is true, otherwise tries to do a setRollbackOnly.
+ * Implements the &lt;transaction-rollback&gt; element.
  */
-public class TransactionRollback extends MethodOperation {
+public final class TransactionRollback extends MethodOperation {
 
     public static final String module = TransactionRollback.class.getName();
 
-    ContextAccessor<Boolean> beganTransactionAcsr;
+    private final FlexibleMapAccessor<Boolean> beganTransactionFma;
 
     public TransactionRollback(Element element, SimpleMethod simpleMethod) throws MiniLangException {
         super(element, simpleMethod);
-        beganTransactionAcsr = new ContextAccessor<Boolean>(element.getAttribute("began-transaction-name"), "beganTransaction");
+        if (MiniLangValidate.validationOn()) {
+            MiniLangValidate.attributeNames(simpleMethod, element, "began-transaction-name");
+            MiniLangValidate.expressionAttributes(simpleMethod, element, "began-transaction-name");
+            MiniLangValidate.noChildElements(simpleMethod, element);
+        }
+        beganTransactionFma = FlexibleMapAccessor.getInstance(MiniLangValidate.checkAttribute(element.getAttribute("began-transaction-name"), "beganTransaction"));
     }
 
     @Override
     public boolean exec(MethodContext methodContext) throws MiniLangException {
         boolean beganTransaction = false;
-        Boolean beganTransactionBoolean = beganTransactionAcsr.get(methodContext);
+        Boolean beganTransactionBoolean = beganTransactionFma.get(methodContext.getEnvMap());
         if (beganTransactionBoolean != null) {
             beganTransaction = beganTransactionBoolean.booleanValue();
         }
         try {
             TransactionUtil.rollback(beganTransaction, "Explicit rollback in simple-method [" + this.simpleMethod.getShortDescription() + "]", null);
         } catch (GenericTransactionException e) {
-            Debug.logError(e, "Could not rollback transaction in simple-method, returning error.", module);
-            String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process [error rolling back a transaction: " + e.getMessage() + "]";
-            methodContext.setErrorReturn(errMsg, simpleMethod);
+            String errMsg = "Exception thrown while rolling back transaction: " + e.getMessage();
+            Debug.logWarning(e, errMsg, module);
+            simpleMethod.addErrorMessage(methodContext, errMsg);
             return false;
         }
-        beganTransactionAcsr.remove(methodContext);
+        beganTransactionFma.remove(methodContext.getEnvMap());
         return true;
     }
 
     @Override
     public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+        return FlexibleStringExpander.expandString(toString(), methodContext.getEnvMap());
     }
 
     @Override
     public String rawString() {
-        // TODO: something more than the empty tag
-        return "<transaction-rollback/>";
+        return toString();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder("<transaction-rollback ");
+        sb.append("began-transaction-name=\"").append(this.beganTransactionFma).append("\" />");
+        return sb.toString();
     }
 
+    /**
+     * A factory for the &lt;transaction-rollback&gt; element.
+     */
     public static final class TransactionRollbackFactory implements Factory<TransactionRollback> {
+        @Override
         public TransactionRollback createMethodOperation(Element element, SimpleMethod simpleMethod) throws MiniLangException {
             return new TransactionRollback(element, simpleMethod);
         }
 
+        @Override
         public String getName() {
             return "transaction-rollback";
         }

Modified: ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/envops/ClearField.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/envops/ClearField.java?rev=1349976&r1=1349975&r2=1349976&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/envops/ClearField.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/envops/ClearField.java Wed Jun 13 18:01:08 2012
@@ -18,70 +18,66 @@
  *******************************************************************************/
 package org.ofbiz.minilang.method.envops;
 
-import java.util.Map;
-
-import javolution.util.FastMap;
-
-import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.collections.FlexibleMapAccessor;
+import org.ofbiz.base.util.string.FlexibleStringExpander;
 import org.ofbiz.minilang.MiniLangException;
+import org.ofbiz.minilang.MiniLangValidate;
 import org.ofbiz.minilang.SimpleMethod;
-import org.ofbiz.minilang.method.ContextAccessor;
 import org.ofbiz.minilang.method.MethodContext;
 import org.ofbiz.minilang.method.MethodOperation;
 import org.w3c.dom.Element;
 
 /**
- * Clears the specified field
+ * Implements the &lt;clear-field&gt; element.
  */
-public class ClearField extends MethodOperation {
+public final class ClearField extends MethodOperation {
 
-    public static final String module = ClearField.class.getName();
-
-    ContextAccessor<Object> fieldAcsr;
-    ContextAccessor<Map<String, Object>> mapAcsr;
+    private final FlexibleMapAccessor<Object> fieldFma;
 
     public ClearField(Element element, SimpleMethod simpleMethod) throws MiniLangException {
         super(element, simpleMethod);
-        // the schema for this element now just has the "field" attribute, though the old "field-name" and "map-name" pair is still supported
-        fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field"), element.getAttribute("field-name"));
-        mapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("map-name"));
+        if (MiniLangValidate.validationOn()) {
+            MiniLangValidate.attributeNames(simpleMethod, element, "field");
+            MiniLangValidate.requiredAttributes(simpleMethod, element, "field");
+            MiniLangValidate.expressionAttributes(simpleMethod, element, "field");
+            MiniLangValidate.noChildElements(simpleMethod, element);
+        }
+        this.fieldFma = FlexibleMapAccessor.getInstance(element.getAttribute("field"));
     }
 
     @Override
     public boolean exec(MethodContext methodContext) throws MiniLangException {
-        if (!mapAcsr.isEmpty()) {
-            Map<String, Object> toMap = mapAcsr.get(methodContext);
-            if (toMap == null) {
-                // it seems silly to create a new map, but necessary since whenever
-                // an env field like a Map or List is referenced it should be created, even if empty
-                if (Debug.verboseOn())
-                    Debug.logVerbose("Map not found with name " + mapAcsr + ", creating new map", module);
-                toMap = FastMap.newInstance();
-                mapAcsr.put(methodContext, toMap);
-            }
-            fieldAcsr.put(toMap, null, methodContext);
-        } else {
-            fieldAcsr.put(methodContext, null);
-        }
+        fieldFma.put(methodContext.getEnvMap(), null);
         return true;
     }
 
     @Override
     public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+        return FlexibleStringExpander.expandString(toString(), methodContext.getEnvMap());
     }
 
     @Override
     public String rawString() {
-        return "<clear-field field-name=\"" + this.fieldAcsr + "\" map-name=\"" + this.mapAcsr + "\"/>";
+        return toString();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder("<set ");
+        sb.append("field=\"").append(this.fieldFma).append("\" />");
+        return sb.toString();
     }
 
+    /**
+     * A factory for the &lt;clear-field&gt; element.
+     */
     public static final class ClearFieldFactory implements Factory<ClearField> {
+        @Override
         public ClearField createMethodOperation(Element element, SimpleMethod simpleMethod) throws MiniLangException {
             return new ClearField(element, simpleMethod);
         }
 
+        @Override
         public String getName() {
             return "clear-field";
         }

Modified: ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/envops/CreateObject.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/envops/CreateObject.java?rev=1349976&r1=1349975&r2=1349976&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/envops/CreateObject.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/envops/CreateObject.java Wed Jun 13 18:01:08 2012
@@ -19,19 +19,19 @@
 package org.ofbiz.minilang.method.envops;
 
 import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
-import java.util.Map;
-
-import javolution.util.FastList;
-import javolution.util.FastMap;
 
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.ObjectType;
 import org.ofbiz.base.util.UtilXml;
+import org.ofbiz.base.util.collections.FlexibleMapAccessor;
+import org.ofbiz.base.util.string.FlexibleStringExpander;
 import org.ofbiz.minilang.MiniLangException;
+import org.ofbiz.minilang.MiniLangRuntimeException;
+import org.ofbiz.minilang.MiniLangValidate;
 import org.ofbiz.minilang.SimpleMethod;
-import org.ofbiz.minilang.method.ContextAccessor;
 import org.ofbiz.minilang.method.FieldObject;
 import org.ofbiz.minilang.method.MethodContext;
 import org.ofbiz.minilang.method.MethodObject;
@@ -40,57 +40,54 @@ import org.ofbiz.minilang.method.StringO
 import org.w3c.dom.Element;
 
 /**
- * Creates a Java object using the given fields as parameters
+ * Implements the &lt;create-object&gt; element.
  */
-public class CreateObject extends MethodOperation {
+public final class CreateObject extends MethodOperation {
 
     public static final String module = CreateObject.class.getName();
 
-    String className;
-    ContextAccessor<Object> fieldAcsr;
-    ContextAccessor<Map<String, Object>> mapAcsr;
-    /** A list of MethodObject objects to use as the method call parameters */
-    List<MethodObject<?>> parameters;
+    private final String className;
+    private final Class<?> targetClass;
+    private final FlexibleMapAccessor<Object> fieldFma;
+    private final List<MethodObject<?>> parameters;
 
     public CreateObject(Element element, SimpleMethod simpleMethod) throws MiniLangException {
         super(element, simpleMethod);
+        if (MiniLangValidate.validationOn()) {
+            MiniLangValidate.handleError("<create-object> element is deprecated (use <script>)", simpleMethod, element);
+            MiniLangValidate.attributeNames(simpleMethod, element, "class-name", "field");
+            MiniLangValidate.expressionAttributes(simpleMethod, element, "field");
+            MiniLangValidate.requiredAttributes(simpleMethod, element, "class-name", "field");
+            MiniLangValidate.childElements(simpleMethod, element, "string", "field");
+        }
         className = element.getAttribute("class-name");
-        // the schema for this element now just has the "field" attribute, though the old
-        // "field-name" and "map-name" pair is still supported
-        fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field"), element.getAttribute("field-name"));
-        mapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("map-name"));
+        Class<?> targetClass = null;
+        try {
+            targetClass = ObjectType.loadClass(this.className);
+        } catch (ClassNotFoundException e) {
+            MiniLangValidate.handleError("Class not found with name " + this.className, simpleMethod, element);
+        }
+        this.targetClass = targetClass;
+        fieldFma = FlexibleMapAccessor.getInstance(element.getAttribute("field"));
         List<? extends Element> parameterElements = UtilXml.childElementList(element);
         if (parameterElements.size() > 0) {
-            parameters = FastList.newInstance();
+            ArrayList<MethodObject<?>> parameterList = new ArrayList<MethodObject<?>>(parameterElements.size());
             for (Element parameterElement : parameterElements) {
-                MethodObject<?> methodObject = null;
                 if ("string".equals(parameterElement.getNodeName())) {
-                    methodObject = new StringObject(parameterElement, simpleMethod);
+                    parameterList.add(new StringObject(parameterElement, simpleMethod));
                 } else if ("field".equals(parameterElement.getNodeName())) {
-                    methodObject = new FieldObject<Object>(parameterElement, simpleMethod);
-                } else {
-                    // whoops, invalid tag here, print warning
-                    Debug.logWarning("Found an unsupported tag under the call-object-method tag: " + parameterElement.getNodeName() + "; ignoring", module);
-                }
-                if (methodObject != null) {
-                    parameters.add(methodObject);
+                    parameterList.add(new FieldObject<Object>(parameterElement, simpleMethod));
                 }
             }
+            parameterList.trimToSize();
+            this.parameters = Collections.unmodifiableList(parameterList);
+        } else {
+            this.parameters = null;
         }
     }
 
     @Override
     public boolean exec(MethodContext methodContext) throws MiniLangException {
-        String className = methodContext.expandString(this.className);
-        Class<?> methodClass = null;
-        try {
-            methodClass = ObjectType.loadClass(className, methodContext.getLoader());
-        } catch (ClassNotFoundException e) {
-            Debug.logError(e, "Class to create not found with name " + className + " in create-object operation", module);
-            String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process [Class to create not found with name " + className + ": " + e.toString() + "]";
-            methodContext.setErrorReturn(errMsg, simpleMethod);
-            return false;
-        }
         Object[] args = null;
         Class<?>[] parameterTypes = null;
         if (parameters != null) {
@@ -113,75 +110,42 @@ public class CreateObject extends Method
             }
         }
         try {
-            Constructor<?> constructor = methodClass.getConstructor(parameterTypes);
-            try {
-                Object newObject = constructor.newInstance(args);
-                // if fieldAcsr is empty, ignore return value
-                if (!fieldAcsr.isEmpty()) {
-                    if (!mapAcsr.isEmpty()) {
-                        Map<String, Object> retMap = mapAcsr.get(methodContext);
-                        if (retMap == null) {
-                            retMap = FastMap.newInstance();
-                            mapAcsr.put(methodContext, retMap);
-                        }
-                        fieldAcsr.put(retMap, newObject, methodContext);
-                    } else {
-                        // no map name, use the env
-                        fieldAcsr.put(methodContext, newObject);
-                    }
-                }
-            } catch (InstantiationException e) {
-                Debug.logError(e, "Could not instantiate object in create-object operation", module);
-                String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process [Could not instantiate object: " + e.toString() + "]";
-                methodContext.setErrorReturn(errMsg, simpleMethod);
-                return false;
-            } catch (IllegalAccessException e) {
-                Debug.logError(e, "Illegal access constructing object in create-object operation", module);
-                String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process [Illegal access constructing object: " + e.toString() + "]";
-                methodContext.setErrorReturn(errMsg, simpleMethod);
-                return false;
-            } catch (IllegalArgumentException e) {
-                Debug.logError(e, "Illegal argument calling method in create-object operation", module);
-                String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process [Illegal argument calling constructor: " + e.toString() + "]";
-                methodContext.setErrorReturn(errMsg, simpleMethod);
-                return false;
-            } catch (InvocationTargetException e) {
-                Debug.logError(e.getTargetException(), "Constructor in create-object operation threw an exception", module);
-                String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process [Constructor in create-object threw an exception: " + e.getTargetException() + "]";
-                methodContext.setErrorReturn(errMsg, simpleMethod);
-                return false;
-            }
-        } catch (NoSuchMethodException e) {
-            Debug.logError(e, "Could not find constructor to execute in simple-method create-object operation", module);
-            String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process [Could not find constructor to execute: " + e.toString() + "]";
-            methodContext.setErrorReturn(errMsg, simpleMethod);
-            return false;
-        } catch (SecurityException e) {
-            Debug.logError(e, "Security exception finding constructor to execute in simple-method create-object operation", module);
-            String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process [Security exception finding constructor to execute: " + e.toString() + "]";
-            methodContext.setErrorReturn(errMsg, simpleMethod);
-            return false;
+            Constructor<?> constructor = targetClass.getConstructor(parameterTypes);
+            fieldFma.put(methodContext.getEnvMap(),constructor.newInstance(args));
+        } catch (Exception e) {
+            throw new MiniLangRuntimeException(e, this);
         }
         return true;
     }
 
     @Override
     public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+        return FlexibleStringExpander.expandString(toString(), methodContext.getEnvMap());
     }
 
     @Override
     public String rawString() {
-        // TODO: something more than the empty tag
-        return "<create-object/>";
+        return toString();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder("<create-object ");
+        sb.append("class-name=\"").append(this.className).append("\" ");
+        sb.append("field=\"").append(this.fieldFma).append("\" />");
+        return sb.toString();
     }
 
+    /**
+     * A factory for the &lt;create-object&gt; element.
+     */
     public static final class CreateObjectFactory implements Factory<CreateObject> {
+        @Override
         public CreateObject createMethodOperation(Element element, SimpleMethod simpleMethod) throws MiniLangException {
             return new CreateObject(element, simpleMethod);
         }
 
+        @Override
         public String getName() {
             return "create-object";
         }

Modified: ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/envops/FieldToList.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/envops/FieldToList.java?rev=1349976&r1=1349975&r2=1349976&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/envops/FieldToList.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/envops/FieldToList.java Wed Jun 13 18:01:08 2012
@@ -19,82 +19,81 @@
 package org.ofbiz.minilang.method.envops;
 
 import java.util.List;
-import java.util.Map;
 
 import javolution.util.FastList;
 
-import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.collections.FlexibleMapAccessor;
+import org.ofbiz.base.util.string.FlexibleStringExpander;
 import org.ofbiz.minilang.MiniLangException;
+import org.ofbiz.minilang.MiniLangValidate;
 import org.ofbiz.minilang.SimpleMethod;
-import org.ofbiz.minilang.method.ContextAccessor;
 import org.ofbiz.minilang.method.MethodContext;
 import org.ofbiz.minilang.method.MethodOperation;
 import org.w3c.dom.Element;
 
 /**
- * Copies an environment field to a list
+ * Implements the &lt;field-to-list&gt; element.
  */
-public class FieldToList extends MethodOperation {
+public final class FieldToList extends MethodOperation {
 
-    public static final String module = FieldToList.class.getName();
-
-    ContextAccessor<Object> fieldAcsr;
-    ContextAccessor<List<Object>> listAcsr;
-    ContextAccessor<Map<String, ? extends Object>> mapAcsr;
+    private final FlexibleMapAccessor<Object> fieldFma;
+    private final FlexibleMapAccessor<List<Object>> listFma;
 
     public FieldToList(Element element, SimpleMethod simpleMethod) throws MiniLangException {
         super(element, simpleMethod);
-        // the schema for this element now just has the "field" attribute, though the old "field-name" and "map-name" pair is still supported
-        mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name"));
-        fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field"), element.getAttribute("field-name"));
-        listAcsr = new ContextAccessor<List<Object>>(element.getAttribute("list"), element.getAttribute("list-name"));
+        if (MiniLangValidate.validationOn()) {
+            MiniLangValidate.handleError("<field-to-list> element is deprecated (use <set>)", simpleMethod, element);
+            MiniLangValidate.attributeNames(simpleMethod, element, "field", "list");
+            MiniLangValidate.requiredAttributes(simpleMethod, element, "field", "list");
+            MiniLangValidate.expressionAttributes(simpleMethod, element, "field", "list");
+            MiniLangValidate.noChildElements(simpleMethod, element);
+        }
+        fieldFma = FlexibleMapAccessor.getInstance(element.getAttribute("field"));
+        listFma = FlexibleMapAccessor.getInstance(element.getAttribute("list"));
     }
 
     @Override
     public boolean exec(MethodContext methodContext) throws MiniLangException {
-        Object fieldVal = null;
-        if (!mapAcsr.isEmpty()) {
-            Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext);
-            if (fromMap == null) {
-                Debug.logWarning("Map not found with name " + mapAcsr + ", Not copying to list", module);
-                return true;
+        Object fieldVal = fieldFma.get(methodContext.getEnvMap());
+        if (fieldVal != null) {
+            List<Object> toList = listFma.get(methodContext.getEnvMap());
+            if (toList == null) {
+                toList = FastList.newInstance();
+                listFma.put(methodContext.getEnvMap(), toList);
             }
-            fieldVal = fieldAcsr.get(fromMap, methodContext);
-        } else {
-            // no map name, try the env
-            fieldVal = fieldAcsr.get(methodContext);
-        }
-        if (fieldVal == null) {
-            Debug.logWarning("Field value not found with name " + fieldAcsr + " in Map with name " + mapAcsr + ", Not copying to list", module);
-            return true;
-        }
-        List<Object> toList = listAcsr.get(methodContext);
-        if (toList == null) {
-            if (Debug.verboseOn())
-                Debug.logVerbose("List not found with name " + listAcsr + ", creating new list", module);
-            toList = FastList.newInstance();
-            listAcsr.put(methodContext, toList);
+            toList.add(fieldVal);
         }
-        toList.add(fieldVal);
         return true;
     }
 
     @Override
     public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+        return FlexibleStringExpander.expandString(toString(), methodContext.getEnvMap());
     }
 
     @Override
     public String rawString() {
-        return "<field-to-list list-name=\"" + this.listAcsr + "\" field-name=\"" + this.fieldAcsr + "\" map-name=\"" + this.mapAcsr + "\"/>";
+        return toString();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder("<field-to-list ");
+        sb.append("field=\"").append(this.fieldFma).append("\" ");
+        sb.append("list=\"").append(this.listFma).append("\" />");
+        return sb.toString();
     }
 
+    /**
+     * A factory for the &lt;field-to-list&gt; element.
+     */
     public static final class FieldToListFactory implements Factory<FieldToList> {
+        @Override
         public FieldToList createMethodOperation(Element element, SimpleMethod simpleMethod) throws MiniLangException {
             return new FieldToList(element, simpleMethod);
         }
 
+        @Override
         public String getName() {
             return "field-to-list";
         }

Modified: ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/envops/FirstFromList.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/envops/FirstFromList.java?rev=1349976&r1=1349975&r2=1349976&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/envops/FirstFromList.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/envops/FirstFromList.java Wed Jun 13 18:01:08 2012
@@ -20,62 +20,76 @@ package org.ofbiz.minilang.method.envops
 
 import java.util.List;
 
-import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.base.util.collections.FlexibleMapAccessor;
+import org.ofbiz.base.util.string.FlexibleStringExpander;
 import org.ofbiz.minilang.MiniLangException;
+import org.ofbiz.minilang.MiniLangValidate;
 import org.ofbiz.minilang.SimpleMethod;
-import org.ofbiz.minilang.method.ContextAccessor;
 import org.ofbiz.minilang.method.MethodContext;
 import org.ofbiz.minilang.method.MethodOperation;
 import org.w3c.dom.Element;
 
 /**
- * Get the first entry from the list
+ * Implements the &lt;first-from-list&gt; element.
  */
-public class FirstFromList extends MethodOperation {
+public final class FirstFromList extends MethodOperation {
 
-    public static final String module = FirstFromList.class.getName();
-
-    ContextAccessor<Object> entryAcsr;
-    ContextAccessor<List<? extends Object>> listAcsr;
+    private final FlexibleMapAccessor<Object> entryFma;
+    private final FlexibleMapAccessor<List<Object>> listFma;
 
     public FirstFromList(Element element, SimpleMethod simpleMethod) throws MiniLangException {
         super(element, simpleMethod);
-        this.entryAcsr = new ContextAccessor<Object>(element.getAttribute("entry"), element.getAttribute("entry-name"));
-        this.listAcsr = new ContextAccessor<List<? extends Object>>(element.getAttribute("list"), element.getAttribute("list-name"));
+        if (MiniLangValidate.validationOn()) {
+            MiniLangValidate.handleError("<first-from-list> element is deprecated (use <set>)", simpleMethod, element);
+            MiniLangValidate.attributeNames(simpleMethod, element, "entry", "list");
+            MiniLangValidate.requiredAttributes(simpleMethod, element, "entry", "list");
+            MiniLangValidate.expressionAttributes(simpleMethod, element, "entry", "list");
+            MiniLangValidate.noChildElements(simpleMethod, element);
+        }
+        entryFma = FlexibleMapAccessor.getInstance(element.getAttribute("entry"));
+        listFma = FlexibleMapAccessor.getInstance(element.getAttribute("list"));
     }
 
     @Override
     public boolean exec(MethodContext methodContext) throws MiniLangException {
-        if (listAcsr.isEmpty()) {
-            Debug.logWarning("No list-name specified in iterate tag, doing nothing", module);
-            return true;
-        }
-        List<? extends Object> theList = listAcsr.get(methodContext);
+        List<? extends Object> theList = listFma.get(methodContext.getEnvMap());
         if (UtilValidate.isEmpty(theList)) {
-            entryAcsr.put(methodContext, null);
-            return true;
+            entryFma.put(methodContext.getEnvMap(), null);
+        } else {
+            entryFma.put(methodContext.getEnvMap(), theList.get(0));
         }
-        entryAcsr.put(methodContext, theList.get(0));
         return true;
     }
 
     @Override
     public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+        return FlexibleStringExpander.expandString(toString(), methodContext.getEnvMap());
     }
 
     @Override
     public String rawString() {
-        return "<first-from-list list-name=\"" + this.listAcsr + "\" entry-name=\"" + this.entryAcsr + "\"/>";
+        return toString();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder("<first-from-list ");
+        sb.append("entry=\"").append(this.entryFma).append("\" ");
+        sb.append("list=\"").append(this.listFma).append("\" />");
+        return sb.toString();
     }
 
+    /**
+     * A factory for the &lt;first-from-list&gt; element.
+     */
     public static final class FirstFromListFactory implements Factory<FirstFromList> {
+        @Override
         public FirstFromList createMethodOperation(Element element, SimpleMethod simpleMethod) throws MiniLangException {
             return new FirstFromList(element, simpleMethod);
         }
 
+        @Override
         public String getName() {
             return "first-from-list";
         }

Modified: ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/envops/ListToList.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/envops/ListToList.java?rev=1349976&r1=1349975&r2=1349976&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/envops/ListToList.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/envops/ListToList.java Wed Jun 13 18:01:08 2012
@@ -22,66 +22,77 @@ import java.util.List;
 
 import javolution.util.FastList;
 
-import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.collections.FlexibleMapAccessor;
+import org.ofbiz.base.util.string.FlexibleStringExpander;
 import org.ofbiz.minilang.MiniLangException;
+import org.ofbiz.minilang.MiniLangValidate;
 import org.ofbiz.minilang.SimpleMethod;
-import org.ofbiz.minilang.method.ContextAccessor;
 import org.ofbiz.minilang.method.MethodContext;
 import org.ofbiz.minilang.method.MethodOperation;
 import org.w3c.dom.Element;
 
 /**
- * Copies an environment field to a list
+ * Implements the &lt;list-to-list&gt; element.
  */
-public class ListToList extends MethodOperation {
+public final class ListToList extends MethodOperation {
 
-    public static final String module = ListToList.class.getName();
-
-    ContextAccessor<List<Object>> listAcsr;
-    ContextAccessor<List<Object>> toListAcsr;
+    private final FlexibleMapAccessor<List<Object>> listFma;
+    private final FlexibleMapAccessor<List<Object>> toListFma;
 
     public ListToList(Element element, SimpleMethod simpleMethod) throws MiniLangException {
         super(element, simpleMethod);
-        listAcsr = new ContextAccessor<List<Object>>(element.getAttribute("list"), element.getAttribute("list-name"));
-        toListAcsr = new ContextAccessor<List<Object>>(element.getAttribute("to-list"), element.getAttribute("to-list-name"));
+        if (MiniLangValidate.validationOn()) {
+            MiniLangValidate.attributeNames(simpleMethod, element, "to-list", "list");
+            MiniLangValidate.requiredAttributes(simpleMethod, element, "to-list", "list");
+            MiniLangValidate.expressionAttributes(simpleMethod, element, "to-list", "list");
+            MiniLangValidate.noChildElements(simpleMethod, element);
+        }
+        toListFma = FlexibleMapAccessor.getInstance(element.getAttribute("to-list"));
+        listFma = FlexibleMapAccessor.getInstance(element.getAttribute("list"));
     }
 
     @Override
     public boolean exec(MethodContext methodContext) throws MiniLangException {
-        List<Object> fromList = listAcsr.get(methodContext);
-        List<Object> toList = toListAcsr.get(methodContext);
-        if (fromList == null) {
-            if (Debug.infoOn())
-                Debug.logInfo("List not found with name " + listAcsr + ", not copying list", module);
-            return true;
-        }
-        if (toList == null) {
-            if (Debug.verboseOn())
-                Debug.logVerbose("List not found with name " + toListAcsr + ", creating new list", module);
-            toList = FastList.newInstance();
-            toListAcsr.put(methodContext, toList);
+        List<Object> fromList = listFma.get(methodContext.getEnvMap());
+        if (fromList != null) {
+            List<Object> toList = toListFma.get(methodContext.getEnvMap());
+            if (toList == null) {
+                toList = FastList.newInstance();
+                toListFma.put(methodContext.getEnvMap(), toList);
+            }
+            toList.addAll(fromList);
         }
-        toList.addAll(fromList);
         return true;
     }
 
     @Override
     public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+        return FlexibleStringExpander.expandString(toString(), methodContext.getEnvMap());
     }
 
     @Override
     public String rawString() {
-        // TODO: something more than the empty tag
-        return "<list-to-list/>";
+        return toString();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder("<list-to-list ");
+        sb.append("to-list=\"").append(this.toListFma).append("\" ");
+        sb.append("list=\"").append(this.listFma).append("\" />");
+        return sb.toString();
     }
 
+    /**
+     * A factory for the &lt;list-to-list&gt; element.
+     */
     public static final class ListToListFactory implements Factory<ListToList> {
+        @Override
         public ListToList createMethodOperation(Element element, SimpleMethod simpleMethod) throws MiniLangException {
             return new ListToList(element, simpleMethod);
         }
 
+        @Override
         public String getName() {
             return "list-to-list";
         }

Modified: ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/envops/MapToMap.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/envops/MapToMap.java?rev=1349976&r1=1349975&r2=1349976&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/envops/MapToMap.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/minilang/src/org/ofbiz/minilang/method/envops/MapToMap.java Wed Jun 13 18:01:08 2012
@@ -22,74 +22,84 @@ import java.util.Map;
 
 import javolution.util.FastMap;
 
-import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.collections.FlexibleMapAccessor;
+import org.ofbiz.base.util.string.FlexibleStringExpander;
 import org.ofbiz.minilang.MiniLangException;
+import org.ofbiz.minilang.MiniLangValidate;
 import org.ofbiz.minilang.SimpleMethod;
-import org.ofbiz.minilang.method.ContextAccessor;
 import org.ofbiz.minilang.method.MethodContext;
 import org.ofbiz.minilang.method.MethodOperation;
 import org.w3c.dom.Element;
 
 /**
- * Copies a map field to a map field
+ * Implements the &lt;map-to-map&gt; element.
  */
-public class MapToMap extends MethodOperation {
+public final class MapToMap extends MethodOperation {
 
-    public static final String module = MapToMap.class.getName();
-
-    ContextAccessor<Map<String, Object>> mapAcsr;
-    ContextAccessor<Map<String, Object>> toMapAcsr;
+    private final FlexibleMapAccessor<Map<String, Object>> mapFma;
+    private final FlexibleMapAccessor<Map<String, Object>> toMapFma;
 
     public MapToMap(Element element, SimpleMethod simpleMethod) throws MiniLangException {
         super(element, simpleMethod);
-        mapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("map"), element.getAttribute("map-name"));
-        toMapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("to-map"), element.getAttribute("to-map-name"));
+        if (MiniLangValidate.validationOn()) {
+            MiniLangValidate.attributeNames(simpleMethod, element, "to-map", "map");
+            MiniLangValidate.requiredAttributes(simpleMethod, element, "map");
+            MiniLangValidate.expressionAttributes(simpleMethod, element, "to-map", "map");
+            MiniLangValidate.noChildElements(simpleMethod, element);
+        }
+        mapFma = FlexibleMapAccessor.getInstance(element.getAttribute("map"));
+        toMapFma = FlexibleMapAccessor.getInstance(element.getAttribute("to-map"));
     }
 
     @Override
     public boolean exec(MethodContext methodContext) throws MiniLangException {
-        Map<String, Object> fromMap = null;
-        if (!mapAcsr.isEmpty()) {
-            fromMap = mapAcsr.get(methodContext);
-            if (fromMap == null) {
-                if (Debug.infoOn())
-                    Debug.logInfo("Map not found with name " + mapAcsr + ", not copying from this map", module);
-                fromMap = FastMap.newInstance();
-                mapAcsr.put(methodContext, fromMap);
-            }
-        }
-        if (!toMapAcsr.isEmpty()) {
-            Map<String, Object> toMap = toMapAcsr.get(methodContext);
-            if (toMap == null) {
-                if (Debug.verboseOn())
-                    Debug.logVerbose("Map not found with name " + toMapAcsr + ", creating new map", module);
-                toMap = FastMap.newInstance();
-                toMapAcsr.put(methodContext, toMap);
+        Map<String, Object> fromMap = mapFma.get(methodContext.getEnvMap());
+        if (fromMap != null) {
+            if (!toMapFma.isEmpty()) {
+                Map<String, Object> toMap = toMapFma.get(methodContext.getEnvMap());
+                if (toMap == null) {
+                    toMap = FastMap.newInstance();
+                    toMapFma.put(methodContext.getEnvMap(), toMap);
+                    toMap.putAll(fromMap);
+                }
+            } else {
+                methodContext.putAllEnv(fromMap);
             }
-            toMap.putAll(fromMap);
-        } else {
-            methodContext.putAllEnv(fromMap);
         }
         return true;
     }
 
     @Override
     public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+        return FlexibleStringExpander.expandString(toString(), methodContext.getEnvMap());
     }
 
     @Override
     public String rawString() {
-        // TODO: something more than the empty tag
-        return "<map-to-map/>";
+        return toString();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder("<map-to-map ");
+        sb.append("map=\"").append(this.mapFma).append("\" ");
+        if (!toMapFma.isEmpty()) {
+            sb.append("to-map=\"").append(this.toMapFma).append("\" ");
+        }
+        sb.append("/>");
+        return sb.toString();
     }
 
+    /**
+     * A factory for the &lt;map-to-map&gt; element.
+     */
     public static final class MapToMapFactory implements Factory<MapToMap> {
+        @Override
         public MapToMap createMethodOperation(Element element, SimpleMethod simpleMethod) throws MiniLangException {
             return new MapToMap(element, simpleMethod);
         }
 
+        @Override
         public String getName() {
             return "map-to-map";
         }