Author: lektran
Date: Mon Oct  6 22:48:40 2014
New Revision: 1629782

URL: http://svn.apache.org/r1629782
Log:
Add cache(boolean) method to EntityQuery to allow the cache to be used or not 
based on a boolean variable.  Avoids the need to use an if block when the 
caching decision isn't hardcoded

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java

Modified: 
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java?rev=1629782&r1=1629781&r2=1629782&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java 
(original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java Mon 
Oct  6 22:48:40 2014
@@ -281,6 +281,16 @@ public class EntityQuery {
         return this;
     }
 
+    /** Specifies whether results should be read from the cache (or written to 
the cache if the results have not yet been cached)
+     * 
+     * @param useCache - boolean to indicate if the cache should be used or not
+     * @return this EntityQuery object, to enable chaining
+     */
+    public EntityQuery cache(boolean useCache) {
+        this.useCache = useCache;
+        return this;
+    }
+
     /** Specifies whether the query should return only values that are 
currently active using from/thruDate fields.
      * 
      * @return this EntityQuery object, to enable chaining


Reply via email to