You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2012/04/19 17:09:08 UTC

svn commit: r1327981 [5/9] - in /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang: ./ method/ method/callops/ method/conditional/ method/entityops/ method/envops/ method/eventops/ method/ifops/ method/otherops/ method/serviceops/ operation/

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/CompareFieldCondition.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/CompareFieldCondition.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/CompareFieldCondition.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/CompareFieldCondition.java Thu Apr 19 15:09:03 2012
@@ -18,47 +18,37 @@
  *******************************************************************************/
 package org.ofbiz.minilang.method.conditional;
 
-import java.util.*;
+import java.util.List;
+import java.util.Map;
+
 import javolution.util.FastList;
-import org.w3c.dom.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.minilang.*;
-import org.ofbiz.minilang.method.*;
-import org.ofbiz.minilang.operation.*;
+
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.minilang.SimpleMethod;
+import org.ofbiz.minilang.method.ContextAccessor;
+import org.ofbiz.minilang.method.MethodContext;
+import org.ofbiz.minilang.operation.BaseCompare;
+import org.w3c.dom.Element;
 
 /**
  * Implements compare to a field condition.
  */
 public class CompareFieldCondition implements Conditional {
-    public static final class CompareFieldConditionFactory extends ConditionalFactory<CompareFieldCondition> {
-        @Override
-        public CompareFieldCondition createCondition(Element element, SimpleMethod simpleMethod) {
-            return new CompareFieldCondition(element, simpleMethod);
-        }
-
-        @Override
-        public String getName() {
-            return "if-compare-field";
-        }
-    }
-
 
     public static final String module = CompareFieldCondition.class.getName();
 
-    SimpleMethod simpleMethod;
-
-    ContextAccessor<Map<String, ? extends Object>> mapAcsr;
     ContextAccessor<Object> fieldAcsr;
-    ContextAccessor<Map<String, ? extends Object>> toMapAcsr;
-    ContextAccessor<Object> toFieldAcsr;
-
+    String format;
+    ContextAccessor<Map<String, ? extends Object>> mapAcsr;
     String operator;
+    SimpleMethod simpleMethod;
+    ContextAccessor<Object> toFieldAcsr;
+    ContextAccessor<Map<String, ? extends Object>> toMapAcsr;
     String type;
-    String format;
 
     public CompareFieldCondition(Element element, SimpleMethod simpleMethod) {
         this.simpleMethod = simpleMethod;
-
         // NOTE: this is still supported, but is deprecated
         this.mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name"));
         this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field"));
@@ -66,7 +56,6 @@ public class CompareFieldCondition imple
             // NOTE: this is still supported, but is deprecated
             this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
         }
-
         // NOTE: this is still supported, but is deprecated
         this.toMapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("to-map-name"));
         // set fieldAcsr to their default value of fieldAcsr if empty
@@ -75,11 +64,9 @@ public class CompareFieldCondition imple
             // NOTE: this is still supported, but is deprecated
             this.toFieldAcsr = new ContextAccessor<Object>(element.getAttribute("to-field-name"), element.getAttribute("field-name"));
         }
-
         // do NOT default the to-map-name to the map-name because that
-        //would make it impossible to compare from a map field to an
-        //environment field
-
+        // would make it impossible to compare from a map field to an
+        // environment field
         this.operator = element.getAttribute("operator");
         this.type = element.getAttribute("type");
         this.format = element.getAttribute("format");
@@ -89,23 +76,19 @@ public class CompareFieldCondition imple
         String operator = methodContext.expandString(this.operator);
         String type = methodContext.expandString(this.type);
         String format = methodContext.expandString(this.format);
-
         Object fieldVal1 = getFieldVal1(methodContext);
         Object fieldVal2 = getFieldVal2(methodContext);
-
         List<Object> messages = FastList.newInstance();
         Boolean resultBool = BaseCompare.doRealCompare(fieldVal1, fieldVal2, operator, type, format, messages, null, methodContext.getLoader(), false);
-
         if (messages.size() > 0) {
-            messages.add(0, "Error with comparison in if-compare-field between fields [" + mapAcsr.toString() + "." + fieldAcsr.toString() + "] with value [" + fieldVal1 + "] and [" + toMapAcsr.toString() + "." + toFieldAcsr.toString() + "] with value [" + fieldVal2 + "] with operator [" + operator + "] and type [" + type + "]: ");
+            messages.add(0, "Error with comparison in if-compare-field between fields [" + mapAcsr.toString() + "." + fieldAcsr.toString() + "] with value [" + fieldVal1 + "] and [" + toMapAcsr.toString() + "." + toFieldAcsr.toString() + "] with value [" + fieldVal2 + "] with operator [" + operator
+                    + "] and type [" + type + "]: ");
             if (methodContext.getMethodType() == MethodContext.EVENT) {
                 StringBuilder fullString = new StringBuilder();
-
-                for (Object message: messages) {
+                for (Object message : messages) {
                     fullString.append(message);
                 }
                 Debug.logWarning(fullString.toString(), module);
-
                 methodContext.putEnv(simpleMethod.getEventErrorMessageName(), fullString.toString());
                 methodContext.putEnv(simpleMethod.getEventResponseCodeName(), simpleMethod.getDefaultErrorCode());
             } else if (methodContext.getMethodType() == MethodContext.SERVICE) {
@@ -114,9 +97,8 @@ public class CompareFieldCondition imple
             }
             return false;
         }
-
-        if (resultBool != null) return resultBool.booleanValue();
-
+        if (resultBool != null)
+            return resultBool.booleanValue();
         return false;
     }
 
@@ -125,7 +107,8 @@ public class CompareFieldCondition imple
         if (!mapAcsr.isEmpty()) {
             Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext);
             if (fromMap == null) {
-                if (Debug.infoOn()) Debug.logInfo("Map not found with name " + mapAcsr + ", using null for comparison", module);
+                if (Debug.infoOn())
+                    Debug.logInfo("Map not found with name " + mapAcsr + ", using null for comparison", module);
             } else {
                 fieldVal1 = fieldAcsr.get(fromMap, methodContext);
             }
