You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2015/01/05 09:50:36 UTC

svn commit: r1649482 [11/26] - in /ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23: ./ applications/accounting/src/org/ofbiz/accounting/invoice/ applications/accounting/src/org/ofbiz/accounting/payment/ applications/accounting/src/org/ofbiz/ac...

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilHttp.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilHttp.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilHttp.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilHttp.java Mon Jan  5 08:50:30 2015
@@ -53,8 +53,6 @@ import org.apache.oro.text.regex.Malform
 import org.apache.oro.text.regex.Pattern;
 import org.apache.oro.text.regex.PatternMatcher;
 import org.apache.oro.text.regex.Perl5Matcher;
-import org.owasp.esapi.errors.EncodingException;
-import org.owasp.esapi.errors.IntrusionException;
 
 import com.ibm.icu.util.Calendar;
 
@@ -155,10 +153,6 @@ public class UtilHttp {
         return canonicalizeParameterMap(paramMap);
     }
 
-    public static Map<String, Object> getQueryStringOnlyParameterMap(HttpServletRequest request) {
-        return getQueryStringOnlyParameterMap(request.getQueryString());
-    }
-
     public static Map<String, Object> getQueryStringOnlyParameterMap(String queryString) {
         Map<String, Object> paramMap = new HashMap<String, Object>();
         if (UtilValidate.isNotEmpty(queryString)) {
@@ -232,13 +226,9 @@ public class UtilHttp {
     }
 
     public static Map<String, Object> getUrlOnlyParameterMap(HttpServletRequest request) {
-        return getUrlOnlyParameterMap(request.getQueryString(), request.getPathInfo());
-    }
-
-    public static Map<String, Object> getUrlOnlyParameterMap(String queryString, String pathInfo) {
         // NOTE: these have already been through canonicalizeParameterMap, so not doing it again here
-        Map<String, Object> paramMap = getQueryStringOnlyParameterMap(queryString);
-        paramMap.putAll(getPathInfoOnlyParameterMap(pathInfo, null, null));
+        Map<String, Object> paramMap = getQueryStringOnlyParameterMap(request.getQueryString());
+        paramMap.putAll(getPathInfoOnlyParameterMap(request.getPathInfo(), null, null));
         return paramMap;
     }
 
@@ -259,10 +249,11 @@ public class UtilHttp {
 
     public static String canonicalizeParameter(String paramValue) {
         try {
-            String cannedStr = StringUtil.defaultWebEncoder.canonicalize(paramValue, StringUtil.esapiCanonicalizeStrict);
+            /** calling canonicalize with strict flag set to false so we only get warnings about double encoding, etc; can be set to true for exceptions and more security */
+            String cannedStr = UtilCodec.canonicalize(paramValue, false);
             if (Debug.verboseOn()) Debug.logVerbose("Canonicalized parameter with " + (cannedStr.equals(paramValue) ? "no " : "") + "change: original [" + paramValue + "] canned [" + cannedStr + "]", module);
             return cannedStr;
-        } catch (IntrusionException e) {
+        } catch (Exception e) {
             Debug.logError(e, "Error in canonicalize parameter value [" + paramValue + "]: " + e.toString(), module);
             return paramValue;
         }
@@ -799,22 +790,14 @@ public class UtilHttp {
                                 buf.append("&");
                             }
                         }
-                        try {
-                            buf.append(StringUtil.defaultWebEncoder.encodeForURL(name));
-                        } catch (EncodingException e) {
-                            Debug.logError(e, module);
-                        }
+                        buf.append(UtilCodec.getEncoder("url").encode(name));
                         /* the old way: try {
                             buf.append(URLEncoder.encode(name, "UTF-8"));
                         } catch (UnsupportedEncodingException e) {
                             Debug.logError(e, module);
                         } */
                         buf.append('=');
-                        try {
-                            buf.append(StringUtil.defaultWebEncoder.encodeForURL(valueStr));
-                        } catch (EncodingException e) {
-                            Debug.logError(e, module);
-                        }
+                        buf.append(UtilCodec.getEncoder("url").encode(valueStr));
                         /* the old way: try {
                             buf.append(URLEncoder.encode(valueStr, "UTF-8"));
                         } catch (UnsupportedEncodingException e) {

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilMisc.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilMisc.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilMisc.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilMisc.java Mon Jan  5 08:50:30 2015
@@ -722,46 +722,40 @@ public class UtilMisc {
      * @param localeObject An Object representing the locale
      */
     public static Locale ensureLocale(Object localeObject) {
-        if (localeObject != null && localeObject instanceof String) {
-            localeObject = UtilMisc.parseLocale((String) localeObject);
-        }
-        if (localeObject != null && localeObject instanceof Locale) {
+        if (localeObject instanceof String) {
+            return parseLocale((String) localeObject);
+        } else if (localeObject instanceof Locale) {
             return (Locale) localeObject;
         }
         return Locale.getDefault();
     }
 
-    public static List<Locale> availableLocaleList = null;
-    /** Returns a List of available locales sorted by display name */
-    public static List<Locale> availableLocales() {
-        if (availableLocaleList == null) {
-            synchronized(UtilMisc.class) {
-                if (availableLocaleList == null) {
-                    TreeMap<String, Locale> localeMap = new TreeMap<String, Locale>();
-                    String localesString = UtilProperties.getPropertyValue("general", "locales.available");
-                    if (UtilValidate.isNotEmpty(localesString)) { // check if available locales need to be limited according general.properties file
-                        int end = -1;
-                        int start = 0;
-                        for (int i=0; start < localesString.length(); i++) {
-                            end = localesString.indexOf(",", start);
-                            if (end == -1) {
-                                end = localesString.length();
-                            }
-                            Locale curLocale = UtilMisc.ensureLocale(localesString.substring(start, end));
-                            localeMap.put(curLocale.getDisplayName(), curLocale);
-                            start = end + 1;
-                        }
-                    } else {
-                        Locale[] locales = Locale.getAvailableLocales();
-                        for (int i = 0; i < locales.length && locales[i] != null; i++) {
-                            localeMap.put(locales[i].getDisplayName(), locales[i]);
-                        }
-                    }
-                    availableLocaleList = new LinkedList<Locale>(localeMap.values());
+    // Private lazy-initializer class
+    private static class LocaleHolder {
+        private static final List<Locale> availableLocaleList = getAvailableLocaleList();
+
+        private static List<Locale> getAvailableLocaleList() {
+            TreeMap<String, Locale> localeMap = new TreeMap<String, Locale>();
+            String localesString = UtilProperties.getPropertyValue("general", "locales.available");
+            if (UtilValidate.isNotEmpty(localesString)) {
+                List<String> idList = StringUtil.split(localesString, ",");
+                for (String id : idList) {
+                    Locale curLocale = parseLocale(id);
+                    localeMap.put(curLocale.getDisplayName(), curLocale);
+                }
+            } else {
+                Locale[] locales = Locale.getAvailableLocales();
+                for (int i = 0; i < locales.length && locales[i] != null; i++) {
+                    localeMap.put(locales[i].getDisplayName(), locales[i]);
                 }
             }
+            return Collections.unmodifiableList(new ArrayList<Locale>(localeMap.values()));
         }
-        return availableLocaleList;
+    }
+
+    /** Returns a List of available locales sorted by display name */
+    public static List<Locale> availableLocales() {
+        return LocaleHolder.availableLocaleList;
     }
 
     /** @deprecated use Thread.sleep() */

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilProperties.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilProperties.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilProperties.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilProperties.java Mon Jan  5 08:50:30 2015
@@ -30,6 +30,7 @@ import java.math.BigInteger;
 import java.net.URL;
 import java.text.MessageFormat;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashSet;
 import java.util.InvalidPropertiesFormatException;
@@ -77,8 +78,6 @@ public class UtilProperties implements S
      */
     private static final UtilCache<String, Properties> urlCache = UtilCache.createUtilCache("properties.UtilPropertiesUrlCache");
 
-    protected static Locale fallbackLocale = null;
-    protected static Set<Locale> defaultCandidateLocales = null;
     protected static Set<String> propertiesNotFound = new HashSet<String>();
 
     /** Compares the specified property to the compareString, returns true if they are the same, false otherwise
@@ -746,29 +745,31 @@ public class UtilProperties implements S
 
     // ========= Classes and Methods for expanded Properties file support ========== //
 
+    // Private lazy-initializer class
+    private static class FallbackLocaleHolder {
+        private static final Locale fallbackLocale = getFallbackLocale();
+
+        private static Locale getFallbackLocale() {
+            Locale fallbackLocale = null;
+            String locale = getPropertyValue("general", "locale.properties.fallback");
+            if (UtilValidate.isNotEmpty(locale)) {
+                fallbackLocale = UtilMisc.parseLocale(locale);
+            }
+            if (fallbackLocale == null) {
+                fallbackLocale = Locale.ENGLISH;
+            }
+            return fallbackLocale;
+        }
+    }
+
     /** Returns the configured fallback locale. UtilProperties uses this locale
      * to resolve locale-specific XML properties.<p>The fallback locale can be
      * configured using the <code>locale.properties.fallback</code> property in
      * <code>general.properties</code>.
      * @return The configured fallback locale
-     * @deprecated Use <code>java.util.ResourceBundle.Control.getFallbackLocale(...)</code>
      */
-    @Deprecated
     public static Locale getFallbackLocale() {
-        if (fallbackLocale == null) {
-            synchronized (UtilProperties.class) {
-                if (fallbackLocale == null) {
-                    String locale = getPropertyValue("general", "locale.properties.fallback");
-                    if (UtilValidate.isNotEmpty(locale)) {
-                        fallbackLocale = UtilMisc.parseLocale(locale);
-                    }
-                    if (fallbackLocale == null) {
-                        fallbackLocale = UtilMisc.parseLocale("en");
-                    }
-                }
-            }
-        }
-        return fallbackLocale;
+        return FallbackLocaleHolder.fallbackLocale;
     }
 
     /** Converts a Locale instance to a candidate Locale list. The list
@@ -790,23 +791,26 @@ public class UtilProperties implements S
         return localeList;
     }
 
+    // Private lazy-initializer class
+    private static class CandidateLocalesHolder {
+        private static Set<Locale> defaultCandidateLocales = getDefaultCandidateLocales();
+
+        private static Set<Locale> getDefaultCandidateLocales() {
+            Set<Locale> defaultCandidateLocales = new LinkedHashSet<Locale>();
+            defaultCandidateLocales.addAll(localeToCandidateList(Locale.getDefault()));
+            defaultCandidateLocales.addAll(localeToCandidateList(getFallbackLocale()));
+            defaultCandidateLocales.add(Locale.ROOT);
+            return Collections.unmodifiableSet(defaultCandidateLocales);
+        }
+    }
+
     /** Returns the default candidate Locale list. The list is populated
      * with the JVM's default locale, the OFBiz fallback locale, and
      * the <code>LOCALE_ROOT</code> (empty) locale - in that order.
      * @return A list of default candidate locales.
      */
     public static Set<Locale> getDefaultCandidateLocales() {
-        if (defaultCandidateLocales == null) {
-            synchronized (UtilProperties.class) {
-                if (defaultCandidateLocales == null) {
-                    defaultCandidateLocales = new LinkedHashSet<Locale>();
-                    defaultCandidateLocales.addAll(localeToCandidateList(Locale.getDefault()));
-                    defaultCandidateLocales.addAll(localeToCandidateList(getFallbackLocale()));
-                    defaultCandidateLocales.add(Locale.ROOT);
-                }
-            }
-        }
-        return defaultCandidateLocales;
+        return CandidateLocalesHolder.defaultCandidateLocales;
     }
 
     /** Returns a list of candidate locales based on a supplied locale.
@@ -815,9 +819,7 @@ public class UtilProperties implements S
      * - in that order.
      * @param locale The desired locale
      * @return A list of candidate locales
-     * @deprecated Use <code>java.util.ResourceBundle.Control.getCandidateLocales(...)</code>
      */
-    @Deprecated
     public static List<Locale> getCandidateLocales(Locale locale) {
         // Java 6 conformance
         if (Locale.ROOT.equals(locale)) {
@@ -855,7 +857,7 @@ public class UtilProperties implements S
     }
 
     public static boolean isPropertiesResourceNotFound(String resource, Locale locale, boolean removeExtension) {
-        return propertiesNotFound.contains(UtilProperties.createResourceName(resource, locale, removeExtension));
+        return propertiesNotFound.contains(createResourceName(resource, locale, removeExtension));
     }
 
     /** Resolve a properties file URL.

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilValidate.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilValidate.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilValidate.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilValidate.java Mon Jan  5 08:50:30 2015
@@ -1052,7 +1052,9 @@ public class UtilValidate {
     public static boolean isCreditCard(String stPassed) {
         if (isEmpty(stPassed)) return defaultEmptyOK;
         String st = stripCharsInBag(stPassed, creditCardDelimiters);
-
+		
+		if (!isInteger(st)) return false;
+		
         // encoding only works on cars with less the 19 digits
         if (st.length() > 19) return false;
         return sumIsMod10(getLuhnSum(st));

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java Mon Jan  5 08:50:30 2015
@@ -47,6 +47,7 @@ import javax.servlet.http.HttpServletReq
 import org.ofbiz.base.location.FlexibleLocation;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.StringUtil;
+import org.ofbiz.base.util.UtilCodec;
 import org.ofbiz.base.util.UtilGenerics;
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilProperties;
@@ -687,7 +688,7 @@ public class FreeMarkerWorker {
             te.printStackTrace(pw);
             String stackTrace = tempWriter.toString();
 
-            StringUtil.SimpleEncoder simpleEncoder = FreeMarkerWorker.getWrappedObject("simpleEncoder", env);
+            UtilCodec.SimpleEncoder simpleEncoder = FreeMarkerWorker.getWrappedObject("simpleEncoder", env);
             if (simpleEncoder != null) {
                 stackTrace = simpleEncoder.encode(stackTrace);
             }

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/test/StringUtilTests.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/test/StringUtilTests.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/test/StringUtilTests.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/test/StringUtilTests.java Mon Jan  5 08:50:30 2015
@@ -18,8 +18,6 @@
  *******************************************************************************/
 package org.ofbiz.base.util.test;
 
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -53,18 +51,6 @@ public class StringUtilTests extends Gen
         assertTrue("correct INSTANCE", StringUtil.INSTANCE instanceof StringUtil);
     }
 
-    private static void encoderTest(String label, StringUtil.SimpleEncoder encoder, String wanted, String toEncode) {
-        assertNull(label + "(encoder):null", encoder.encode(null));
-        assertEquals(label + "(encoder):encode", wanted, encoder.encode(toEncode));
-    }
-
-    public void testGetEncoder() {
-        encoderTest("string", StringUtil.getEncoder("string"), "abc\\\"def", "abc\"def");
-        encoderTest("xml", StringUtil.getEncoder("xml"), "&lt;&gt;&#39;&quot;", "<>'\"");
-        encoderTest("html", StringUtil.getEncoder("html"), "&lt;&gt;&#39;&quot;", "<>'\"");
-        assertNull("invalid encoder", StringUtil.getEncoder("foobar"));
-    }
-
     public void testInternString() {
         assertSame("intern-constant", StringUtil.internString("foo"), StringUtil.internString("foo"));
         assertSame("intern-new", StringUtil.internString("foo"), StringUtil.internString(new String("foo")));
@@ -283,29 +269,6 @@ public class StringUtilTests extends Gen
         assertEquals("all converions", "one && two || three > four >= five < six <= seven", StringUtil.convertOperatorSubstitutions("one @and two @or three @gt four @gteq five @lt six @lteq seven"));
     }
 
-    private static void checkStringForHtmlStrictNone_test(String label, String fixed, String input, String... wantedMessages) {
-        List<String> gottenMessages = new ArrayList<String>();
-        assertEquals(label, fixed, StringUtil.checkStringForHtmlStrictNone(label, input, gottenMessages));
-        assertEquals(label, Arrays.asList(wantedMessages), gottenMessages);
-    }
-
-    public void testCheckStringForHtmlStrictNone() {
-        checkStringForHtmlStrictNone_test("null pass-thru", null, null);
-        checkStringForHtmlStrictNone_test("empty pass-thru", "", "");
-        checkStringForHtmlStrictNone_test("o-numeric-encode", "foo", "f&#111;o");
-        checkStringForHtmlStrictNone_test("o-hex-encode", "foo", "f%6fo");
-        checkStringForHtmlStrictNone_test("o-double-hex-encode", "foo", "f%256fo");
-        checkStringForHtmlStrictNone_test("<-not-allowed", "f<oo", "f<oo", "In field [<-not-allowed] less-than (<) and greater-than (>) symbols are not allowed.");
-        checkStringForHtmlStrictNone_test(">-not-allowed", "f>oo", "f>oo", "In field [>-not-allowed] less-than (<) and greater-than (>) symbols are not allowed.");
-        checkStringForHtmlStrictNone_test("high-ascii", "fÀ®", "f%C0%AE");
-        // this looks like a bug, namely the extra trailing ;
-        checkStringForHtmlStrictNone_test("double-ampersand", "f\";oo", "f%26quot%3boo");
-        checkStringForHtmlStrictNone_test("double-encoding", "%2%353Cscript", "%2%353Cscript", "In field [double-encoding] found character escaping (mixed or double) that is not allowed or other format consistency error: org.owasp.esapi.errors.IntrusionException: Input validation failure");
-    }
-
-    public void testCheckStringForHtmlSafeOnly() {
-    }
-
     public void testCollapseNewlines() {
     }
 

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/testdef/basetests.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/testdef/basetests.xml?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/testdef/basetests.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/testdef/basetests.xml Mon Jan  5 08:50:30 2015
@@ -23,9 +23,14 @@
         xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd">
     <test-group case-name="basetests">
         <junit-test-suite class-name="org.ofbiz.base.lang.test.ComparableRangeTests"/>
+        <junit-test-suite class-name="org.ofbiz.base.util.test.AssertTests"/>
         <junit-test-suite class-name="org.ofbiz.base.util.test.IndentingWriterTests"/>
         <junit-test-suite class-name="org.ofbiz.base.util.test.ObjectTypeTests"/>
+        <!--junit-test-suite class-name="org.ofbiz.base.util.test.ReferenceCleanerTests"/-->
         <junit-test-suite class-name="org.ofbiz.base.util.test.UtilObjectTests"/>
+        <junit-test-suite class-name="org.ofbiz.base.util.test.StringUtilTests"/>
+        <junit-test-suite class-name="org.ofbiz.base.util.test.UtilHttpTests"/>
+        <junit-test-suite class-name="org.ofbiz.base.util.test.UtilCodecTests"/>
         <junit-test-suite class-name="org.ofbiz.base.util.string.test.FlexibleStringExpanderTests"/>
         <junit-test-suite class-name="org.ofbiz.base.util.collections.test.FlexibleMapAccessorTests"/>
         <junit-test-suite class-name="org.ofbiz.base.util.test.TimeDurationTests"/>

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/config/CommonUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/config/CommonUiLabels.xml?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/config/CommonUiLabels.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/config/CommonUiLabels.xml Mon Jan  5 08:50:30 2015
@@ -8291,7 +8291,7 @@
         <value xml:lang="de">Bitte wählen</value>
         <value xml:lang="en">please select</value>
         <value xml:lang="es">Por favor, seleccione</value>
-        <value xml:lang="fr">SVP, séléctionnez</value>
+        <value xml:lang="fr">SVP, sélectionnez</value>
         <value xml:lang="ja">選択してください</value>
         <value xml:lang="pt_BR">Por favor, selecione</value>
         <value xml:lang="ru">Пожалуйста выберите</value>
@@ -11797,6 +11797,10 @@
         <value xml:lang="zh_CN">上传</value>
         <value xml:lang="zh_TW">上傳</value>
     </property>
+    <property key="CommonUseBackButton">
+        <value xml:lang="en">Use the browser Back button for that</value>
+        <value xml:lang="fr">Utilisez le bouton de retour de votre navigateur pour cela</value>
+    </property>
     <property key="CommonUsed">
         <value xml:lang="ar">مستعمل</value>
         <value xml:lang="cs">Použito</value>

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/entitydef/entitymodel.xml?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/entitydef/entitymodel.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/entitydef/entitymodel.xml Mon Jan  5 08:50:30 2015
@@ -311,12 +311,6 @@ under the License.
     <extend-entity entity-name="Visit">
         <field name="clientIpStateProvGeoId" type="id"></field>
         <field name="clientIpCountryGeoId" type="id"></field>
-        <relation type="one" fk-name="VISIT_CIP_STPRV" title="ClientIpStateProv" rel-entity-name="Geo">
-            <key-map field-name="clientIpStateProvGeoId" rel-field-name="geoId"/>
-        </relation>
-        <relation type="one" fk-name="VISIT_CIP_CNTRY" title="ClientIpCountry" rel-entity-name="Geo">
-            <key-map field-name="clientIpCountryGeoId" rel-field-name="geoId"/>
-        </relation>
     </extend-entity>
  
   <!-- ========================================================= -->

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/CommonServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/CommonServices.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/CommonServices.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/CommonServices.java Mon Jan  5 08:50:30 2015
@@ -46,7 +46,7 @@ import javax.mail.internet.MimeMessage;
 import org.ofbiz.base.metrics.Metrics;
 import org.ofbiz.base.metrics.MetricsFactory;
 import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.StringUtil;
+import org.ofbiz.base.util.UtilCodec;
 import org.ofbiz.base.util.UtilDateTime;
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilProperties;
@@ -56,6 +56,7 @@ import org.ofbiz.entity.GenericEntityExc
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.model.ModelEntity;
 import org.ofbiz.entity.transaction.TransactionUtil;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.GenericServiceException;
 import org.ofbiz.service.LocalDispatcher;
@@ -63,7 +64,6 @@ import org.ofbiz.service.ModelService;
 import org.ofbiz.service.ServiceSynchronization;
 import org.ofbiz.service.ServiceUtil;
 import org.ofbiz.service.mail.MimeMessageWrapper;
-import org.owasp.esapi.errors.EncodingException;
 
 /**
  * Common Services
@@ -506,7 +506,7 @@ public class CommonServices {
 
         long count = -1;
         try {
-            count = delegator.findCountByCondition("SequenceValueItem", null, null, null);
+            count = EntityQuery.use(delegator).from("SequenceValueItem").queryCount();
         } catch (GenericEntityException e) {
             Debug.logError(e.getMessage(), module);
             return ServiceUtil.returnError(UtilProperties.getMessage(resource, "CommonPingDatasourceCannotConnect", locale));
@@ -538,17 +538,15 @@ public class CommonServices {
     }
 
     public static Map<String, Object> resetMetric(DispatchContext dctx, Map<String, ?> context) {
-        String name = (String) context.get("name");
-        try {
-            name = StringUtil.defaultWebEncoder.decodeFromURL(name);
-        } catch (EncodingException e) {
-            return ServiceUtil.returnError("Exception thrown while decoding metric name \"" + name + "\"");
+        String originalName = (String) context.get("name");
+        String name = UtilCodec.getDecoder("url").decode(originalName);
+        if (name == null) {
+            return ServiceUtil.returnError("Exception thrown while decoding metric name \"" + originalName + "\"");
         }
         Metrics metric = MetricsFactory.getMetric(name);
         if (metric != null) {
             metric.reset();
             return ServiceUtil.returnSuccess();
-
         }
         return ServiceUtil.returnError("Metric \"" + name + "\" not found.");
     }

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/CommonWorkers.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/CommonWorkers.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/CommonWorkers.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/CommonWorkers.java Mon Jan  5 08:50:30 2015
@@ -65,7 +65,7 @@ public class CommonWorkers {
 
         List<GenericValue> countriesList = new LinkedList<GenericValue>();
         try {
-            countriesList = delegator.findList("Geo", EntityCondition.makeCondition(exprs), null, UtilMisc.toList("geoName"), null, true);
+            countriesList = EntityQuery.use(delegator).from("Geo").where(exprs).orderBy("geoName").cache(true).queryList();
         } catch (GenericEntityException e) {
             Debug.logError(e, "Cannot lookup Geo", module);
         }
@@ -93,9 +93,8 @@ public class CommonWorkers {
         List<GenericValue> geoList = new LinkedList<GenericValue>();
         EntityCondition condition = EntityCondition.makeCondition(EntityOperator.OR, EntityCondition.makeCondition("geoTypeId", "STATE"), EntityCondition.makeCondition("geoTypeId", "PROVINCE"), EntityCondition.makeCondition("geoTypeId", "TERRITORY"),
                 EntityCondition.makeCondition("geoTypeId", "MUNICIPALITY"));
-        List<String> sortList = UtilMisc.toList("geoName");
         try {
-            geoList = delegator.findList("Geo", condition, null, sortList, null, true);
+            geoList = EntityQuery.use(delegator).from("Geo").where(condition).orderBy("geoName").cache(true).queryList();
         } catch (GenericEntityException e) {
             Debug.logError(e, "Cannot lookup State Geos: " + e.toString(), module);
         }
@@ -124,11 +123,20 @@ public class CommonWorkers {
         try {
             // Check if the country is a country group and get recursively the
             // states
-            EntityCondition stateRegionFindCond = EntityCondition.makeCondition(EntityCondition.makeCondition("geoIdFrom", country), EntityCondition.makeCondition("geoAssocTypeId", "GROUP_MEMBER"), EntityCondition.makeCondition("geoTypeId", "GROUP"));
-            List<GenericValue> regionList = delegator.findList("GeoAssocAndGeoToWithState", stateRegionFindCond, null, sortList, null, true);
+            List<GenericValue> regionList = EntityQuery.use(delegator)
+                                                       .from("GeoAssocAndGeoToWithState")
+                                                       .where("geoIdFrom", country, "geoAssocTypeId", "GROUP_MEMBER", "geoTypeId", "GROUP")
+                                                       .orderBy(sortList)
+                                                       .cache(true)
+                                                       .queryList();
             if (regionList.size() == 1) {
                 for (GenericValue region : regionList) {
-                    List<GenericValue> tmpState = delegator.findList("GeoAssocAndGeoTo", EntityCondition.makeCondition("geoId", region.getString("geoIdFrom")), null, sortList, null, true);
+                    List<GenericValue> tmpState = EntityQuery.use(delegator)
+                                                             .from("GeoAssocAndGeoTo")
+                                                             .where("geoId", region.getString("geoIdFrom"))
+                                                             .orderBy(sortList)
+                                                             .cache(true)
+                                                             .queryList();
                     for (GenericValue state : tmpState) {
                         geoList.addAll(getAssociatedStateList(delegator, state.getString("geoIdFrom"), listOrderBy));
                     }
@@ -141,8 +149,14 @@ public class CommonWorkers {
                     EntityCondition.makeCondition("geoAssocTypeId", "REGIONS"),
                     EntityCondition.makeCondition(EntityOperator.OR, EntityCondition.makeCondition("geoTypeId", "STATE"), EntityCondition.makeCondition("geoTypeId", "PROVINCE"), EntityCondition.makeCondition("geoTypeId", "MUNICIPALITY"),
                             EntityCondition.makeCondition("geoTypeId", "COUNTY")));
-            geoList.addAll(delegator.findList("GeoAssocAndGeoToWithState", stateProvinceFindCond, null, sortList, null, true));
-        } catch (GenericEntityException e) {
+            geoList.addAll(EntityQuery.use(delegator)
+                                      .from("GeoAssocAndGeoToWithState")
+                                      .where(stateProvinceFindCond)
+                                      .orderBy(sortList)
+                                      .cache(true)
+                                      .queryList()
+                          );
+        } catch (GenericEntityException e){
             Debug.logError(e, "Cannot lookup Geo", module);
         }
 

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/FindServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/FindServices.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/FindServices.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/FindServices.java Mon Jan  5 08:50:30 2015
@@ -53,6 +53,7 @@ import org.ofbiz.entity.model.ModelEntit
 import org.ofbiz.entity.model.ModelField;
 import org.ofbiz.entity.util.EntityFindOptions;
 import org.ofbiz.entity.util.EntityListIterator;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.entity.util.EntityUtilProperties;
 import org.ofbiz.service.DispatchContext;
@@ -617,8 +618,15 @@ public class FindServices {
         int listSize = 0;
         try {
             if (noConditionFind || (entityConditionList != null && entityConditionList.getConditionListSize() > 0)) {
-                listIt = delegator.find(entityName, entityConditionList, null, fieldSet, orderByList,
-                        new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, -1, maxRows, distinct));
+                listIt = EntityQuery.use(delegator)
+                                    .select(fieldSet)
+                                    .from(entityName)
+                                    .where(entityConditionList)
+                                    .orderBy(orderByList)
+                                    .cursorScrollInsensitive()
+                                    .maxRows(maxRows)
+                                    .distinct(distinct)
+                                    .queryIterator();
                 listSize = listIt.getResultsSizeAfterPartialList();
             }
         } catch (GenericEntityException e) {

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/KeywordSearchUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/KeywordSearchUtil.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/KeywordSearchUtil.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/KeywordSearchUtil.java Mon Jan  5 08:50:30 2015
@@ -33,6 +33,7 @@ import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 
 /**
  * A few utility methods related to Keyword Search.
@@ -217,7 +218,7 @@ public class KeywordSearchUtil {
         boolean replaceEnteredKeyword = false;
 
         try {
-            List<GenericValue> thesaurusList = delegator.findByAnd("KeywordThesaurus", UtilMisc.toMap("enteredKeyword", enteredKeyword), null, true);
+            List<GenericValue> thesaurusList = EntityQuery.use(delegator).from("KeywordThesaurus").where("enteredKeyword", enteredKeyword).cache(true).queryList();
             for (GenericValue keywordThesaurus: thesaurusList) {
                 String relationshipEnumId = (String) keywordThesaurus.get("relationshipEnumId");
                 if (thesaurusRelsToInclude.contains(relationshipEnumId)) {

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/UrlServletHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/UrlServletHelper.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/UrlServletHelper.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/UrlServletHelper.java Mon Jan  5 08:50:30 2015
@@ -60,7 +60,7 @@ public class UrlServletHelper extends Co
 
                 //Use base delegator for fetching data from entity of entityGroup org.ofbiz.tenant 
                 Delegator baseDelegator = DelegatorFactory.getDelegator(delegator.getDelegatorBaseName());
-                GenericValue tenantDomainName = baseDelegator.findOne("TenantDomainName", UtilMisc.toMap("domainName", serverName), false);
+                GenericValue tenantDomainName = EntityQuery.use(baseDelegator).from("TenantDomainName").where("domainName", serverName).queryOne();
 
                 if (UtilValidate.isNotEmpty(tenantDomainName)) {
                     String tenantId = tenantDomainName.getString("tenantId");
@@ -157,7 +157,11 @@ public class UrlServletHelper extends Co
         // check path alias
         GenericValue pathAlias = null;
         try {
-            pathAlias = EntityQuery.use(delegator).from("WebSitePathAlias").where("webSiteId", webSiteId, "pathAlias", pathInfo).cache().queryOne();
+            pathAlias = EntityQuery.use(delegator)
+                                   .from("WebSitePathAlias")
+                                   .where("webSiteId", webSiteId, "pathAlias", pathInfo)
+                                   .cache()
+                                   .queryOne();
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
         }
@@ -182,7 +186,10 @@ public class UrlServletHelper extends Co
         } else {
             // send 404 error if a URI is alias TO
             try {
-                List<GenericValue> aliasTos = delegator.findByAnd("WebSitePathAlias", UtilMisc.toMap("webSiteId", webSiteId, "aliasTo", httpRequest.getRequestURI()), null, false);
+                List<GenericValue> aliasTos = EntityQuery.use(delegator)
+                                                         .from("WebSitePathAlias")
+                                                         .where("webSiteId", webSiteId, "aliasTo", httpRequest.getRequestURI())
+                                                         .queryList();
                 if (UtilValidate.isNotEmpty(aliasTos)) {
                     httpResponse.sendError(HttpServletResponse.SC_NOT_FOUND, "Not Found");
                     return;

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/email/EmailServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/email/EmailServices.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/email/EmailServices.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/email/EmailServices.java Mon Jan  5 08:50:30 2015
@@ -238,7 +238,7 @@ public class EmailServices {
             }
 
             session = Session.getInstance(props);
-            boolean debug = UtilProperties.propertyValueEqualsIgnoreCase("general.properties", "mail.debug.on", "Y");
+            boolean debug = EntityUtilProperties.propertyValueEqualsIgnoreCase("general.properties", "mail.debug.on", "Y", delegator);
             session.setDebug(debug);
 
             mail = new MimeMessage(session);

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/geo/GeoWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/geo/GeoWorker.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/geo/GeoWorker.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/geo/GeoWorker.java Mon Jan  5 08:50:30 2015
@@ -91,7 +91,11 @@ public class GeoWorker {
         }
         Map<String, String> geoIdByTypeMapTemp =  new LinkedHashMap<String, String>();
         for (Map.Entry<String, String> geoIdByTypeEntry: geoIdByTypeMapOrig.entrySet()) {
-            List<GenericValue> geoAssocList = delegator.findByAnd("GeoAssoc", UtilMisc.toMap("geoIdTo", geoIdByTypeEntry.getValue(), "geoAssocTypeId", "REGIONS"), null, true);
+            List<GenericValue> geoAssocList = EntityQuery.use(delegator)
+                                                         .from("GeoAssoc")
+                                                         .where("geoIdTo", geoIdByTypeEntry.getValue(), "geoAssocTypeId", "REGIONS")
+                                                         .cache(true)
+                                                         .queryList();
             for (GenericValue geoAssoc: geoAssocList) {
                 GenericValue newGeo = EntityQuery.use(delegator).from("Geo").where("geoId", geoAssoc.get("geoId")).cache().queryOne();
                 geoIdByTypeMapTemp.put(newGeo.getString("geoTypeId"), newGeo.getString("geoId"));
@@ -127,13 +131,17 @@ public class GeoWorker {
         List<GenericValue> gptList = null;
         if (UtilValidate.isNotEmpty(secondId) && UtilValidate.isNotEmpty(secondValueId)) {
             try {
-                gptList = delegator.findByAnd(entityName, UtilMisc.toMap(mainId, mainValueId, secondId, secondValueId), UtilMisc.toList("-fromDate"), false);
+                gptList = EntityQuery.use(delegator)
+                                     .from(entityName)
+                                     .where(mainId, mainValueId, secondId, secondValueId)
+                                     .orderBy("-fromDate")
+                                     .queryList();
             } catch (GenericEntityException e) {
                 Debug.logError(e, "Error while finding latest GeoPoint for " + mainId + " with Id [" + mainValueId + "] and " + secondId + " Id [" + secondValueId + "] " + e.toString(), module);
             }
         } else {
             try {
-                gptList = delegator.findByAnd(entityName, UtilMisc.toMap(mainId, mainValueId), UtilMisc.toList("-fromDate"), false);
+                gptList = EntityQuery.use(delegator).from(entityName).where(mainId, mainValueId).orderBy("-fromDate").queryList();
             } catch (GenericEntityException e) {
                 Debug.logError(e, "Error while finding latest GeoPoint for " + mainId + " with Id [" + mainValueId + "] " + e.toString(), module);
             }

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/login/LdapAuthenticationServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/login/LdapAuthenticationServices.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/login/LdapAuthenticationServices.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/login/LdapAuthenticationServices.java Mon Jan  5 08:50:30 2015
@@ -37,6 +37,7 @@ import org.ofbiz.entity.GenericEntityExc
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.transaction.GenericTransactionException;
 import org.ofbiz.entity.transaction.TransactionUtil;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtilProperties;
 import org.ofbiz.service.DispatchContext;
 
@@ -62,7 +63,7 @@ public class LdapAuthenticationServices
         boolean isServiceAuth = context.get("isServiceAuth") != null && ((Boolean) context.get("isServiceAuth")).booleanValue();
         GenericValue userLogin = null;
         try {
-            userLogin = delegator.findOne("UserLogin", isServiceAuth, "userLoginId", username);
+            userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", username).cache(isServiceAuth).queryOne();
         } catch (GenericEntityException e) {
             Debug.logWarning(e, "", module);
         }

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/login/LoginServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/login/LoginServices.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/login/LoginServices.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/login/LoginServices.java Mon Jan  5 08:50:30 2015
@@ -133,7 +133,7 @@ public class LoginServices {
 
                 try {
                     // only get userLogin from cache for service calls; for web and other manual logins there is less time sensitivity
-                    userLogin = delegator.findOne("UserLogin", isServiceAuth, "userLoginId", username);
+                    userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", username).cache(isServiceAuth).queryOne();
                 } catch (GenericEntityException e) {
                     Debug.logWarning(e, "", module);
                 }
@@ -149,7 +149,7 @@ public class LoginServices {
 
                     // check the user login object again
                     try {
-                        userLogin = delegator.findOne("UserLogin", isServiceAuth, "userLoginId", username);
+                    	userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", username).cache(isServiceAuth).queryOne();
                     } catch (GenericEntityException e) {
                         Debug.logWarning(e, "", module);
                     }
@@ -436,9 +436,12 @@ public class LoginServices {
             return;
         }
 
-        EntityFindOptions efo = new EntityFindOptions();
-        efo.setResultSetType(EntityFindOptions.TYPE_SCROLL_INSENSITIVE);
-        EntityListIterator eli = delegator.find("UserLoginPasswordHistory", EntityCondition.makeConditionMap("userLoginId", userLoginId), null, null, UtilMisc.toList("-fromDate"), efo);
+        EntityListIterator eli = EntityQuery.use(delegator)
+                                            .from("UserLoginPasswordHistory")
+                                            .where("userLoginId", userLoginId)
+                                            .orderBy("-fromDate")
+                                            .cursorScrollInsensitive()
+                                            .queryIterator();
         Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
         GenericValue pwdHist;
         if ((pwdHist = eli.next()) != null) {
@@ -532,7 +535,7 @@ public class LoginServices {
 
         try {
             EntityCondition condition = EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("userLoginId"), EntityOperator.EQUALS, EntityFunction.UPPER(userLoginId));
-            if (UtilValidate.isNotEmpty(delegator.findList("UserLogin", condition, null, null, null, false))) {
+            if (UtilValidate.isNotEmpty(EntityQuery.use(delegator).from("UserLogin").where(condition).queryList())) {
                 Map<String, String> messageMap = UtilMisc.toMap("userLoginId", userLoginId);
                 errMsg = UtilProperties.getMessage(resource,"loginservices.could_not_create_login_user_with_ID_exists", messageMap, locale);
                 errorMessageList.add(errMsg);
@@ -925,7 +928,11 @@ public class LoginServices {
         if (passwordChangeHistoryLimit > 0 && userLogin != null) {
             Debug.logInfo(" checkNewPassword Checking if user is tyring to use old password " + passwordChangeHistoryLimit, module);
             try {
-                List<GenericValue> pwdHistList = delegator.findByAnd("UserLoginPasswordHistory", UtilMisc.toMap("userLoginId",userLogin.getString("userLoginId")), UtilMisc.toList("-fromDate"), false);
+                List<GenericValue> pwdHistList = EntityQuery.use(delegator)
+                                                            .from("UserLoginPasswordHistory")
+                                                            .where("userLoginId",userLogin.getString("userLoginId"))
+                                                            .orderBy("-fromDate")
+                                                            .queryList();
                 for (GenericValue pwdHistValue : pwdHistList) {
                     if (checkPassword(pwdHistValue.getString("currentPassword"), useEncryption, newPassword)) {
                         Map<String, Integer> messageMap = UtilMisc.toMap("passwordChangeHistoryLimit", passwordChangeHistoryLimit);

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/preferences/PreferenceServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/preferences/PreferenceServices.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/preferences/PreferenceServices.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/preferences/PreferenceServices.java Mon Jan  5 08:50:30 2015
@@ -33,6 +33,7 @@ import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.ServiceUtil;
@@ -80,7 +81,7 @@ public class PreferenceServices {
 
         Map<String, Object> userPrefMap = null;
         try {
-            GenericValue preference = EntityUtil.getFirst(delegator.findByAnd("UserPreference", fieldMap, null, true));
+            GenericValue preference = EntityQuery.use(delegator).from("UserPreference").where(fieldMap).cache(true).queryFirst();
             if (preference != null) {
                 userPrefMap = PreferenceWorker.createUserPrefMap(preference);
             }
@@ -129,10 +130,10 @@ public class PreferenceServices {
         Map<String, Object> userPrefMap = null;
         try {
             Map<String, String> fieldMap = UtilMisc.toMap("userLoginId", "_NA_", "userPrefGroupTypeId", userPrefGroupTypeId);
-            userPrefMap = PreferenceWorker.createUserPrefMap(delegator.findByAnd("UserPreference", fieldMap, null, true));
+            userPrefMap = PreferenceWorker.createUserPrefMap(EntityQuery.use(delegator).from("UserPreference").where(fieldMap).cache(true).queryList());
             if (userLoginId != null) {
                 fieldMap.put("userLoginId", userLoginId);
-                userPrefMap.putAll(PreferenceWorker.createUserPrefMap(delegator.findByAnd("UserPreference", fieldMap, null, true)));
+                userPrefMap.putAll(PreferenceWorker.createUserPrefMap(EntityQuery.use(delegator).from("UserPreference").where(fieldMap).cache(true).queryList()));
             }
         } catch (GenericEntityException e) {
             Debug.logWarning(e.getMessage(), module);
@@ -207,8 +208,10 @@ public class PreferenceServices {
         }
 
         try {
-            GenericValue rec = delegator.findOne("UserPreference", 
-                    UtilMisc.toMap("userLoginId", userLoginId, "userPrefTypeId", userPrefTypeId), false);
+            GenericValue rec = EntityQuery.use(delegator)
+                                          .from("UserPreference")
+                                          .where("userLoginId", userLoginId, "userPrefTypeId", userPrefTypeId)
+                                          .queryOne();
             if (rec != null) {
                 rec.remove();
             }
@@ -277,8 +280,10 @@ public class PreferenceServices {
         }
 
         try {
-            Map<String, String> fieldMap = UtilMisc.toMap("userLoginId", fromUserLoginId, "userPrefGroupTypeId", userPrefGroupTypeId);
-            List<GenericValue> resultList = delegator.findByAnd("UserPreference", fieldMap, null, false);
+            List<GenericValue> resultList = EntityQuery.use(delegator)
+                                                       .from("UserPreference")
+                                                       .where("userLoginId", fromUserLoginId, "userPrefGroupTypeId", userPrefGroupTypeId)
+                                                       .queryList();
             if (resultList != null) {
                 for (GenericValue preference: resultList) {
                     preference.set("userLoginId", userLoginId);

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/scripting/ScriptHelperImpl.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/scripting/ScriptHelperImpl.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/scripting/ScriptHelperImpl.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/scripting/ScriptHelperImpl.java Mon Jan  5 08:50:30 2015
@@ -38,6 +38,7 @@ import org.ofbiz.entity.GenericEntityExc
 import org.ofbiz.entity.GenericPK;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.model.ModelEntity;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.service.GenericServiceException;
 import org.ofbiz.service.ModelService;
 import org.ofbiz.service.ServiceUtil;
@@ -86,12 +87,12 @@ public final class ScriptHelperImpl impl
         if (entityPK.containsPrimaryKey(true)) {
             try {
                 if (useCache) {
-                    valueOut = delegator.findOne(entityPK.getEntityName(), entityPK, true);
+                    valueOut = EntityQuery.use(delegator).from(entityPK.getEntityName()).where(entityPK).cache(true).queryOne();
                 } else {
                     if (fieldsToSelect != null) {
                         valueOut = delegator.findByPrimaryKeyPartial(entityPK, fieldsToSelect);
                     } else {
-                        valueOut = delegator.findOne(entityPK.getEntityName(), entityPK, false);
+                        valueOut = EntityQuery.use(delegator).from(entityPK.getEntityName()).where(entityPK).queryOne();
                     }
                 }
             } catch (GenericEntityException e) {

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/status/StatusServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/status/StatusServices.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/status/StatusServices.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/status/StatusServices.java Mon Jan  5 08:50:30 2015
@@ -34,6 +34,7 @@ import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.ServiceUtil;
 
@@ -56,7 +57,12 @@ public class StatusServices {
         List<GenericValue> statusItems = new LinkedList<GenericValue>();
         for (String statusTypeId: statusTypes) {
             try {
-                List<GenericValue> myStatusItems = delegator.findByAnd("StatusItem", UtilMisc.toMap("statusTypeId", statusTypeId), UtilMisc.toList("sequenceId"), true);
+                List<GenericValue> myStatusItems = EntityQuery.use(delegator)
+                                                              .from("StatusItem")
+                                                              .where("statusTypeId", statusTypeId)
+                                                              .orderBy("sequenceId")
+                                                              .cache(true)
+                                                              .queryList();
                 statusItems.addAll(myStatusItems);
             } catch (GenericEntityException e) {
                 Debug.logError(e, module);
@@ -72,7 +78,12 @@ public class StatusServices {
         List<GenericValue> statusValidChangeToDetails = null;
         String statusId = (String) context.get("statusId");
         try {
-            statusValidChangeToDetails = delegator.findByAnd("StatusValidChangeToDetail", UtilMisc.toMap("statusId", statusId), UtilMisc.toList("sequenceId"), true);
+            statusValidChangeToDetails = EntityQuery.use(delegator)
+                                                    .from("StatusValidChangeToDetail")
+                                                    .where("statusId", statusId)
+                                                    .orderBy("sequenceId")
+                                                    .cache(true)
+                                                    .queryList();
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
         }

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/status/StatusWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/status/StatusWorker.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/status/StatusWorker.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/src/org/ofbiz/common/status/StatusWorker.java Mon Jan  5 08:50:30 2015
@@ -28,6 +28,7 @@ import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 
 /**
  * StatusWorker
@@ -40,8 +41,12 @@ public class StatusWorker {
         Delegator delegator = (Delegator) pageContext.getRequest().getAttribute("delegator");
 
         try {
-            List<GenericValue> statusItems = delegator.findByAnd("StatusItem", UtilMisc.toMap("statusTypeId", statusTypeId), UtilMisc.toList("sequenceId"), true);
-
+            List<GenericValue> statusItems = EntityQuery.use(delegator)
+                                                        .from("StatusItem")
+                                                        .where("statusTypeId", statusTypeId)
+                                                        .orderBy("sequenceId")
+                                                        .cache(true)
+                                                        .queryList();
             if (statusItems != null)
                 pageContext.setAttribute(attributeName, statusItems);
         } catch (GenericEntityException e) {
@@ -54,16 +59,24 @@ public class StatusWorker {
         List<GenericValue> statusItems = new LinkedList<GenericValue>();
 
         try {
-            List<GenericValue> calItems = delegator.findByAnd("StatusItem", UtilMisc.toMap("statusTypeId", statusTypeIdOne), UtilMisc.toList("sequenceId"), true);
-
+             List<GenericValue> calItems = EntityQuery.use(delegator)
+                                                      .from("StatusItem")
+                                                      .where("statusTypeId", statusTypeIdOne)
+                                                      .orderBy("sequenceId")
+                                                      .cache(true)
+                                                      .queryList();
             if (calItems != null)
                 statusItems.addAll(calItems);
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
         }
         try {
-            List<GenericValue> taskItems = delegator.findByAnd("StatusItem", UtilMisc.toMap("statusTypeId", statusTypeIdTwo), UtilMisc.toList("sequenceId"), true);
-
+            List<GenericValue> taskItems = EntityQuery.use(delegator)
+                                                      .from("StatusItem")
+                                                      .where("statusTypeId", statusTypeIdTwo)
+                                                      .orderBy("sequenceId")
+                                                      .cache(true)
+                                                      .queryList();
             if (taskItems != null)
                 statusItems.addAll(taskItems);
         } catch (GenericEntityException e) {
@@ -79,7 +92,12 @@ public class StatusWorker {
         List<GenericValue> statusValidChangeToDetails = null;
 
         try {
-            statusValidChangeToDetails = delegator.findByAnd("StatusValidChangeToDetail", UtilMisc.toMap("statusId", statusId), UtilMisc.toList("sequenceId"), true);
+            statusValidChangeToDetails = EntityQuery.use(delegator)
+                                                    .from("StatusValidChangeToDetail")
+                                                    .where("statusId", statusId)
+                                                    .orderBy("sequenceId")
+                                                    .cache(true)
+                                                    .queryList();
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
         }

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/webcommon/WEB-INF/actions/includes/ListPortalPortlets.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/webcommon/WEB-INF/actions/includes/ListPortalPortlets.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/webcommon/WEB-INF/actions/includes/ListPortalPortlets.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/webcommon/WEB-INF/actions/includes/ListPortalPortlets.groovy Mon Jan  5 08:50:30 2015
@@ -33,7 +33,7 @@ portalPortlets = [];
         if (listPortalPortlet.securityServiceName && listPortalPortlet.securityMainAction) {
             inMap.mainAction = listPortalPortlet.securityMainAction;
             inMap.userLogin = context.userLogin;
-            result = dispatcher.runSync(listPortalPortlet.securityServiceName, inMap)
+            result = runService(listPortalPortlet.securityServiceName, inMap)
             hasPermission = result.hasPermission;
         } else {
             hasPermission = true;

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/GenericDelegator.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/GenericDelegator.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/GenericDelegator.java Mon Jan  5 08:50:30 2015
@@ -77,6 +77,7 @@ import org.ofbiz.entity.util.Distributed
 import org.ofbiz.entity.util.EntityCrypto;
 import org.ofbiz.entity.util.EntityFindOptions;
 import org.ofbiz.entity.util.EntityListIterator;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.SequenceUtil;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -196,13 +197,13 @@ public class GenericDelegator implements
         // before continuing, if there is a tenantId use the base delegator to see if it is valid
         if (UtilValidate.isNotEmpty(this.delegatorTenantId)) {
             Delegator baseDelegator = DelegatorFactory.getDelegator(this.delegatorBaseName);
-            GenericValue tenant = baseDelegator.findOne("Tenant", true, "tenantId", this.delegatorTenantId);
+            GenericValue tenant = EntityQuery.use(baseDelegator).from("Tenant").where("tenantId", this.delegatorTenantId).cache(true).queryOne();
             if (tenant == null) {
                 throw new GenericEntityException("No Tenant record found for delegator [" + this.delegatorFullName + "] with tenantId [" + this.delegatorTenantId + "]");
             } else if ("Y".equals(tenant.getString("disabled"))) {
                 throw new GenericEntityException("No Tenant record found for delegator [" + this.delegatorFullName + "] with tenantId [" + this.delegatorTenantId + "]");
             }
-            GenericValue kekValue = baseDelegator.findOne("TenantKeyEncryptingKey", true, "tenantId", getDelegatorTenantId());
+            GenericValue kekValue = EntityQuery.use(baseDelegator).from("TenantKeyEncryptingKey").where("tenantId", getDelegatorTenantId()).cache(true).queryOne();
             if (kekValue != null) {
                 kekText = kekValue.getString("kekText");
             } else {
@@ -490,7 +491,7 @@ public class GenericDelegator implements
                 // NOTE: instead of caching the GenericHelpInfo object do a cached query here and create a new object each time, will avoid issues when the database data changes during run time
                 // NOTE: always use the base delegator for this to avoid problems when this is being initialized
                 Delegator baseDelegator = DelegatorFactory.getDelegator(this.delegatorBaseName);
-                GenericValue tenantDataSource = baseDelegator.findOne("TenantDataSource", true, "tenantId", this.delegatorTenantId, "entityGroupName", entityGroupName);
+                GenericValue tenantDataSource = EntityQuery.use(baseDelegator).from("TenantDataSource").where("tenantId", this.delegatorTenantId, "entityGroupName", entityGroupName).cache(true).queryOne();
                 if (tenantDataSource != null) {
                     helperInfo.setTenantId(this.delegatorTenantId);
                     helperInfo.setOverrideJdbcUri(tenantDataSource.getString("jdbcUri"));

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/GenericEntity.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/GenericEntity.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/GenericEntity.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/GenericEntity.java Mon Jan  5 08:50:30 2015
@@ -370,8 +370,7 @@ public class GenericEntity implements Ma
 
     public Object get(String name) {
         if (getModelEntity().getField(name) == null) {
-            Debug.logWarning("The field name (or key) [" + name + "] is not valid for entity [" + this.getEntityName() + "], printing IllegalArgumentException instead of throwing it because Map interface specification does not allow throwing that exception.", module);
-            return null;
+            throw new IllegalArgumentException("The field name (or key) [" + name + "] is not valid for entity [" + this.getEntityName() + "].");
         }
         return fields.get(name);
     }
@@ -784,18 +783,7 @@ public class GenericEntity implements Ma
      *    property value is returned; otherwise returns the field value
      */
     public Object get(String name, String resource, Locale locale) {
-        Object fieldValue = null;
-        try {
-            fieldValue = get(name);
-        } catch (IllegalArgumentException e) {
-            if (Debug.verboseOn()) {
-                Debug.logVerbose(e, "The field name (or key) [" + name + "] is not valid for entity [" + this.getEntityName() + "], printing IllegalArgumentException instead of throwing it because Map interface specification does not allow throwing that exception.", module);
-            } else {
-                Debug.logWarning("The field name (or key) [" + name + "] is not valid for entity [" + this.getEntityName() + "], printing IllegalArgumentException instead of throwing it because Map interface specification does not allow throwing that exception.", module);
-            }
-            return null;
-        }
-
+        Object fieldValue = get(name);
         // In case of view entity first try to retrieve with View field names
         ModelEntity modelEntityToUse = this.getModelEntity();
         Object resourceValue = get(this.getModelEntity(), modelEntityToUse, name, resource, locale);

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java Mon Jan  5 08:50:30 2015
@@ -60,6 +60,7 @@ import org.ofbiz.entity.model.ModelViewE
 import org.ofbiz.entity.transaction.TransactionUtil;
 import org.ofbiz.entity.util.EntityFindOptions;
 import org.ofbiz.entity.util.EntityListIterator;
+import org.ofbiz.entity.util.EntityQuery;
 
 /**
  * Generic Entity Data Access Object - Handles persistence for any defined entity.
@@ -418,7 +419,7 @@ public class GenericDAO {
             List<GenericValue> meResult = null;
 
             try {
-                meResult = delegator.findByAnd(meName, findByMap, null, false);
+                meResult = EntityQuery.use(delegator).from(meName).where(findByMap).queryList();
             } catch (GenericEntityException e) {
                 throw new GenericEntityException("Error while retrieving partial results for entity member: " + meName, e);
             }

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/finder/PrimaryKeyFinder.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/finder/PrimaryKeyFinder.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/finder/PrimaryKeyFinder.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/finder/PrimaryKeyFinder.java Mon Jan  5 08:50:30 2015
@@ -35,6 +35,7 @@ import org.ofbiz.entity.GenericPK;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.model.ModelEntity;
 import org.ofbiz.entity.model.ModelField;
+import org.ofbiz.entity.util.EntityQuery;
 import org.w3c.dom.Element;
 
 /**
@@ -146,12 +147,12 @@ public class PrimaryKeyFinder extends Fi
             // make sure we have a full primary key, if any field is null then just log a warning and return null instead of blowing up
             if (entityPK.containsPrimaryKey(true)) {
                 if (useCache) {
-                    valueOut = delegator.findOne(entityPK.getEntityName(), entityPK, true);
+                    valueOut = EntityQuery.use(delegator).from(entityPK.getEntityName()).where(entityPK).cache(true).queryOne();
                 } else {
                     if (fieldsToSelect != null) {
                         valueOut = delegator.findByPrimaryKeyPartial(entityPK, fieldsToSelect);
                     } else {
-                        valueOut = delegator.findOne(entityPK.getEntityName(), entityPK, false);
+                        valueOut = EntityQuery.use(delegator).from(entityPK.getEntityName()).where(entityPK).cache(false).queryOne();
                     }
                 }
             } else {

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/test/EntityCryptoTestSuite.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/test/EntityCryptoTestSuite.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/test/EntityCryptoTestSuite.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/test/EntityCryptoTestSuite.java Mon Jan  5 08:50:30 2015
@@ -92,25 +92,18 @@ public class EntityCryptoTestSuite exten
 
     public void testCryptoLookup() throws Exception {
         String nanoTime = "" + System.nanoTime();
-        EntityCondition condition;
 
         delegator.removeByAnd("TestingCrypto", UtilMisc.toMap("testingCryptoTypeId", "LOOKUP"));
         delegator.create("TestingCrypto", UtilMisc.toMap("testingCryptoId", "lookup-null", "testingCryptoTypeId", "LOOKUP"));
         delegator.create("TestingCrypto", UtilMisc.toMap("testingCryptoId", "lookup-value", "testingCryptoTypeId", "LOOKUP", "encryptedValue", nanoTime, "saltedEncryptedValue", nanoTime));
 
         // This ends up using EntityExpr contained in EntityConditionList
-        assertEquals(1, delegator.findByAnd("TestingCrypto", UtilMisc.toMap("testingCryptoTypeId", "LOOKUP", "encryptedValue", null), null, false).size());
-        assertEquals(1, delegator.findByAnd("TestingCrypto", UtilMisc.toMap("testingCryptoTypeId", "LOOKUP", "saltedEncryptedValue", null), null, false).size());
-        assertEquals(1, delegator.findByAnd("TestingCrypto", UtilMisc.toMap("testingCryptoTypeId", "LOOKUP", "encryptedValue", nanoTime), null, false).size());
-        assertEquals(0, delegator.findByAnd("TestingCrypto", UtilMisc.toMap("testingCryptoTypeId", "LOOKUP", "saltedEncryptedValue", nanoTime), null, false).size());
-
-        // This ends up using EntityExpr contained in EntityExpr
-        condition = EntityCondition.makeCondition(
-            EntityCondition.makeCondition("testingCryptoTypeId", EntityOperator.EQUALS, "LOOKUP"),
-            EntityOperator.AND,
-            EntityCondition.makeCondition("encryptedValue", EntityOperator.EQUALS, nanoTime)
-        );
-        assertEquals(1, delegator.findList("TestingCrypto", condition, null, null, null, false).size());
+        assertEquals(1, (EntityQuery.use(delegator).from("TestingCrypto").where("testingCryptoTypeId", "LOOKUP", "encryptedValue", null).queryList()).size());
+        assertEquals(1, (EntityQuery.use(delegator).from("TestingCrypto").where("testingCryptoTypeId", "LOOKUP", "saltedEncryptedValue", null).queryList()).size());
+        assertEquals(1, (EntityQuery.use(delegator).from("TestingCrypto").where("testingCryptoTypeId", "LOOKUP", "encryptedValue", nanoTime).queryList()).size());
+        assertEquals(0, (EntityQuery.use(delegator).from("TestingCrypto").where("testingCryptoTypeId", "LOOKUP", "saltedEncryptedValue", nanoTime).queryList()).size());
+        
+        assertEquals(1, EntityQuery.use(delegator).from("TestingCrypto").where("testingCryptoTypeId", "LOOKUP", "encryptedValue", nanoTime).queryList().size());
     }
 
     protected EntityCondition makeSubSelectCondition(String nanoTime) {
@@ -139,23 +132,23 @@ public class EntityCryptoTestSuite exten
         delegator.create("TestingCrypto", UtilMisc.toMap("testingCryptoId", "SUB_2", "testingCryptoTypeId", "SUB_SELECT_2", "encryptedValue", nanoTime));
         delegator.create("TestingCrypto", UtilMisc.toMap("testingCryptoId", "SUB_3", "testingCryptoTypeId", "SUB_SELECT_3", "encryptedValue", "constant"));
 
-        results = delegator.findList("TestingCrypto", EntityCondition.makeCondition("encryptedValue", EntityOperator.EQUALS, nanoTime), null, UtilMisc.toList("testingCryptoId"), null, false);
+        results = EntityQuery.use(delegator).from("TestingCrypto").where("encryptedValue", nanoTime).orderBy("testingCryptoId").queryList();
         assertEquals(2, results.size());
         assertEquals("SUB_1", results.get(0).get("testingCryptoId"));
         assertEquals("SUB_2", results.get(1).get("testingCryptoId"));
 
-        results = delegator.findList("TestingCrypto", EntityCondition.makeCondition("testingCryptoTypeId", EntityOperator.IN, UtilMisc.toList("SUB_SELECT_1", "SUB_SELECT_3")), null, UtilMisc.toList("testingCryptoId"), null, false);
+        results = EntityQuery.use(delegator).from("TestingCrypto").where(EntityCondition.makeCondition("testingCryptoTypeId", EntityOperator.IN, UtilMisc.toList("SUB_SELECT_1", "SUB_SELECT_3"))).orderBy("testingCryptoId").queryList();
         assertEquals(2, results.size());
         assertEquals("SUB_1", results.get(0).get("testingCryptoId"));
         assertEquals("SUB_3", results.get(1).get("testingCryptoId"));
 
         condition = makeSubSelectCondition(nanoTime);
-        results = delegator.findList("TestingCrypto", condition, null, UtilMisc.toList("testingCryptoId"), null, false);
+        results = EntityQuery.use(delegator).from("TestingCrypto").where(condition).orderBy("testingCryptoId").queryList();
         assertEquals(1, results.size());
         assertEquals("SUB_1", results.get(0).get("testingCryptoId"));
 
         condition = EntityCondition.makeCondition("testingCryptoId", EntityOperator.EQUALS, makeSubSelect(nanoTime));
-        results = delegator.findList("TestingCrypto", condition, null, UtilMisc.toList("testingCryptoId"), null, false);
+        results = EntityQuery.use(delegator).from("TestingCrypto").where(condition).orderBy("testingCryptoId").queryList();
         assertEquals(1, results.size());
         assertEquals("SUB_1", results.get(0).get("testingCryptoId"));
     }