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 2012/04/21 13:38:14 UTC

svn commit: r1328637 - /ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java

Author: jleroux
Date: Sat Apr 21 11:38:14 2012
New Revision: 1328637

URL: http://svn.apache.org/viewvc?rev=1328637&view=rev
Log:
A patch from Daniel Riquelme "Enable NOT-IN operator to performFind" https://issues.apache.org/jira/browse/OFBIZ-4815

This patch will enable NOT-IN operator to the performFind service.
Only two lines of the file framework/common/src/org/ofbiz/common/FindServices.java were modified to enable de NOT-IN operator.
An use case is provided to test

Modified:
    ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java

Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java?rev=1328637&r1=1328636&r2=1328637&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java Sat Apr 21 11:38:14 2012
@@ -76,6 +76,7 @@ public class FindServices {
         entityOperators.put("greaterThan", EntityOperator.GREATER_THAN);
         entityOperators.put("greaterThanEqualTo", EntityOperator.GREATER_THAN_EQUAL_TO);
         entityOperators.put("in", EntityOperator.IN);
+        entityOperators.put("not-in", EntityOperator.NOT_IN);
         entityOperators.put("lessThan", EntityOperator.LESS_THAN);
         entityOperators.put("lessThanEqualTo", EntityOperator.LESS_THAN_EQUAL_TO);
         entityOperators.put("like", EntityOperator.LIKE);
@@ -332,7 +333,7 @@ public class FindServices {
             fieldOp = EntityOperator.EQUALS;
         }
         Object fieldObject = fieldValue;
-        if (fieldOp != EntityOperator.IN || !(fieldValue instanceof Collection<?>)) {
+        if ((fieldOp != EntityOperator.IN && fieldOp != EntityOperator.NOT_IN ) || !(fieldValue instanceof Collection<?>)) {
             fieldObject = modelField.getModelEntity().convertFieldValue(modelField, fieldValue, delegator, context);
         }
         if (ignoreCase && fieldObject instanceof String) {