@@ -141,7 +124,8 @@ public class CompareFieldCondition imple
         if (!toMapAcsr.isEmpty()) {
             Map<String, ? extends Object> toMap = toMapAcsr.get(methodContext);
             if (toMap == null) {
-                if (Debug.infoOn()) Debug.logInfo("To Map not found with name " + toMapAcsr + ", using null for comparison", module);
+                if (Debug.infoOn())
+                    Debug.logInfo("To Map not found with name " + toMapAcsr + ", using null for comparison", module);
             } else {
                 fieldVal2 = toFieldAcsr.get(toMap, methodContext);
             }
@@ -156,10 +140,8 @@ public class CompareFieldCondition imple
         String operator = methodContext.expandString(this.operator);
         String type = methodContext.expandString(this.type);
         String format = methodContext.expandString(this.format);
-
         Object fieldVal1 = getFieldVal1(methodContext);
         Object fieldVal2 = getFieldVal2(methodContext);
-
         messageBuffer.append("[");
         if (!this.mapAcsr.isEmpty()) {
             messageBuffer.append(this.mapAcsr);
@@ -169,9 +151,7 @@ public class CompareFieldCondition imple
         messageBuffer.append("=");
         messageBuffer.append(fieldVal1);
         messageBuffer.append("] ");
-
         messageBuffer.append(operator);
-
         messageBuffer.append(" [");
         if (!this.toMapAcsr.isEmpty()) {
             messageBuffer.append(this.toMapAcsr);
@@ -181,7 +161,6 @@ public class CompareFieldCondition imple
         messageBuffer.append("=");
         messageBuffer.append(fieldVal2);
         messageBuffer.append("] ");
-
         messageBuffer.append(" as ");
         messageBuffer.append(type);
         if (UtilValidate.isNotEmpty(format)) {
@@ -189,4 +168,16 @@ public class CompareFieldCondition imple
             messageBuffer.append(format);
         }
     }
+
+    public static final class CompareFieldConditionFactory extends ConditionalFactory<CompareFieldCondition> {
+        @Override
+        public CompareFieldCondition createCondition(Element element, SimpleMethod simpleMethod) {
+            return new CompareFieldCondition(element, simpleMethod);
+        }
+
+        @Override
+        public String getName() {
+            return "if-compare-field";
+        }
+    }
 }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/Conditional.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/Conditional.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/Conditional.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/Conditional.java Thu Apr 19 15:09:03 2012
@@ -18,13 +18,14 @@
  *******************************************************************************/
 package org.ofbiz.minilang.method.conditional;
 
-import org.ofbiz.minilang.method.*;
-
+import org.ofbiz.minilang.method.MethodContext;
 
 /**
  * Interface for all conditional elements under the master if element or and else-if element.
  */
 public interface Conditional {
+
     public boolean checkCondition(MethodContext methodContext);
+
     public void prettyPrint(StringBuilder messageBuffer, MethodContext methodContext);
 }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ConditionalFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ConditionalFactory.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ConditionalFactory.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ConditionalFactory.java Thu Apr 19 15:09:03 2012
@@ -24,15 +24,19 @@ import java.util.Iterator;
 import java.util.Map;
 import java.util.ServiceLoader;
 
-import org.w3c.dom.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.minilang.*;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilGenerics;
+import org.ofbiz.minilang.SimpleMethod;
+import org.w3c.dom.Element;
 
 /**
  * Creates Conditional objects according to the element that is passed.
  */
 public abstract class ConditionalFactory<C extends Conditional> {
+
+    public static final String module = ConditionalFactory.class.getName();
     private static final Map<String, ConditionalFactory<?>> conditionalFactories;
+
     static {
         Map<String, ConditionalFactory<?>> factories = new HashMap<String, ConditionalFactory<?>>();
         Iterator<ConditionalFactory<?>> it = UtilGenerics.cast(ServiceLoader.load(ConditionalFactory.class, ConditionalFactory.class.getClassLoader()).iterator());
@@ -43,11 +47,8 @@ public abstract class ConditionalFactory
         conditionalFactories = Collections.unmodifiableMap(factories);
     }
 
-    public static final String module = ConditionalFactory.class.getName();
-
     public static Conditional makeConditional(Element element, SimpleMethod simpleMethod) {
         String tagName = element.getTagName();
-
         ConditionalFactory<?> factory = conditionalFactories.get(tagName);
         if (factory != null) {
             return factory.createCondition(element, simpleMethod);
@@ -58,5 +59,6 @@ public abstract class ConditionalFactory
     }
 
     public abstract C createCondition(Element element, SimpleMethod simpleMethod);
+
     public abstract String getName();
 }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ElseIf.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ElseIf.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ElseIf.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ElseIf.java Thu Apr 19 15:09:03 2012
@@ -18,14 +18,15 @@
  *******************************************************************************/
 package org.ofbiz.minilang.method.conditional;
 
-import java.util.*;
+import java.util.List;
 
 import javolution.util.FastList;
 
-import org.w3c.dom.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.minilang.*;
-import org.ofbiz.minilang.method.*;
+import org.ofbiz.base.util.UtilXml;
+import org.ofbiz.minilang.SimpleMethod;
+import org.ofbiz.minilang.method.MethodContext;
+import org.ofbiz.minilang.method.MethodOperation;
+import org.w3c.dom.Element;
 
 /**
  * Implements the else-if alternate execution element.
@@ -35,7 +36,7 @@ public class ElseIf {
     protected Conditional condition;
     protected List<MethodOperation> thenSubOps = FastList.newInstance();
 
-    public ElseIf (Element element, SimpleMethod simpleMethod) {
+    public ElseIf(Element element, SimpleMethod simpleMethod) {
         Element conditionElement = UtilXml.firstChildElement(element, "condition");
         Element conditionChildElement = UtilXml.firstChildElement(conditionElement);
         this.condition = ConditionalFactory.makeConditional(conditionChildElement, simpleMethod);
@@ -44,14 +45,14 @@ public class ElseIf {
         SimpleMethod.readOperations(thenElement, thenSubOps, simpleMethod);
     }
 
-    public List<MethodOperation> getThenSubOps() {
-        return this.thenSubOps;
-    }
-
     public boolean checkCondition(MethodContext methodContext) {
         return condition.checkCondition(methodContext);
     }
 
+    public List<MethodOperation> getThenSubOps() {
+        return this.thenSubOps;
+    }
+
     public boolean runSubOps(MethodContext methodContext) {
         return SimpleMethod.runSubOps(thenSubOps, methodContext);
     }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/EmptyCondition.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/EmptyCondition.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/EmptyCondition.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/EmptyCondition.java Thu Apr 19 15:09:03 2012
@@ -18,39 +18,28 @@
  *******************************************************************************/
 package org.ofbiz.minilang.method.conditional;
 
-import java.util.*;
-import org.w3c.dom.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.minilang.*;
-import org.ofbiz.minilang.method.*;
+import java.util.Collection;
+import java.util.Map;
+
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.minilang.SimpleMethod;
+import org.ofbiz.minilang.method.ContextAccessor;
+import org.ofbiz.minilang.method.MethodContext;
+import org.w3c.dom.Element;
 
 /**
  * Implements compare to a constant condition.
  */
 public class EmptyCondition implements Conditional {
-    public static final class EmptyConditionFactory extends ConditionalFactory<EmptyCondition> {
-        @Override
-        public EmptyCondition createCondition(Element element, SimpleMethod simpleMethod) {
-            return new EmptyCondition(element, simpleMethod);
-        }
-
-        @Override
-        public String getName() {
-            return "if-empty";
-        }
-    }
-
 
     public static final String module = EmptyCondition.class.getName();
 
-    SimpleMethod simpleMethod;
-
-    ContextAccessor<Map<String, ? extends Object>> mapAcsr;
     ContextAccessor<Object> fieldAcsr;
+    ContextAccessor<Map<String, ? extends Object>> mapAcsr;
+    SimpleMethod simpleMethod;
 
     public EmptyCondition(Element element, SimpleMethod simpleMethod) {
         this.simpleMethod = simpleMethod;
-
         // NOTE: this is still supported, but is deprecated
         this.mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name"));
         this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field"));
@@ -64,31 +53,26 @@ public class EmptyCondition implements C
         // only run subOps if element is empty/null
         boolean runSubOps = false;
         Object fieldVal = getFieldVal(methodContext);
-
         if (fieldVal == null) {
             runSubOps = true;
         } else {
             if (fieldVal instanceof String) {
                 String fieldStr = (String) fieldVal;
-
                 if (fieldStr.length() == 0) {
                     runSubOps = true;
                 }
             } else if (fieldVal instanceof Collection<?>) {
                 Collection<?> fieldCol = (Collection<?>) fieldVal;
-
                 if (fieldCol.size() == 0) {
                     runSubOps = true;
                 }
             } else if (fieldVal instanceof Map<?, ?>) {
-                Map<?,?> fieldMap = (Map<?,?>) fieldVal;
-
+                Map<?, ?> fieldMap = (Map<?, ?>) fieldVal;
                 if (fieldMap.size() == 0) {
                     runSubOps = true;
                 }
             }
         }
-
         return runSubOps;
     }
 
@@ -97,7 +81,8 @@ public class EmptyCondition implements C
         if (!mapAcsr.isEmpty()) {
             Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext);
             if (fromMap == null) {
-                if (Debug.infoOn()) Debug.logInfo("Map not found with name " + mapAcsr + ", running operations", module);
+                if (Debug.infoOn())
+                    Debug.logInfo("Map not found with name " + mapAcsr + ", running operations", module);
             } else {
                 fieldVal = fieldAcsr.get(fromMap, methodContext);
             }
@@ -121,4 +106,16 @@ public class EmptyCondition implements C
         }
         messageBuffer.append("]");
     }
+
+    public static final class EmptyConditionFactory extends ConditionalFactory<EmptyCondition> {
+        @Override
+        public EmptyCondition createCondition(Element element, SimpleMethod simpleMethod) {
+            return new EmptyCondition(element, simpleMethod);
+        }
+
+        @Override
+        public String getName() {
+            return "if-empty";
+        }
+    }
 }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/HasPermissionCondition.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/HasPermissionCondition.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/HasPermissionCondition.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/HasPermissionCondition.java Thu Apr 19 15:09:03 2012
@@ -30,27 +30,13 @@ import org.w3c.dom.Element;
  * Implements compare to a constant condition.
  */
 public class HasPermissionCondition implements Conditional {
-    public static final class HasPermissionConditionFactory extends ConditionalFactory<HasPermissionCondition> {
-        @Override
-        public HasPermissionCondition createCondition(Element element, SimpleMethod simpleMethod) {
-            return new HasPermissionCondition(element, simpleMethod);
-        }
-
-        @Override
-        public String getName() {
-            return "if-has-permission";
-        }
-    }
-
 
-    SimpleMethod simpleMethod;
-
-    String permission;
     String action;
+    String permission;
+    SimpleMethod simpleMethod;
 
     public HasPermissionCondition(Element element, SimpleMethod simpleMethod) {
         this.simpleMethod = simpleMethod;
-
         this.permission = element.getAttribute("permission");
         this.action = element.getAttribute("action");
     }
@@ -58,8 +44,8 @@ public class HasPermissionCondition impl
     public boolean checkCondition(MethodContext methodContext) {
         // only run subOps if element is empty/null
         boolean runSubOps = false;
-
-        // if no user is logged in, treat as if the user does not have permission: do not run subops
+        // if no user is logged in, treat as if the user does not have permission: do not
+        // run subops
         GenericValue userLogin = methodContext.getUserLogin();
         if (userLogin != null) {
             String permission = methodContext.expandString(this.permission);
@@ -79,7 +65,6 @@ public class HasPermissionCondition impl
                 }
             }
         }
