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 [9/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/otherops/Calculate.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Calculate.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Calculate.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Calculate.java Thu Apr 19 15:09:03 2012
@@ -21,8 +21,8 @@ package org.ofbiz.minilang.method.othero
 import java.math.BigDecimal;
 import java.text.DecimalFormat;
 import java.util.List;
-import java.util.Map;
 import java.util.Locale;
+import java.util.Map;
 
 import javolution.util.FastMap;
 
@@ -40,52 +40,39 @@ import org.w3c.dom.Element;
  * Calculates a result based on nested calcops.
  */
 public class Calculate extends MethodOperation {
-    public static final class CalculateFactory implements Factory<Calculate> {
-        public Calculate createMethodOperation(Element element, SimpleMethod simpleMethod) {
-            return new Calculate(element, simpleMethod);
-        }
-
-        public String getName() {
-            return "calculate";
-        }
-    }
 
     public static final String module = Calculate.class.getName();
 
-    public static final BigDecimal ZERO = BigDecimal.ZERO;
     public static final int TYPE_DOUBLE = 1;
     public static final int TYPE_FLOAT = 2;
     public static final int TYPE_LONG = 3;
     public static final int TYPE_INTEGER = 4;
     public static final int TYPE_STRING = 5;
     public static final int TYPE_BIG_DECIMAL = 6;
+    public static final BigDecimal ZERO = BigDecimal.ZERO;
 
-    ContextAccessor<Map<String, Object>> mapAcsr;
-    ContextAccessor<Object> fieldAcsr;
-    String decimalScaleString;
+    Calculate.SubCalc calcops[];
     String decimalFormatString;
-    String typeString;
+    String decimalScaleString;
+    ContextAccessor<Object> fieldAcsr;
+    ContextAccessor<Map<String, Object>> mapAcsr;
     String roundingModeString;
-    Calculate.SubCalc calcops[];
+    String typeString;
 
     public Calculate(Element element, SimpleMethod simpleMethod) {
         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
         this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field"), element.getAttribute("field-name"));
         this.mapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("map-name"));
-
         decimalScaleString = element.getAttribute("decimal-scale");
         decimalFormatString = element.getAttribute("decimal-format");
         typeString = element.getAttribute("type");
         roundingModeString = element.getAttribute("rounding-mode");
-
         List<? extends Element> calcopElements = UtilXml.childElementList(element);
         calcops = new Calculate.SubCalc[calcopElements.size()];
         int i = 0;
-
-        for (Element calcopElement: calcopElements) {
+        for (Element calcopElement : calcopElements) {
             String nodeName = calcopElement.getNodeName();
-
             if ("calcop".equals(nodeName)) {
                 calcops[i] = new Calculate.CalcOp(calcopElement);
             } else if ("number".equals(nodeName)) {
@@ -93,7 +80,6 @@ public class Calculate extends MethodOpe
             } else {
                 Debug.logError("Error: calculate operation with type " + nodeName, module);
             }
-            // Debug.logInfo("Added operation type " + nodeName + " in position " + i, module);
             i++;
         }
     }
@@ -117,7 +103,6 @@ public class Calculate extends MethodOpe
         } else {
             type = Calculate.TYPE_BIG_DECIMAL;
         }
-
         String roundingModeString = methodContext.expandString(this.roundingModeString);
         int roundingMode;
         if ("Ceiling".equals(roundingModeString)) {
@@ -140,76 +125,63 @@ public class Calculate extends MethodOpe
             // default to HalfEven, reduce cumulative errors
             roundingMode = BigDecimal.ROUND_HALF_EVEN;
         }
-
         String decimalScaleString = methodContext.expandString(this.decimalScaleString);
         int decimalScale = 2;
         if (UtilValidate.isNotEmpty(decimalScaleString)) {
             decimalScale = Integer.valueOf(decimalScaleString).intValue();
         }
-
         String decimalFormatString = methodContext.expandString(this.decimalFormatString);
         DecimalFormat df = null;
         if (UtilValidate.isNotEmpty(decimalFormatString)) {
             df = new DecimalFormat(decimalFormatString);
         }
-
         BigDecimal resultValue = ZERO;
         resultValue = resultValue.setScale(decimalScale, roundingMode);
-        for (Calculate.SubCalc calcop: calcops) {
+        for (Calculate.SubCalc calcop : calcops) {
             resultValue = resultValue.add(calcop.calcValue(methodContext, decimalScale, roundingMode));
             // Debug.logInfo("main total so far: " + resultValue, module);
         }
         resultValue = resultValue.setScale(decimalScale, roundingMode);
-
-        /* the old thing that did conversion to string and back, may want to use somewhere sometime...:
-         * for now just doing the setScale above (before and after calc ops)
-        try {
-            resultValue = new BigDecimal(df.format(resultValue));
-        } catch (ParseException e) {
-            String errorMessage = "Unable to format [" + formatString + "] result [" + resultValue + "]";
-            Debug.logError(e, errorMessage, module);
-            if (methodContext.getMethodType() == MethodContext.EVENT) {
-                methodContext.putEnv(simpleMethod.getEventErrorMessageName(), errorMessage);
-            } else if (methodContext.getMethodType() == MethodContext.SERVICE) {
-                methodContext.putEnv(simpleMethod.getServiceErrorMessageName(), errorMessage);
-            }
-            return false;
-        }
-        */
-
+        /*
+         * the old thing that did conversion to string and back, may want to use somewhere sometime...: for now just doing the setScale above (before and after calc ops) try { resultValue = new
+         * BigDecimal(df.format(resultValue)); } catch (ParseException e) { String errorMessage = "Unable to format [" + formatString + "] result [" + resultValue + "]"; Debug.logError(e,
+         * errorMessage, module); if (methodContext.getMethodType() == MethodContext.EVENT) { methodContext.putEnv(simpleMethod.getEventErrorMessageName(), errorMessage); } else if
+         * (methodContext.getMethodType() == MethodContext.SERVICE) { methodContext.putEnv(simpleMethod.getServiceErrorMessageName(), errorMessage); } return false; }
+         */
         Object resultObj = null;
         switch (type) {
-        case TYPE_DOUBLE:
-            resultObj = Double.valueOf(resultValue.doubleValue());
-            break;
-        case TYPE_FLOAT:
-            resultObj = Float.valueOf(resultValue.floatValue());
-            break;
-        case TYPE_LONG:
-            resultValue = resultValue.setScale(0, roundingMode);
-            resultObj = Long.valueOf(resultValue.longValue());
-            break;
-        case TYPE_INTEGER:
-            resultValue = resultValue.setScale(0, roundingMode);
-            resultObj = Integer.valueOf(resultValue.intValue());
-            break;
-        case TYPE_STRING:
-            // run the decimal-formatting
-            if (df != null && resultValue.compareTo(ZERO) > 0) {
-                resultObj = df.format(resultValue);
-            } else {
-                resultObj = resultValue.toString();
-            }
-            break;
-        case TYPE_BIG_DECIMAL:
-            resultObj = resultValue;
-            break;
+            case TYPE_DOUBLE:
+                resultObj = Double.valueOf(resultValue.doubleValue());
+                break;
+            case TYPE_FLOAT:
+                resultObj = Float.valueOf(resultValue.floatValue());
+                break;
+            case TYPE_LONG:
+                resultValue = resultValue.setScale(0, roundingMode);
+                resultObj = Long.valueOf(resultValue.longValue());
+                break;
+            case TYPE_INTEGER:
+                resultValue = resultValue.setScale(0, roundingMode);
+                resultObj = Integer.valueOf(resultValue.intValue());
+                break;
+            case TYPE_STRING:
+                // run the decimal-formatting
+                if (df != null && resultValue.compareTo(ZERO) > 0) {
+                    resultObj = df.format(resultValue);
+                } else {
+                    resultObj = resultValue.toString();
+                }
+                break;
+            case TYPE_BIG_DECIMAL:
+                resultObj = resultValue;
+                break;
         }
 
         if (!mapAcsr.isEmpty()) {
             Map<String, Object> toMap = mapAcsr.get(methodContext);
             if (toMap == null) {
-                if (Debug.verboseOn()) Debug.logVerbose("Map not found with name " + mapAcsr + ", creating new map", module);
+                if (Debug.verboseOn())
+                    Debug.logVerbose("Map not found with name " + mapAcsr + ", creating new map", module);
                 toMap = FastMap.newInstance();
                 mapAcsr.put(methodContext, toMap);
             }
@@ -222,73 +194,40 @@ public class Calculate extends MethodOpe
     }
 
     @Override
-    public String rawString() {
-        // TODO: add all attributes and other info
-        return "<calculate field-name=\"" + this.fieldAcsr + "\" map-name=\"" + this.mapAcsr + "\"/>";
-    }
-    @Override
     public String expandedString(MethodContext methodContext) {
         // TODO: something more than a stub/dummy
         return this.rawString();
     }
 
-    protected static interface SubCalc {
-        public BigDecimal calcValue(MethodContext methodContext, int scale, int roundingMode);
-    }
-
-    protected static class NumberOp implements SubCalc {
-        String valueStr;
-
-        public NumberOp(Element element) {
-            valueStr = element.getAttribute("value");
-        }
-
-        public BigDecimal calcValue(MethodContext methodContext, int scale, int roundingMode) {
-            String valueStr = methodContext.expandString(this.valueStr);
-            Locale locale = methodContext.getLocale();
-
-            if (locale == null) locale = Locale.getDefault();
-            
-            BigDecimal value;
-            try {
-                BigDecimal parseVal = (BigDecimal) ObjectType.simpleTypeConvert(valueStr, "BigDecimal", null, null, locale, true);
-                value = parseVal.setScale(scale, roundingMode);
-            } catch (Exception e) {
-                Debug.logError(e, "Could not parse the number string: " + valueStr, module);
-                throw new IllegalArgumentException("Could not parse the number string: " + valueStr);
-            }
-
-            // Debug.logInfo("calcValue number: " + value, module);
-            return value;
-        }
-
+    @Override
+    public String rawString() {
+        // TODO: add all attributes and other info
+        return "<calculate field-name=\"" + this.fieldAcsr + "\" map-name=\"" + this.mapAcsr + "\"/>";
     }
 
     protected static class CalcOp implements SubCalc {
         public static final int OPERATOR_ADD = 1;
-        public static final int OPERATOR_SUBTRACT = 2;
-        public static final int OPERATOR_MULTIPLY = 3;
         public static final int OPERATOR_DIVIDE = 4;
+        public static final int OPERATOR_MULTIPLY = 3;
         public static final int OPERATOR_NEGATIVE = 5;
+        public static final int OPERATOR_SUBTRACT = 2;
 
-        ContextAccessor<Map<String, ? extends Object>> mapAcsr;
+        Calculate.SubCalc calcops[];
         ContextAccessor<Object> fieldAcsr;
+        ContextAccessor<Map<String, ? extends Object>> mapAcsr;
         String operatorStr;
-        Calculate.SubCalc calcops[];
 
         public CalcOp(Element element) {
             // the schema for this element now just has the "field" attribute, though the old "field-name" and "map-name" pair is still supported
             this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field"), element.getAttribute("field-name"));
             this.mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name"));
             operatorStr = element.getAttribute("operator");
-
             List<? extends Element> calcopElements = UtilXml.childElementList(element);
             calcops = new Calculate.SubCalc[calcopElements.size()];
             int i = 0;
 
-            for (Element calcopElement: calcopElements) {
+            for (Element calcopElement : calcopElements) {
                 String nodeName = calcopElement.getNodeName();
-
                 if ("calcop".equals(calcopElement.getNodeName())) {
                     calcops[i] = new Calculate.CalcOp(calcopElement);
                 } else if ("number".equals(calcopElement.getNodeName())) {
@@ -296,7 +235,6 @@ public class Calculate extends MethodOpe
                 } else {
                     Debug.logError("Error: calculate operation unknown with type " + nodeName, module);
                 }
-                // Debug.logInfo("Added operation type " + nodeName + " in position " + i, module);
                 i++;
             }
         }
@@ -317,19 +255,17 @@ public class Calculate extends MethodOpe
             } else if ("negative".equals(operatorStr)) {
                 operator = CalcOp.OPERATOR_NEGATIVE;
             }
-
             BigDecimal resultValue = ZERO;
             resultValue = resultValue.setScale(scale, roundingMode);
             boolean isFirst = true;
-
             // if a fieldAcsr was specified, get the field from the map or result and use it as the initial value
             if (!fieldAcsr.isEmpty()) {
                 Object fieldObj = null;
-
                 if (!mapAcsr.isEmpty()) {
                     Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext);
                     if (fromMap == null) {
-                        if (Debug.verboseOn()) Debug.logVerbose("Map not found with name " + mapAcsr + ", creating new map", module);
+                        if (Debug.verboseOn())
+                            Debug.logVerbose("Map not found with name " + mapAcsr + ", creating new map", module);
                         fromMap = FastMap.newInstance();
                         mapAcsr.put(methodContext, fromMap);
                     }
@@ -337,7 +273,6 @@ public class Calculate extends MethodOpe
                 } else {
                     fieldObj = fieldAcsr.get(methodContext);
                 }
-
                 if (fieldObj != null) {
                     if (fieldObj instanceof Double) {
                         resultValue = new BigDecimal(((Double) fieldObj).doubleValue());
@@ -352,39 +287,78 @@ public class Calculate extends MethodOpe
                     } else if (fieldObj instanceof BigDecimal) {
                         resultValue = (BigDecimal) fieldObj;
                     }
-                    if (operator == OPERATOR_NEGATIVE) resultValue = resultValue.negate();
+                    if (operator == OPERATOR_NEGATIVE)
+                        resultValue = resultValue.negate();
                     isFirst = false;
                 } else {
-                    if (Debug.infoOn()) Debug.logInfo("Field not found with field-name " + fieldAcsr + ", and map-name " + mapAcsr + "using a default of 0", module);
+                    if (Debug.infoOn())
+                        Debug.logInfo("Field not found with field-name " + fieldAcsr + ", and map-name " + mapAcsr + "using a default of 0", module);
                 }
             }
-
-            for (SubCalc calcop: calcops) {
+            for (SubCalc calcop : calcops) {
                 if (isFirst) {
                     resultValue = calcop.calcValue(methodContext, scale, roundingMode);
-                    if (operator == OPERATOR_NEGATIVE) resultValue = resultValue.negate();
+                    if (operator == OPERATOR_NEGATIVE)
+                        resultValue = resultValue.negate();
                     isFirst = false;
                 } else {
                     switch (operator) {
-                    case OPERATOR_ADD:
-                        resultValue = resultValue.add(calcop.calcValue(methodContext, scale, roundingMode));
-                        break;
-                    case OPERATOR_SUBTRACT:
-                    case OPERATOR_NEGATIVE:
-                        resultValue = resultValue.subtract(calcop.calcValue(methodContext, scale, roundingMode));
-                        break;
-                    case OPERATOR_MULTIPLY:
-                        resultValue = resultValue.multiply(calcop.calcValue(methodContext, scale, roundingMode));
-                        break;
-                    case OPERATOR_DIVIDE:
-                        resultValue = resultValue.divide(calcop.calcValue(methodContext, scale, roundingMode), scale, roundingMode);
-                        break;
+                        case OPERATOR_ADD:
+                            resultValue = resultValue.add(calcop.calcValue(methodContext, scale, roundingMode));
+                            break;
+                        case OPERATOR_SUBTRACT:
+                        case OPERATOR_NEGATIVE:
+                            resultValue = resultValue.subtract(calcop.calcValue(methodContext, scale, roundingMode));
+                            break;
+                        case OPERATOR_MULTIPLY:
+                            resultValue = resultValue.multiply(calcop.calcValue(methodContext, scale, roundingMode));
+                            break;
+                        case OPERATOR_DIVIDE:
+                            resultValue = resultValue.divide(calcop.calcValue(methodContext, scale, roundingMode), scale, roundingMode);
+                            break;
                     }
                 }
-                // Debug.logInfo("sub total so far: " + resultValue, module);
             }
-            // Debug.logInfo("calcValue calcop: " + resultValue + "(field=" + fieldAcsr + ", map=" + mapAcsr + ")", module);
             return resultValue;
         }
     }
+
+    public static final class CalculateFactory implements Factory<Calculate> {
+        public Calculate createMethodOperation(Element element, SimpleMethod simpleMethod) {
+            return new Calculate(element, simpleMethod);
+        }
+
+        public String getName() {
+            return "calculate";
+        }
+    }
+
+    protected static class NumberOp implements SubCalc {
+        String valueStr;
+
+        public NumberOp(Element element) {
+            valueStr = element.getAttribute("value");
+        }
+
+        public BigDecimal calcValue(MethodContext methodContext, int scale, int roundingMode) {
+            String valueStr = methodContext.expandString(this.valueStr);
+            Locale locale = methodContext.getLocale();
+            if (locale == null)
+                locale = Locale.getDefault();
+            BigDecimal value;
+            try {
+                BigDecimal parseVal = (BigDecimal) ObjectType.simpleTypeConvert(valueStr, "BigDecimal", null, null, locale, true);
+                value = parseVal.setScale(scale, roundingMode);
+            } catch (Exception e) {
+                Debug.logError(e, "Could not parse the number string: " + valueStr, module);
+                throw new IllegalArgumentException("Could not parse the number string: " + valueStr);
+            }
+            return value;
+        }
+
+    }
+
+    protected static interface SubCalc {
+        public BigDecimal calcValue(MethodContext methodContext, int scale, int roundingMode);
+    }
 }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Log.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Log.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Log.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Log.java Thu Apr 19 15:09:03 2012
@@ -18,52 +18,47 @@
  *******************************************************************************/
 package org.ofbiz.minilang.method.otherops;
 
-import java.util.*;
+import java.util.List;
 
-import org.w3c.dom.*;
 import javolution.util.FastList;
-import org.ofbiz.base.util.*;
-import org.ofbiz.minilang.*;
-import org.ofbiz.minilang.method.*;
+
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilXml;
+import org.ofbiz.minilang.SimpleMethod;
+import org.ofbiz.minilang.method.FieldString;
+import org.ofbiz.minilang.method.MethodContext;
+import org.ofbiz.minilang.method.MethodOperation;
+import org.ofbiz.minilang.method.MethodString;
+import org.ofbiz.minilang.method.StringString;
+import org.w3c.dom.Element;
 
 /**
  * Calculates a result based on nested calcops.
  */
 public class Log extends MethodOperation {
-    public static final class LogFactory implements Factory<Log> {
-        public Log createMethodOperation(Element element, SimpleMethod simpleMethod) {
-            return new Log(element, simpleMethod);
-        }
-
-        public String getName() {
-            return "log";
-        }
-    }
 
     public static final String module = Log.class.getName();
 
     String levelStr;
     String message;
-    Object startLine;
     List<MethodString> methodStrings = null;
+    Object startLine;
 
     public Log(Element element, SimpleMethod simpleMethod) {
         super(element, simpleMethod);
         this.message = element.getAttribute("message");
         this.levelStr = element.getAttribute("level");
         this.startLine = element.getUserData("startLine");
-
         List<? extends Element> methodStringElements = UtilXml.childElementList(element);
         if (methodStringElements.size() > 0) {
             methodStrings = FastList.newInstance();
-
-            for (Element methodStringElement: methodStringElements) {
+            for (Element methodStringElement : methodStringElements) {
                 if ("string".equals(methodStringElement.getNodeName())) {
                     methodStrings.add(new StringString(methodStringElement, simpleMethod));
                 } else if ("field".equals(methodStringElement.getNodeName())) {
                     methodStrings.add(new FieldString(methodStringElement, simpleMethod));
                 } else {
-                    //whoops, invalid tag here, print warning
+                    // whoops, invalid tag here, print warning
                     Debug.logWarning("Found an unsupported tag under the log tag: " + methodStringElement.getNodeName() + "; ignoring", module);
                 }
             }
@@ -74,7 +69,6 @@ public class Log extends MethodOperation
     public boolean exec(MethodContext methodContext) {
         String levelStr = methodContext.expandString(this.levelStr);
         String message = methodContext.expandString(this.message);
-
         int level;
         Integer levelInt = Debug.getLevelFromString(levelStr);
         if (levelInt == null) {
@@ -83,12 +77,10 @@ public class Log extends MethodOperation
         } else {
             level = levelInt.intValue();
         }
-
-        //bail out quick if the logging level isn't on, ie don't even create string
+        // bail out quick if the logging level isn't on, ie don't even create string
         if (!Debug.isOn(level)) {
             return true;
         }
-
         StringBuilder buf = new StringBuilder();
         buf.append("[");
         String methodLocation = this.simpleMethod.getFromLocation();
@@ -104,29 +96,38 @@ public class Log extends MethodOperation
             buf.append(this.startLine);
         }
         buf.append("] ");
-
-        if (message != null) buf.append(message);
-
+        if (message != null)
+            buf.append(message);
         if (methodStrings != null) {
-            for (MethodString methodString: methodStrings) {
+            for (MethodString methodString : methodStrings) {
                 String strValue = methodString.getString(methodContext);
-                if (strValue != null) buf.append(strValue);
+                if (strValue != null)
+                    buf.append(strValue);
             }
         }
-
         Debug.log(level, null, buf.toString(), module);
-
         return true;
     }
 
     @Override
+    public String expandedString(MethodContext methodContext) {
+        // TODO: something more than a stub/dummy
+        return this.rawString();
+    }
+
+    @Override
     public String rawString() {
         // TODO: add all attributes and other info
         return "<log level=\"" + this.levelStr + "\" message=\"" + this.message + "\"/>";
     }
-    @Override
-    public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+
+    public static final class LogFactory implements Factory<Log> {
+        public Log createMethodOperation(Element element, SimpleMethod simpleMethod) {
+            return new Log(element, simpleMethod);
+        }
+
+        public String getName() {
+            return "log";
+        }
     }
 }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/PropertyToField.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/PropertyToField.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/PropertyToField.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/PropertyToField.java Thu Apr 19 15:09:03 2012
@@ -18,39 +18,35 @@
  *******************************************************************************/
 package org.ofbiz.minilang.method.otherops;
 
-import java.text.*;
-import java.util.*;
+import java.text.MessageFormat;
+import java.util.List;
+import java.util.Map;
 
-import org.w3c.dom.*;
 import javolution.util.FastMap;
-import org.ofbiz.base.util.*;
+
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.util.EntityUtilProperties;
-import org.ofbiz.minilang.*;
-import org.ofbiz.minilang.method.*;
+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 properties file property value to a field
  */
 public class PropertyToField extends MethodOperation {
-    public static final class PropertyToFieldFactory implements Factory<PropertyToField> {
-        public PropertyToField createMethodOperation(Element element, SimpleMethod simpleMethod) {
-            return new PropertyToField(element, simpleMethod);
-        }
-
-        public String getName() {
-            return "property-to-field";
-        }
-    }
 
     public static final String module = PropertyToField.class.getName();
 
-    String resource;
-    String property;
-    ContextAccessor<Map<String, Object>> mapAcsr;
-    ContextAccessor<Object> fieldAcsr;
+    ContextAccessor<List<? extends Object>> argListAcsr;
     String defaultVal;
+    ContextAccessor<Object> fieldAcsr;
+    ContextAccessor<Map<String, Object>> mapAcsr;
     boolean noLocale;
-    ContextAccessor<List<? extends Object>> argListAcsr;
+    String property;
+    String resource;
 
     public PropertyToField(Element element, SimpleMethod simpleMethod) {
         super(element, simpleMethod);
@@ -69,7 +65,6 @@ public class PropertyToField extends Met
     public boolean exec(MethodContext methodContext) {
         String resource = methodContext.expandString(this.resource);
         String property = methodContext.expandString(this.property);
-
         String value = null;
         if (noLocale) {
             value = EntityUtilProperties.getPropertyValue(resource, property, methodContext.getDelegator());
@@ -79,24 +74,21 @@ public class PropertyToField extends Met
         if (UtilValidate.isEmpty(value)) {
             value = defaultVal;
         }
-
         // note that expanding the value string here will handle defaultValue and the string from
-        //  the properties file; if we decide later that we don't want the string from the properties
-        //  file to be expanded we should just expand the defaultValue at the beginning of this method.
+        // the properties file; if we decide later that we don't want the string from the properties
+        // file to be expanded we should just expand the defaultValue at the beginning of this method.
         value = methodContext.expandString(value);
-
         if (!argListAcsr.isEmpty()) {
             List<? extends Object> argList = argListAcsr.get(methodContext);
             if (UtilValidate.isNotEmpty(argList)) {
                 value = MessageFormat.format(value, argList.toArray());
             }
         }
-
         if (!mapAcsr.isEmpty()) {
             Map<String, Object> toMap = mapAcsr.get(methodContext);
-
             if (toMap == null) {
-                if (Debug.infoOn()) Debug.logInfo("Map not found with name " + mapAcsr + ", creating new map", module);
+                if (Debug.infoOn())
+                    Debug.logInfo("Map not found with name " + mapAcsr + ", creating new map", module);
                 toMap = FastMap.newInstance();
                 mapAcsr.put(methodContext, toMap);
             }
@@ -104,18 +96,28 @@ public class PropertyToField extends Met
         } else {
             fieldAcsr.put(methodContext, value);
         }
-
         return true;
     }
 
     @Override
+    public String expandedString(MethodContext methodContext) {
+        // TODO: something more than a stub/dummy
+        return this.rawString();
+    }
+
+    @Override
     public String rawString() {
         // TODO: add all attributes and other info
         return "<property-to-field field-name=\"" + this.fieldAcsr + "\" map-name=\"" + this.mapAcsr + "\"/>";
     }
-    @Override
-    public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+
+    public static final class PropertyToFieldFactory implements Factory<PropertyToField> {
+        public PropertyToField createMethodOperation(Element element, SimpleMethod simpleMethod) {
+            return new PropertyToField(element, simpleMethod);
+        }
+
+        public String getName() {
+            return "property-to-field";
+        }
     }
 }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/serviceops/FieldToResult.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/serviceops/FieldToResult.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/serviceops/FieldToResult.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/serviceops/FieldToResult.java Thu Apr 19 15:09:03 2012
@@ -18,31 +18,24 @@
  *******************************************************************************/
 package org.ofbiz.minilang.method.serviceops;
 
-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;
 
 /**
  * Copies a map field to a Service result entry
  */
 public class FieldToResult extends MethodOperation {
-    public static final class FieldToResultFactory implements Factory<FieldToResult> {
-        public FieldToResult createMethodOperation(Element element, SimpleMethod simpleMethod) {
-            return new FieldToResult(element, simpleMethod);
-        }
-
-        public String getName() {
-            return "field-to-result";
-        }
-    }
 
     public static final String module = FieldToResult.class.getName();
 
-    ContextAccessor<Map<String, ? extends Object>> mapAcsr;
     ContextAccessor<Object> fieldAcsr;
+    ContextAccessor<Map<String, ? extends Object>> mapAcsr;
     ContextAccessor<Object> resultAcsr;
 
     public FieldToResult(Element element, SimpleMethod simpleMethod) {
@@ -58,39 +51,45 @@ public class FieldToResult extends Metho
         // only run this if it is in an SERVICE context
         if (methodContext.getMethodType() == MethodContext.SERVICE) {
             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, module);
                     return true;
                 }
-
                 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, module);
                 return true;
             }
-
             resultAcsr.put(methodContext.getResults(), fieldVal, methodContext);
         }
         return true;
     }
 
     @Override
+    public String expandedString(MethodContext methodContext) {
+        // TODO: something more than a stub/dummy
+        return this.rawString();
+    }
+
+    @Override
     public String rawString() {
         // TODO: add all attributes and other info
         return "<field-to-result field-name=\"" + this.fieldAcsr + "\" map-name=\"" + this.mapAcsr + "\"/>";
     }
-    @Override
-    public String expandedString(MethodContext methodContext) {
-        // TODO: something more than a stub/dummy
-        return this.rawString();
+
+    public static final class FieldToResultFactory implements Factory<FieldToResult> {
+        public FieldToResult createMethodOperation(Element element, SimpleMethod simpleMethod) {
+            return new FieldToResult(element, simpleMethod);
+        }
+
+        public String getName() {
+            return "field-to-result";
+        }
     }
 }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/BaseCompare.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/BaseCompare.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/BaseCompare.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/BaseCompare.java Thu Apr 19 15:09:03 2012
@@ -18,51 +18,41 @@
  *******************************************************************************/
 package org.ofbiz.minilang.operation;
 
-import java.util.*;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
 
-import org.w3c.dom.*;
-import org.ofbiz.base.util.*;
+import org.ofbiz.base.util.ObjectType;
+import org.w3c.dom.Element;
 
 /**
  * Abstract class providing functionality for the compare SimpleMapOperations
  */
 public abstract class BaseCompare extends SimpleMapOperation {
+
+    public static Boolean doRealCompare(Object value1, Object value2, String operator, String type, String format, List<Object> messages, Locale locale, ClassLoader loader, boolean value2InlineConstant) {
+        return ObjectType.doRealCompare(value1, value2, operator, type, format, messages, locale, loader, value2InlineConstant);
+    }
+
+    String format;
     String operator;
     String type;
-    String format;
 
     public BaseCompare(Element element, SimpleMapProcess simpleMapProcess) {
         super(element, simpleMapProcess);
         this.operator = element.getAttribute("operator");
         this.type = element.getAttribute("type");
         this.format = element.getAttribute("format");
-
-        /* -- Let ObjectType handle the default --
-         if (UtilValidate.isEmpty(this.format)) {
-         if ("Date".equals(type)) {
-         this.format = "yyyy-MM-dd";
-         } else if ("Time".equals(type)) {
-         this.format = "HH:mm:ss";
-         } else if ("Timestamp".equals(type)) {
-         this.format = "yyyy-MM-dd HH:mm:ss";
-         }
-         }
-         */
     }
 
     public void doCompare(Object value1, Object value2, List<Object> messages, Locale locale, ClassLoader loader, boolean value2InlineConstant) {
         Boolean success = BaseCompare.doRealCompare(value1, value2, this.operator, this.type, this.format, messages, locale, loader, value2InlineConstant);
-
         if (success != null && success.booleanValue() == false) {
             addMessage(messages, loader, locale);
         }
     }
 
     @Override
-    public void exec(Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) {}
-
-    public static Boolean doRealCompare(Object value1, Object value2, String operator, String type, String format,
-        List<Object> messages, Locale locale, ClassLoader loader, boolean value2InlineConstant) {
-        return ObjectType.doRealCompare(value1, value2, operator, type, format, messages, locale, loader, value2InlineConstant);
+    public void exec(Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) {
     }
 }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Compare.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Compare.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Compare.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Compare.java Thu Apr 19 15:09:03 2012
@@ -18,8 +18,11 @@
  *******************************************************************************/
 package org.ofbiz.minilang.operation;
 
-import java.util.*;
-import org.w3c.dom.*;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.w3c.dom.Element;
 
 /**
  * Compares an in-field to the specified value
@@ -36,7 +39,6 @@ public class Compare extends BaseCompare
     @Override
     public void exec(Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) {
         Object fieldValue = inMap.get(fieldName);
-
         doCompare(fieldValue, value, messages, locale, loader, true);
     }
 }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/CompareField.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/CompareField.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/CompareField.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/CompareField.java Thu Apr 19 15:09:03 2012
@@ -18,8 +18,11 @@
  *******************************************************************************/
 package org.ofbiz.minilang.operation;
 
-import java.util.*;
-import org.w3c.dom.*;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.w3c.dom.Element;
 
 /**
  * Compares the current field to another field

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/ConstantOper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/ConstantOper.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/ConstantOper.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/ConstantOper.java Thu Apr 19 15:09:03 2012
@@ -18,13 +18,16 @@
  *******************************************************************************/
 package org.ofbiz.minilang.operation;
 
-import java.util.*;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
 
-import org.w3c.dom.*;
-import org.ofbiz.base.util.*;
+import org.ofbiz.base.util.UtilXml;
+import org.w3c.dom.Element;
 
 /**
- * <p><b>Title:</b> A MakeInStringOperation that appends the specified constant string
+ * <p>
+ * <b>Title:</b> A MakeInStringOperation that appends the specified constant string
  */
 public class ConstantOper extends MakeInStringOperation {
 

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Convert.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Convert.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Convert.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Convert.java Thu Apr 19 15:09:03 2012
@@ -32,13 +32,14 @@ import org.w3c.dom.Element;
  * Convert the current field from the in-map and place it in the out-map
  */
 public class Convert extends SimpleMapOperation {
+
     public static final String module = Convert.class.getName();
 
-    String toField;
-    String type;
+    String format;
     boolean replace = true;
     boolean setIfNull = true;
-    String format;
+    String toField;
+    String type;
 
     public Convert(Element element, SimpleMapProcess simpleMapProcess) {
         super(element, simpleMapProcess);
@@ -46,26 +47,22 @@ public class Convert extends SimpleMapOp
         if (UtilValidate.isEmpty(this.toField)) {
             this.toField = this.fieldName;
         }
-
         type = element.getAttribute("type");
         // if anything but false it will be true
         replace = !"false".equals(element.getAttribute("replace"));
         // if anything but false it will be true
         setIfNull = !"false".equals(element.getAttribute("set-if-null"));
-
         format = element.getAttribute("format");
     }
 
     @Override
     public void exec(Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) {
         Object fieldObject = inMap.get(fieldName);
-
         if (fieldObject == null) {
             if (setIfNull && (replace || !results.containsKey(toField)))
                 results.put(toField, null);
             return;
         }
-
         // if an incoming string is empty,
         // set to null if setIfNull is true, otherwise do nothing, ie treat as if null
         if (fieldObject instanceof java.lang.String) {
@@ -75,9 +72,7 @@ public class Convert extends SimpleMapOp
                 return;
             }
         }
-
         Object convertedObject = null;
-
         try {
             convertedObject = ObjectType.simpleTypeConvert(fieldObject, type, format, locale);
         } catch (GeneralException e) {
@@ -85,10 +80,8 @@ public class Convert extends SimpleMapOp
             Debug.logError(e, "Error in convert simple-map-processor operation: " + e.toString(), module);
             return;
         }
-
         if (convertedObject == null)
             return;
-
         if (replace) {
             results.put(toField, convertedObject);
             // if (Debug.infoOn()) Debug.logInfo("[SimpleMapProcessor.Converted.exec] Put converted value \"" + convertedObject + "\" in field \"" + toField + "\"", module);

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Copy.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Copy.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Copy.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Copy.java Thu Apr 19 15:09:03 2012
@@ -18,10 +18,12 @@
  *******************************************************************************/
 package org.ofbiz.minilang.operation;
 
-import java.util.*;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
 
 import org.ofbiz.base.util.UtilValidate;
-import org.w3c.dom.*;
+import org.w3c.dom.Element;
 
 /**
  * Copies a field in the in-map to the out-map
@@ -38,7 +40,6 @@ public class Copy extends SimpleMapOpera
         if (UtilValidate.isEmpty(this.toField)) {
             this.toField = this.fieldName;
         }
-
         // if anything but false it will be true
         replace = !"false".equals(element.getAttribute("replace"));
         // if anything but false it will be true
@@ -48,10 +49,8 @@ public class Copy extends SimpleMapOpera
     @Override
     public void exec(Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) {
         Object fieldValue = inMap.get(fieldName);
-
         if (fieldValue == null && !setIfNull)
             return;
-
         if (fieldValue instanceof java.lang.String) {
             if (((String) fieldValue).length() == 0) {
                 if (setIfNull && (replace || !results.containsKey(toField))) {
@@ -60,7 +59,6 @@ public class Copy extends SimpleMapOpera
                 return;
             }
         }
-
         if (replace) {
             results.put(toField, fieldValue);
             // if (Debug.infoOn()) Debug.logInfo("[SimpleMapProcessor.Copy.exec] Copied \"" + fieldValue + "\" to field \"" + toField + "\"", module);

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/InFieldOper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/InFieldOper.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/InFieldOper.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/InFieldOper.java Thu Apr 19 15:09:03 2012
@@ -18,10 +18,14 @@
  *******************************************************************************/
 package org.ofbiz.minilang.operation;
 
-import java.util.*;
-
-import org.w3c.dom.*;
-import org.ofbiz.base.util.*;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.GeneralException;
+import org.ofbiz.base.util.ObjectType;
+import org.w3c.dom.Element;
 
 /**
  * A MakeInStringOperation that inserts the value of an in-field
@@ -40,7 +44,6 @@ public class InFieldOper extends MakeInS
     @Override
     public String exec(Map<String, Object> inMap, List<Object> messages, Locale locale, ClassLoader loader) {
         Object obj = inMap.get(fieldName);
-
         if (obj == null) {
             Debug.logWarning("[SimpleMapProcessor.InFieldOper.exec] In field " + fieldName + " not found, not appending anything", module);
             return null;

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MakeInString.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MakeInString.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MakeInString.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MakeInString.java Thu Apr 19 15:09:03 2012
@@ -18,12 +18,16 @@
  *******************************************************************************/
 package org.ofbiz.minilang.operation;
 
-import java.util.*;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
 
 import javolution.util.FastList;
 
-import org.w3c.dom.*;
-import org.ofbiz.base.util.*;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.base.util.UtilXml;
+import org.w3c.dom.Element;
 
 /**
  * The container of MakeInString operations to make a new input String
@@ -37,13 +41,10 @@ public class MakeInString {
 
     public MakeInString(Element makeInStringElement) {
         fieldName = makeInStringElement.getAttribute("field");
-
         List<? extends Element> operationElements = UtilXml.childElementList(makeInStringElement);
-
         if (UtilValidate.isNotEmpty(operationElements)) {
-            for (Element curOperElem: operationElements) {
+            for (Element curOperElem : operationElements) {
                 String nodeName = curOperElem.getNodeName();
-
                 if ("in-field".equals(nodeName)) {
                     operations.add(new InFieldOper(curOperElem));
                 } else if ("property".equals(nodeName)) {
@@ -59,9 +60,8 @@ public class MakeInString {
 
     public void exec(Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) {
         StringBuilder buffer = new StringBuilder();
-        for (MakeInStringOperation oper: operations) {
+        for (MakeInStringOperation oper : operations) {
             String curStr = oper.exec(inMap, messages, locale, loader);
-
             if (curStr != null)
                 buffer.append(curStr);
         }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MakeInStringOperation.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MakeInStringOperation.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MakeInStringOperation.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MakeInStringOperation.java Thu Apr 19 15:09:03 2012
@@ -18,15 +18,19 @@
  *******************************************************************************/
 package org.ofbiz.minilang.operation;
 
-import java.util.*;
-import org.w3c.dom.*;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.w3c.dom.Element;
 
 /**
  * Abstract class defining the interface to a MakeInString operation
  */
 public abstract class MakeInStringOperation {
 
-    public MakeInStringOperation(Element element) {}
+    public MakeInStringOperation(Element element) {
+    }
 
     public abstract String exec(Map<String, Object> inMap, List<Object> messages, Locale locale, ClassLoader loader);
 }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MapProcessor.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MapProcessor.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MapProcessor.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MapProcessor.java Thu Apr 19 15:09:03 2012
@@ -18,52 +18,51 @@
  *******************************************************************************/
 package org.ofbiz.minilang.operation;
 
-import java.util.*;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
 
 import javolution.util.FastList;
-import org.w3c.dom.*;
-import org.ofbiz.base.util.*;
+
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.base.util.UtilXml;
+import org.w3c.dom.Element;
 
 /**
  * Map Processor Main Class
  */
 public class MapProcessor {
 
-    String name;
     List<MakeInString> makeInStrings = FastList.newInstance();
+    String name;
     List<SimpleMapProcess> simpleMapProcesses = FastList.newInstance();
 
     public MapProcessor(Element simpleMapProcessorElement) {
         name = simpleMapProcessorElement.getAttribute("name");
-
-        for (Element makeInStringElement: UtilXml.childElementList(simpleMapProcessorElement, "make-in-string")) {
+        for (Element makeInStringElement : UtilXml.childElementList(simpleMapProcessorElement, "make-in-string")) {
             MakeInString makeInString = new MakeInString(makeInStringElement);
-
             makeInStrings.add(makeInString);
         }
-
-        for (Element simpleMapProcessElement: UtilXml.childElementList(simpleMapProcessorElement, "process")) {
+        for (Element simpleMapProcessElement : UtilXml.childElementList(simpleMapProcessorElement, "process")) {
             SimpleMapProcess strProc = new SimpleMapProcess(simpleMapProcessElement);
-
             simpleMapProcesses.add(strProc);
         }
     }
 
-    public String getName() {
-        return name;
-    }
-
     public void exec(Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) {
         if (UtilValidate.isNotEmpty(makeInStrings)) {
-            for (MakeInString makeInString: makeInStrings) {
+            for (MakeInString makeInString : makeInStrings) {
                 makeInString.exec(inMap, results, messages, locale, loader);
             }
         }
-
         if (UtilValidate.isNotEmpty(simpleMapProcesses)) {
-            for (SimpleMapProcess simpleMapProcess: simpleMapProcesses) {
+            for (SimpleMapProcess simpleMapProcess : simpleMapProcesses) {
                 simpleMapProcess.exec(inMap, results, messages, locale, loader);
             }
         }
     }
+
+    public String getName() {
+        return name;
+    }
 }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/NotEmpty.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/NotEmpty.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/NotEmpty.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/NotEmpty.java Thu Apr 19 15:09:03 2012
@@ -18,10 +18,12 @@
  *******************************************************************************/
 package org.ofbiz.minilang.operation;
 
-import java.util.*;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
 
-import org.w3c.dom.*;
-import org.ofbiz.base.util.*;
+import org.ofbiz.base.util.UtilValidate;
+import org.w3c.dom.Element;
 
 /**
  * Checks to see if the current field is empty (null or zero length)
@@ -35,10 +37,8 @@ public class NotEmpty extends SimpleMapO
     @Override
     public void exec(Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) {
         Object obj = inMap.get(fieldName);
-
         if (obj instanceof java.lang.String) {
             String fieldValue = (java.lang.String) obj;
-
             if (!UtilValidate.isNotEmpty(fieldValue)) {
                 addMessage(messages, loader, locale);
             }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/PropertyOper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/PropertyOper.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/PropertyOper.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/PropertyOper.java Thu Apr 19 15:09:03 2012
@@ -18,10 +18,15 @@
  *******************************************************************************/
 package org.ofbiz.minilang.operation;
 
-import java.util.*;
-
-import org.w3c.dom.*;
-import org.ofbiz.base.util.*;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilProperties;
+import org.ofbiz.base.util.UtilURL;
+import org.ofbiz.base.util.UtilValidate;
+import org.w3c.dom.Element;
 
 /**
  * A MakeInStringOperation that insert the value of a property from a properties file
@@ -30,8 +35,8 @@ public class PropertyOper extends MakeIn
 
     public static final String module = PropertyOper.class.getName();
 
-    String resource;
     String property;
+    String resource;
 
     public PropertyOper(Element element) {
         super(element);

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Regexp.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Regexp.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Regexp.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Regexp.java Thu Apr 19 15:09:03 2012
@@ -35,7 +35,6 @@ import org.w3c.dom.Element;
 public class Regexp extends SimpleMapOperation {
 
     public static final String module = Regexp.class.getName();
-
     private transient static ThreadLocal<CompilerMatcher> compilerMatcher = CompilerMatcher.getThreadLocal();
 
     String expr;
@@ -48,16 +47,13 @@ public class Regexp extends SimpleMapOpe
     @Override
     public void exec(Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) {
         Object obj = inMap.get(fieldName);
-
         String fieldValue = null;
-
         try {
             fieldValue = (String) ObjectType.simpleTypeConvert(obj, "String", null, locale);
         } catch (GeneralException e) {
             messages.add("Could not convert field value for comparison: " + e.getMessage());
             return;
         }
-
         boolean matches = false;
         try {
             matches = compilerMatcher.get().matches(fieldValue, expr);
@@ -65,7 +61,6 @@ public class Regexp extends SimpleMapOpe
             Debug.logError(e, "Regular Expression [" + this.expr + "] is mal-formed: " + e.toString(), module);
             return;
         }
-
         if (!matches) {
             addMessage(messages, loader, locale);
         }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/SimpleMapOperation.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/SimpleMapOperation.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/SimpleMapOperation.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/SimpleMapOperation.java Thu Apr 19 15:09:03 2012
@@ -18,26 +18,30 @@
  *******************************************************************************/
 package org.ofbiz.minilang.operation;
 
-import java.util.*;
-
-import org.w3c.dom.*;
-import org.ofbiz.base.util.*;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.ofbiz.base.util.MessageString;
+import org.ofbiz.base.util.UtilProperties;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.base.util.UtilXml;
+import org.w3c.dom.Element;
 
 /**
  * A single operation, does the specified operation on the given field
  */
 public abstract class SimpleMapOperation {
 
+    String fieldName;
+    boolean isProperty = false;
     String message = null;
     String propertyResource = null;
-    boolean isProperty = false;
     SimpleMapProcess simpleMapProcess;
-    String fieldName;
 
     public SimpleMapOperation(Element element, SimpleMapProcess simpleMapProcess) {
         Element failMessage = UtilXml.firstChildElement(element, "fail-message");
         Element failProperty = UtilXml.firstChildElement(element, "fail-property");
-
         if (failMessage != null) {
             this.message = failMessage.getAttribute("message");
             this.isProperty = false;
@@ -46,13 +50,10 @@ public abstract class SimpleMapOperation
             this.message = failProperty.getAttribute("property");
             this.isProperty = true;
         }
-
         this.simpleMapProcess = simpleMapProcess;
         this.fieldName = simpleMapProcess.getFieldName();
     }
 
-    public abstract void exec(Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader);
-
     public void addMessage(List<Object> messages, ClassLoader loader, Locale locale) {
         if (!isProperty && message != null) {
             messages.add(new MessageString(message, fieldName, true));
@@ -71,4 +72,6 @@ public abstract class SimpleMapOperation
             // if (Debug.infoOn()) Debug.logInfo("[SimpleMapOperation.addMessage] ERROR: No message found", module);
         }
     }
+
+    public abstract void exec(Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader);
 }

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/SimpleMapProcess.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/SimpleMapProcess.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/SimpleMapProcess.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/SimpleMapProcess.java Thu Apr 19 15:09:03 2012
@@ -18,12 +18,16 @@
  *******************************************************************************/
 package org.ofbiz.minilang.operation;
 
-import java.util.*;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
 
 import javolution.util.FastList;
 
-import org.w3c.dom.*;
-import org.ofbiz.base.util.*;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.base.util.UtilXml;
+import org.w3c.dom.Element;
 
 /**
  * A complete string process for a given field; contains multiple string operations
@@ -32,31 +36,29 @@ public class SimpleMapProcess {
 
     public static final String module = SimpleMapProcess.class.getName();
 
-    List<SimpleMapOperation> simpleMapOperations = FastList.newInstance();
     String field = "";
+    List<SimpleMapOperation> simpleMapOperations = FastList.newInstance();
 
     public SimpleMapProcess(Element simpleMapProcessElement) {
         this.field = simpleMapProcessElement.getAttribute("field");
         readOperations(simpleMapProcessElement);
     }
 
-    public String getFieldName() {
-        return field;
-    }
-
     public void exec(Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) {
-        for (SimpleMapOperation simpleMapOperation: simpleMapOperations) {
+        for (SimpleMapOperation simpleMapOperation : simpleMapOperations) {
             simpleMapOperation.exec(inMap, results, messages, locale, loader);
         }
     }
 
+    public String getFieldName() {
+        return field;
+    }
+
     void readOperations(Element simpleMapProcessElement) {
         List<? extends Element> operationElements = UtilXml.childElementList(simpleMapProcessElement);
-
         if (UtilValidate.isNotEmpty(operationElements)) {
-            for (Element curOperElem: operationElements) {
+            for (Element curOperElem : operationElements) {
                 String nodeName = curOperElem.getNodeName();
-
                 if ("validate-method".equals(nodeName)) {
                     simpleMapOperations.add(new ValidateMethod(curOperElem, this));
                 } else if ("compare".equals(nodeName)) {

Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/ValidateMethod.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/ValidateMethod.java?rev=1327981&r1=1327980&r2=1327981&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/ValidateMethod.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/ValidateMethod.java Thu Apr 19 15:09:03 2012
@@ -18,12 +18,15 @@
  *******************************************************************************/
 package org.ofbiz.minilang.operation;
 
-import java.util.*;
-import java.lang.reflect.*;
-
-import org.w3c.dom.*;
-
-import org.ofbiz.base.util.*;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.GeneralException;
+import org.ofbiz.base.util.ObjectType;
+import org.w3c.dom.Element;
 
 /**
  * A string operation that calls a validation method
@@ -32,8 +35,8 @@ public class ValidateMethod extends Simp
 
     public static final String module = ValidateMethod.class.getName();
 
-    String methodName;
     String className;
+    String methodName;
 
     public ValidateMethod(Element element, SimpleMapProcess simpleMapProcess) {
         super(element, simpleMapProcess);
@@ -44,49 +47,37 @@ public class ValidateMethod extends Simp
     @Override
     public void exec(Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) {
         Object obj = inMap.get(fieldName);
-
         String fieldValue = null;
-
         try {
             fieldValue = (String) ObjectType.simpleTypeConvert(obj, "String", null, locale);
         } catch (GeneralException e) {
             messages.add("Could not convert field value for comparison: " + e.getMessage());
             return;
         }
-
         if (loader == null) {
             loader = Thread.currentThread().getContextClassLoader();
         }
-
-        Class<?>[] paramTypes = new Class<?>[] {String.class};
-        Object[] params = new Object[] {fieldValue};
-
+        Class<?>[] paramTypes = new Class<?>[] { String.class };
+        Object[] params = new Object[] { fieldValue };
         Class<?> valClass;
-
         try {
             valClass = loader.loadClass(className);
         } catch (ClassNotFoundException cnfe) {
             String msg = "Could not find validation class: " + className;
-
             messages.add(msg);
             Debug.logError("[ValidateMethod.exec] " + msg, module);
             return;
         }
-
         Method valMethod;
-
         try {
             valMethod = valClass.getMethod(methodName, paramTypes);
         } catch (NoSuchMethodException cnfe) {
             String msg = "Could not find validation method: " + methodName + " of class " + className;
-
             messages.add(msg);
             Debug.logError("[ValidateMethod.exec] " + msg, module);
             return;
         }
-
         Boolean resultBool = Boolean.FALSE;
-
         try {
             resultBool = (Boolean) valMethod.invoke(null, params);
         } catch (Exception e) {
@@ -96,7 +87,6 @@ public class ValidateMethod extends Simp
             Debug.logError("[ValidateMethod.exec] " + msg, module);
             return;
         }
-
         if (!resultBool.booleanValue()) {
             addMessage(messages, loader, locale);
         }