Author: jaz
Date: Thu Feb 4 22:52:22 2010
New Revision: 906709
URL: http://svn.apache.org/viewvc?rev=906709&view=rev
Log:
implemented not-contains and not-like operators in the generic performFind
service
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=906709&r1=906708&r2=906709&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java
(original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java Thu Feb
4 22:52:22 2010
@@ -78,6 +78,7 @@
entityOperators.put("lessThan", EntityOperator.LESS_THAN);
entityOperators.put("lessThanEqualTo",
EntityOperator.LESS_THAN_EQUAL_TO);
entityOperators.put("like", EntityOperator.LIKE);
+ entityOperators.put("notLike", EntityOperator.NOT_LIKE);
entityOperators.put("not", EntityOperator.NOT);
entityOperators.put("notEqual", EntityOperator.NOT_EQUAL);
}
@@ -238,6 +239,8 @@
if (opString != null) {
if (opString.equals("contains")) {
fieldOp = EntityOperator.LIKE;
+ } else if (opString.equals("not-contains")) {
+ fieldOp = EntityOperator.NOT_LIKE;
} else if (opString.equals("empty")) {
fieldOp = EntityOperator.EQUALS;
} else {
@@ -251,11 +254,14 @@
if (fieldValue == null) {
continue;
}
-
+
if (opString != null) {
if (opString.equals("contains")) {
fieldOp = EntityOperator.LIKE;
fieldValue = "%" + fieldValue + "%";
+ } else if ("not-contains".equals(opString) ||
"notContains".equals(opString)) {
+ fieldOp = EntityOperator.NOT_LIKE;
+ fieldValue = "%" + fieldValue + "%";
} else if (opString.equals("empty")) {
fieldOp = EntityOperator.EQUALS;
fieldValue = null;
@@ -263,6 +269,9 @@
} else if (opString.equals("like")) {
fieldOp = EntityOperator.LIKE;
fieldValue = fieldValue + "%";
+ } else if ("not-like".equals(opString) ||
"notLike".equals(opString)) {
+ fieldOp = EntityOperator.NOT_LIKE;
+ fieldValue = fieldValue + "%";
} else if (opString.equals("greaterThanFromDayStart")) {
fieldValue = dayStart((String) fieldValue, 0);
fieldOp = EntityOperator.GREATER_THAN;
@@ -326,6 +335,8 @@
if (opString != null) {
if (opString.equals("contains")) {
fieldOp = EntityOperator.LIKE;
+ } else if ("not-contains".equals(opString) ||
"notContains".equals(opString)) {
+ fieldOp = EntityOperator.LIKE;
} else if (opString.equals("empty")) {
fieldOp = EntityOperator.EQUALS;
} else {
@@ -339,9 +350,9 @@
if (fieldValue == null) {
continue;
}
- if (opString.equals("like")) {
+ if ("like".equals(opString) || "not-like".equals(opString) ||
"notLike".equals(opString)) {
fieldValue = fieldValue + "%";
- } else if (opString.equals("contains")) {
+ } else if ("contains".equals(opString) ||
"not-contains".equals(opString) || "notContains".equals(opString)) {
fieldValue = fieldValue + "%" + fieldValue + "%";
} else if (opString.equals("empty")) {
fieldOp = EntityOperator.EQUALS;