-
         return runSubOps;
     }
 
@@ -92,4 +77,16 @@ public class HasPermissionCondition impl
         }
         messageBuffer.append("]");
     }
+
+    public static final class HasPermissionConditionFactory extends ConditionalFactory<HasPermissionCondition> {
+        @Override
+        public HasPermissionCondition createCondition(Element element, SimpleMethod simpleMethod) {
+            return new HasPermissionCondition(element, simpleMethod);
+        }
+
+        @Override
+        public String getName() {
+            return "if-has-permission";
+        }
+    }
 }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/MasterIf.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/MasterIf.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/MasterIf.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/MasterIf.java Thu Apr 19 15:09:03 2012
@@ -18,54 +18,41 @@
  *******************************************************************************/
 package org.ofbiz.minilang.method.conditional;
 
-import java.util.*;
+import java.util.List;
 
 import javolution.util.FastList;
 
-import org.w3c.dom.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.minilang.*;
-import org.ofbiz.minilang.method.*;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.base.util.UtilXml;
+import org.ofbiz.minilang.SimpleMethod;
+import org.ofbiz.minilang.method.MethodContext;
+import org.ofbiz.minilang.method.MethodOperation;
+import org.w3c.dom.Element;
 
 /**
  * Represents the top-level element and only mounted operation for the more flexible if structure.
  */
 public class MasterIf extends MethodOperation {
-    public static final class MasterIfFactory implements Factory<MasterIf> {
-        public MasterIf createMethodOperation(Element element, SimpleMethod simpleMethod) {
-            return new MasterIf (element, simpleMethod);
-        }
-
-        public String getName() {
-            return "if";
-        }
-    }
 
     Conditional condition;
-
-    List<MethodOperation> thenSubOps = FastList.newInstance();
-    List<MethodOperation> elseSubOps = null;
-
     List<ElseIf> elseIfs = null;
+    List<MethodOperation> elseSubOps = null;
+    List<MethodOperation> thenSubOps = FastList.newInstance();
 
-    public MasterIf (Element element, SimpleMethod simpleMethod) {
+    public MasterIf(Element element, SimpleMethod simpleMethod) {
         super(element, simpleMethod);
-
         Element conditionElement = UtilXml.firstChildElement(element, "condition");
         Element conditionChildElement = UtilXml.firstChildElement(conditionElement);
         this.condition = ConditionalFactory.makeConditional(conditionChildElement, simpleMethod);
-
         Element thenElement = UtilXml.firstChildElement(element, "then");
         SimpleMethod.readOperations(thenElement, thenSubOps, simpleMethod);
-
         List<? extends Element> elseIfElements = UtilXml.childElementList(element, "else-if");
         if (UtilValidate.isNotEmpty(elseIfElements)) {
             elseIfs = FastList.newInstance();
-            for (Element elseIfElement: elseIfElements) {
-                elseIfs.add(new ElseIf (elseIfElement, simpleMethod));
+            for (Element elseIfElement : elseIfElements) {
+                elseIfs.add(new ElseIf(elseIfElement, simpleMethod));
             }
         }
-
         Element elseElement = UtilXml.firstChildElement(element, "else");
         if (elseElement != null) {
             elseSubOps = FastList.newInstance();
@@ -78,22 +65,19 @@ public class MasterIf extends MethodOper
         // if conditions fails, always return true; if a sub-op returns false
         // return false and stop, otherwise return true
         // return true;
-
         // only run subOps if element is empty/null
         boolean runSubOps = condition.checkCondition(methodContext);
-
         if (runSubOps) {
             return SimpleMethod.runSubOps(thenSubOps, methodContext);
         } else {
             // try the else-ifs
             if (UtilValidate.isNotEmpty(elseIfs)) {
-                for (ElseIf elseIf: elseIfs) {
+                for (ElseIf elseIf : elseIfs) {
                     if (elseIf.checkCondition(methodContext)) {
                         return elseIf.runSubOps(methodContext);
                     }
                 }
             }
-
             if (elseSubOps != null) {
                 return SimpleMethod.runSubOps(elseSubOps, methodContext);
             } else {
@@ -102,16 +86,24 @@ public class MasterIf extends MethodOper
         }
     }
 
+    @Override
+    public String expandedString(MethodContext methodContext) {
+        // TODO: fill in missing details, if needed
+        StringBuilder messageBuf = new StringBuilder();
+        this.condition.prettyPrint(messageBuf, methodContext);
+        return "<if><condition>" + messageBuf + "</condition></if>";
+    }
+
     public List<MethodOperation> getAllSubOps() {
         List<MethodOperation> allSubOps = FastList.newInstance();
         allSubOps.addAll(this.thenSubOps);
-        if (this.elseSubOps != null) allSubOps.addAll(this.elseSubOps);
+        if (this.elseSubOps != null)
+            allSubOps.addAll(this.elseSubOps);
         if (elseIfs != null) {
-            for (ElseIf elseIf: elseIfs) {
+            for (ElseIf elseIf : elseIfs) {
                 allSubOps.addAll(elseIf.getThenSubOps());
             }
         }
-
         return allSubOps;
     }
 
@@ -120,11 +112,13 @@ public class MasterIf extends MethodOper
         return expandedString(null);
     }
 
-    @Override
-    public String expandedString(MethodContext methodContext) {
-        // TODO: fill in missing details, if needed
-        StringBuilder messageBuf = new StringBuilder();
-        this.condition.prettyPrint(messageBuf, methodContext);
-        return "<if><condition>" + messageBuf + "</condition></if>";
+    public static final class MasterIfFactory implements Factory<MasterIf> {
+        public MasterIf createMethodOperation(Element element, SimpleMethod simpleMethod) {
+            return new MasterIf(element, simpleMethod);
+        }
+
+        public String getName() {
+            return "if";
+        }
     }
 }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/RegexpCondition.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/RegexpCondition.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/RegexpCondition.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/RegexpCondition.java Thu Apr 19 15:09:03 2012
@@ -38,36 +38,19 @@ import org.w3c.dom.Element;
  * Implements compare to a constant condition.
  */
 public class RegexpCondition implements Conditional {
-    public static final class RegexpConditionFactory extends ConditionalFactory<RegexpCondition> {
-        @Override
-        public RegexpCondition createCondition(Element element, SimpleMethod simpleMethod) {
-            return new RegexpCondition(element, simpleMethod);
-        }
-
-        @Override
-        public String getName() {
-            return "if-regexp";
-        }
-    }
-
 
     public static final String module = RegexpCondition.class.getName();
-
-    SimpleMethod simpleMethod;
-
     private transient static ThreadLocal<CompilerMatcher> compilerMatcher = CompilerMatcher.getThreadLocal();
 
-    List<?> subOps = FastList.newInstance();
     List<?> elseSubOps = null;
-
-    ContextAccessor<Map<String, ? extends Object>> mapAcsr;
-    ContextAccessor<Object> fieldAcsr;
-
     FlexibleStringExpander exprExdr;
+    ContextAccessor<Object> fieldAcsr;
+    ContextAccessor<Map<String, ? extends Object>> mapAcsr;
+    SimpleMethod simpleMethod;
+    List<?> subOps = FastList.newInstance();
 
     public RegexpCondition(Element element, SimpleMethod simpleMethod) {
         this.simpleMethod = simpleMethod;
-
         // NOTE: this is still supported, but is deprecated
         this.mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name"));
         this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field"));
@@ -75,25 +58,20 @@ public class RegexpCondition implements 
             // NOTE: this is still supported, but is deprecated
             this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
         }
-
         this.exprExdr = FlexibleStringExpander.getInstance(element.getAttribute("expr"));
     }
 
     public boolean checkCondition(MethodContext methodContext) {
         String fieldString = getFieldString(methodContext);
-
         boolean matches = false;
         try {
             matches = compilerMatcher.get().matches(fieldString, methodContext.expandString(this.exprExdr));
         } catch (MalformedPatternException e) {
             Debug.logError(e, "Regular Expression [" + this.exprExdr + "] is mal-formed: " + e.toString(), module);
         }
-
         if (matches) {
-            //Debug.logInfo("The string [" + fieldString + "] matched the pattern expr [" + pattern.getPattern() + "]", module);
             return true;
         } else {
-            //Debug.logInfo("The string [" + fieldString + "] did NOT match the pattern expr [" + pattern.getPattern() + "]", module);
             return false;
         }
     }
@@ -101,11 +79,11 @@ public class RegexpCondition implements 
     protected String getFieldString(MethodContext methodContext) {
         String fieldString = null;
         Object fieldVal = null;
-
         if (!mapAcsr.isEmpty()) {
             Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext);
             if (fromMap == null) {
-                if (Debug.infoOn()) Debug.logInfo("Map not found with name " + mapAcsr + ", using empty string for comparison", module);
+                if (Debug.infoOn())
+                    Debug.logInfo("Map not found with name " + mapAcsr + ", using empty string for comparison", module);
             } else {
                 fieldVal = fieldAcsr.get(fromMap, methodContext);
             }
@@ -113,7 +91,6 @@ public class RegexpCondition implements 
             // no map name, try the env
             fieldVal = fieldAcsr.get(methodContext);
         }
-
         if (fieldVal != null) {
             try {
                 fieldString = (String) ObjectType.simpleTypeConvert(fieldVal, "String", null, methodContext.getTimeZone(), methodContext.getLocale(), true);
@@ -122,8 +99,8 @@ public class RegexpCondition implements 
             }
         }
         // always use an empty string by default
-        if (fieldString == null) fieldString = "";
-
+        if (fieldString == null)
+            fieldString = "";
         return fieldString;
     }
 
@@ -141,4 +118,16 @@ public class RegexpCondition implements 
         messageBuffer.append(methodContext.expandString(this.exprExdr));
         messageBuffer.append("]");
     }
+
+    public static final class RegexpConditionFactory extends ConditionalFactory<RegexpCondition> {
+        @Override
+        public RegexpCondition createCondition(Element element, SimpleMethod simpleMethod) {
+            return new RegexpCondition(element, simpleMethod);
+        }
+
+        @Override
+        public String getName() {
+            return "if-regexp";
+        }
+    }
 }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ValidateMethodCondition.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ValidateMethodCondition.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ValidateMethodCondition.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ValidateMethodCondition.java Thu Apr 19 15:09:03 2012
@@ -18,36 +18,28 @@
  *******************************************************************************/
 package org.ofbiz.minilang.method.conditional;
 
-import java.util.*;
-import java.lang.reflect.*;
-import org.w3c.dom.*;
-import org.ofbiz.base.util.*;
+import java.lang.reflect.Method;
+import java.util.Map;
+
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.GeneralException;
+import org.ofbiz.base.util.ObjectType;
 import org.ofbiz.minilang.SimpleMethod;
-import org.ofbiz.minilang.method.*;
+import org.ofbiz.minilang.method.ContextAccessor;
+import org.ofbiz.minilang.method.MethodContext;
+import org.w3c.dom.Element;
 
 /**
  * Implements validate method condition.
  */
 public class ValidateMethodCondition implements Conditional {
-    public static final class ValidateMethodConditionFactory extends ConditionalFactory<ValidateMethodCondition> {
-        @Override
-        public ValidateMethodCondition createCondition(Element element, SimpleMethod simpleMethod) {
-            return new ValidateMethodCondition(element);
-        }
-
-        @Override
-        public String getName() {
-            return "if-validate-method";
-        }
-    }
-
 
     public static final String module = ValidateMethodCondition.class.getName();
 
-    ContextAccessor<Map<String, ? extends Object>> mapAcsr;
+    String className;
     ContextAccessor<Object> fieldAcsr;
+    ContextAccessor<Map<String, ? extends Object>> mapAcsr;
     String methodName;
-    String className;
 
     public ValidateMethodCondition(Element element) {
         this.mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name"));
@@ -59,12 +51,9 @@ public class ValidateMethodCondition imp
     public boolean checkCondition(MethodContext methodContext) {
         String methodName = methodContext.expandString(this.methodName);
         String className = methodContext.expandString(this.className);
-
         String fieldString = getFieldString(methodContext);
-
-        Class<?>[] paramTypes = new Class<?>[] {String.class};
-        Object[] params = new Object[] {fieldString};
-
+        Class<?>[] paramTypes = new Class<?>[] { String.class };
+        Object[] params = new Object[] { fieldString };
         Class<?> valClass;
         try {
             valClass = methodContext.getLoader().loadClass(className);
@@ -72,7 +61,6 @@ public class ValidateMethodCondition imp
             Debug.logError("Could not find validation class: " + className, module);
             return false;
         }
-
         Method valMethod;
         try {
             valMethod = valClass.getMethod(methodName, paramTypes);
@@ -80,27 +68,25 @@ public class ValidateMethodCondition imp
             Debug.logError("Could not find validation method: " + methodName + " of class " + className, module);
             return false;
         }
-
         Boolean resultBool = Boolean.FALSE;
         try {
             resultBool = (Boolean) valMethod.invoke(null, params);
         } catch (Exception e) {
             Debug.logError(e, "Error in IfValidationMethod " + methodName + " of class " + className + ", not processing sub-ops ", module);
         }
-
-        if (resultBool != null) return resultBool.booleanValue();
-
+        if (resultBool != null)
+            return resultBool.booleanValue();
         return false;
     }
 
     protected String getFieldString(MethodContext methodContext) {
         String fieldString = null;
         Object fieldVal = null;
-
         if (!mapAcsr.isEmpty()) {
             Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext);
             if (fromMap == null) {
-                if (Debug.infoOn()) Debug.logInfo("Map not found with name " + mapAcsr + ", using empty string for comparison", module);
+                if (Debug.infoOn())
+                    Debug.logInfo("Map not found with name " + mapAcsr + ", using empty string for comparison", module);
             } else {
                 fieldVal = fieldAcsr.get(fromMap, methodContext);
             }
@@ -108,7 +94,6 @@ public class ValidateMethodCondition imp
             // no map name, try the env
             fieldVal = fieldAcsr.get(methodContext);
         }
-
         if (fieldVal != null) {
             try {
                 fieldString = (String) ObjectType.simpleTypeConvert(fieldVal, "String", null, methodContext.getTimeZone(), methodContext.getLocale(), true);
@@ -116,10 +101,9 @@ public class ValidateMethodCondition imp
                 Debug.logError(e, "Could not convert object to String, using empty String", module);
             }
         }
-
         // always use an empty string by default
-        if (fieldString == null) fieldString = "";
-
+        if (fieldString == null)
+            fieldString = "";
         return fieldString;
     }
 
@@ -127,7 +111,6 @@ public class ValidateMethodCondition imp
         // allow methodContext to be null
         String methodName = methodContext == null ? this.methodName : methodContext.expandString(this.methodName);
         String className = methodContext == null ? this.className : methodContext.expandString(this.className);
-
         messageBuffer.append("validate-method[");
         messageBuffer.append(className);
         messageBuffer.append(".");
@@ -144,4 +127,16 @@ public class ValidateMethodCondition imp
         }
         messageBuffer.append(")]");
     }
+
+    public static final class ValidateMethodConditionFactory extends ConditionalFactory<ValidateMethodCondition> {
+        @Override
+        public ValidateMethodCondition createCondition(Element element, SimpleMethod simpleMethod) {
+            return new ValidateMethodCondition(element);
+        }
+
+        @Override
+        public String getName() {
+            return "if-validate-method";
+        }
+    }
 }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/While.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/While.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/While.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/While.java Thu Apr 19 15:09:03 2012
@@ -18,42 +18,29 @@
  *******************************************************************************/
 package org.ofbiz.minilang.method.conditional;
 
-import java.util.*;
+import java.util.List;
 
 import javolution.util.FastList;
 
-import org.w3c.dom.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.minilang.*;
-import org.ofbiz.minilang.method.*;
-import org.ofbiz.minilang.method.conditional.Conditional;
-import org.ofbiz.minilang.method.conditional.ConditionalFactory;
+import org.ofbiz.base.util.UtilXml;
+import org.ofbiz.minilang.SimpleMethod;
+import org.ofbiz.minilang.method.MethodContext;
+import org.ofbiz.minilang.method.MethodOperation;
+import org.w3c.dom.Element;
 
 /**
  * Continually processes sub-ops while the condition remains true
  */
 public class While extends MethodOperation {
-    public static final class WhileFactory implements Factory<While> {
-        public While createMethodOperation(Element element, SimpleMethod simpleMethod) {
-            return new While(element, simpleMethod);
-        }
-
-        public String getName() {
-            return "while";
-        }
-    }
 
     Conditional condition;
-
     List<MethodOperation> thenSubOps = FastList.newInstance();
 
     public While(Element element, SimpleMethod simpleMethod) {
         super(element, simpleMethod);
-
         Element conditionElement = UtilXml.firstChildElement(element, "condition");
         Element conditionChildElement = UtilXml.firstChildElement(conditionElement);
         this.condition = ConditionalFactory.makeConditional(conditionChildElement, simpleMethod);
-
         Element thenElement = UtilXml.firstChildElement(element, "then");
         SimpleMethod.readOperations(thenElement, thenSubOps, simpleMethod);
     }
@@ -61,7 +48,8 @@ public class While extends MethodOperati
     @Override
     public boolean exec(MethodContext methodContext) {
         // if conditions fails, always return true;
-        // if a sub-op returns false return false and stop, otherwise drop though loop and return true
+        // if a sub-op returns false return false and stop, otherwise drop though loop and
+        // return true
         while (condition.checkCondition(methodContext)) {
             boolean runSubOpsResult = SimpleMethod.runSubOps(thenSubOps, methodContext);
             if (!runSubOpsResult) {
@@ -71,6 +59,14 @@ public class While extends MethodOperati
         return true;
     }
 
+    @Override
+    public String expandedString(MethodContext methodContext) {
+        // TODO: fill in missing details, if needed
+        StringBuilder messageBuf = new StringBuilder();
+        this.condition.prettyPrint(messageBuf, methodContext);
+        return "<while><condition>" + messageBuf + "</condition></while>";
+    }
+
     public List<MethodOperation> getThenSubOps() {
         return this.thenSubOps;
     }
@@ -80,11 +76,13 @@ public class While extends MethodOperati
         return expandedString(null);
     }
 
-    @Override
-    public String expandedString(MethodContext methodContext) {
-        // TODO: fill in missing details, if needed
-        StringBuilder messageBuf = new StringBuilder();
-        this.condition.prettyPrint(messageBuf, methodContext);
-        return "<while><condition>" + messageBuf + "</condition></while>";
+    public static final class WhileFactory implements Factory<While> {
+        public While createMethodOperation(Element element, SimpleMethod simpleMethod) {
+            return new While(element, simpleMethod);
+        }
+
+        public String getName() {
+            return "while";
+        }
     }
 }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/ClearCacheLine.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/ClearCacheLine.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/ClearCacheLine.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/ClearCacheLine.java Thu Apr 19 15:09:03 2012
@@ -18,27 +18,19 @@
  *******************************************************************************/
 package org.ofbiz.minilang.method.entityops;
 
-import java.util.*;
+import java.util.Map;
 
-import org.w3c.dom.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.minilang.*;
-import org.ofbiz.minilang.method.*;
+import org.ofbiz.base.util.Debug;
+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 clear elements from the cache; intelligently looks at
- *  the map passed to see if it is a byPrimaryKey, and byAnd, or an all.
+ * Uses the delegator to clear elements from the cache; intelligently looks at the map passed to see if it is a byPrimaryKey, and byAnd, or an all.
  */
 public class ClearCacheLine extends MethodOperation {
-    public static final class ClearCacheLineFactory implements Factory<ClearCacheLine> {
-        public ClearCacheLine createMethodOperation(Element element, SimpleMethod simpleMethod) {
-            return new ClearCacheLine(element, simpleMethod);
-        }
-
-        public String getName() {
-            return "clear-cache-line";
-        }
-    }
 
     public static final String module = ClearCacheLine.class.getName();
 
@@ -69,13 +61,24 @@ public class ClearCacheLine extends Meth
     }
 
     @Override
+    public String expandedString(MethodContext methodContext) {
+        // TODO: something more than a stub/dummy
+        return this.rawString();
+    }
+
+    @Override
     public String rawString() {
         // TODO: something more than the empty tag
         return "<clear-cache-line/>";
     }
-    @Override
-    public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+
+    public static final class ClearCacheLineFactory implements Factory<ClearCacheLine> {
+        public ClearCacheLine createMethodOperation(Element element, SimpleMethod simpleMethod) {
+            return new ClearCacheLine(element, simpleMethod);
+        }
+
+        public String getName() {
+            return "clear-cache-line";
+        }
     }
 }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/ClearEntityCaches.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/ClearEntityCaches.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/ClearEntityCaches.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/ClearEntityCaches.java Thu Apr 19 15:09:03 2012
@@ -18,24 +18,15 @@
  *******************************************************************************/
 package org.ofbiz.minilang.method.entityops;
 
-import org.w3c.dom.*;
-
-import org.ofbiz.minilang.*;
-import org.ofbiz.minilang.method.*;
+import org.ofbiz.minilang.SimpleMethod;
+import org.ofbiz.minilang.method.MethodContext;
+import org.ofbiz.minilang.method.MethodOperation;
+import org.w3c.dom.Element;
 
 /**
  * Clears all Entity Engine Caches
  */
 public class ClearEntityCaches extends MethodOperation {
-    public static final class ClearEntityCachesFactory implements Factory<ClearEntityCaches> {
-        public ClearEntityCaches createMethodOperation(Element element, SimpleMethod simpleMethod) {
-            return new ClearEntityCaches(element, simpleMethod);
-        }
-
-        public String getName() {
-            return "clear-entity-caches";
-        }
-    }
 
     public ClearEntityCaches(Element element, SimpleMethod simpleMethod) {
         super(element, simpleMethod);
@@ -48,13 +39,24 @@ public class ClearEntityCaches extends M
     }
 
     @Override
+    public String expandedString(MethodContext methodContext) {
+        // TODO: something more than a stub/dummy
+        return this.rawString();
+    }
+
+    @Override
     public String rawString() {
         // TODO: something more than the empty tag
         return "<clear-entity-caches/>";
     }
-    @Override
-    public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+
+    public static final class ClearEntityCachesFactory implements Factory<ClearEntityCaches> {
+        public ClearEntityCaches createMethodOperation(Element element, SimpleMethod simpleMethod) {
+            return new ClearEntityCaches(element, simpleMethod);
+        }
+
+        public String getName() {
+            return "clear-entity-caches";
+        }
     }
 }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/CloneValue.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/CloneValue.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/CloneValue.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/CloneValue.java Thu Apr 19 15:09:03 2012
@@ -30,20 +30,11 @@ import org.w3c.dom.Element;
  * Uses the delegator to find entity values by anding the map fields
  */
 public class CloneValue extends MethodOperation {
-    public static final class CloneValueFactory implements Factory<CloneValue> {
-        public CloneValue createMethodOperation(Element element, SimpleMethod simpleMethod) {
-            return new CloneValue(element, simpleMethod);
-        }
-
-        public String getName() {
-            return "clone-value";
-        }
-    }
 
     public static final String module = CloneValue.class.getName();
 
-    ContextAccessor<GenericValue> valueAcsr;
     ContextAccessor<GenericValue> newValueAcsr;
+    ContextAccessor<GenericValue> valueAcsr;
 
     public CloneValue(Element element, SimpleMethod simpleMethod) {
         super(element, simpleMethod);
@@ -58,19 +49,29 @@ public class CloneValue extends MethodOp
             Debug.logWarning("In clone-value a value was not found with the specified valueAcsr: " + valueAcsr + ", not copying", module);
             return true;
         }
-
         newValueAcsr.put(methodContext, GenericValue.create(value));
         return true;
     }
 
     @Override
+    public String expandedString(MethodContext methodContext) {
+        // TODO: something more than a stub/dummy
+        return this.rawString();
+    }
+
+    @Override
     public String rawString() {
         // TODO: something more than the empty tag
         return "<clone-value/>";
     }
-    @Override
-    public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+
+    public static final class CloneValueFactory implements Factory<CloneValue> {
+        public CloneValue createMethodOperation(Element element, SimpleMethod simpleMethod) {
+            return new CloneValue(element, simpleMethod);
+        }
+
+        public String getName() {
+            return "clone-value";
+        }
     }
 }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/CreateValue.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/CreateValue.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/CreateValue.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/CreateValue.java Thu Apr 19 15:09:03 2012
@@ -31,22 +31,13 @@ import org.w3c.dom.Element;
  * Uses the delegator to create the specified value object entity in the datasource
  */
 public class CreateValue extends MethodOperation {
-    public static final class CreateValueFactory implements Factory<CreateValue> {
-        public CreateValue createMethodOperation(Element element, SimpleMethod simpleMethod) {
-            return new CreateValue(element, simpleMethod);
-        }
-
-        public String getName() {
-            return "create-value";
-        }
-    }
 
     public static final String module = CreateValue.class.getName();
 
-    ContextAccessor<GenericValue> valueAcsr;
+    boolean createOrStore;
     String doCacheClearStr;
     boolean testDuplicate;
-    boolean createOrStore;
+    ContextAccessor<GenericValue> valueAcsr;
 
     public CreateValue(Element element, SimpleMethod simpleMethod) {
         super(element, simpleMethod);
@@ -58,7 +49,6 @@ public class CreateValue extends MethodO
     @Override
     public boolean exec(MethodContext methodContext) {
         boolean doCacheClear = !"false".equals(methodContext.expandString(doCacheClearStr));
-
         GenericValue value = valueAcsr.get(methodContext);
         if (value == null) {
             String errMsg = "In create-value a value was not found with the specified valueAcsr: " + valueAcsr + ", not creating";
@@ -95,13 +85,24 @@ public class CreateValue extends MethodO
     }
 
     @Override
+    public String expandedString(MethodContext methodContext) {
+        // TODO: something more than a stub/dummy
+        return this.rawString();
+    }
+
+    @Override
     public String rawString() {
         // TODO: something more than the empty tag
         return "<create-value/>";
     }
-    @Override
-    public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+
+    public static final class CreateValueFactory implements Factory<CreateValue> {
+        public CreateValue createMethodOperation(Element element, SimpleMethod simpleMethod) {
+            return new CreateValue(element, simpleMethod);
+        }
+
+        public String getName() {
+            return "create-value";
+        }
     }
 }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityAnd.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityAnd.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityAnd.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityAnd.java Thu Apr 19 15:09:03 2012
@@ -31,15 +31,6 @@ import org.w3c.dom.Element;
  * Uses the delegator to find entity values by a condition
  */
 public class EntityAnd extends MethodOperation {
-    public static final class EntityAndFactory implements Factory<EntityAnd> {
-        public EntityAnd createMethodOperation(Element element, SimpleMethod simpleMethod) {
-            return new EntityAnd(element, simpleMethod);
-        }
-
-        public String getName() {
-            return "entity-and";
-        }
-    }
 
     public static final String module = EntityAnd.class.getName();
 
@@ -58,7 +49,6 @@ public class EntityAnd extends MethodOpe
         } catch (GeneralException e) {
             Debug.logError(e, module);
             String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process: " + e.getMessage();
-
             if (methodContext.getMethodType() == MethodContext.EVENT) {
                 methodContext.putEnv(simpleMethod.getEventErrorMessageName(), errMsg);
                 methodContext.putEnv(simpleMethod.getEventResponseCodeName(), simpleMethod.getDefaultErrorCode());
@@ -71,6 +61,12 @@ public class EntityAnd extends MethodOpe
         return true;
     }
 
+    @Override
+    public String expandedString(MethodContext methodContext) {
+        // TODO: something more than a stub/dummy
+        return this.rawString();
+    }
+
     public String getEntityName() {
         return this.finder.getEntityName();
     }
@@ -80,10 +76,14 @@ public class EntityAnd extends MethodOpe
         // TODO: something more than the empty tag
         return "<entity-and/>";
     }
-    @Override
-    public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+
+    public static final class EntityAndFactory implements Factory<EntityAnd> {
+        public EntityAnd createMethodOperation(Element element, SimpleMethod simpleMethod) {
+            return new EntityAnd(element, simpleMethod);
+        }
+
+        public String getName() {
+            return "entity-and";
+        }
     }
 }
-

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCondition.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCondition.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCondition.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCondition.java Thu Apr 19 15:09:03 2012
@@ -31,15 +31,6 @@ import org.w3c.dom.Element;
  * Uses the delegator to find entity values by a condition
  */
 public class EntityCondition extends MethodOperation {
-    public static final class EntityConditionFactory implements Factory<EntityCondition> {
-        public EntityCondition createMethodOperation(Element element, SimpleMethod simpleMethod) {
-            return new EntityCondition(element, simpleMethod);
-        }
-
-        public String getName() {
-            return "entity-condition";
-        }
-    }
 
     public static final String module = EntityCondition.class.getName();
 
@@ -58,7 +49,6 @@ public class EntityCondition extends Met
         } catch (GeneralException e) {
             Debug.logError(e, module);
             String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process: " + e.getMessage();
-
             if (methodContext.getMethodType() == MethodContext.EVENT) {
                 methodContext.putEnv(simpleMethod.getEventErrorMessageName(), errMsg);
                 methodContext.putEnv(simpleMethod.getEventResponseCodeName(), simpleMethod.getDefaultErrorCode());
@@ -71,6 +61,12 @@ public class EntityCondition extends Met
         return true;
     }
 
+    @Override
+    public String expandedString(MethodContext methodContext) {
+        // TODO: something more than a stub/dummy
+        return this.rawString();
+    }
+
     public String getEntityName() {
         return this.finder.getEntityName();
     }
@@ -80,10 +76,14 @@ public class EntityCondition extends Met
         // TODO: something more than the empty tag
         return "<entity-condition/>";
     }
-    @Override
-    public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+
+    public static final class EntityConditionFactory implements Factory<EntityCondition> {
+        public EntityCondition createMethodOperation(Element element, SimpleMethod simpleMethod) {
+            return new EntityCondition(element, simpleMethod);
+        }
+
+        public String getName() {
+            return "entity-condition";
+        }
     }
 }
-

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java Thu Apr 19 15:09:03 2012
@@ -43,23 +43,14 @@ import org.w3c.dom.Element;
  * Uses the delegator to find entity values by a condition
  */
 public class EntityCount extends MethodOperation {
-    public static final class EntityCountFactory implements Factory<EntityCount> {
-        public EntityCount createMethodOperation(Element element, SimpleMethod simpleMethod) {
-            return new EntityCount(element, simpleMethod);
-        }
-
-        public String getName() {
-            return "entity-count";
-        }
-    }
 
     public static final String module = EntityCount.class.getName();
 
-    protected FlexibleStringExpander entityNameExdr;
+    protected FlexibleMapAccessor<Long> countAcsr;
     protected FlexibleStringExpander delegatorNameExdr;
-    protected Condition whereCondition;
+    protected FlexibleStringExpander entityNameExdr;
     protected Condition havingCondition;
-    protected FlexibleMapAccessor<Long> countAcsr;
+    protected Condition whereCondition;
 
     public EntityCount(Element element, SimpleMethod simpleMethod) {
         super(element, simpleMethod);
@@ -70,7 +61,6 @@ public class EntityCount extends MethodO
         } else {
             this.countAcsr = FlexibleMapAccessor.getInstance(element.getAttribute("count-name"));
         }
-
         // process condition-expr | condition-list
         Element conditionExprElement = UtilXml.firstChildElement(element, "condition-expr");
         Element conditionListElement = UtilXml.firstChildElement(element, "condition-list");
@@ -85,7 +75,6 @@ public class EntityCount extends MethodO
         } else if (conditionObjectElement != null) {
             this.whereCondition = new ConditionObject(conditionObjectElement);
         }
-
         // process having-condition-list
         Element havingConditionListElement = UtilXml.firstChildElement(element, "having-condition-list");
         if (havingConditionListElement != null) {
@@ -100,32 +89,25 @@ public class EntityCount extends MethodO
             Delegator delegator = methodContext.getDelegator();
             String entityName = this.entityNameExdr.expandString(context);
             String delegatorName = this.delegatorNameExdr.expandString(context);
-
             if (UtilValidate.isNotEmpty(delegatorName)) {
                 delegator = DelegatorFactory.getDelegator(delegatorName);
             }
-
             ModelEntity modelEntity = delegator.getModelEntity(entityName);
-
             // create whereEntityCondition from whereCondition
             EntityCondition whereEntityCondition = null;
             if (this.whereCondition != null) {
                 whereEntityCondition = this.whereCondition.createCondition(context, modelEntity, delegator.getModelFieldTypeReader(modelEntity));
             }
-
             // create havingEntityCondition from havingCondition
             EntityCondition havingEntityCondition = null;
             if (this.havingCondition != null) {
                 havingEntityCondition = this.havingCondition.createCondition(context, modelEntity, delegator.getModelFieldTypeReader(modelEntity));
             }
-
             long count = delegator.findCountByCondition(entityName, whereEntityCondition, havingEntityCondition, null);
-
             this.countAcsr.put(context, count);
         } catch (GeneralException e) {
             Debug.logError(e, module);
             String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process: " + e.getMessage();
-
             if (methodContext.getMethodType() == MethodContext.EVENT) {
                 methodContext.putEnv(simpleMethod.getEventErrorMessageName(), errMsg);
                 methodContext.putEnv(simpleMethod.getEventResponseCodeName(), simpleMethod.getDefaultErrorCode());
@@ -138,10 +120,17 @@ public class EntityCount extends MethodO
         return true;
     }
 
+    @Override
+    public String expandedString(MethodContext methodContext) {
+        // TODO: something more than a stub/dummy
+        return this.rawString();
+    }
+
     public String getEntityName() {
         String entName = this.entityNameExdr.getOriginal();
         // if there is expansion syntax
-        if (entName.indexOf("${") >= 0) return null;
+        if (entName.indexOf("${") >= 0)
+            return null;
         return entName;
     }
 
@@ -150,10 +139,14 @@ public class EntityCount extends MethodO
         // TODO: something more than the empty tag
         return "<entity-count/>";
     }
-    @Override
-    public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+
+    public static final class EntityCountFactory implements Factory<EntityCount> {
+        public EntityCount createMethodOperation(Element element, SimpleMethod simpleMethod) {
+            return new EntityCount(element, simpleMethod);
+        }
+
+        public String getName() {
+            return "entity-count";
+        }
     }
 }
