You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2009/11/26 02:33:38 UTC

svn commit: r884363 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java

Author: doogie
Date: Thu Nov 26 01:33:38 2009
New Revision: 884363

URL: http://svn.apache.org/viewvc?rev=884363&view=rev
Log:
Helper method to fetch all rows/values from a query.

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java?rev=884363&r1=884362&r2=884363&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java Thu Nov 26 01:33:38 2009
@@ -21,6 +21,7 @@
 import java.util.List;
 import java.util.ListIterator;
 import java.util.Map;
+import java.util.concurrent.Callable;
 
 import javolution.util.FastList;
 import javolution.util.FastMap;
@@ -35,6 +36,7 @@
 import org.ofbiz.entity.condition.EntityCondition;
 import org.ofbiz.entity.model.DynamicViewEntity;
 import org.ofbiz.entity.model.ModelKeyMap;
+import org.ofbiz.entity.transaction.TransactionUtil;
 import org.ofbiz.entity.util.EntityListIterator;
 
 import org.ofbiz.sql.SelectPlan;
@@ -67,6 +69,20 @@
         return delegator.findListIteratorByCondition(dve, whereCondition, havingCondition, null, orderBy, null);
     }
 
+    public List<GenericValue> getAll(final GenericDelegator delegator, final Map<String, ? extends Object> params) throws GenericEntityException {
+        return TransactionUtil.doTransaction("sql select", new Callable<List<GenericValue>>() {
+            public List<GenericValue> call() throws Exception {
+                EntityListIterator it = null;
+                try {
+                    it = getEntityListIterator(delegator, params);
+                    return it.getCompleteList();
+                } finally {
+                    if (it != null) it.close();
+                }
+            }
+        });
+    }
+
     public DynamicViewEntity getDynamicViewEntity() {
         return dve;
     }



Re: svn commit: r884363 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java

Posted by Scott Gray <sc...@hotwaxmedia.com>.
Buildbot reported a compilation failure for this commit, for some  
reason no email was sent: http://ci.apache.org/builders/ofbiz-trunk/builds/1879

Regards
Scott

On 26/11/2009, at 2:33 PM, doogie@apache.org wrote:

> Author: doogie
> Date: Thu Nov 26 01:33:38 2009
> New Revision: 884363
>
> URL: http://svn.apache.org/viewvc?rev=884363&view=rev
> Log:
> Helper method to fetch all rows/values from a query.
>
> Modified:
>    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/ 
> EntitySelectPlan.java
>
> Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/ 
> EntitySelectPlan.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java?rev=884363&r1=884362&r2=884363&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/ 
> EntitySelectPlan.java (original)
> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/ 
> EntitySelectPlan.java Thu Nov 26 01:33:38 2009
> @@ -21,6 +21,7 @@
> import java.util.List;
> import java.util.ListIterator;
> import java.util.Map;
> +import java.util.concurrent.Callable;
>
> import javolution.util.FastList;
> import javolution.util.FastMap;
> @@ -35,6 +36,7 @@
> import org.ofbiz.entity.condition.EntityCondition;
> import org.ofbiz.entity.model.DynamicViewEntity;
> import org.ofbiz.entity.model.ModelKeyMap;
> +import org.ofbiz.entity.transaction.TransactionUtil;
> import org.ofbiz.entity.util.EntityListIterator;
>
> import org.ofbiz.sql.SelectPlan;
> @@ -67,6 +69,20 @@
>         return delegator.findListIteratorByCondition(dve,  
> whereCondition, havingCondition, null, orderBy, null);
>     }
>
> +    public List<GenericValue> getAll(final GenericDelegator  
> delegator, final Map<String, ? extends Object> params) throws  
> GenericEntityException {
> +        return TransactionUtil.doTransaction("sql select", new  
> Callable<List<GenericValue>>() {
> +            public List<GenericValue> call() throws Exception {
> +                EntityListIterator it = null;
> +                try {
> +                    it = getEntityListIterator(delegator, params);
> +                    return it.getCompleteList();
> +                } finally {
> +                    if (it != null) it.close();
> +                }
> +            }
> +        });
> +    }
> +
>     public DynamicViewEntity getDynamicViewEntity() {
>         return dve;
>     }
>
>