Author: jleroux
Date: Wed Nov  4 23:35:48 2009
New Revision: 832908

URL: http://svn.apache.org/viewvc?rev=832908&view=rev
Log:
A patch from Bob Morley " Resolve widget action entity caching with 
filter-by-date" (https://issues.apache.org/jira/browse/OFBIZ-3090) - OFBIZ-3090
When you attempt to get a cached result in an action block with 
"filter-by-date" turned on, caching never occurs because the date/time changes 
with each request. Recommended solution is when use-cache and filter-by-date 
are both true, we will create a condition w/o the date restriction, execute the 
(cachable) query, and then use the EntityUtil to filter by date.

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java

Modified: 
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java?rev=832908&r1=832907&r2=832908&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java 
(original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java 
Wed Nov  4 23:35:48 2009
@@ -171,7 +171,7 @@
 
         try {
             // if filterByDate, do a date filter on the results based on the 
now-timestamp
-            if (filterByDate) {
+            if (filterByDate && !useCache) {
                 EntityCondition filterByDateCondition = 
EntityUtil.getFilterByDateExpr();
                 if (whereEntityCondition != null) {
                     whereEntityCondition = 
EntityCondition.makeCondition(UtilMisc.toList(whereEntityCondition, 
filterByDateCondition));
@@ -182,6 +182,9 @@
 
             if (useCache) {
                 List<GenericValue> results = delegator.findList(entityName, 
whereEntityCondition, fieldsToSelect, orderByFields, null, true);
+                if (filterByDate) {
+                    results = EntityUtil.filterByDate(results);
+                }
                 this.outputHandler.handleOutput(results, context, listAcsr);
             } else {
                 boolean useTransaction = true;


Reply via email to