-

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityData.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityData.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityData.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityData.java Thu Apr 19 15:09:03 2012
@@ -42,24 +42,14 @@ import org.w3c.dom.Element;
  * Uses the delegator to find entity values by a primary key
  */
 public class EntityData extends MethodOperation {
-    public static final class EntityDataFactory implements Factory<EntityData> {
-        public EntityData createMethodOperation(Element element, SimpleMethod simpleMethod) {
-            return new EntityData(element, simpleMethod);
-        }
-
-        public String getName() {
-            // FIXME: not in SimpleMethod
-            return "entity-data";
-        }
-    }
 
     public static final String module = EntityData.class.getName();
 
-    protected FlexibleStringExpander locationExdr;
     protected FlexibleStringExpander delegatorNameExdr;
-    protected FlexibleStringExpander timeoutExdr;
     protected ContextAccessor<List<Object>> errorListAcsr;
+    protected FlexibleStringExpander locationExdr;
     protected String mode;
+    protected FlexibleStringExpander timeoutExdr;
 
     public EntityData(Element element, SimpleMethod simpleMethod) {
         super(element, simpleMethod);
@@ -67,7 +57,6 @@ public class EntityData extends MethodOp
         delegatorNameExdr = FlexibleStringExpander.getInstance(element.getAttribute("delegator-name"));
         timeoutExdr = FlexibleStringExpander.getInstance(element.getAttribute("timeout"));
         errorListAcsr = new ContextAccessor<List<Object>>(element.getAttribute("error-list-name"), "error_list");
-
         mode = element.getAttribute("mode");
         if (UtilValidate.isEmpty(mode)) {
             mode = "load";
@@ -81,15 +70,12 @@ public class EntityData extends MethodOp
             messages = FastList.newInstance();
             errorListAcsr.put(methodContext, messages);
         }
-
         String location = this.locationExdr.expandString(methodContext.getEnvMap());
         String delegatorName = this.delegatorNameExdr.expandString(methodContext.getEnvMap());
-
         Delegator delegator = methodContext.getDelegator();
         if (UtilValidate.isNotEmpty(delegatorName)) {
             delegator = DelegatorFactory.getDelegator(delegatorName);
         }
-
         URL dataUrl = null;
         try {
             dataUrl = FlexibleLocation.resolveLocation(location, methodContext.getLoader());
@@ -99,7 +85,6 @@ public class EntityData extends MethodOp
         if (dataUrl == null) {
             messages.add("Could not find Entity Data document in resource: " + location);
         }
-
         String timeout = this.timeoutExdr.expandString(methodContext.getEnvMap());
         int txTimeout = -1;
         if (UtilValidate.isNotEmpty(timeout)) {
@@ -109,14 +94,14 @@ public class EntityData extends MethodOp
                 Debug.logWarning("Timeout not formatted properly in entity-data operation, defaulting to container default", module);
             }
         }
-
         if ("assert".equals(mode)) {
-            // load the XML file, read in one element at a time and check it against the database
+            // load the XML file, read in one element at a time and check it against the
+            // database
             try {
                 EntityDataAssert.assertData(dataUrl, delegator, messages);
             } catch (Exception e) {
                 String xmlError = "Error checking/asserting XML Resource \"" + dataUrl.toExternalForm() + "\"; Error was: " + e.getMessage();
-                //Debug.logError(e, xmlError, module);
+                // Debug.logError(e, xmlError, module);
                 messages.add(xmlError);
             }
         } else {
@@ -139,14 +124,25 @@ public class EntityData extends MethodOp
     }
 
     @Override
+    public String expandedString(MethodContext methodContext) {
+        // TODO: something more than a stub/dummy
+        return this.rawString();
+    }
+
+    @Override
     public String rawString() {
         // TODO: something more than the empty tag
         return "<entity-data/>";
     }
-    @Override
-    public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+
+    public static final class EntityDataFactory implements Factory<EntityData> {
+        public EntityData createMethodOperation(Element element, SimpleMethod simpleMethod) {
+            return new EntityData(element, simpleMethod);
+        }
+
+        public String getName() {
+            // FIXME: not in SimpleMethod
+            return "entity-data";
+        }
     }
 }
-

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityOne.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityOne.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityOne.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityOne.java Thu Apr 19 15:09:03 2012
@@ -31,15 +31,6 @@ import org.w3c.dom.Element;
  * Uses the delegator to find entity values by a primary key
  */
 public class EntityOne extends MethodOperation {
-    public static final class EntityOneFactory implements Factory<EntityOne> {
-        public EntityOne createMethodOperation(Element element, SimpleMethod simpleMethod) {
-            return new EntityOne(element, simpleMethod);
-        }
-
-        public String getName() {
-            return "entity-one";
-        }
-    }
 
     public static final String module = EntityOne.class.getName();
 
@@ -58,7 +49,6 @@ public class EntityOne extends MethodOpe
         } catch (GeneralException e) {
             Debug.logError(e, module);
             String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process: " + e.getMessage();
-
             if (methodContext.getMethodType() == MethodContext.EVENT) {
                 methodContext.putEnv(simpleMethod.getEventErrorMessageName(), errMsg);
                 methodContext.putEnv(simpleMethod.getEventResponseCodeName(), simpleMethod.getDefaultErrorCode());
@@ -71,6 +61,12 @@ public class EntityOne extends MethodOpe
         return true;
     }
 
+    @Override
+    public String expandedString(MethodContext methodContext) {
+        // TODO: something more than a stub/dummy
+        return this.rawString();
+    }
+
     public String getEntityName() {
         return this.finder.getEntityName();
     }
@@ -80,10 +76,14 @@ public class EntityOne extends MethodOpe
         // TODO: something more than the empty tag
         return "<entity-one/>";
     }
-    @Override
-    public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+
+    public static final class EntityOneFactory implements Factory<EntityOne> {
+        public EntityOne createMethodOperation(Element element, SimpleMethod simpleMethod) {
+            return new EntityOne(element, simpleMethod);
+        }
+
+        public String getName() {
+            return "entity-one";
+        }
     }
 }
