You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by le...@apache.org on 2008/05/09 22:57:24 UTC
svn commit: r654934 - in /ofbiz/trunk:
applications/accounting/src/org/ofbiz/accounting/payment/
applications/order/src/org/ofbiz/order/
applications/order/src/org/ofbiz/order/order/
applications/order/src/org/ofbiz/order/requirement/ applications/part...
Author: lektran
Date: Fri May 9 13:57:23 2008
New Revision: 654934
URL: http://svn.apache.org/viewvc?rev=654934&view=rev
Log:
Removed more calls to deprecated GenericDelegator methods
Modified:
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java
ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java
ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java
ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java
ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java
ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/project/ProjectWorker.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
ofbiz/trunk/framework/workflow/src/org/ofbiz/workflow/client/WorkflowServices.java
ofbiz/trunk/specialpurpose/assetmaint/src/org/ofbiz/assetmaint/FixedAssetMaintServices.java
Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java?rev=654934&r1=654933&r2=654934&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java Fri May 9 13:57:23 2008
@@ -41,6 +41,7 @@
import org.ofbiz.entity.condition.EntityCondition;
import org.ofbiz.entity.condition.EntityConditionList;
import org.ofbiz.entity.condition.EntityExpr;
+import org.ofbiz.entity.condition.EntityJoinOperator;
import org.ofbiz.entity.condition.EntityOperator;
import org.ofbiz.entity.util.EntityUtil;
import org.ofbiz.order.order.OrderReadHelper;
@@ -212,11 +213,13 @@
* Returns list of orders which are currently open against a billing account
*/
public static List getBillingAccountOpenOrders(GenericDelegator delegator, String billingAccountId) throws GenericEntityException {
- return delegator.findByAnd("OrderHeader", UtilMisc.toList(
- new EntityExpr("billingAccountId", EntityOperator.EQUALS, billingAccountId),
- new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"),
- new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED"),
- new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "ORDER_COMPLETED")));
+ EntityConditionList<EntityExpr> ecl = new EntityConditionList<EntityExpr>(UtilMisc.toList(
+ new EntityExpr("billingAccountId", EntityOperator.EQUALS, billingAccountId),
+ new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"),
+ new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED"),
+ new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "ORDER_COMPLETED")),
+ EntityJoinOperator.AND);
+ return delegator.findList("OrderHeader", ecl, null, null, null, false);
}
/**
Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java?rev=654934&r1=654933&r2=654934&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java Fri May 9 13:57:23 2008
@@ -38,6 +38,7 @@
import org.ofbiz.entity.GenericDelegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.condition.EntityConditionList;
import org.ofbiz.entity.condition.EntityExpr;
import org.ofbiz.entity.condition.EntityOperator;
import org.ofbiz.entity.util.EntityUtil;
@@ -148,8 +149,8 @@
List paymentMethodTypes = null;
try {
- List pmtFields = UtilMisc.toList(new EntityExpr("paymentMethodTypeId", EntityOperator.NOT_EQUAL, "EXT_OFFLINE"));
- paymentMethodTypes = delegator.findByAnd("PaymentMethodType", pmtFields);
+ EntityExpr ee = new EntityExpr("paymentMethodTypeId", EntityOperator.NOT_EQUAL, "EXT_OFFLINE");
+ paymentMethodTypes = delegator.findList("PaymentMethodType", ee, null, null, null, false);
} catch (GenericEntityException e) {
Debug.logError(e, "Problems getting payment types", module);
request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderProblemsWithPaymentTypeLookup", locale));
@@ -236,9 +237,11 @@
List currentPrefs = null;
double paymentTally = 0.00;
try {
- List oppFields = UtilMisc.toList(new EntityExpr("orderId", EntityOperator.EQUALS, orderId),
- new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_CANCELLED"));
- currentPrefs = delegator.findByAnd("OrderPaymentPreference", oppFields);
+ EntityConditionList<EntityExpr> ecl = new EntityConditionList<EntityExpr>(UtilMisc.toList(
+ new EntityExpr("orderId", EntityOperator.EQUALS, orderId),
+ new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_CANCELLED")),
+ EntityOperator.AND);
+ currentPrefs = delegator.findList("OrderPaymentPreference", ecl, null, null, null, false);
} catch (GenericEntityException e) {
Debug.logError(e, "ERROR: Unable to get existing payment preferences from order", module);
}
Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=654934&r1=654933&r2=654934&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Fri May 9 13:57:23 2008
@@ -4096,7 +4096,7 @@
// The checkOutPaymentId is either a paymentMethodId or paymentMethodTypeId
// the original method did a "\d+" regexp to decide which is the case, this version is more explicit with its lookup of PaymentMethodType
if (checkOutPaymentId != null) {
- List paymentMethodTypes = delegator.findAllCache("PaymentMethodType");
+ List paymentMethodTypes = delegator.findList("PaymentMethodType", null, null, null, null, true);
for (Iterator iter = paymentMethodTypes.iterator(); iter.hasNext(); ) {
GenericValue type = (GenericValue) iter.next();
if (type.get("paymentMethodTypeId").equals(checkOutPaymentId)) {
Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java?rev=654934&r1=654933&r2=654934&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java Fri May 9 13:57:23 2008
@@ -282,14 +282,14 @@
// count all current requirements for this product
double pendingRequirements = 0.0;
- List conditions = UtilMisc.toList(
+ EntityConditionList<EntityExpr> ecl = new EntityConditionList<EntityExpr>(UtilMisc.toList(
new EntityExpr("facilityId", EntityOperator.EQUALS, facilityId),
new EntityExpr("productId", EntityOperator.EQUALS, product.get("productId")),
new EntityExpr("requirementTypeId", EntityOperator.EQUALS, "PRODUCT_REQUIREMENT"),
new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "REQ_ORDERED"),
- new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "REQ_REJECTED")
- );
- List requirements = delegator.findByAnd("Requirement", conditions);
+ new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "REQ_REJECTED")),
+ EntityOperator.AND);
+ List requirements = delegator.findList("Requirement", ecl, null, null, null, false);
for (Iterator riter = requirements.iterator(); riter.hasNext(); ) {
GenericValue requirement = (GenericValue) riter.next();
pendingRequirements += (requirement.get("quantity") == null ? 0.0 : requirement.getDouble("quantity").doubleValue());
Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java?rev=654934&r1=654933&r2=654934&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java (original)
+++ ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java Fri May 9 13:57:23 2008
@@ -474,7 +474,7 @@
target.put("tryEntity", new Boolean(tryEntity));
try {
- Collection contactMechTypes = delegator.findAllCache("ContactMechType");
+ Collection contactMechTypes = delegator.findList("ContactMechType", null, null, null, null, true);
if (contactMechTypes != null) {
target.put("contactMechTypes", contactMechTypes);
@@ -641,7 +641,7 @@
target.put("tryEntity", new Boolean(tryEntity));
try {
- Collection contactMechTypes = delegator.findAllCache("ContactMechType");
+ Collection contactMechTypes = delegator.findList("ContactMechType", null, null, null, null, true);
if (contactMechTypes != null) {
target.put("contactMechTypes", contactMechTypes);
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java?rev=654934&r1=654933&r2=654934&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java Fri May 9 13:57:23 2008
@@ -358,8 +358,8 @@
// find all inventory items w/ a negative ATP
List inventoryItems = null;
try {
- List exprs = UtilMisc.toList(new EntityExpr("availableToPromiseTotal", EntityOperator.LESS_THAN, new Double(0)));
- inventoryItems = delegator.findByAnd("InventoryItem", exprs);
+ EntityExpr ee = new EntityExpr("availableToPromiseTotal", EntityOperator.LESS_THAN, new Double(0));
+ inventoryItems = delegator.findList("InventoryItem", ee, null, null, null, false);
} catch (GenericEntityException e) {
Debug.logError(e, "Trouble getting inventory items", module);
return ServiceUtil.returnError("Problem getting InventoryItem records");
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java?rev=654934&r1=654933&r2=654934&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java Fri May 9 13:57:23 2008
@@ -891,7 +891,7 @@
// new EntityExpr("thruDate", EntityOperator.GREATER_THAN, UtilDateTime.nowTimestamp()));
// productPriceRules = delegator.findByOr("ProductPriceRule", pprExprs);
- productPriceRules = delegator.findAllCache("ProductPriceRule");
+ productPriceRules = delegator.findList("ProductPriceRule", null, null, null, null, true);
if (productPriceRules == null) productPriceRules = new LinkedList();
}
Modified: ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/project/ProjectWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/project/ProjectWorker.java?rev=654934&r1=654933&r2=654934&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/project/ProjectWorker.java (original)
+++ ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/project/ProjectWorker.java Fri May 9 13:57:23 2008
@@ -30,6 +30,7 @@
import org.ofbiz.entity.GenericDelegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.condition.EntityConditionList;
import org.ofbiz.entity.condition.EntityExpr;
import org.ofbiz.entity.condition.EntityOperator;
@@ -103,9 +104,11 @@
if (userLogin != null && userLogin.get("partyId") != null) {
try {
- relatedWorkEfforts = delegator.findByAnd("WorkEffortAssoc",
- UtilMisc.toList(new EntityExpr("workEffortIdFrom", EntityOperator.EQUALS, projectWorkEffortId),
- new EntityExpr("workEffortAssocTypeId", EntityOperator.EQUALS, "WORK_EFF_BREAKDOWN")));
+ EntityConditionList<EntityExpr> ecl = new EntityConditionList<EntityExpr>(UtilMisc.toList(
+ new EntityExpr("workEffortIdFrom", EntityOperator.EQUALS, projectWorkEffortId),
+ new EntityExpr("workEffortAssocTypeId", EntityOperator.EQUALS, "WORK_EFF_BREAKDOWN")),
+ EntityOperator.AND);
+ relatedWorkEfforts = delegator.findByAnd("WorkEffortAssoc", ecl, null, null, null, false);
} catch (GenericEntityException e) {
Debug.logWarning(e, module);
}
@@ -151,9 +154,11 @@
if (userLogin != null && userLogin.get("partyId") != null) {
try {
- relatedWorkEfforts = delegator.findByAnd("WorkEffortAssoc",
- UtilMisc.toList(new EntityExpr("workEffortIdFrom", EntityOperator.EQUALS, phaseWorkEffortId),
- new EntityExpr("workEffortAssocTypeId", EntityOperator.EQUALS, "WORK_EFF_BREAKDOWN")));
+ EntityConditionList<EntityExpr> ecl = new EntityConditionList<EntityExpr>(UtilMisc.toList(
+ new EntityExpr("workEffortIdFrom", EntityOperator.EQUALS, phaseWorkEffortId),
+ new EntityExpr("workEffortAssocTypeId", EntityOperator.EQUALS, "WORK_EFF_BREAKDOWN")),
+ EntityOperator.AND);
+ relatedWorkEfforts = delegator.findByAnd("WorkEffortAssoc", ecl, null, null, null, false);
} catch (GenericEntityException e) {
Debug.logWarning(e, module);
}
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java?rev=654934&r1=654933&r2=654934&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java Fri May 9 13:57:23 2008
@@ -1823,7 +1823,7 @@
}
/** Finds all Generic entities
- * NOTE 20080502: 10 references
+ * NOTE 20080502: 10 references; all changed to findList
*@param entityName The Name of the Entity as defined in the entity XML file
*@param orderBy The fields of the named entity to order the query by; optionally add a " ASC" for ascending or " DESC" for descending
*@return List containing all Generic entities
@@ -1834,7 +1834,7 @@
}
/** Finds all Generic entities, looking first in the cache
- * NOTE 20080502: 4 references
+ * NOTE 20080502: 4 references; all changed to findList
*@param entityName The Name of the Entity as defined in the entity XML file
*@return List containing all Generic entities
*@deprecated Use findList() instead
@@ -1851,11 +1851,11 @@
*@deprecated Use findList() instead
*/
public List<GenericValue> findAllCache(String entityName, String... orderBy) throws GenericEntityException {
- return findAllCache(entityName, Arrays.asList(orderBy));
+ return findList(entityName, null, null, Arrays.asList(orderBy), null, true);
}
/** Finds all Generic entities, looking first in the cache; uses orderBy for lookup, but only keys results on the entityName and fields
- * NOTE 20080502: 2 references
+ * NOTE 20080502: 2 references; all changed to findList
*@param entityName The Name of the Entity as defined in the entity XML file
*@param orderBy The fields of the named entity to order the query by; optionally add a " ASC" for ascending or " DESC" for descending
*@return List containing all Generic entities
@@ -1975,7 +1975,8 @@
*@deprecated Use findList() instead
*/
public <T extends EntityCondition> List<GenericValue> findByAnd(String entityName, T... expressions) throws GenericEntityException {
- return this.findByAnd(entityName, Arrays.asList(expressions));
+ EntityConditionList<T> ecl = new EntityConditionList<T>(Arrays.asList(expressions), EntityOperator.AND);
+ return this.findList(entityName, ecl, null, null, null, false);
}
/** Finds Generic Entity records by all of the specified expressions (ie: combined using AND)
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=654934&r1=654933&r2=654934&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 Fri May 9 13:57:23 2008
@@ -31,6 +31,7 @@
import org.ofbiz.entity.GenericDelegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.condition.EntityConditionList;
import org.ofbiz.entity.condition.EntityExpr;
import org.ofbiz.entity.condition.EntityOperator;
import org.ofbiz.security.Security;
@@ -446,36 +447,41 @@
return true;
} else {
String partyId = userLogin.getString("partyId");
- List expr = new ArrayList();
-
- expr.add(new EntityExpr("partyId", EntityOperator.EQUALS, partyId));
- expr.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "CAL_DECLINED"));
- expr.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "CAL_DELEGATED"));
- expr.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "CAL_COMPLETED"));
- expr.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "CAL_CANCELLED"));
- expr.add(new EntityExpr("workEffortId", EntityOperator.EQUALS, workEffortId));
- expr.add(new EntityExpr("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, UtilDateTime.nowTimestamp()));
+ EntityConditionList<EntityExpr> ecl = new EntityConditionList<EntityExpr>(
+ 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())
+ });
Collection c = null;
try {
- c = userLogin.getDelegator().findByAnd("WorkEffortAndPartyAssign", expr);
+ c = userLogin.getDelegator().findList("WorkEffortAndPartyAssign", ecl, null, null, null, false);
//Debug.logInfo("Found " + c.size() + " records.", module);
} catch (GenericEntityException e) {
Debug.logWarning(e, module);
return false;
}
if (c.size() == 0) {
- expr = new ArrayList();
- expr.add(new EntityExpr("partyId", EntityOperator.EQUALS, partyId));
- expr.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "CAL_DECLINED"));
- expr.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "CAL_DELEGATED"));
- expr.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "CAL_COMPLETED"));
- expr.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "CAL_CANCELLED"));
- expr.add(new EntityExpr("workEffortParentId", EntityOperator.EQUALS, workEffortId));
- expr.add(new EntityExpr("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, UtilDateTime.nowTimestamp()));
+ ecl = new EntityConditionList<EntityExpr>(
+ 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())
+ });
try {
- c = userLogin.getDelegator().findByAnd("WorkEffortAndPartyAssign", expr);
+ c = userLogin.getDelegator().findList("WorkEffortAndPartyAssign", ecl, null, null, null, false);
//Debug.logInfo("Found " + c.size() + " records.", module);
} catch (GenericEntityException e) {
Debug.logWarning(e, module);
Modified: ofbiz/trunk/specialpurpose/assetmaint/src/org/ofbiz/assetmaint/FixedAssetMaintServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/assetmaint/src/org/ofbiz/assetmaint/FixedAssetMaintServices.java?rev=654934&r1=654933&r2=654934&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/assetmaint/src/org/ofbiz/assetmaint/FixedAssetMaintServices.java (original)
+++ ofbiz/trunk/specialpurpose/assetmaint/src/org/ofbiz/assetmaint/FixedAssetMaintServices.java Fri May 9 13:57:23 2008
@@ -28,6 +28,7 @@
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.base.util.UtilProperties;
+import org.ofbiz.entity.condition.EntityConditionList;
import org.ofbiz.entity.condition.EntityExpr;
import org.ofbiz.entity.condition.EntityOperator;
import org.ofbiz.entity.GenericDelegator;
@@ -76,10 +77,12 @@
return ServiceUtil.returnError
(UtilProperties.getMessage("AssetMaintUiLabels","AssetMaintLowPartInventoryError",UtilMisc.toMap("productId", productId , "quantity", Double.toString(atp)), locale));
}
- List inventoryItems = delegator.findByAnd("InventoryItem", UtilMisc.toList(
+ EntityConditionList<EntityExpr> ecl = new EntityConditionList<EntityExpr>(UtilMisc.toList(
new EntityExpr("productId", EntityOperator.EQUALS, productId),
new EntityExpr("facilityId", EntityOperator.EQUALS, facilityId),
- new EntityExpr("availableToPromiseTotal", EntityOperator.GREATER_THAN, "0"))); //&& inventoryItems.size() > 0
+ new EntityExpr("availableToPromiseTotal", EntityOperator.GREATER_THAN, "0")),
+ EntityOperator.AND);
+ List inventoryItems = delegator.findByAnd("InventoryItem", ecl, null, null, null, false); //&& inventoryItems.size() > 0
Iterator itr = inventoryItems.iterator();
while (requestedQty > 0 && itr.hasNext()) {
GenericValue inventoryItem = (GenericValue)itr.next();