svn commit: r721839 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r721839 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java

jleroux@apache.org
Author: jleroux
Date: Sun Nov 30 08:13:00 2008
New Revision: 721839

URL: http://svn.apache.org/viewvc?rev=721839&view=rev
Log:
Allow to use BETWEEN operator in widget action int he same way IN operator is used.

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

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java?rev=721839&r1=721838&r2=721839&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java Sun Nov 30 08:13:00 2008
@@ -199,8 +199,9 @@
                 throw new IllegalArgumentException("Could not find an entity operator for the name: " + operatorName);
             }
 
-            // If IN operator, see if value is a literal list and split it
-            if (operator == EntityOperator.IN && value instanceof String) {
+            // If IN or BETWEEN operator, see if value is a literal list and split it
+            if ((operator == EntityOperator.IN || operator == EntityOperator.BETWEEN)
+                    && value instanceof String) {
                 String delim = null;
                 if (((String)value).indexOf("|") >= 0) {
                     delim = "|";  
@@ -211,9 +212,10 @@
                     value = StringUtil.split((String)value, delim);  
                 }
             }
-            
-            // don't convert the field to the desired type if this is an IN operator and we have a Collection
-            if (!(operator == EntityOperator.IN && value instanceof Collection)) {
+                        
+            // don't convert the field to the desired type if this is an IN or BETWEEN operator and we have a Collection
+            if (!((operator == EntityOperator.IN || operator == EntityOperator.BETWEEN)
+                    && value instanceof Collection)) {
                 // now to a type conversion for the target fieldName
                 value = modelEntity.convertFieldValue(modelEntity.getField(fieldName), value, delegator, context);
             }