You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jo...@apache.org on 2008/05/28 07:20:10 UTC
svn commit: r660812 - in /ofbiz/trunk/framework:
common/src/org/ofbiz/common/ common/src/org/ofbiz/common/login/
common/src/org/ofbiz/common/period/ entity/src/org/ofbiz/entity/condition/
entityext/src/org/ofbiz/entityext/data/ entityext/src/org/ofbiz/...
Author: jonesde
Date: Tue May 27 22:20:09 2008
New Revision: 660812
URL: http://svn.apache.org/viewvc?rev=660812&view=rev
Log:
Changed EntityExpr and EntityFunction subclasses to use the factory instead of constructor pattern, plus moved EntityExpr to EntityCondition factory methods; a number of EntityExpr cleanups, but many more to go
Modified:
ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java
ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java
ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java
ofbiz/trunk/framework/common/src/org/ofbiz/common/period/PeriodServices.java
ofbiz/trunk/framework/common/src/org/ofbiz/common/period/PeriodWorker.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityCondition.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFunction.java
ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataServices.java
ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/permission/EntityPermissionChecker.java
ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java
ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/FopRenderer.java
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JspViewHandler.java
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/RegionViewHandler.java
ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java
ofbiz/trunk/framework/workflow/src/org/ofbiz/workflow/client/WorkflowServices.java
Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java?rev=660812&r1=660811&r2=660812&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java Tue May 27 22:20:09 2008
@@ -69,8 +69,8 @@
public static List getStateList(GenericDelegator delegator) {
List geoList = FastList.newInstance();
EntityCondition condition = EntityCondition.makeCondition(EntityOperator.OR,
- new EntityExpr("geoTypeId", EntityOperator.EQUALS, "STATE"), new EntityExpr("geoTypeId", EntityOperator.EQUALS, "PROVINCE"),
- new EntityExpr("geoTypeId", EntityOperator.EQUALS, "TERRITORY"));
+ EntityCondition.makeCondition("geoTypeId", "STATE"), EntityCondition.makeCondition("geoTypeId", "PROVINCE"),
+ EntityCondition.makeCondition("geoTypeId", "TERRITORY"));
List<String> sortList = UtilMisc.toList("geoName");
try {
geoList = delegator.findList("Geo", condition, null, sortList, null, true);
@@ -89,11 +89,11 @@
country = UtilProperties.getPropertyValue("general.properties", "country.geo.id.default");
}
EntityCondition stateProvinceFindCond = EntityCondition.makeCondition(
- new EntityExpr("geoIdFrom", EntityOperator.EQUALS, country),
- new EntityExpr("geoAssocTypeId", EntityOperator.EQUALS, "REGIONS"),
+ EntityCondition.makeCondition("geoIdFrom", country),
+ EntityCondition.makeCondition("geoAssocTypeId", "REGIONS"),
EntityCondition.makeCondition(EntityOperator.OR,
- new EntityExpr("geoTypeId", EntityOperator.EQUALS, "STATE"),
- new EntityExpr("geoTypeId", EntityOperator.EQUALS, "PROVINCE")));
+ EntityCondition.makeCondition("geoTypeId", "STATE"),
+ EntityCondition.makeCondition("geoTypeId", "PROVINCE")));
List<String> sortList = UtilMisc.toList("geoId");
List<GenericValue> geoList = FastList.newInstance();
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=660812&r1=660811&r2=660812&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java Tue May 27 22:20:09 2008
@@ -284,9 +284,9 @@
}
if (ignoreCase != null && ignoreCase.equals("Y")) {
- cond = new EntityExpr(new EntityFunction.UPPER(new EntityFieldValue(fieldName)), (EntityComparisonOperator) fieldOp, new EntityFunction.UPPER(fieldValue.toUpperCase()));
+ cond = EntityCondition.makeCondition(EntityFunction.UPPER_FIELD(fieldName), (EntityComparisonOperator) fieldOp, EntityFunction.UPPER(fieldValue.toUpperCase()));
} else {
- cond = new EntityExpr(fieldName, (EntityComparisonOperator) fieldOp, fieldValue);
+ cond = EntityCondition.makeCondition(fieldName, (EntityComparisonOperator) fieldOp, fieldValue);
}
tmpList.add(cond);
count++;
@@ -329,7 +329,7 @@
fieldOp = EntityOperator.LESS_THAN;
}
// String rhs = fieldValue.toString();
- cond = new EntityExpr(fieldName, (EntityComparisonOperator) fieldOp, fieldValue);
+ cond = EntityCondition.makeCondition(fieldName, (EntityComparisonOperator) fieldOp, fieldValue);
tmpList.add(cond);
// add to queryStringMap
Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java?rev=660812&r1=660811&r2=660812&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java Tue May 27 22:20:09 2008
@@ -20,8 +20,6 @@
package org.ofbiz.common.login;
import java.sql.Timestamp;
-import java.util.HashMap;
-import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -29,6 +27,7 @@
import javax.transaction.Transaction;
import javolution.util.FastList;
+import javolution.util.FastMap;
import org.ofbiz.base.crypto.HashCrypt;
import org.ofbiz.base.util.Debug;
@@ -40,8 +39,7 @@
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.condition.EntityCondition;
-import org.ofbiz.entity.condition.EntityConditionList;
-import org.ofbiz.entity.condition.EntityExpr;
+import org.ofbiz.entity.condition.EntityFunction;
import org.ofbiz.entity.condition.EntityOperator;
import org.ofbiz.entity.model.ModelEntity;
import org.ofbiz.entity.serialize.XmlSerializer;
@@ -66,7 +64,7 @@
* @return Map of results including (userLogin) GenericValue object
*/
public static Map userLogin(DispatchContext ctx, Map context) {
- Map result = new HashMap();
+ Map result = FastMap.newInstance();
GenericDelegator delegator = ctx.getDelegator();
Locale locale = (Locale) context.get("locale");
@@ -373,10 +371,10 @@
// Not saving password history, so return from here.
return;
}
- List exprs = FastList.newInstance();
+ List<EntityCondition> exprs = FastList.newInstance();
EntityFindOptions efo = new EntityFindOptions();
efo.setResultSetType(EntityFindOptions.TYPE_SCROLL_INSENSITIVE);
- exprs.add(new EntityExpr("userLoginId", EntityOperator.EQUALS, userLoginId));
+ exprs.add(EntityCondition.makeConditionMap("userLoginId", userLoginId));
EntityListIterator eli = delegator.find("UserLoginPasswordHistory", EntityCondition.makeCondition(exprs), null, null, UtilMisc.toList("-fromDate"), efo);
Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
GenericValue pwdHist;
@@ -406,11 +404,11 @@
*@return Map with the result of the service, the output parameters
*/
public static Map createUserLogin(DispatchContext ctx, Map context) {
- Map result = new HashMap();
+ Map result = FastMap.newInstance();
GenericDelegator delegator = ctx.getDelegator();
Security security = ctx.getSecurity();
GenericValue loggedInUserLogin = (GenericValue) context.get("userLogin");
- List errorMessageList = new LinkedList();
+ List errorMessageList = FastList.newInstance();
Locale locale = (Locale) context.get("locale");
boolean useEncryption = "true".equals(UtilProperties.getPropertyValue("security.properties", "password.encrypt"));
@@ -462,7 +460,7 @@
userLoginToCreate.set("currentPassword", useEncryption ? HashCrypt.getDigestHash(currentPassword, getHashType()) : currentPassword);
try {
- EntityCondition condition = new EntityExpr("userLoginId", true, EntityOperator.EQUALS, userLoginId, true);
+ EntityCondition condition = EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("userLoginId"), EntityOperator.EQUALS, EntityFunction.UPPER(userLoginId));
if (UtilValidate.isNotEmpty(delegator.findList("UserLogin", condition, null, null, null, false))) {
Map messageMap = UtilMisc.toMap("userLoginId", userLoginId);
errMsg = UtilProperties.getMessage(resource,"loginservices.could_not_create_login_user_with_ID_exists", messageMap, locale);
@@ -499,7 +497,7 @@
*@return Map with the result of the service, the output parameters
*/
public static Map updatePassword(DispatchContext ctx, Map context) {
- Map result = new HashMap();
+ Map result = FastMap.newInstance();
GenericDelegator delegator = ctx.getDelegator();
Security security = ctx.getSecurity();
GenericValue loggedInUserLogin = (GenericValue) context.get("userLogin");
@@ -553,7 +551,7 @@
newPasswordVerify = newPasswordVerify.toLowerCase();
}
- List errorMessageList = new LinkedList();
+ List<String> errorMessageList = FastList.newInstance();
if (newPassword != null && newPassword.length() > 0) {
checkNewPassword(userLoginToUpdate, currentPassword, newPassword, newPasswordVerify,
passwordHint, errorMessageList, adminUser, locale);
@@ -588,10 +586,10 @@
*@return Map with the result of the service, the output parameters
*/
public static Map updateUserLoginId(DispatchContext ctx, Map context) {
- Map result = new HashMap();
+ Map result = FastMap.newInstance();
GenericDelegator delegator = ctx.getDelegator();
GenericValue loggedInUserLogin = (GenericValue) context.get("userLogin");
- List errorMessageList = new LinkedList();
+ List errorMessageList = FastList.newInstance();
Locale locale = (Locale) context.get("locale");
//boolean useEncryption = "true".equals(UtilProperties.getPropertyValue("security.properties", "password.encrypt"));
@@ -700,7 +698,7 @@
*@return Map with the result of the service, the output parameters
*/
public static Map updateUserLoginSecurity(DispatchContext ctx, Map context) {
- Map result = new HashMap();
+ Map result = FastMap.newInstance();
GenericDelegator delegator = ctx.getDelegator();
Security security = ctx.getSecurity();
GenericValue loggedInUserLogin = (GenericValue) context.get("userLogin");
Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/period/PeriodServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/period/PeriodServices.java?rev=660812&r1=660811&r2=660812&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/period/PeriodServices.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/period/PeriodServices.java Tue May 27 22:20:09 2008
@@ -57,12 +57,12 @@
try {
// try to get the ending date of the most recent accounting time period before findDate which has been closed
- List findClosedConditions = UtilMisc.toList(new EntityExpr("organizationPartyId", EntityOperator.EQUALS, organizationPartyId),
- new EntityExpr("thruDate", EntityOperator.LESS_THAN_EQUAL_TO, findDate),
- new EntityExpr("isClosed", EntityOperator.EQUALS, "Y"));
+ List findClosedConditions = UtilMisc.toList(EntityCondition.makeConditionMap("organizationPartyId", organizationPartyId),
+ EntityCondition.makeCondition("thruDate", EntityOperator.LESS_THAN_EQUAL_TO, findDate),
+ EntityCondition.makeConditionMap("isClosed", "Y"));
if ((periodTypeId != null) && !(periodTypeId.equals(""))) {
// if a periodTypeId was supplied, use it
- findClosedConditions.add(new EntityExpr("periodTypeId", EntityOperator.EQUALS, periodTypeId));
+ findClosedConditions.add(EntityCondition.makeConditionMap("periodTypeId", periodTypeId));
}
List closedTimePeriods = delegator.findList("CustomTimePeriod", EntityCondition.makeCondition(findClosedConditions),
UtilMisc.toSet("customTimePeriodId", "periodTypeId", "isClosed", "fromDate", "thruDate"),
Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/period/PeriodWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/period/PeriodWorker.java?rev=660812&r1=660811&r2=660812&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/period/PeriodWorker.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/period/PeriodWorker.java Tue May 27 22:20:09 2008
@@ -21,14 +21,11 @@
package org.ofbiz.common.period;
import java.sql.Timestamp;
-import java.util.List;
import org.ofbiz.base.util.UtilDateTime;
-import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.condition.EntityCondition;
import org.ofbiz.entity.condition.EntityConditionList;
-import org.ofbiz.entity.condition.EntityExpr;
import org.ofbiz.entity.condition.EntityOperator;
public class PeriodWorker {
@@ -50,8 +47,8 @@
}
EntityConditionList betweenCondition = EntityCondition.makeCondition(
- new EntityExpr(fieldName, EntityOperator.GREATER_THAN, fromDate),
- new EntityExpr(fieldName, EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
- return EntityCondition.makeCondition(new EntityExpr(fieldName, EntityOperator.NOT_EQUAL, null), betweenCondition);
+ EntityCondition.makeCondition(fieldName, EntityOperator.GREATER_THAN, fromDate),
+ EntityCondition.makeCondition(fieldName, EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
+ return EntityCondition.makeCondition(EntityCondition.makeCondition(fieldName, EntityOperator.NOT_EQUAL, null), betweenCondition);
}
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityCondition.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityCondition.java?rev=660812&r1=660811&r2=660812&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityCondition.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityCondition.java Tue May 27 22:20:09 2008
@@ -42,78 +42,96 @@
*
*/
public abstract class EntityCondition extends EntityConditionBase implements Reusable {
-
- public static <T extends EntityCondition> EntityConditionList<T> makeCondition(EntityJoinOperator operator, T... conditionList) {
- EntityConditionList<T> ecl = new EntityConditionList<T>();
- ecl.init(operator, conditionList);
- return ecl;
- }
-
- public static <T extends EntityCondition> EntityConditionList<T> makeCondition(T... conditionList) {
- EntityConditionList<T> ecl = new EntityConditionList<T>();
- ecl.init(EntityOperator.AND, conditionList);
- return ecl;
- }
-
- public static <T extends EntityCondition> EntityConditionList<T> makeCondition(List<T> conditionList, EntityJoinOperator operator) {
- EntityConditionList<T> ecl = new EntityConditionList<T>();
- ecl.init(conditionList, operator);
- return ecl;
- }
-
- public static <T extends EntityCondition> EntityConditionList<T> makeCondition(List<T> conditionList) {
- EntityConditionList<T> ecl = new EntityConditionList<T>();
- ecl.init(conditionList, EntityOperator.AND);
- return ecl;
- }
-
- public static EntityFieldMap makeCondition(Map<String, ? extends Object> fieldMap, EntityComparisonOperator compOp, EntityJoinOperator joinOp) {
- EntityFieldMap efm = new EntityFieldMap();
- efm.init(fieldMap, compOp, joinOp);
- return efm;
- }
-
- public static EntityFieldMap makeCondition(Map<String, ? extends Object> fieldMap, EntityJoinOperator joinOp) {
- EntityFieldMap efm = new EntityFieldMap();
- efm.init(fieldMap, EntityOperator.EQUALS, joinOp);
- return efm;
- }
-
- public static EntityFieldMap makeCondition(Map<String, ? extends Object> fieldMap) {
- EntityFieldMap efm = new EntityFieldMap();
- efm.init(fieldMap, EntityOperator.EQUALS, EntityOperator.AND);
- return efm;
- }
-
- public static EntityFieldMap makeCondition(EntityComparisonOperator compOp, EntityJoinOperator joinOp, Object... keysValues) {
- EntityFieldMap efm = new EntityFieldMap();
- efm.init(compOp, joinOp, keysValues);
- return efm;
- }
-
- public static EntityFieldMap makeCondition(EntityJoinOperator joinOp, Object... keysValues) {
- EntityFieldMap efm = new EntityFieldMap();
- efm.init(EntityOperator.EQUALS, joinOp, keysValues);
- return efm;
- }
-
- public static EntityFieldMap makeCondition(Object... keysValues) {
- EntityFieldMap efm = new EntityFieldMap();
- efm.init(EntityOperator.EQUALS, EntityOperator.AND, keysValues);
- return efm;
- }
-
- public static EntityDateFilterCondition makeConditionDate(String fromDateName, String thruDateName) {
- EntityDateFilterCondition edfc = new EntityDateFilterCondition();
- edfc.init(fromDateName, thruDateName);
- return edfc;
- }
-
- public static EntityWhereString makeConditionWhere(String sqlString) {
- EntityWhereString ews = new EntityWhereString();
- ews.init(sqlString);
- return ews;
- }
+
+ public static EntityExpr makeCondition(Object lhs, EntityComparisonOperator operator, Object rhs) {
+ EntityExpr expr = new EntityExpr();
+ expr.init(lhs, operator, rhs);
+ return expr;
+ }
+
+ public static EntityExpr makeCondition(String fieldName, Object value) {
+ EntityExpr expr = new EntityExpr();
+ expr.init(fieldName, EntityOperator.EQUALS, value);
+ return expr;
+ }
+
+ public static EntityExpr makeCondition(EntityCondition lhs, EntityJoinOperator operator, EntityCondition rhs) {
+ EntityExpr expr = new EntityExpr();
+ expr.init(lhs, operator, rhs);
+ return expr;
+ }
+
+ public static <T extends EntityCondition> EntityConditionList<T> makeCondition(EntityJoinOperator operator, T... conditionList) {
+ EntityConditionList<T> ecl = new EntityConditionList<T>();
+ ecl.init(operator, conditionList);
+ return ecl;
+ }
+
+ public static <T extends EntityCondition> EntityConditionList<T> makeCondition(T... conditionList) {
+ EntityConditionList<T> ecl = new EntityConditionList<T>();
+ ecl.init(EntityOperator.AND, conditionList);
+ return ecl;
+ }
+
+ public static <T extends EntityCondition> EntityConditionList<T> makeCondition(List<T> conditionList, EntityJoinOperator operator) {
+ EntityConditionList<T> ecl = new EntityConditionList<T>();
+ ecl.init(conditionList, operator);
+ return ecl;
+ }
+
+ public static <T extends EntityCondition> EntityConditionList<T> makeCondition(List<T> conditionList) {
+ EntityConditionList<T> ecl = new EntityConditionList<T>();
+ ecl.init(conditionList, EntityOperator.AND);
+ return ecl;
+ }
+
+ public static EntityFieldMap makeCondition(Map<String, ? extends Object> fieldMap, EntityComparisonOperator compOp, EntityJoinOperator joinOp) {
+ EntityFieldMap efm = new EntityFieldMap();
+ efm.init(fieldMap, compOp, joinOp);
+ return efm;
+ }
+
+ public static EntityFieldMap makeCondition(Map<String, ? extends Object> fieldMap, EntityJoinOperator joinOp) {
+ EntityFieldMap efm = new EntityFieldMap();
+ efm.init(fieldMap, EntityOperator.EQUALS, joinOp);
+ return efm;
+ }
+
+ public static EntityFieldMap makeCondition(Map<String, ? extends Object> fieldMap) {
+ EntityFieldMap efm = new EntityFieldMap();
+ efm.init(fieldMap, EntityOperator.EQUALS, EntityOperator.AND);
+ return efm;
+ }
+
+ public static EntityFieldMap makeCondition(EntityComparisonOperator compOp, EntityJoinOperator joinOp, Object... keysValues) {
+ EntityFieldMap efm = new EntityFieldMap();
+ efm.init(compOp, joinOp, keysValues);
+ return efm;
+ }
+
+ public static EntityFieldMap makeCondition(EntityJoinOperator joinOp, Object... keysValues) {
+ EntityFieldMap efm = new EntityFieldMap();
+ efm.init(EntityOperator.EQUALS, joinOp, keysValues);
+ return efm;
+ }
+
+ public static EntityFieldMap makeConditionMap(Object... keysValues) {
+ EntityFieldMap efm = new EntityFieldMap();
+ efm.init(EntityOperator.EQUALS, EntityOperator.AND, keysValues);
+ return efm;
+ }
+
+ public static EntityDateFilterCondition makeConditionDate(String fromDateName, String thruDateName) {
+ EntityDateFilterCondition edfc = new EntityDateFilterCondition();
+ edfc.init(fromDateName, thruDateName);
+ return edfc;
+ }
+
+ public static EntityWhereString makeConditionWhere(String sqlString) {
+ EntityWhereString ews = new EntityWhereString();
+ ews.init(sqlString);
+ return ews;
+ }
public String toString() {
return makeWhereString(null, FastList.<EntityConditionParam>newInstance(), null);
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java?rev=660812&r1=660811&r2=660812&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java Tue May 27 22:20:09 2008
@@ -44,12 +44,29 @@
protected EntityExpr() {}
+ /** @deprecated Use EntityCondition.makeCondition() instead */
public EntityExpr(Object lhs, EntityComparisonOperator operator, Object rhs) {
+ this.init(lhs, operator, rhs);
+ }
+
+ /** @deprecated Use EntityCondition.makeCondition() instead */
+ public EntityExpr(String lhs, EntityComparisonOperator operator, Object rhs) {
+ this.init(lhs, operator, rhs);
+ }
+
+ /** @deprecated Use EntityCondition.makeCondition() instead */
+ public EntityExpr(String lhs, boolean leftUpper, EntityComparisonOperator operator, Object rhs, boolean rightUpper) {
+ this.init(leftUpper ? EntityFunction.UPPER_FIELD(lhs) : lhs, operator, rightUpper ? EntityFunction.UPPER(rhs) : rhs);
+ }
+
+ /** @deprecated Use EntityCondition.makeCondition() instead */
+ public EntityExpr(EntityCondition lhs, EntityJoinOperator operator, EntityCondition rhs) {
+ this.init(lhs, operator, rhs);
+ }
+
+ public void init(Object lhs, EntityComparisonOperator operator, Object rhs) {
if (lhs == null) {
- throw new IllegalArgumentException("The field value cannot be null");
- }
- if (lhs instanceof String) {
- Debug.logError(new Exception(), "EntityExpr called with lhs as a String; consider recompiling", module);
+ throw new IllegalArgumentException("The field name/value cannot be null");
}
if (operator == null) {
throw new IllegalArgumentException("The operator argument cannot be null");
@@ -67,38 +84,18 @@
}
}
- this.lhs = lhs;
+ if (lhs instanceof String) {
+ this.lhs = new EntityFieldValue((String) lhs);
+ } else {
+ this.lhs = lhs;
+ }
this.operator = operator;
this.rhs = rhs;
//Debug.logInfo("new EntityExpr internal field=" + lhs + ", value=" + rhs + ", value type=" + (rhs == null ? "null object" : rhs.getClass().getName()), module);
}
-
- public EntityExpr(String lhs, EntityComparisonOperator operator, Object rhs) {
- this(new EntityFieldValue(lhs), operator, rhs);
- //Debug.logInfo("new EntityExpr field=" + lhs + ", value=" + rhs + ", value type=" + (rhs == null ? "null object" : rhs.getClass().getName()), module);
- }
-
- public EntityExpr(String lhs, boolean leftUpper, EntityComparisonOperator operator, Object rhs, boolean rightUpper) {
- if (lhs == null) {
- throw new IllegalArgumentException("The field value cannot be null");
- }
- if (operator == null) {
- throw new IllegalArgumentException("The operator argument cannot be null");
- }
- this.lhs = new EntityFieldValue(lhs);
- if (leftUpper) this.lhs = new EntityFunction.UPPER(this.lhs);
- this.operator = operator;
- if (rhs instanceof EntityConditionValue) {
- if (rightUpper) rhs = new EntityFunction.UPPER((EntityConditionValue) rhs);
- this.rhs = rhs;
- } else {
- if (rightUpper) rhs = new EntityFunction.UPPER(rhs);
- this.rhs = rhs;
- }
- }
-
- public EntityExpr(EntityCondition lhs, EntityJoinOperator operator, EntityCondition rhs) {
+
+ public void init(EntityCondition lhs, EntityJoinOperator operator, EntityCondition rhs) {
if (lhs == null) {
throw new IllegalArgumentException("The left EntityCondition argument cannot be null");
}
@@ -113,11 +110,11 @@
this.operator = operator;
this.rhs = rhs;
}
-
+
public void reset() {
- this.lhs = null;
- this.operator = null;
- this.rhs = null;
+ this.lhs = null;
+ this.operator = null;
+ this.rhs = null;
}
/** @deprecated */
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java?rev=660812&r1=660811&r2=660812&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java Tue May 27 22:20:09 2008
@@ -22,6 +22,8 @@
import java.util.List;
import java.util.Map;
+import javolution.lang.Reusable;
+
import org.ofbiz.entity.GenericDelegator;
import org.ofbiz.entity.GenericEntity;
import org.ofbiz.entity.GenericModelException;
@@ -33,13 +35,30 @@
* Encapsulates operations between entities and entity fields. This is a immutable class.
*
*/
-public class EntityFieldValue extends EntityConditionValue {
+public class EntityFieldValue extends EntityConditionValue implements Reusable {
- protected String fieldName;
+ protected String fieldName = null;
+
+ public static EntityFieldValue makeFieldValue(String fieldName) {
+ EntityFieldValue efv = new EntityFieldValue();
+ efv.init(fieldName);
+ return efv;
+ }
+ protected EntityFieldValue() {}
+
+ /** @deprecated Use EntityFieldValue.makeFieldValue() instead */
public EntityFieldValue(String fieldName) {
+ this.init(fieldName);
+ }
+
+ public void init(String fieldName) {
this.fieldName = fieldName;
}
+
+ public void reset() {
+ this.fieldName = null;
+ }
public String getFieldName() {
return fieldName;
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFunction.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFunction.java?rev=660812&r1=660811&r2=660812&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFunction.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFunction.java Tue May 27 22:20:09 2008
@@ -22,6 +22,8 @@
import java.util.List;
import java.util.Map;
+import javolution.lang.Reusable;
+
import org.ofbiz.entity.GenericDelegator;
import org.ofbiz.entity.GenericModelException;
import org.ofbiz.entity.config.DatasourceInfo;
@@ -32,7 +34,7 @@
* Encapsulates operations between entities and entity fields. This is a immutable class.
*
*/
-public abstract class EntityFunction<T extends Comparable> extends EntityConditionValue {
+public abstract class EntityFunction<T extends Comparable> extends EntityConditionValue implements Reusable {
public static interface Fetcher<T> {
T getValue(Object value);
@@ -42,56 +44,93 @@
public static final int ID_TRIM = 2;
public static final int ID_UPPER = 3;
public static final int ID_LOWER = 4;
+
+ public static EntityFunction<Integer> LENGTH(EntityConditionValue nested) { LENGTH ef = new LENGTH(); ef.init(nested); return ef; }
+ public static EntityFunction<Integer> LENGTH(Object value) { LENGTH ef = new LENGTH(); ef.init(value); return ef; }
+ public static EntityFunction<String> TRIM(EntityConditionValue nested) { TRIM ef = new TRIM(); ef.init(nested); return ef; }
+ public static EntityFunction<String> TRIM(Object value) { TRIM ef = new TRIM(); ef.init(value); return ef; }
+ public static EntityFunction<String> UPPER(EntityConditionValue nested) { UPPER ef = new UPPER(); ef.init(nested); return ef; }
+ public static EntityFunction<String> UPPER(Object value) { UPPER ef = new UPPER(); ef.init(value); return ef; }
+ public static EntityFunction<String> UPPER_FIELD(String fieldName) { UPPER ef = new UPPER(); ef.init(EntityFieldValue.makeFieldValue(fieldName)); return ef; }
+ public static EntityFunction<String> LOWER(EntityConditionValue nested) { LOWER ef = new LOWER(); ef.init(nested); return ef; }
+ public static EntityFunction<String> LOWER(Object value) { LOWER ef = new LOWER(); ef.init(value); return ef; }
public static class LENGTH extends EntityFunction<Integer> {
public static Fetcher<Integer> FETCHER = new Fetcher<Integer>() {
public Integer getValue(Object value) { return value.toString().length(); }
};
- public LENGTH(EntityConditionValue nested) { super(FETCHER, ID_LENGTH, "LENGTH", nested); }
- public LENGTH(Object value) { super(FETCHER, ID_LENGTH, "LENGTH", value); }
+ protected LENGTH() {}
+ /** @deprecated Use EntityCondition.LENGTH() instead */
+ public LENGTH(EntityConditionValue nested) { init(nested); }
+ /** @deprecated Use EntityCondition.LENGTH() instead */
+ public LENGTH(Object value) { init(value); }
+ public void init(Object value) {
+ super.init(FETCHER, ID_LENGTH, "LENGTH", value);
+ }
};
public static class TRIM extends EntityFunction<String> {
public static Fetcher<String> FETCHER = new Fetcher<String>() {
public String getValue(Object value) { return value.toString().trim(); }
};
- public TRIM(EntityConditionValue nested) { super(FETCHER, ID_TRIM, "TRIM", nested); }
- public TRIM(Object value) { super(FETCHER, ID_TRIM, "TRIM", value); }
+ protected TRIM() {}
+ /** @deprecated Use EntityCondition.TRIM() instead */
+ public TRIM(EntityConditionValue nested) { init(nested); }
+ /** @deprecated Use EntityCondition.TRIM() instead */
+ public TRIM(Object value) { init(value); }
+ public void init(Object value) {
+ super.init(FETCHER, ID_TRIM, "TRIM", value);
+ }
};
public static class UPPER extends EntityFunction<String> {
public static Fetcher<String> FETCHER = new Fetcher<String>() {
public String getValue(Object value) { return value.toString().toUpperCase(); }
};
- public UPPER(EntityConditionValue nested) { super(FETCHER, ID_UPPER, "UPPER", nested); }
- public UPPER(Object value) { super(FETCHER, ID_UPPER, "UPPER", value); }
+ protected UPPER() {}
+ /** @deprecated Use EntityCondition.UPPER() instead */
+ public UPPER(EntityConditionValue nested) { init(nested); }
+ /** @deprecated Use EntityCondition.UPPER() instead */
+ public UPPER(Object value) { init(value); }
+ public void init(Object value) {
+ super.init(FETCHER, ID_UPPER, "UPPER", value);
+ }
};
public static class LOWER extends EntityFunction<String> {
public static Fetcher<String> FETCHER = new Fetcher<String>() {
public String getValue(Object value) { return value.toString().toLowerCase(); }
};
- public LOWER(EntityConditionValue nested) { super(FETCHER, ID_LOWER, "LOWER", nested); }
- public LOWER(Object value) { super(FETCHER, ID_LOWER, "LOWER", value); }
+ protected LOWER() {}
+ /** @deprecated Use EntityCondition.LOWER() instead */
+ public LOWER(EntityConditionValue nested) { init(nested); }
+ /** @deprecated Use EntityCondition.LOWER() instead */
+ public LOWER(Object value) { init(value); }
+ public void init(Object value) {
+ super.init(FETCHER, ID_LOWER, "LOWER", value);
+ }
};
- protected int idInt;
- protected String codeString;
- protected EntityConditionValue nested;
- protected Object value;
- protected Fetcher<T> fetcher;
+ protected Integer idInt = null;
+ protected String codeString = null;
+ protected EntityConditionValue nested = null;
+ protected Object value = null;
+ protected Fetcher<T> fetcher = null;
+
+ protected EntityFunction() {}
protected EntityFunction(Fetcher<T> fetcher, int id, String code, EntityConditionValue nested) {
- this.fetcher = fetcher;
- idInt = id;
- codeString = code;
- this.nested = nested;
+ this.init(fetcher, id, code, nested);
}
protected EntityFunction(Fetcher<T> fetcher, int id, String code, Object value) {
+ this.init(fetcher, id, code, value);
+ }
+
+ public void init(Fetcher<T> fetcher, int id, String code, Object value) {
this.fetcher = fetcher;
- idInt = id;
- codeString = code;
+ this.idInt = id;
+ this.codeString = code;
if (value instanceof EntityConditionValue) {
this.nested = (EntityConditionValue) value;
} else if (value instanceof String) {
@@ -100,6 +139,14 @@
this.value = value;
}
}
+
+ public void reset() {
+ this.idInt = null;
+ this.codeString = null;
+ this.nested = null;
+ this.value = null;
+ this.fetcher = null;
+ }
public EntityConditionValue freeze() {
if (nested != null) {
Modified: ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataServices.java?rev=660812&r1=660811&r2=660812&view=diff
==============================================================================
--- ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataServices.java (original)
+++ ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataServices.java Tue May 27 22:20:09 2008
@@ -309,7 +309,7 @@
if (entity == null) {
return null;
}
- List modelFields = entity.getFieldsCopy();
+ List modelFields = entity.getFieldsUnmodifiable();
if (modelFields == null) {
return null;
}
Modified: ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/permission/EntityPermissionChecker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/permission/EntityPermissionChecker.java?rev=660812&r1=660811&r2=660812&view=diff
==============================================================================
--- ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/permission/EntityPermissionChecker.java (original)
+++ ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/permission/EntityPermissionChecker.java Tue May 27 22:20:09 2008
@@ -261,11 +261,11 @@
//Iterator iterType = targetOperationList.iterator();
//while (iterType.hasNext()) {
// String op = (String)iterType.next();
- // condList.add(new EntityExpr(lcEntityName + "OperationId", EntityOperator.EQUALS, op));
+ // condList.add(EntityCondition.makeCondition(lcEntityName + "OperationId", op));
//}
//EntityCondition opCond = new EntityConditionList(condList, EntityOperator.OR);
- EntityCondition opCond = new EntityExpr(lcEntityName + "OperationId", EntityOperator.IN, targetOperationList);
+ EntityCondition opCond = EntityCondition.makeCondition(lcEntityName + "OperationId", EntityOperator.IN, targetOperationList);
List targetOperationEntityList = delegator.findList(modelOperationEntity.getEntityName(), opCond, null, null, null, true);
Map entities = new HashMap();
@@ -905,17 +905,15 @@
thruDate = (Timestamp)partyRelationshipValues.get("thruDate") ;
}
- EntityExpr partyFromExpr = new EntityExpr("partyIdFrom", EntityOperator.EQUALS, partyIdFrom);
- EntityExpr partyToExpr = new EntityExpr("partyIdTo", EntityOperator.EQUALS, partyIdTo);
+ EntityExpr partyFromExpr = EntityCondition.makeCondition("partyIdFrom", partyIdFrom);
+ EntityExpr partyToExpr = EntityCondition.makeCondition("partyIdTo", partyIdTo);
- EntityExpr relationExpr = new EntityExpr("partyRelationshipTypeId", EntityOperator.EQUALS,
- "CONTENT_PERMISSION");
- //EntityExpr roleTypeIdFromExpr = new EntityExpr("roleTypeIdFrom", EntityOperator.EQUALS, "CONTENT_PERMISSION_GROUP_MEMBER");
- //EntityExpr roleTypeIdToExpr = new EntityExpr("roleTypeIdTo", EntityOperator.EQUALS, "CONTENT_PERMISSION_GROUP");
- EntityExpr fromExpr = new EntityExpr("fromDate", EntityOperator.LESS_THAN_EQUAL_TO,
- fromDate);
- EntityCondition thruCond = EntityCondition.makeCondition(UtilMisc.toList(new EntityExpr("thruDate", EntityOperator.EQUALS, null),
- new EntityExpr("thruDate", EntityOperator.GREATER_THAN, thruDate)), EntityOperator.OR);
+ EntityExpr relationExpr = EntityCondition.makeCondition("partyRelationshipTypeId", "CONTENT_PERMISSION");
+ //EntityExpr roleTypeIdFromExpr = EntityCondition.makeCondition("roleTypeIdFrom", "CONTENT_PERMISSION_GROUP_MEMBER");
+ //EntityExpr roleTypeIdToExpr = EntityCondition.makeCondition("roleTypeIdTo", "CONTENT_PERMISSION_GROUP");
+ EntityExpr fromExpr = EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, fromDate);
+ EntityCondition thruCond = EntityCondition.makeCondition(UtilMisc.toList(EntityCondition.makeCondition("thruDate", null),
+ EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, thruDate)), EntityOperator.OR);
// This method is simplified to make it work, these conditions need to be added back in.
//List joinList = UtilMisc.toList(fromExpr, thruCond, partyFromExpr, partyToExpr, relationExpr);
@@ -1064,7 +1062,7 @@
}
public void init( GenericDelegator delegator) throws GenericEntityException {
- EntityCondition opCond = new EntityExpr(operationFieldName, EntityOperator.IN, this.operationList);
+ EntityCondition opCond = EntityCondition.makeCondition(operationFieldName, EntityOperator.IN, this.operationList);
this.entityList = delegator.findList(this.entityName, opCond, null, null, null, true);
}
@@ -1359,9 +1357,9 @@
public static List getUserRolesFromList(GenericDelegator delegator, List idList, String partyId, String entityIdFieldName, String partyIdFieldName, String roleTypeIdFieldName, String entityName) throws GenericEntityException {
- EntityExpr expr = new EntityExpr(entityIdFieldName, EntityOperator.IN, idList);
- EntityExpr expr2 = new EntityExpr(partyIdFieldName, EntityOperator.EQUALS, partyId);
- EntityConditionList condList = new EntityConditionList(UtilMisc.toList(expr, expr2), EntityOperator.AND);
+ EntityExpr expr = EntityCondition.makeCondition(entityIdFieldName, EntityOperator.IN, idList);
+ EntityExpr expr2 = EntityCondition.makeCondition(partyIdFieldName, partyId);
+ EntityConditionList condList = EntityCondition.makeCondition(UtilMisc.toList(expr, expr2));
List roleList = delegator.findList(entityName, condList, null, null, null, true);
List roleListFiltered = EntityUtil.filterByDate(roleList);
HashSet distinctSet = new HashSet();
Modified: ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java?rev=660812&r1=660811&r2=660812&view=diff
==============================================================================
--- ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java (original)
+++ ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java Tue May 27 22:20:09 2008
@@ -350,8 +350,8 @@
try {
// get the values created within the current time range
EntityCondition findValCondition = EntityCondition.makeCondition(
- new EntityExpr(ModelEntity.CREATE_STAMP_TX_FIELD, EntityOperator.GREATER_THAN_EQUAL_TO, currentRunStartTime),
- new EntityExpr(ModelEntity.CREATE_STAMP_TX_FIELD, EntityOperator.LESS_THAN, currentRunEndTime));
+ EntityCondition.makeCondition(ModelEntity.CREATE_STAMP_TX_FIELD, EntityOperator.GREATER_THAN_EQUAL_TO, currentRunStartTime),
+ EntityCondition.makeCondition(ModelEntity.CREATE_STAMP_TX_FIELD, EntityOperator.LESS_THAN, currentRunEndTime));
EntityListIterator eli = delegator.find(modelEntity.getEntityName(), findValCondition, null, null, UtilMisc.toList(ModelEntity.CREATE_STAMP_TX_FIELD, ModelEntity.CREATE_STAMP_FIELD), null);
GenericValue nextValue = null;
long valuesPerEntity = 0;
@@ -379,8 +379,8 @@
Timestamp startCheckStamp = new Timestamp(System.currentTimeMillis() - syncEndBufferMillis);
EntityCondition findNextCondition = EntityCondition.makeCondition(
- new EntityExpr(ModelEntity.CREATE_STAMP_TX_FIELD, EntityOperator.NOT_EQUAL, null),
- new EntityExpr(ModelEntity.CREATE_STAMP_TX_FIELD, EntityOperator.GREATER_THAN_EQUAL_TO, currentRunEndTime));
+ EntityCondition.makeCondition(ModelEntity.CREATE_STAMP_TX_FIELD, EntityOperator.NOT_EQUAL, null),
+ EntityCondition.makeCondition(ModelEntity.CREATE_STAMP_TX_FIELD, EntityOperator.GREATER_THAN_EQUAL_TO, currentRunEndTime));
EntityListIterator eliNext = delegator.find(modelEntity.getEntityName(), findNextCondition, null, null, UtilMisc.toList(ModelEntity.CREATE_STAMP_TX_FIELD), null);
// get the first element and it's tx time value...
GenericValue firstVal = (GenericValue) eliNext.next();
@@ -485,13 +485,13 @@
try {
// get all values that were updated, but NOT created in the current time range; if no info on created stamp, that's okay we'll include it here because it won't have been included in the valuesToCreate list
- EntityCondition createdBeforeStartCond = new EntityExpr(
- new EntityExpr(ModelEntity.CREATE_STAMP_TX_FIELD, EntityOperator.EQUALS, null),
+ EntityCondition createdBeforeStartCond = EntityCondition.makeCondition(
+ EntityCondition.makeCondition(ModelEntity.CREATE_STAMP_TX_FIELD, EntityOperator.EQUALS, null),
EntityOperator.OR,
- new EntityExpr(ModelEntity.CREATE_STAMP_TX_FIELD, EntityOperator.LESS_THAN, currentRunStartTime));
+ EntityCondition.makeCondition(ModelEntity.CREATE_STAMP_TX_FIELD, EntityOperator.LESS_THAN, currentRunStartTime));
EntityCondition findValCondition = EntityCondition.makeCondition(
- new EntityExpr(ModelEntity.STAMP_TX_FIELD, EntityOperator.GREATER_THAN_EQUAL_TO, currentRunStartTime),
- new EntityExpr(ModelEntity.STAMP_TX_FIELD, EntityOperator.LESS_THAN, currentRunEndTime),
+ EntityCondition.makeCondition(ModelEntity.STAMP_TX_FIELD, EntityOperator.GREATER_THAN_EQUAL_TO, currentRunStartTime),
+ EntityCondition.makeCondition(ModelEntity.STAMP_TX_FIELD, EntityOperator.LESS_THAN, currentRunEndTime),
createdBeforeStartCond);
EntityListIterator eli = delegator.find(modelEntity.getEntityName(), findValCondition, null, null, UtilMisc.toList(ModelEntity.STAMP_TX_FIELD, ModelEntity.STAMP_FIELD), null);
GenericValue nextValue = null;
@@ -520,10 +520,10 @@
Timestamp startCheckStamp = new Timestamp(System.currentTimeMillis() - syncEndBufferMillis);
EntityCondition findNextCondition = EntityCondition.makeCondition(
- new EntityExpr(ModelEntity.STAMP_TX_FIELD, EntityOperator.NOT_EQUAL, null),
- new EntityExpr(ModelEntity.STAMP_TX_FIELD, EntityOperator.GREATER_THAN_EQUAL_TO, currentRunEndTime),
- new EntityExpr(ModelEntity.CREATE_STAMP_TX_FIELD, EntityOperator.NOT_EQUAL, null),
- new EntityExpr(ModelEntity.CREATE_STAMP_TX_FIELD, EntityOperator.LESS_THAN, currentRunEndTime));
+ EntityCondition.makeCondition(ModelEntity.STAMP_TX_FIELD, EntityOperator.NOT_EQUAL, null),
+ EntityCondition.makeCondition(ModelEntity.STAMP_TX_FIELD, EntityOperator.GREATER_THAN_EQUAL_TO, currentRunEndTime),
+ EntityCondition.makeCondition(ModelEntity.CREATE_STAMP_TX_FIELD, EntityOperator.NOT_EQUAL, null),
+ EntityCondition.makeCondition(ModelEntity.CREATE_STAMP_TX_FIELD, EntityOperator.LESS_THAN, currentRunEndTime));
EntityListIterator eliNext = delegator.find(modelEntity.getEntityName(), findNextCondition, null, null, UtilMisc.toList(ModelEntity.STAMP_TX_FIELD), null);
// get the first element and it's tx time value...
GenericValue firstVal = (GenericValue) eliNext.next();
@@ -613,8 +613,8 @@
try {
// find all instances of this entity with the STAMP_TX_FIELD != null, sort ascending to get lowest/oldest value first, then grab first and consider as candidate currentRunStartTime
EntityCondition findValCondition = EntityCondition.makeCondition(
- new EntityExpr(ModelEntity.STAMP_TX_FIELD, EntityOperator.GREATER_THAN_EQUAL_TO, currentRunStartTime),
- new EntityExpr(ModelEntity.STAMP_TX_FIELD, EntityOperator.LESS_THAN, currentRunEndTime));
+ EntityCondition.makeCondition(ModelEntity.STAMP_TX_FIELD, EntityOperator.GREATER_THAN_EQUAL_TO, currentRunStartTime),
+ EntityCondition.makeCondition(ModelEntity.STAMP_TX_FIELD, EntityOperator.LESS_THAN, currentRunEndTime));
EntityListIterator removeEli = delegator.find("EntitySyncRemove", findValCondition, null, null, UtilMisc.toList(ModelEntity.STAMP_TX_FIELD, ModelEntity.STAMP_FIELD), null);
GenericValue entitySyncRemove = null;
while ((entitySyncRemove = (GenericValue) removeEli.next()) != null) {
@@ -655,7 +655,7 @@
// if we didn't find anything for this entity, find the next value's Timestamp and keep track of it
if (keysToRemove.size() == 0) {
- EntityCondition findNextCondition = new EntityExpr(ModelEntity.STAMP_TX_FIELD, EntityOperator.GREATER_THAN_EQUAL_TO, currentRunEndTime);
+ EntityCondition findNextCondition = EntityCondition.makeCondition(ModelEntity.STAMP_TX_FIELD, EntityOperator.GREATER_THAN_EQUAL_TO, currentRunEndTime);
EntityListIterator eliNext = delegator.find("EntitySyncRemove", findNextCondition, null, null, UtilMisc.toList(ModelEntity.STAMP_TX_FIELD), null);
// get the first element and it's tx time value...
GenericValue firstVal = (GenericValue) eliNext.next();
@@ -864,7 +864,7 @@
Set fieldsToSelect = UtilMisc.toSet(modelEntity.getPkFieldNames());
// find all instances of this entity with the STAMP_TX_FIELD != null, sort ascending to get lowest/oldest value first, then grab first and consider as candidate currentRunStartTime
fieldsToSelect.add(ModelEntity.STAMP_TX_FIELD);
- EntityListIterator eli = delegator.find(modelEntity.getEntityName(), new EntityExpr(ModelEntity.STAMP_TX_FIELD, EntityOperator.NOT_EQUAL, null), null, fieldsToSelect, UtilMisc.toList(ModelEntity.STAMP_TX_FIELD), null);
+ EntityListIterator eli = delegator.find(modelEntity.getEntityName(), EntityCondition.makeCondition(ModelEntity.STAMP_TX_FIELD, EntityOperator.NOT_EQUAL, null), null, fieldsToSelect, UtilMisc.toList(ModelEntity.STAMP_TX_FIELD), null);
GenericValue nextValue = (GenericValue) eli.next();
eli.close();
if (nextValue != null) {
Modified: ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java?rev=660812&r1=660811&r2=660812&view=diff
==============================================================================
--- ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java (original)
+++ ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java Tue May 27 22:20:09 2008
@@ -45,6 +45,7 @@
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.serialize.XmlSerializer;
import org.ofbiz.entity.serialize.SerializeException;
+import org.ofbiz.entity.condition.EntityCondition;
import org.ofbiz.entity.condition.EntityExpr;
import org.ofbiz.entity.condition.EntityOperator;
import org.ofbiz.entity.model.ModelEntity;
@@ -624,7 +625,7 @@
nowCal.add(Calendar.SECOND, -keepSeconds);
Timestamp keepAfterStamp = new Timestamp(nowCal.getTimeInMillis());
- int numRemoved = delegator.removeByCondition("EntitySyncRemove", new EntityExpr(ModelEntity.STAMP_TX_FIELD, EntityOperator.LESS_THAN, keepAfterStamp));
+ int numRemoved = delegator.removeByCondition("EntitySyncRemove", EntityCondition.makeCondition(ModelEntity.STAMP_TX_FIELD, EntityOperator.LESS_THAN, keepAfterStamp));
Debug.logInfo("In cleanSyncRemoveInfo removed [" + numRemoved + "] values with TX timestamp before [" + keepAfterStamp + "]", module);
return ServiceUtil.returnSuccess();
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java?rev=660812&r1=660811&r2=660812&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java Tue May 27 22:20:09 2008
@@ -352,13 +352,13 @@
Timestamp purgeTime = new Timestamp(cal.getTimeInMillis());
// create the conditions to query
- EntityCondition pool = new EntityExpr("poolId", EntityOperator.EQUALS, sendPool);
+ EntityCondition pool = EntityCondition.makeCondition("poolId", sendPool);
- List<EntityExpr> finExp = UtilMisc.toList(new EntityExpr("finishDateTime", EntityOperator.NOT_EQUAL, null));
- finExp.add(new EntityExpr("finishDateTime", EntityOperator.LESS_THAN, purgeTime));
+ List<EntityExpr> finExp = UtilMisc.toList(EntityCondition.makeCondition("finishDateTime", EntityOperator.NOT_EQUAL, null));
+ finExp.add(EntityCondition.makeCondition("finishDateTime", EntityOperator.LESS_THAN, purgeTime));
- List<EntityExpr> canExp = UtilMisc.toList(new EntityExpr("cancelDateTime", EntityOperator.NOT_EQUAL, null));
- canExp.add(new EntityExpr("cancelDateTime", EntityOperator.LESS_THAN, purgeTime));
+ List<EntityExpr> canExp = UtilMisc.toList(EntityCondition.makeCondition("cancelDateTime", EntityOperator.NOT_EQUAL, null));
+ canExp.add(EntityCondition.makeCondition("cancelDateTime", EntityOperator.LESS_THAN, purgeTime));
EntityCondition cancelled = EntityCondition.makeCondition(canExp);
EntityCondition finished = EntityCondition.makeCondition(finExp);
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java?rev=660812&r1=660811&r2=660812&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java Tue May 27 22:20:09 2008
@@ -20,10 +20,7 @@
import java.io.IOException;
import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Collection;
import java.util.Date;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -111,17 +108,17 @@
List<String> order = UtilMisc.toList("runTime");
// basic query
- List<EntityExpr> expressions = UtilMisc.toList(new EntityExpr("runTime", EntityOperator.LESS_THAN_EQUAL_TO,
- UtilDateTime.nowTimestamp()), new EntityExpr("startDateTime", EntityOperator.EQUALS, null),
- new EntityExpr("cancelDateTime", EntityOperator.EQUALS, null),
- new EntityExpr("runByInstanceId", EntityOperator.EQUALS, null));
+ List<EntityExpr> expressions = UtilMisc.toList(EntityCondition.makeCondition("runTime", EntityOperator.LESS_THAN_EQUAL_TO,
+ UtilDateTime.nowTimestamp()), EntityCondition.makeCondition("startDateTime", EntityOperator.EQUALS, null),
+ EntityCondition.makeCondition("cancelDateTime", EntityOperator.EQUALS, null),
+ EntityCondition.makeCondition("runByInstanceId", EntityOperator.EQUALS, null));
// limit to just defined pools
List<String> pools = ServiceConfigUtil.getRunPools();
- List<EntityExpr> poolsExpr = UtilMisc.toList(new EntityExpr("poolId", EntityOperator.EQUALS, null));
+ List<EntityExpr> poolsExpr = UtilMisc.toList(EntityCondition.makeCondition("poolId", EntityOperator.EQUALS, null));
if (pools != null) {
for (String poolName: pools) {
- poolsExpr.add(new EntityExpr("poolId", EntityOperator.EQUALS, poolName));
+ poolsExpr.add(EntityCondition.makeCondition("poolId", EntityOperator.EQUALS, poolName));
}
}
@@ -204,9 +201,9 @@
String instanceId = UtilProperties.getPropertyValue("general.properties", "unique.instanceId", "ofbiz0");
List<GenericValue> crashed = null;
- List<EntityExpr> exprs = UtilMisc.toList(new EntityExpr("finishDateTime", EntityOperator.EQUALS, null));
- exprs.add(new EntityExpr("cancelDateTime", EntityOperator.EQUALS, null));
- exprs.add(new EntityExpr("runByInstanceId", EntityOperator.EQUALS, instanceId));
+ List<EntityExpr> exprs = UtilMisc.toList(EntityCondition.makeCondition("finishDateTime", null));
+ exprs.add(EntityCondition.makeCondition("cancelDateTime", null));
+ exprs.add(EntityCondition.makeCondition("runByInstanceId", instanceId));
EntityConditionList<EntityExpr> ecl = EntityCondition.makeCondition(exprs);
try {
Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java?rev=660812&r1=660811&r2=660812&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java Tue May 27 22:20:09 2008
@@ -727,33 +727,33 @@
protected static boolean checkValidIssuer(GenericDelegator delegator, Map x500Map, BigInteger serialNumber) throws GeneralException {
List<EntityCondition> conds = FastList.newInstance();
- conds.add(EntityCondition.makeCondition(EntityOperator.OR, new EntityExpr("commonName", EntityOperator.EQUALS, x500Map.get("CN")),
- new EntityExpr("commonName", EntityOperator.EQUALS, null),
- new EntityExpr("commonName", EntityOperator.EQUALS, "")));
-
- conds.add(EntityCondition.makeCondition(EntityOperator.OR, new EntityExpr("organizationalUnit", EntityOperator.EQUALS, x500Map.get("OU")),
- new EntityExpr("organizationalUnit", EntityOperator.EQUALS, null),
- new EntityExpr("organizationalUnit", EntityOperator.EQUALS, "")));
-
- conds.add(EntityCondition.makeCondition(EntityOperator.OR, new EntityExpr("organizationName", EntityOperator.EQUALS, x500Map.get("O")),
- new EntityExpr("organizationName", EntityOperator.EQUALS, null),
- new EntityExpr("organizationName", EntityOperator.EQUALS, "")));
-
- conds.add(EntityCondition.makeCondition(EntityOperator.OR, new EntityExpr("cityLocality", EntityOperator.EQUALS, x500Map.get("L")),
- new EntityExpr("cityLocality", EntityOperator.EQUALS, null),
- new EntityExpr("cityLocality", EntityOperator.EQUALS, "")));
-
- conds.add(EntityCondition.makeCondition(EntityOperator.OR, new EntityExpr("stateProvince", EntityOperator.EQUALS, x500Map.get("ST")),
- new EntityExpr("stateProvince", EntityOperator.EQUALS, null),
- new EntityExpr("stateProvince", EntityOperator.EQUALS, "")));
-
- conds.add(EntityCondition.makeCondition(EntityOperator.OR, new EntityExpr("country", EntityOperator.EQUALS, x500Map.get("C")),
- new EntityExpr("country", EntityOperator.EQUALS, null),
- new EntityExpr("country", EntityOperator.EQUALS, "")));
-
- conds.add(EntityCondition.makeCondition(EntityOperator.OR, new EntityExpr("serialNumber", EntityOperator.EQUALS, serialNumber.toString(16)),
- new EntityExpr("serialNumber", EntityOperator.EQUALS, null),
- new EntityExpr("serialNumber", EntityOperator.EQUALS, "")));
+ conds.add(EntityCondition.makeCondition(EntityOperator.OR, EntityCondition.makeConditionMap("commonName", x500Map.get("CN")),
+ EntityCondition.makeConditionMap("commonName", null),
+ EntityCondition.makeConditionMap("commonName", "")));
+
+ conds.add(EntityCondition.makeCondition(EntityOperator.OR, EntityCondition.makeConditionMap("organizationalUnit", x500Map.get("OU")),
+ EntityCondition.makeConditionMap("organizationalUnit", null),
+ EntityCondition.makeConditionMap("organizationalUnit", "")));
+
+ conds.add(EntityCondition.makeCondition(EntityOperator.OR, EntityCondition.makeConditionMap("organizationName", x500Map.get("O")),
+ EntityCondition.makeConditionMap("organizationName", null),
+ EntityCondition.makeConditionMap("organizationName", "")));
+
+ conds.add(EntityCondition.makeCondition(EntityOperator.OR, EntityCondition.makeConditionMap("cityLocality", x500Map.get("L")),
+ EntityCondition.makeConditionMap("cityLocality", null),
+ EntityCondition.makeConditionMap("cityLocality", "")));
+
+ conds.add(EntityCondition.makeCondition(EntityOperator.OR, EntityCondition.makeConditionMap("stateProvince", x500Map.get("ST")),
+ EntityCondition.makeConditionMap("stateProvince", null),
+ EntityCondition.makeConditionMap("stateProvince", "")));
+
+ conds.add(EntityCondition.makeCondition(EntityOperator.OR, EntityCondition.makeConditionMap("country", x500Map.get("C")),
+ EntityCondition.makeConditionMap("country", null),
+ EntityCondition.makeConditionMap("country", "")));
+
+ conds.add(EntityCondition.makeCondition(EntityOperator.OR, EntityCondition.makeConditionMap("serialNumber", serialNumber.toString(16)),
+ EntityCondition.makeConditionMap("serialNumber", null),
+ EntityCondition.makeConditionMap("serialNumber", "")));
EntityConditionList<EntityCondition> condition = EntityCondition.makeCondition(conds);
Debug.logInfo("Doing issuer lookup: " + condition.toString(), module);
Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/FopRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/FopRenderer.java?rev=660812&r1=660811&r2=660812&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/FopRenderer.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/FopRenderer.java Tue May 27 22:20:09 2008
@@ -48,10 +48,8 @@
*/
public static ByteArrayOutputStream render(Writer writer) throws GeneralException {
- FopFactory fopFactory = ApacheFopFactory.instance();
-
+ FopFactory fopFactory = ApacheFopWorker.getFactoryInstance();
ByteArrayOutputStream out = new ByteArrayOutputStream();
-
TransformerFactory transFactory = TransformerFactory.newInstance();
try {
Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JspViewHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JspViewHandler.java?rev=660812&r1=660811&r2=660812&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JspViewHandler.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JspViewHandler.java Tue May 27 22:20:09 2008
@@ -82,7 +82,7 @@
if (throwable instanceof JspException) {
JspException jspe = (JspException) throwable;
- throwable = jspe.getRootCause() != null ? jspe.getRootCause() : jspe;
+ throwable = jspe.getCause() != null ? jspe.getCause() : jspe;
}
Debug.logError(throwable, "ServletException rendering JSP view", module);
throw new ViewHandlerException(e.getMessage(), throwable);
Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/RegionViewHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/RegionViewHandler.java?rev=660812&r1=660811&r2=660812&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/RegionViewHandler.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/RegionViewHandler.java Tue May 27 22:20:09 2008
@@ -92,7 +92,7 @@
if (throwable instanceof JspException) {
JspException jspe = (JspException) throwable;
- throwable = jspe.getRootCause() != null ? jspe.getRootCause() : jspe;
+ throwable = jspe.getCause() != null ? jspe.getCause() : jspe;
}
Debug.logError(throwable, "ServletException rendering JSP view", module);
throw new ViewHandlerException(e.getMessage(), throwable);
Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java?rev=660812&r1=660811&r2=660812&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java Tue May 27 22:20:09 2008
@@ -67,6 +67,7 @@
import org.ofbiz.entity.condition.EntityCondition;
import org.ofbiz.entity.condition.EntityConditionList;
import org.ofbiz.entity.condition.EntityExpr;
+import org.ofbiz.entity.condition.EntityFunction;
import org.ofbiz.entity.condition.EntityOperator;
import org.ofbiz.entity.model.ModelEntity;
import org.ofbiz.entity.model.ModelField;
@@ -940,15 +941,15 @@
paramList.add("lookupFlag=" + lookupFlag);
if (UtilValidate.isNotEmpty(serviceName)) {
paramList.add("serviceName=" + serviceName);
- conditions.add(new EntityExpr("serviceName", true, EntityOperator.LIKE, "%"+serviceName+"%", true));
+ conditions.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("serviceName"), EntityOperator.LIKE, EntityFunction.UPPER("%"+serviceName+"%")));
}
if (UtilValidate.isNotEmpty(jobId)) {
paramList.add("jobId=" + jobId);
- conditions.add(new EntityExpr("jobId", true, EntityOperator.LIKE, "%"+jobId+"%", true));
+ conditions.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("jobId"), EntityOperator.LIKE, EntityFunction.UPPER("%"+jobId+"%")));
}
if (UtilValidate.isNotEmpty(jobName)) {
paramList.add("jobName=" + jobName);
- conditions.add(new EntityExpr("jobName", true, EntityOperator.LIKE, "%"+jobName+"%", true));
+ conditions.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("jobName"), EntityOperator.LIKE, EntityFunction.UPPER("%"+jobName+"%")));
}
List filterExprs = FastList.newInstance();
String filterJobPending = (String) context.get("filterJobsWithPendingStatus");
@@ -966,17 +967,17 @@
}
if ("Y".equals(filterJobPending)) {
paramList.add("filterJobsWithPendingStatus=Y");
- filterExprs.add(new EntityExpr("statusId", EntityOperator.EQUALS, "SERVICE_PENDING"));
+ filterExprs.add(EntityCondition.makeCondition("statusId", "SERVICE_PENDING"));
result.put("filterJobsWithPendingStatus", filterJobPending);
}
if ("Y".equals(filterJobRunning)) {
paramList.add("filterJobsWithRunningStatus=Y");
- filterExprs.add(new EntityExpr("statusId", EntityOperator.EQUALS, "SERVICE_RUNNING"));
+ filterExprs.add(EntityCondition.makeCondition("statusId", "SERVICE_RUNNING"));
result.put("filterJobsWithRunningStatus", filterJobRunning);
}
if ("Y".equals(filterJobFinished)) {
paramList.add("filterJobsWithFinishedStatus=Y");
- filterExprs.add(new EntityExpr("statusId", EntityOperator.EQUALS, "SERVICE_FINISHED"));
+ filterExprs.add(EntityCondition.makeCondition("statusId", "SERVICE_FINISHED"));
result.put("filterJobsWithFinishedStatus", filterJobFinished);
}
if (filterExprs.size() > 0) {
Modified: ofbiz/trunk/framework/workflow/src/org/ofbiz/workflow/client/WorkflowServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/workflow/src/org/ofbiz/workflow/client/WorkflowServices.java?rev=660812&r1=660811&r2=660812&view=diff
==============================================================================
--- ofbiz/trunk/framework/workflow/src/org/ofbiz/workflow/client/WorkflowServices.java (original)
+++ ofbiz/trunk/framework/workflow/src/org/ofbiz/workflow/client/WorkflowServices.java Tue May 27 22:20:09 2008
@@ -447,16 +447,13 @@
} else {
String partyId = userLogin.getString("partyId");
EntityConditionList<EntityExpr> ecl = EntityCondition.makeCondition(
- EntityOperator.AND,
- new EntityExpr[] {
- new EntityExpr("partyId", EntityOperator.EQUALS, partyId),
- new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "CAL_DECLINED"),
- new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "CAL_DELEGATED"),
- new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "CAL_COMPLETED"),
- new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "CAL_CANCELLED"),
- new EntityExpr("workEffortId", EntityOperator.EQUALS, workEffortId),
- new EntityExpr("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, UtilDateTime.nowTimestamp())
- });
+ EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId),
+ EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "CAL_DECLINED"),
+ EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "CAL_DELEGATED"),
+ EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "CAL_COMPLETED"),
+ EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "CAL_CANCELLED"),
+ EntityCondition.makeCondition("workEffortId", EntityOperator.EQUALS, workEffortId),
+ EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, UtilDateTime.nowTimestamp()));
Collection c = null;
@@ -469,16 +466,13 @@
}
if (c.size() == 0) {
ecl = EntityCondition.makeCondition(
- EntityOperator.AND,
- new EntityExpr[] {
- new EntityExpr("partyId", EntityOperator.EQUALS, partyId),
- new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "CAL_DECLINED"),
- new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "CAL_DELEGATED"),
- new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "CAL_COMPLETED"),
- new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "CAL_CANCELLED"),
- new EntityExpr("workEffortParentId", EntityOperator.EQUALS, workEffortId),
- new EntityExpr("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, UtilDateTime.nowTimestamp())
- });
+ EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId),
+ EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "CAL_DECLINED"),
+ EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "CAL_DELEGATED"),
+ EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "CAL_COMPLETED"),
+ EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "CAL_CANCELLED"),
+ EntityCondition.makeCondition("workEffortParentId", EntityOperator.EQUALS, workEffortId),
+ EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, UtilDateTime.nowTimestamp()));
try {
c = userLogin.getDelegator().findList("WorkEffortAndPartyAssign", ecl, null, null, null, false);
//Debug.logInfo("Found " + c.size() + " records.", module);