-

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FilterListByAnd.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FilterListByAnd.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FilterListByAnd.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FilterListByAnd.java Thu Apr 19 15:09:03 2012
@@ -33,19 +33,10 @@ import org.w3c.dom.Element;
  * Uses the delegator to find entity values by anding the map fields
  */
 public class FilterListByAnd extends MethodOperation {
-    public static final class FilterListByAndFactory implements Factory<FilterListByAnd> {
-        public FilterListByAnd createMethodOperation(Element element, SimpleMethod simpleMethod) {
-            return new FilterListByAnd(element, simpleMethod);
-        }
-
-        public String getName() {
-            return "filter-list-by-and";
-        }
-    }
 
     ContextAccessor<List<GenericEntity>> listAcsr;
-    ContextAccessor<List<GenericEntity>> toListAcsr;
     ContextAccessor<Map<String, ? extends Object>> mapAcsr;
+    ContextAccessor<List<GenericEntity>> toListAcsr;
 
     public FilterListByAnd(Element element, SimpleMethod simpleMethod) {
         super(element, simpleMethod);
@@ -60,7 +51,6 @@ public class FilterListByAnd extends Met
     @Override
     public boolean exec(MethodContext methodContext) {
         Map<String, ? extends Object> theMap = null;
-
         if (!mapAcsr.isEmpty()) {
             theMap = mapAcsr.get(methodContext);
         }
@@ -69,13 +59,24 @@ public class FilterListByAnd extends Met
     }
 
     @Override
+    public String expandedString(MethodContext methodContext) {
+        // TODO: something more than a stub/dummy
+        return this.rawString();
+    }
+
+    @Override
     public String rawString() {
         // TODO: something more than the empty tag
         return "<filter-list-by-and/>";
     }
-    @Override
-    public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+
+    public static final class FilterListByAndFactory implements Factory<FilterListByAnd> {
+        public FilterListByAnd createMethodOperation(Element element, SimpleMethod simpleMethod) {
+            return new FilterListByAnd(element, simpleMethod);
+        }
+
+        public String getName() {
+            return "filter-list-by-and";
+        }
     }
 }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FilterListByDate.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FilterListByDate.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FilterListByDate.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FilterListByDate.java Thu Apr 19 15:09:03 2012
@@ -35,22 +35,13 @@ import org.w3c.dom.Element;
  * Uses the delegator to find entity values by anding the map fields
  */
 public class FilterListByDate extends MethodOperation {
-    public static final class FilterListByDateFactory implements Factory<FilterListByDate> {
-        public FilterListByDate createMethodOperation(Element element, SimpleMethod simpleMethod) {
-            return new FilterListByDate(element, simpleMethod);
-        }
-
-        public String getName() {
-            return "filter-list-by-date";
-        }
-    }
 
+    String allSameStr;
+    String fromFieldName;
     ContextAccessor<List<GenericEntity>> listAcsr;
+    String thruFieldName;
     ContextAccessor<List<GenericEntity>> toListAcsr;
     ContextAccessor<Timestamp> validDateAcsr;
-    String fromFieldName;
-    String thruFieldName;
-    String allSameStr;
 
     public FilterListByDate(Element element, SimpleMethod simpleMethod) {
         super(element, simpleMethod);
@@ -60,18 +51,17 @@ public class FilterListByDate extends Me
             toListAcsr = listAcsr;
         }
         validDateAcsr = new ContextAccessor<Timestamp>(element.getAttribute("valid-date"), element.getAttribute("valid-date-name"));
-
         fromFieldName = element.getAttribute("from-field-name");
-        if (UtilValidate.isEmpty(fromFieldName)) fromFieldName = "fromDate";
+        if (UtilValidate.isEmpty(fromFieldName))
+            fromFieldName = "fromDate";
         thruFieldName = element.getAttribute("thru-field-name");
-        if (UtilValidate.isEmpty(thruFieldName)) thruFieldName = "thruDate";
-
+        if (UtilValidate.isEmpty(thruFieldName))
+            thruFieldName = "thruDate";
         allSameStr = element.getAttribute("all-same");
     }
 
     @Override
     public boolean exec(MethodContext methodContext) {
-
         if (!validDateAcsr.isEmpty()) {
             toListAcsr.put(methodContext, EntityUtil.filterByDate(listAcsr.get(methodContext), validDateAcsr.get(methodContext), fromFieldName, thruFieldName, true));
         } else {
@@ -81,14 +71,24 @@ public class FilterListByDate extends Me
     }
 
     @Override
+    public String expandedString(MethodContext methodContext) {
+        // TODO: something more than a stub/dummy
+        return this.rawString();
+    }
+
+    @Override
     public String rawString() {
         // TODO: something more than the empty tag
         return "<filter-list-by-date/>";
     }
-    @Override
-    public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+
+    public static final class FilterListByDateFactory implements Factory<FilterListByDate> {
+        public FilterListByDate createMethodOperation(Element element, SimpleMethod simpleMethod) {
+            return new FilterListByDate(element, simpleMethod);
+        }
+
+        public String getName() {
+            return "filter-list-by-date";
+        }
     }
 }
-

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java Thu Apr 19 15:09:03 2012
@@ -37,23 +37,14 @@ import org.w3c.dom.Element;
  * Uses the delegator to find entity values by anding the map fields
  */
 public class FindByAnd extends MethodOperation {
-    public static final class FindByAndFactory implements Factory<FindByAnd> {
-        public FindByAnd createMethodOperation(Element element, SimpleMethod simpleMethod) {
-            return new FindByAnd(element, simpleMethod);
-        }
-
-        public String getName() {
-            return "find-by-and";
-        }
-    }
 
     public static final String module = FindByAnd.class.getName();
 
-    ContextAccessor<Object> listAcsr;
+    String delegatorName;
     String entityName;
+    ContextAccessor<Object> listAcsr;
     ContextAccessor<Map<String, ? extends Object>> mapAcsr;
     ContextAccessor<List<String>> orderByListAcsr;
-    String delegatorName;
     String useCacheStr;
     String useIteratorStr;
 
@@ -64,7 +55,6 @@ public class FindByAnd extends MethodOpe
         mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map"), element.getAttribute("map-name"));
         orderByListAcsr = new ContextAccessor<List<String>>(element.getAttribute("order-by-list"), element.getAttribute("order-by-list-name"));
         delegatorName = element.getAttribute("delegator-name");
-
         useCacheStr = element.getAttribute("use-cache");
         useIteratorStr = element.getAttribute("use-iterator");
     }
@@ -75,20 +65,16 @@ public class FindByAnd extends MethodOpe
         String delegatorName = methodContext.expandString(this.delegatorName);
         String useCacheStr = methodContext.expandString(this.useCacheStr);
         String useIteratorStr = methodContext.expandString(this.useIteratorStr);
-
         boolean useCache = "true".equals(useCacheStr);
         boolean useIterator = "true".equals(useIteratorStr);
-
         List<String> orderByNames = null;
         if (!orderByListAcsr.isEmpty()) {
             orderByNames = orderByListAcsr.get(methodContext);
         }
-
         Delegator delegator = methodContext.getDelegator();
         if (UtilValidate.isNotEmpty(delegatorName)) {
             delegator = DelegatorFactory.getDelegator(delegatorName);
         }
-
         try {
             if (useIterator) {
                 EntityCondition whereCond = null;
@@ -106,7 +92,6 @@ public class FindByAnd extends MethodOpe
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
             String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process [problem finding the " + entityName + " entity: " + e.getMessage() + "]";
-
             if (methodContext.getMethodType() == MethodContext.EVENT) {
                 methodContext.putEnv(simpleMethod.getEventErrorMessageName(), errMsg);
                 methodContext.putEnv(simpleMethod.getEventResponseCodeName(), simpleMethod.getDefaultErrorCode());
@@ -119,6 +104,12 @@ public class FindByAnd extends MethodOpe
         return true;
     }
 
+    @Override
+    public String expandedString(MethodContext methodContext) {
+        // TODO: something more than a stub/dummy
+        return this.rawString();
+    }
+
     public String getEntityName() {
         return this.entityName;
     }
@@ -128,9 +119,14 @@ public class FindByAnd extends MethodOpe
         // TODO: something more than the empty tag
         return "<find-by-and/>";
     }
-    @Override
-    public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+
+    public static final class FindByAndFactory implements Factory<FindByAnd> {
+        public FindByAnd createMethodOperation(Element element, SimpleMethod simpleMethod) {
+            return new FindByAnd(element, simpleMethod);
+        }
+
+        public String getName() {
+            return "find-by-and";
+        }
     }
 }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java Thu Apr 19 15:09:03 2012
@@ -39,24 +39,15 @@ import org.w3c.dom.Element;
  * Uses the delegator to find an entity value by its primary key
  */
 public class FindByPrimaryKey extends MethodOperation {
-    public static final class FindByPrimaryKeyFactory implements Factory<FindByPrimaryKey> {
-        public FindByPrimaryKey createMethodOperation(Element element, SimpleMethod simpleMethod) {
-            return new FindByPrimaryKey(element, simpleMethod);
-        }
-
-        public String getName() {
-            return "find-by-primary-key";
-        }
-    }
 
     public static final String module = FindByPrimaryKey.class.getName();
 
-    ContextAccessor<GenericValue> valueAcsr;
+    String delegatorName;
     String entityName;
+    ContextAccessor<Collection<String>> fieldsToSelectListAcsr;
     ContextAccessor<Map<String, ? extends Object>> mapAcsr;
-    String delegatorName;
     String useCacheStr;
-    ContextAccessor<Collection<String>> fieldsToSelectListAcsr;
+    ContextAccessor<GenericValue> valueAcsr;
 
     public FindByPrimaryKey(Element element, SimpleMethod simpleMethod) {
         super(element, simpleMethod);
@@ -73,25 +64,20 @@ public class FindByPrimaryKey extends Me
         String entityName = methodContext.expandString(this.entityName);
         String delegatorName = methodContext.expandString(this.delegatorName);
         String useCacheStr = methodContext.expandString(this.useCacheStr);
-
         boolean useCache = "true".equals(useCacheStr);
-
         Delegator delegator = methodContext.getDelegator();
         if (UtilValidate.isNotEmpty(delegatorName)) {
             delegator = DelegatorFactory.getDelegator(delegatorName);
         }
-
         Map<String, ? extends Object> inMap = mapAcsr.get(methodContext);
         if (UtilValidate.isEmpty(entityName) && inMap instanceof GenericEntity) {
             GenericEntity inEntity = (GenericEntity) inMap;
             entityName = inEntity.getEntityName();
         }
-
         Collection<String> fieldsToSelectList = null;
         if (!fieldsToSelectListAcsr.isEmpty()) {
             fieldsToSelectList = fieldsToSelectListAcsr.get(methodContext);
         }
-
         try {
             if (fieldsToSelectList != null) {
                 valueAcsr.put(methodContext, delegator.findByPrimaryKeyPartial(delegator.makePK(entityName, inMap), UtilMisc.makeSetWritable(fieldsToSelectList)));
@@ -107,6 +93,12 @@ public class FindByPrimaryKey extends Me
         return true;
     }
 
+    @Override
+    public String expandedString(MethodContext methodContext) {
+        // TODO: something more than a stub/dummy
+        return this.rawString();
+    }
+
     public String getEntityName() {
         return this.entityName;
     }
@@ -116,9 +108,14 @@ public class FindByPrimaryKey extends Me
         // TODO: something more than the empty tag
         return "<find-by-primary-key/>";
     }
-    @Override
-    public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+
+    public static final class FindByPrimaryKeyFactory implements Factory<FindByPrimaryKey> {
+        public FindByPrimaryKey createMethodOperation(Element element, SimpleMethod simpleMethod) {
+            return new FindByPrimaryKey(element, simpleMethod);
+        }
+
+        public String getName() {
+            return "find-by-primary-key";
+        }
     }
 }