Author: lektran Date: Thu Oct 30 04:18:05 2014 New Revision: 1635383 URL: http://svn.apache.org/r1635383 Log: Regex search/replace for delegator.findOne() to EntityQuery.queryOne()
Apologies for the large commit. Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/quote/QuoteServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/test/PurchaseOrderTest.java ofbiz/trunk/applications/order/src/org/ofbiz/order/test/SalesOrderTest.java ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java ofbiz/trunk/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyHelper.java ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyRelationshipServices.java ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyTypeHelper.java ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyWorker.java ofbiz/trunk/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CatalogUrlFilter.java ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java ofbiz/trunk/applications/product/src/org/ofbiz/product/category/OfbizCatalogAltUrlTransform.java ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigItemContentWrapper.java ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java ofbiz/trunk/applications/product/src/org/ofbiz/product/feature/ParametricSearch.java ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/FrameImage.java ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageUrlServlet.java ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/WatermarkImage.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/product/src/org/ofbiz/product/product/ProductContentWrapper.java ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductPromoContentWrapper.java ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearch.java ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java ofbiz/trunk/applications/product/src/org/ofbiz/product/product/VariantEvents.java ofbiz/trunk/applications/product/src/org/ofbiz/product/promo/PromoServices.java ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java ofbiz/trunk/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java ofbiz/trunk/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java ofbiz/trunk/applications/product/src/org/ofbiz/product/test/InventoryItemTransferTest.java ofbiz/trunk/applications/product/src/org/ofbiz/product/test/StockMovesTest.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentEvents.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/test/IssuanceTest.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java ofbiz/trunk/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalWorker.java ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortPartyAssignmentServices.java ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearch.java ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java ofbiz/trunk/framework/common/src/org/ofbiz/common/UrlServletHelper.java ofbiz/trunk/framework/common/src/org/ofbiz/common/geo/GeoWorker.java ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityCryptoTestSuite.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityCrypto.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtilProperties.java ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/cache/EntityCacheServices.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/service/src/org/ofbiz/service/ServiceUtil.java ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java ofbiz/trunk/framework/service/src/org/ofbiz/service/semaphore/ServiceSemaphore.java ofbiz/trunk/framework/service/src/org/ofbiz/service/test/ServiceEngineTestServices.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/OfbizUrlBuilder.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlEventListener.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapperImage.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayBestOfferAutoPref.java ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayFeedback.java ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreCustomerService.java ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreHelper.java ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreInventoryServices.java ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOrder.java ofbiz/trunk/specialpurpose/ecommerce/src/org/ofbiz/ecommerce/janrain/JanrainHelper.java ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java ofbiz/trunk/specialpurpose/ldap/src/org/ofbiz/ldap/commons/AbstractOFBizAuthenticationHandler.java ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/search/ProductDocument.java ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/test/LuceneTests.java ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java ofbiz/trunk/specialpurpose/scrum/src/org/ofbiz/scrum/ScrumServices.java ofbiz/trunk/specialpurpose/webpos/src/org/ofbiz/webpos/WebPosEvents.java Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java Thu Oct 30 04:18:05 2014 @@ -48,6 +48,7 @@ import org.ofbiz.entity.condition.Entity import org.ofbiz.entity.condition.EntityConditionList; import org.ofbiz.entity.condition.EntityExpr; import org.ofbiz.entity.condition.EntityOperator; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.order.thirdparty.paypal.ExpressCheckoutEvents; import org.ofbiz.product.product.ProductContentWrapper; @@ -140,7 +141,7 @@ public class OrderReturnServices { // get the return item information GenericValue returnItem = null; try { - returnItem = delegator.findOne("ReturnItem", UtilMisc.toMap("returnId", returnId, "returnItemSeqId", returnItemSeqId), false); + returnItem = EntityQuery.use(delegator).from("ReturnItem").where("returnId", returnId, "returnItemSeqId", returnItemSeqId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); throw new GeneralRuntimeException(e.getMessage()); @@ -200,7 +201,7 @@ public class OrderReturnServices { // get the return header GenericValue returnHeader = null; try { - returnHeader = delegator.findOne("ReturnHeader", UtilMisc.toMap("returnId", returnId), false); + returnHeader = EntityQuery.use(delegator).from("ReturnHeader").where("returnId", returnId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, @@ -248,7 +249,7 @@ public class OrderReturnServices { GenericValue productStoreEmail = null; try { - productStoreEmail = delegator.findOne("ProductStoreEmailSetting", UtilMisc.toMap("productStoreId", productStoreId, "emailType", emailType), false); + productStoreEmail = EntityQuery.use(delegator).from("ProductStoreEmailSetting").where("productStoreId", productStoreId, "emailType", emailType).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); } @@ -354,7 +355,7 @@ public class OrderReturnServices { if (returnItemResponse != null) { String replacementOrderId = returnItemResponse.getString("replacementOrderId"); Map<String, Object> svcCtx = UtilMisc.<String, Object>toMap("orderId", replacementOrderId, "userLogin", userLogin); - GenericValue orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", replacementOrderId), false); + GenericValue orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", replacementOrderId).queryOne(); if ("ORDER_HOLD".equals(orderHeader.getString("statusId"))) { try { dispatcher.runSync("cancelOrderItem", svcCtx); @@ -460,7 +461,7 @@ public class OrderReturnServices { GenericValue orderHeader = null; try { - orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, @@ -604,7 +605,7 @@ public class OrderReturnServices { GenericValue returnHeader = null; List<GenericValue> returnItems = null; try { - returnHeader = delegator.findOne("ReturnHeader", UtilMisc.toMap("returnId", returnId), false); + returnHeader = EntityQuery.use(delegator).from("ReturnHeader").where("returnId", returnId).queryOne(); if (returnHeader != null) { returnItems = returnHeader.getRelated("ReturnItem", null, null, false); } @@ -697,7 +698,7 @@ public class OrderReturnServices { GenericValue returnHeader = null; List<GenericValue> returnItems = null; try { - returnHeader = delegator.findOne("ReturnHeader", UtilMisc.toMap("returnId", returnId), false); + returnHeader = EntityQuery.use(delegator).from("ReturnHeader").where("returnId", returnId).queryOne(); if (returnHeader != null) { returnItems = returnHeader.getRelated("ReturnItem", UtilMisc.toMap("returnTypeId", "RTN_CREDIT"), null, false); } @@ -775,7 +776,7 @@ public class OrderReturnServices { String thisBillingAccountId = billingAccountItr.next().getString("billingAccountId"); BigDecimal billingAccountBalance = ZERO; try { - GenericValue billingAccount = delegator.findOne("BillingAccount", UtilMisc.toMap("billingAccountId", thisBillingAccountId), false); + GenericValue billingAccount = EntityQuery.use(delegator).from("BillingAccount").where("billingAccountId", thisBillingAccountId).queryOne(); billingAccountBalance = OrderReadHelper.getBillingAccountBalance(billingAccount); } catch (GenericEntityException e) { return ServiceUtil.returnError(e.getMessage()); @@ -1083,7 +1084,7 @@ public class OrderReturnServices { GenericValue orderHeader = null; List<GenericValue> orderPayPrefs = FastList.newInstance(); try { - orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); orderPayPrefs = orderHeader.getRelated("OrderPaymentPreference", null, UtilMisc.toList("-maxAmount"), false); } catch (GenericEntityException e) { Debug.logError("Problem looking up order information for orderId #" + orderId, module); @@ -1143,7 +1144,7 @@ public class OrderReturnServices { GenericValue returnHeader = null; List<GenericValue> returnItems = null; try { - returnHeader = delegator.findOne("ReturnHeader", UtilMisc.toMap("returnId", returnId), false); + returnHeader = EntityQuery.use(delegator).from("ReturnHeader").where("returnId", returnId).queryOne(); if (returnHeader != null) { returnItems = returnHeader.getRelated("ReturnItem", UtilMisc.toMap("returnTypeId", returnTypeId), null, false); } @@ -1184,7 +1185,7 @@ public class OrderReturnServices { GenericValue orderHeader = null; List<GenericValue> orderPayPrefs = null; try { - orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); // sort these desending by maxAmount orderPayPrefs = orderHeader.getRelated("OrderPaymentPreference", null, UtilMisc.toList("-maxAmount"), false); @@ -1196,7 +1197,7 @@ public class OrderReturnServices { List<GenericValue> orderItemAssocs = delegator.findByAnd("OrderItemAssoc", UtilMisc.toMap("toOrderId", orderId, "orderItemAssocTypeId", "REPLACEMENT"), null, false); if (UtilValidate.isNotEmpty(orderItemAssocs)) { String originalOrderId = EntityUtil.getFirst(orderItemAssocs).getString("orderId"); - orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", originalOrderId), false); + orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", originalOrderId).queryOne(); orderPayPrefs = orderHeader.getRelated("OrderPaymentPreference", null, UtilMisc.toList("-maxAmount"), false); orderPayPrefs = EntityUtil.filterByOr(orderPayPrefs, exprs); orderId = originalOrderId; @@ -1355,7 +1356,7 @@ public class OrderReturnServices { Map<String, Object> result = dispatcher.runSync("createOrderPaymentPreference", serviceContext); orderPaymentPreferenceNewId = (String) result.get("orderPaymentPreferenceId"); try { - refundOrderPaymentPreference = delegator.findOne("OrderPaymentPreference", false, "orderPaymentPreferenceId", orderPaymentPreferenceNewId); + refundOrderPaymentPreference = EntityQuery.use(delegator).from("OrderPaymentPreference").where("orderPaymentPreferenceId", orderPaymentPreferenceNewId).queryOne(); } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderProblemsWithTheRefundSeeLogs", locale)); } @@ -1589,7 +1590,7 @@ public class OrderReturnServices { String responseId = (String) context.get("returnItemResponseId"); String errorMsg = "Failed to create payment applications for return item response [" + responseId + "]. "; try { - GenericValue response = delegator.findOne("ReturnItemResponse", UtilMisc.toMap("returnItemResponseId", responseId), false); + GenericValue response = EntityQuery.use(delegator).from("ReturnItemResponse").where("returnItemResponseId", responseId).queryOne(); if (response == null) { return ServiceUtil.returnError(errorMsg + "Return Item Response not found with ID [" + responseId + "]."); } @@ -1673,7 +1674,7 @@ public class OrderReturnServices { GenericValue returnHeader = null; List<GenericValue> returnItems = null; try { - returnHeader = delegator.findOne("ReturnHeader", UtilMisc.toMap("returnId", returnId), false); + returnHeader = EntityQuery.use(delegator).from("ReturnHeader").where("returnId", returnId).queryOne(); if (returnHeader != null) { returnItems = returnHeader.getRelated("ReturnItem", UtilMisc.toMap("returnTypeId", returnTypeId), null, false); } @@ -1697,7 +1698,7 @@ public class OrderReturnServices { // get order header & payment prefs GenericValue orderHeader = null; try { - orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Cannot get Order details for #" + orderId, module); continue; @@ -2156,7 +2157,7 @@ public class OrderReturnServices { GenericValue returnHeader; List<GenericValue> returnItems = null; try { - returnHeader = delegator.findOne("ReturnHeader", UtilMisc.toMap("returnId", returnId), false); + returnHeader = EntityQuery.use(delegator).from("ReturnHeader").where("returnId", returnId).queryOne(); if (returnHeader != null) { returnItems = returnHeader.getRelated("ReturnItem", UtilMisc.toMap("returnTypeId", "RTN_REFUND"), null, false); } @@ -2368,14 +2369,14 @@ public class OrderReturnServices { // if orderAdjustment is not empty, then copy most return adjustment information from orderAdjustment's if (orderAdjustmentId != null) { try { - orderAdjustment = delegator.findOne("OrderAdjustment", UtilMisc.toMap("orderAdjustmentId", orderAdjustmentId), false); + orderAdjustment = EntityQuery.use(delegator).from("OrderAdjustment").where("orderAdjustmentId", orderAdjustmentId).queryOne(); if (orderAdjustment == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OrderCreateReturnAdjustmentNotFoundOrderAdjustment", UtilMisc.toMap("orderAdjustmentId", orderAdjustmentId), locale)); } // get returnHeaderTypeId from ReturnHeader and then use it to figure out return item type mapping - returnHeader = delegator.findOne("ReturnHeader", UtilMisc.toMap("returnId", returnId), false); + returnHeader = EntityQuery.use(delegator).from("ReturnHeader").where("returnId", returnId).queryOne(); String returnHeaderTypeId = ((returnHeader != null) && (returnHeader.getString("returnHeaderTypeId") != null)) ? returnHeader.getString("returnHeaderTypeId") : "CUSTOMER_RETURN"; returnItemTypeMap = delegator.findOne("ReturnItemTypeMap", UtilMisc.toMap("returnHeaderTypeId", returnHeaderTypeId, "returnItemMapKey", orderAdjustment.get("orderAdjustmentTypeId")), false); @@ -2470,7 +2471,7 @@ public class OrderReturnServices { try { - returnAdjustment = delegator.findOne("ReturnAdjustment", UtilMisc.toMap("returnAdjustmentId", context.get("returnAdjustmentId")), false); + returnAdjustment = EntityQuery.use(delegator).from("ReturnAdjustment").where("returnAdjustmentId", context.get("returnAdjustmentId")).queryOne(); if (returnAdjustment != null) { returnItem = delegator.findOne("ReturnItem", UtilMisc.toMap("returnId", returnAdjustment.get("returnId"), "returnItemSeqId", returnAdjustment.get("returnItemSeqId")), false); 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=1635383&r1=1635382&r2=1635383&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 Thu Oct 30 04:18:05 2014 @@ -63,6 +63,7 @@ import org.ofbiz.entity.transaction.Gene import org.ofbiz.entity.transaction.TransactionUtil; import org.ofbiz.entity.util.EntityFindOptions; import org.ofbiz.entity.util.EntityListIterator; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityTypeUtil; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.order.shoppingcart.CartItemModifyException; @@ -213,7 +214,7 @@ public class OrderServices { GenericValue productStore = null; if ((orderTypeId.equals("SALES_ORDER")) && (UtilValidate.isNotEmpty(productStoreId))) { try { - productStore = delegator.findOne("ProductStore", UtilMisc.toMap("productStoreId", productStoreId), true); + productStore = EntityQuery.use(delegator).from("ProductStore").where("productStoreId", productStoreId).cache().queryOne(); } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "OrderErrorCouldNotFindProductStoreWithID",UtilMisc.toMap("productStoreId",productStoreId),locale) + e.toString()); @@ -231,7 +232,7 @@ public class OrderServices { // lookup the order type entity GenericValue orderType = null; try { - orderType = delegator.findOne("OrderType", UtilMisc.toMap("orderTypeId", orderTypeId), true); + orderType = EntityQuery.use(delegator).from("OrderType").where("orderTypeId", orderTypeId).cache().queryOne(); } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "OrderErrorOrderTypeLookupFailed",locale) + e.toString()); @@ -301,7 +302,7 @@ public class OrderServices { GenericValue product = null; try { - product = delegator.findOne("Product", UtilMisc.toMap("productId", currentProductId), true); + product = EntityQuery.use(delegator).from("Product").where("productId", currentProductId).cache().queryOne(); } catch (GenericEntityException e) { String errMsg = UtilProperties.getMessage(resource_error, "product.not_found", new Object[] { currentProductId }, locale); Debug.logError(e, errMsg, module); @@ -1101,7 +1102,7 @@ public class OrderServices { Map<String, Object> ripCtx = FastMap.newInstance(); if (UtilValidate.isNotEmpty(inventoryFacilityId) && UtilValidate.isNotEmpty(productId) && orderItem.getBigDecimal("quantity").compareTo(BigDecimal.ZERO) > 0) { // do something tricky here: run as the "system" user - GenericValue permUserLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), true); + GenericValue permUserLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne(); ripCtx.put("productId", productId); ripCtx.put("facilityId", inventoryFacilityId); ripCtx.put("inventoryItemTypeId", "SERIALIZED_INV_ITEM"); @@ -1201,7 +1202,7 @@ public class OrderServices { GenericValue productStore = null; if (UtilValidate.isNotEmpty(productStoreId)) { try { - productStore = delegator.findOne("ProductStore", UtilMisc.toMap("productStoreId", productStoreId), true); + productStore = EntityQuery.use(delegator).from("ProductStore").where("productStoreId", productStoreId).cache().queryOne(); } catch (GenericEntityException e) { throw new GeneralException(UtilProperties.getMessage(resource_error, "OrderErrorCouldNotFindProductStoreWithID", @@ -1308,7 +1309,7 @@ public class OrderServices { if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.getString("productTypeId"), "parentTypeId", "MARKETING_PKG_AUTO")) { // do something tricky here: run as the "system" user // that can actually create and run a production run - GenericValue permUserLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), true); + GenericValue permUserLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne(); Map<String, Object> inputMap = new HashMap<String, Object>(); if (UtilValidate.isNotEmpty(shipGroupFacilityId)) { inputMap.put("facilityId", shipGroupFacilityId); @@ -1404,7 +1405,7 @@ public class OrderServices { } if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.getString("productTypeId"), "parentTypeId", "MARKETING_PKG_AUTO")) { - GenericValue permUserLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), true); + GenericValue permUserLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne(); Map<String, Object> inputMap = new HashMap<String, Object>(); if (UtilValidate.isNotEmpty(shipGroupFacilityId)) { inputMap.put("facilityId", shipGroupFacilityId); @@ -1465,7 +1466,7 @@ public class OrderServices { GenericValue orderHeader = null; try { - orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); } catch (GenericEntityException e) { String errMsg = "ERROR: Could not set grantTotal on OrderHeader entity: " + e.toString(); Debug.logError(e, errMsg, module); @@ -1485,7 +1486,7 @@ public class OrderServices { if (UtilValidate.isNotEmpty(productStoreId)) { GenericValue productStore = null; try { - productStore = delegator.findOne("ProductStore", UtilMisc.toMap("productStoreId", productStoreId), true); + productStore = EntityQuery.use(delegator).from("ProductStore").where("productStoreId", productStoreId).cache().queryOne(); } catch (GenericEntityException e) { String errorMessage = UtilProperties.getMessage(resource_error, "OrderErrorCouldNotFindProductStoreWithID", @@ -1600,7 +1601,7 @@ public class OrderServices { // get the order header GenericValue orderHeader = null; try { - orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "OrderErrorCannotGetOrderHeaderEntity",locale) + e.getMessage()); @@ -1667,7 +1668,7 @@ public class OrderServices { GenericValue orderItem = validOrderItems.get(i); String productId = orderItem.getString("productId"); try { - products.add(i, delegator.findOne("Product", UtilMisc.toMap("productId", productId), false)); // get the product entity + products.add(i, EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne()); // get the product entity amounts.add(i, OrderReadHelper.getOrderItemSubTotal(orderItem, allAdjustments, true, false)); // get the item amount shipAmts.add(i, OrderReadHelper.getOrderItemAdjustmentsTotal(orderItem, allAdjustments, false, false, true)); // get the shipping amount itPrices.add(i, orderItem.getBigDecimal("unitPrice")); @@ -1816,7 +1817,7 @@ public class OrderServices { // get the order header GenericValue orderHeader = null; try { - orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "OrderErrorCannotGetOrderHeaderEntity",locale) + e.getMessage()); @@ -1915,7 +1916,7 @@ public class OrderServices { // get the order header GenericValue orderHeader = null; try { - orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Cannot get OrderHeader record", module); } @@ -1976,7 +1977,7 @@ public class OrderServices { // this is a bit of a pain: if the current statusId = ProductStore.headerApprovedStatus and we don't have that status in the history then we don't want to change it on approving the items if (UtilValidate.isNotEmpty(orderHeader.getString("productStoreId"))) { try { - GenericValue productStore = delegator.findOne("ProductStore", UtilMisc.toMap("productStoreId", orderHeader.getString("productStoreId")), false); + GenericValue productStore = EntityQuery.use(delegator).from("ProductStore").where("productStoreId", orderHeader.getString("productStoreId")).queryOne(); if (productStore != null) { String headerApprovedStatus = productStore.getString("headerApprovedStatus"); if (UtilValidate.isNotEmpty(headerApprovedStatus)) { @@ -2321,7 +2322,7 @@ public class OrderServices { } try { - GenericValue orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + GenericValue orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); if (orderHeader == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, @@ -2424,7 +2425,7 @@ public class OrderServices { //Locale locale = (Locale) context.get("locale"); try { - GenericValue shipGroup = delegator.findOne("OrderItemShipGroup", UtilMisc.toMap("orderId", orderId, "shipGroupSeqId", shipGroupSeqId), false); + GenericValue shipGroup = EntityQuery.use(delegator).from("OrderItemShipGroup").where("orderId", orderId, "shipGroupSeqId", shipGroupSeqId).queryOne(); if (shipGroup == null) { result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR); @@ -2568,7 +2569,7 @@ public class OrderServices { // get the order header and store GenericValue orderHeader = null; try { - orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Problem getting OrderHeader", module); } @@ -2585,7 +2586,7 @@ public class OrderServices { GenericValue productStoreEmail = null; try { - productStoreEmail = delegator.findOne("ProductStoreEmailSetting", UtilMisc.toMap("productStoreId", orderHeader.get("productStoreId"), "emailType", emailType), false); + productStoreEmail = EntityQuery.use(delegator).from("ProductStoreEmailSetting").where("productStoreId", orderHeader.get("productStoreId"), "emailType", emailType).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Problem getting the ProductStoreEmailSetting for productStoreId=" + orderHeader.get("productStoreId") + " and emailType=" + emailType, module); } @@ -2709,10 +2710,10 @@ public class OrderServices { // get the order/workflow info try { - workEffort = delegator.findOne("WorkEffort", UtilMisc.toMap("workEffortId", workEffortId), false); + workEffort = EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", workEffortId).queryOne(); String sourceReferenceId = workEffort.getString("sourceReferenceId"); if (sourceReferenceId != null) - orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", sourceReferenceId), false); + orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", sourceReferenceId).queryOne(); } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "OrderProblemWithEntityLookup", locale)); @@ -2722,7 +2723,7 @@ public class OrderServices { GenericValue party = null; Collection<GenericValue> assignedToEmails = null; try { - party = delegator.findOne("Party", UtilMisc.toMap("partyId", assignedToUser), false); + party = EntityQuery.use(delegator).from("Party").where("partyId", assignedToUser).queryOne(); } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "OrderProblemWithEntityLookup", locale)); @@ -2842,7 +2843,7 @@ public class OrderServices { GenericValue orderHeader = null; try { - orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Problem getting order header detial", module); return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, @@ -2865,7 +2866,7 @@ public class OrderServices { GenericValue orderHeader = null; try { - orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, @@ -2905,7 +2906,7 @@ public class OrderServices { //Locale locale = (Locale) context.get("locale"); try { - orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); if (orderHeader != null) result.put("orderHeader", orderHeader); } catch (GenericEntityException e) { @@ -3163,7 +3164,7 @@ public class OrderServices { // need the order header GenericValue orderHeader = null; try { - orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "ERROR: Unable to get OrderHeader for orderId : " + orderId, module); return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, @@ -3247,7 +3248,7 @@ public class OrderServices { // do something tricky here: run as a different user that can actually create an invoice, post transaction, etc Map<String, Object> invoiceResult = null; try { - GenericValue permUserLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), false); + GenericValue permUserLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne(); Map<String, Object> invoiceContext = UtilMisc.<String, Object>toMap("orderId", orderId, "billItems", itemsToInvoice, "userLogin", permUserLogin); invoiceResult = dispatcher.runSync("createInvoiceForOrder", invoiceContext); } catch (GenericEntityException e) { @@ -3398,7 +3399,7 @@ public class OrderServices { GenericValue custMethod = null; if (UtilValidate.isNotEmpty(content.getString("customMethodId"))) { try { - custMethod = delegator.findOne("CustomMethod", UtilMisc.toMap("customMethodId", content.get("customMethodId")), true); + custMethod = EntityQuery.use(delegator).from("CustomMethod").where("customMethodId", content.get("customMethodId")).cache().queryOne(); } catch (GenericEntityException e) { Debug.logError(e,"ERROR: Cannot get CustomMethod associate to Content entity: " + e.getMessage(),module); continue; @@ -4147,7 +4148,7 @@ public class OrderServices { String billingAccountId = cart.getBillingAccountId(); if (UtilValidate.isNotEmpty(billingAccountId)) { try { - GenericValue orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + GenericValue orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); orderHeader.set("billingAccountId", billingAccountId); toStore.add(orderHeader); } catch (GenericEntityException e) { @@ -4291,7 +4292,7 @@ public class OrderServices { } GenericValue oldOrderItem = null; try { - oldOrderItem = delegator.findOne("OrderItem", UtilMisc.toMap("orderId", valueObj.getString("orderId"), "orderItemSeqId", valueObj.getString("orderItemSeqId")), false); + oldOrderItem = EntityQuery.use(delegator).from("OrderItem").where("orderId", valueObj.getString("orderId"), "orderItemSeqId", valueObj.getString("orderItemSeqId")).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); throw new GeneralException(e.getMessage()); @@ -4542,7 +4543,7 @@ public class OrderServices { } try { // get the order payment preference - GenericValue orderPaymentPreference = delegator.findOne("OrderPaymentPreference", UtilMisc.toMap("orderPaymentPreferenceId", orderPaymentPreferenceId), false); + GenericValue orderPaymentPreference = EntityQuery.use(delegator).from("OrderPaymentPreference").where("orderPaymentPreferenceId", orderPaymentPreferenceId).queryOne(); if (orderPaymentPreference == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OrderOrderPaymentCannotBeCreated", @@ -4657,7 +4658,7 @@ public class OrderServices { } GenericValue orderHeader = null; try { - orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -4699,7 +4700,7 @@ public class OrderServices { } GenericValue orderHeader = null; try { - orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -5003,7 +5004,7 @@ public class OrderServices { String statusId = (String) context.get("statusId"); try { - GenericValue opp = delegator.findOne("OrderPaymentPreference", UtilMisc.toMap("orderPaymentPreferenceId", orderPaymentPreferenceId), false); + GenericValue opp = EntityQuery.use(delegator).from("OrderPaymentPreference").where("orderPaymentPreferenceId", orderPaymentPreferenceId).queryOne(); String paymentMethodId = null; String paymentMethodTypeId = null; @@ -5018,7 +5019,7 @@ public class OrderServices { } } if (paymentMethodTypeId == null) { - GenericValue method = delegator.findOne("PaymentMethod", UtilMisc.toMap("paymentMethodTypeId", paymentMethodTypeId), false); + GenericValue method = EntityQuery.use(delegator).from("PaymentMethod").where("paymentMethodTypeId", paymentMethodTypeId).queryOne(); paymentMethodId = checkOutPaymentId; paymentMethodTypeId = (String) method.get("paymentMethodTypeId"); } @@ -5066,7 +5067,7 @@ public class OrderServices { try { - GenericValue orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + GenericValue orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); if (UtilValidate.isEmpty(orderHeader)) { String errorMessage = UtilProperties.getMessage(resource_error, @@ -5138,7 +5139,7 @@ public class OrderServices { try { - GenericValue orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + GenericValue orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); if (UtilValidate.isEmpty(orderHeader)) { String errorMessage = UtilProperties.getMessage(resource_error, @@ -5366,14 +5367,14 @@ public class OrderServices { BigDecimal invoicedQuantity = ZERO; // Quantity invoiced for the target order item try { - orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); if (UtilValidate.isEmpty(orderHeader)) { String errorMessage = UtilProperties.getMessage(resource_error, "OrderErrorOrderIdNotFound", context, locale); Debug.logError(errorMessage, module); return ServiceUtil.returnError(errorMessage); } - orderItemToCheck = delegator.findOne("OrderItem", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId), false); + orderItemToCheck = EntityQuery.use(delegator).from("OrderItem").where("orderId", orderId, "orderItemSeqId", orderItemSeqId).queryOne(); if (UtilValidate.isEmpty(orderItemToCheck)) { String errorMessage = UtilProperties.getMessage(resource_error, "OrderErrorOrderItemNotFound", context, locale); @@ -5478,10 +5479,10 @@ public class OrderServices { String changeReason = (String) context.get("changeReason"); Locale locale = (Locale) context.get("locale"); try { - GenericValue orderPaymentPreference = delegator.findOne("OrderPaymentPreference", UtilMisc.toMap("orderPaymentPreferenceId", orderPaymentPreferenceId), false); + GenericValue orderPaymentPreference = EntityQuery.use(delegator).from("OrderPaymentPreference").where("orderPaymentPreferenceId", orderPaymentPreferenceId).queryOne(); String orderId = orderPaymentPreference.getString("orderId"); String statusUserLogin = orderPaymentPreference.getString("createdByUserLogin"); - GenericValue orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + GenericValue orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); if (orderHeader == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "OrderErrorCouldNotChangeOrderStatusOrderCannotBeFound", locale)); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/quote/QuoteServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/quote/QuoteServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/quote/QuoteServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/quote/QuoteServices.java Thu Oct 30 04:18:05 2014 @@ -33,6 +33,7 @@ import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; @@ -63,7 +64,7 @@ public class QuoteServices { // get the quote and store GenericValue quote = null; try { - quote = delegator.findOne("Quote", UtilMisc.toMap("quoteId", quoteId), false); + quote = EntityQuery.use(delegator).from("Quote").where("quoteId", quoteId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Problem getting Quote", module); } @@ -76,7 +77,7 @@ public class QuoteServices { GenericValue productStoreEmail = null; try { - productStoreEmail = delegator.findOne("ProductStoreEmailSetting", UtilMisc.toMap("productStoreId", quote.get("productStoreId"), "emailType", emailType), false); + productStoreEmail = EntityQuery.use(delegator).from("ProductStoreEmailSetting").where("productStoreId", quote.get("productStoreId"), "emailType", emailType).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Problem getting the ProductStoreEmailSetting for productStoreId=" + quote.get("productStoreId") + " and emailType=" + emailType, module); } 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=1635383&r1=1635382&r2=1635383&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 Thu Oct 30 04:18:05 2014 @@ -31,6 +31,7 @@ import org.ofbiz.entity.condition.*; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.GenericServiceException; @@ -133,7 +134,7 @@ public class RequirementServices { // for good identification, get the UPCA type (UPC code) GenericValue gid = gids.get(productId); if (gid == null) { - gid = delegator.findOne("GoodIdentification", UtilMisc.toMap("goodIdentificationTypeId", "UPCA", "productId", requirement.get("productId")), false); + gid = EntityQuery.use(delegator).from("GoodIdentification").where("goodIdentificationTypeId", "UPCA", "productId", requirement.get("productId")).queryOne(); gids.put(productId, gid); } if (gid != null) union.put("idValue", gid.get("idValue")); @@ -208,7 +209,7 @@ public class RequirementServices { String orderId = (String) context.get("orderId"); try { - GenericValue order = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + GenericValue order = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); GenericValue productStore = order.getRelatedOne("ProductStore", true); if (productStore == null) { Debug.logInfo("ProductStore for order ID " + orderId + " not found, requirements not created", module); @@ -267,7 +268,7 @@ public class RequirementServices { */ String orderId = (String) context.get("orderId"); try { - GenericValue order = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + GenericValue order = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); GenericValue productStore = order.getRelatedOne("ProductStore", true); if (productStore == null) { Debug.logInfo("ProductStore for order ID " + orderId + " not found, ATP requirements not created", module); @@ -288,7 +289,7 @@ public class RequirementServices { if (ordered.compareTo(BigDecimal.ZERO) <= 0) continue; // get the minimum stock for this facility (if not configured assume a minimum of zero, ie create requirements when it goes into backorder) - GenericValue productFacility = delegator.findOne("ProductFacility", UtilMisc.toMap("facilityId", facilityId, "productId", product.get("productId")), false); + GenericValue productFacility = EntityQuery.use(delegator).from("ProductFacility").where("facilityId", facilityId, "productId", product.get("productId")).queryOne(); BigDecimal minimumStock = BigDecimal.ZERO; if (productFacility != null && productFacility.get("minimumStock") != null) { minimumStock = productFacility.getBigDecimal("minimumStock"); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java Thu Oct 30 04:18:05 2014 @@ -43,6 +43,7 @@ import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.marketing.tracking.TrackingCodeEvents; import org.ofbiz.order.order.OrderReadHelper; @@ -508,7 +509,7 @@ public class CheckOutEvents { ShoppingCart cart = ShoppingCartEvents.getCartObject(request); GenericValue productStore = null; try { - productStore = delegator.findOne("ProductStore", UtilMisc.toMap("productStoreId", cart.getProductStoreId()), true); + productStore = EntityQuery.use(delegator).from("ProductStore").where("productStoreId", cart.getProductStoreId()).cache().queryOne(); Debug.logInfo("checkShipmentNeeded: reqShipAddrForDigItems=" + productStore.getString("reqShipAddrForDigItems"), module); } catch (GenericEntityException e) { Debug.logError(e, "Error getting ProductStore: " + e.toString(), module); @@ -758,7 +759,7 @@ public class CheckOutEvents { // no userLogin means we are an anonymous shopper; fake the UL for service calls if (userLogin == null) { try { - userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "anonymous"), false); + userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "anonymous").queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); } Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Thu Oct 30 04:18:05 2014 @@ -47,6 +47,7 @@ import org.ofbiz.entity.condition.Entity import org.ofbiz.entity.condition.EntityExpr; import org.ofbiz.entity.condition.EntityFunction; import org.ofbiz.entity.condition.EntityOperator; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityTypeUtil; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.order.finaccount.FinAccountHelper; @@ -634,9 +635,9 @@ public class CheckOutHelper { try { // do something tricky here: run as the "system" user // that can actually create and run a production run - GenericValue permUserLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), true); + GenericValue permUserLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne(); GenericValue productStore = ProductStoreWorker.getProductStore(productStoreId, delegator); - GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false); + GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.getString("productTypeId"), "parentTypeId", "AGGREGATED")) { org.ofbiz.product.config.ProductConfigWrapper config = this.cart.findCartItem(counter).getConfigWrapper(); Map<String, Object> inputMap = new HashMap<String, Object>(); @@ -696,7 +697,7 @@ public class CheckOutHelper { GenericValue party = null; try { - party = this.delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false); + party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne(); } catch (GenericEntityException e) { Debug.logWarning(e, UtilProperties.getMessage(resource_error,"OrderProblemsGettingPartyRecord", cart.getLocale()), module); } @@ -1267,7 +1268,7 @@ public class CheckOutHelper { userLogin.set("enabled", "N"); userLogin.store(); } else { - userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), true); + userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne(); } } catch (GenericEntityException e) { Debug.logError(e, module); @@ -1293,7 +1294,7 @@ public class CheckOutHelper { // you cannot accept multiple payment type when using an external gateway GenericValue orderHeader = null; try { - orderHeader = this.delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Problems getting order header", module); errMsg = UtilProperties.getMessage(resource_error,"checkhelper.problems_getting_order_header", (cart != null ? cart.getLocale() : Locale.getDefault())); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Thu Oct 30 04:18:05 2014 @@ -59,6 +59,7 @@ import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.condition.EntityCondition; import org.ofbiz.entity.condition.EntityExpr; import org.ofbiz.entity.condition.EntityOperator; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.entity.util.EntityUtilProperties; import org.ofbiz.order.finaccount.FinAccountHelper; @@ -1909,7 +1910,7 @@ public class ShoppingCart implements Ite * @throws GenericEntityException */ public GenericValue getGiftCertSettingFromStore(Delegator delegator) throws GenericEntityException { - return delegator.findOne("ProductStoreFinActSetting", UtilMisc.toMap("productStoreId", getProductStoreId(), "finAccountTypeId", FinAccountHelper.giftCertFinAccountTypeId), true); + return EntityQuery.use(delegator).from("ProductStoreFinActSetting").where("productStoreId", getProductStoreId(), "finAccountTypeId", FinAccountHelper.giftCertFinAccountTypeId).cache().queryOne(); } /** @@ -3431,7 +3432,7 @@ public class ShoppingCart implements Ite String productName = product.getString("productName"); String description = product.getString("description"); Map<String, Object> serviceContext = new HashMap<String, Object>(); - GenericValue permUserLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), false); + GenericValue permUserLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne(); String internalName = item.getProductId() + "_" + configId; serviceContext.put("internalName", internalName); serviceContext.put("productName", productName); @@ -4842,7 +4843,7 @@ public class ShoppingCart implements Ite GenericValue productStore = null; String splitPayPrefPerShpGrp = null; try { - productStore = delegator.findOne("ProductStore", UtilMisc.toMap("productStoreId", cart.getProductStoreId()), false); + productStore = EntityQuery.use(delegator).from("ProductStore").where("productStoreId", cart.getProductStoreId()).queryOne(); } catch (GenericEntityException e) { Debug.logError(e.toString(), module); } Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java Thu Oct 30 04:18:05 2014 @@ -53,6 +53,7 @@ import org.ofbiz.entity.GenericPK; import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.condition.EntityCondition; import org.ofbiz.entity.condition.EntityOperator; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.order.shoppingcart.product.ProductPromoWorker; import org.ofbiz.product.catalog.CatalogWorker; @@ -622,7 +623,7 @@ public class ShoppingCartEvents { if(ProductWorker.isAlternativePacking(delegator, productId , parentProductId)){ GenericValue parentProduct = null; try { - parentProduct = delegator.findOne("Product", UtilMisc.toMap("productId", parentProductId), false); + parentProduct = EntityQuery.use(delegator).from("Product").where("productId", parentProductId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Error getting parent product", module); } @@ -721,7 +722,7 @@ public class ShoppingCartEvents { // check the preferred currency of the supplier, if set, use that for the cart, otherwise use system defaults. ShoppingCart cart = null; try { - GenericValue supplierParty = delegator.findOne("Party", UtilMisc.toMap("partyId", supplierPartyId), false); + GenericValue supplierParty = EntityQuery.use(delegator).from("Party").where("partyId", supplierPartyId).queryOne(); if (UtilValidate.isNotEmpty(supplierParty.getString("preferredCurrencyUomId"))) { cart = new WebShoppingCart(request, locale, supplierParty.getString("preferredCurrencyUomId")); } else { @@ -742,7 +743,7 @@ public class ShoppingCartEvents { if (UtilValidate.isNotEmpty(orderId)) { GenericValue thisOrder = null; try { - thisOrder = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + thisOrder = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e.getMessage(), module); } @@ -1305,7 +1306,7 @@ public class ShoppingCartEvents { } try { - termType = delegator.findOne("TermType", UtilMisc.toMap("termTypeId", termTypeId), false); + termType = EntityQuery.use(delegator).from("TermType").where("termTypeId", termTypeId).queryOne(); } catch (GenericEntityException gee) { request.setAttribute("_ERROR_MESSAGE_", gee.getMessage()); return "error"; @@ -1666,7 +1667,7 @@ public class ShoppingCartEvents { if (UtilValidate.isEmpty(partyId) && UtilValidate.isNotEmpty(userLoginId)) { GenericValue thisUserLogin = null; try { - thisUserLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", userLoginId), false); + thisUserLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", userLoginId).queryOne(); } catch (GenericEntityException gee) { // } @@ -1679,7 +1680,7 @@ public class ShoppingCartEvents { if (UtilValidate.isNotEmpty(partyId)) { GenericValue thisParty = null; try { - thisParty = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false); + thisParty = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne(); } catch (GenericEntityException gee) { // } @@ -1735,7 +1736,7 @@ public class ShoppingCartEvents { String productPromoId = (String)context.get(keyPrefix + i); if (UtilValidate.isNotEmpty(productPromoId)) { try { - GenericValue promo = delegator.findOne("ProductPromo", UtilMisc.toMap("productPromoId", productPromoId), false); + GenericValue promo = EntityQuery.use(delegator).from("ProductPromo").where("productPromoId", productPromoId).queryOne(); if (promo != null) { manualPromotions.add(promo); } @@ -1897,7 +1898,7 @@ public class ShoppingCartEvents { if (UtilValidate.isNotEmpty(orderId)) { GenericValue thisOrder = null; try { - thisOrder = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + thisOrder = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e.getMessage(), module); } Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java Thu Oct 30 04:18:05 2014 @@ -44,6 +44,7 @@ import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityTypeUtil; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.order.order.OrderReadHelper; @@ -192,7 +193,7 @@ public class ShoppingCartHelper { GenericValue product = null; if (productId != null) { try { - product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true); + product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Unable to lookup product : " + productId, module); } @@ -331,7 +332,7 @@ public class ShoppingCartHelper { String aggregatedProdId = null; if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", ProductWorker.getProductTypeId(delegator, productId), "parentTypeId", "AGGREGATED")) { try { - GenericValue instanceProduct = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false); + GenericValue instanceProduct = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); String configId = instanceProduct.getString("configId"); aggregatedProdId = ProductWorker.getInstanceAggregatedId(delegator, productId); configWrapper = ProductConfigWorker.loadProductConfigWrapper(delegator, dispatcher, configId, aggregatedProdId, cart.getProductStoreId(), catalogId, cart.getWebSiteId(), cart.getCurrency(), cart.getLocale(), cart.getAutoUserLogin()); @@ -434,7 +435,7 @@ public class ShoppingCartHelper { originalProductId = productId; productId = ProductWorker.getOriginalProductId(delegator, productId); try { - originalProduct = delegator.findOne("Product", UtilMisc.toMap("productId", originalProductId), false); + originalProduct = EntityQuery.use(delegator).from("Product").where("productId", originalProductId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Error getting parent product", module); } @@ -504,7 +505,7 @@ public class ShoppingCartHelper { requirementId = (String) context.get("requirementId" + thisSuffix); GenericValue requirement = null; try { - requirement = delegator.findOne("Requirement", UtilMisc.toMap("requirementId", requirementId), false); + requirement = EntityQuery.use(delegator).from("Requirement").where("requirementId", requirementId).queryOne(); } catch (GenericEntityException gee) { } if (requirement == null) { Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java Thu Oct 30 04:18:05 2014 @@ -52,6 +52,7 @@ import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.condition.EntityCondition; import org.ofbiz.entity.condition.EntityExpr; import org.ofbiz.entity.condition.EntityOperator; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.order.order.OrderReadHelper; import org.ofbiz.order.shoppingcart.product.ProductPromoWorker; @@ -182,7 +183,7 @@ public class ShoppingCartItem implements GenericValue product = null; try { - product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true); + product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne(); } catch (GenericEntityException e) { Debug.logWarning(e.toString(), module); } @@ -326,7 +327,7 @@ public class ShoppingCartItem implements { try { - parentProduct = delegator.findOne("Product", UtilMisc.toMap("productId", parentProductId), true); + parentProduct = EntityQuery.use(delegator).from("Product").where("productId", parentProductId).cache().queryOne(); } catch (GenericEntityException e) { Debug.logWarning(e.toString(), module); } @@ -515,7 +516,7 @@ public class ShoppingCartItem implements GenericValue product; try { - product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true); + product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne(); // first see if there is a purchase allow category and if this product is in it or not String purchaseProductCategoryId = CatalogWorker.getCatalogPurchaseAllowCategoryId(delegator, prodCatalogId); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java Thu Oct 30 04:18:05 2014 @@ -44,6 +44,7 @@ import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.condition.EntityCondition; import org.ofbiz.entity.condition.EntityExpr; import org.ofbiz.entity.condition.EntityOperator; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityTypeUtil; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.order.order.OrderReadHelper; @@ -178,7 +179,7 @@ public class ShoppingCartServices { // get the order header GenericValue orderHeader = null; try { - orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -362,7 +363,7 @@ public class ShoppingCartServices { } if ("ITEM_REJECTED".equals(item.getString("statusId")) || "ITEM_CANCELLED".equals(item.getString("statusId"))) continue; try { - product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false); + product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); if ("DIGITAL_GOOD".equals(product.getString("productTypeId"))) { Map<String, Object> surveyResponseMap = FastMap.newInstance(); Map<String, Object> answers = FastMap.newInstance(); @@ -432,7 +433,7 @@ public class ShoppingCartServices { String workEffortId = orh.getCurrentOrderItemWorkEffort(item); if (workEffortId != null) { try { - workEffort = delegator.findOne("WorkEffort", UtilMisc.toMap("workEffortId", workEffortId), false); + workEffort = EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", workEffortId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); } @@ -450,7 +451,7 @@ public class ShoppingCartServices { ProductConfigWrapper configWrapper = null; String configId = null; try { - product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false); + product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.getString("productTypeId"), "parentTypeId", "AGGREGATED")) { List<GenericValue>productAssocs = delegator.findByAnd("ProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_CONF", "productIdTo", product.getString("productId")), null, false); productAssocs = EntityUtil.filterByDate(productAssocs); @@ -660,7 +661,7 @@ public class ShoppingCartServices { // get the quote header GenericValue quote = null; try { - quote = delegator.findOne("Quote", UtilMisc.toMap("quoteId", quoteId), false); + quote = EntityQuery.use(delegator).from("Quote").where("quoteId", quoteId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -960,7 +961,7 @@ public class ShoppingCartServices { // get the shopping list header GenericValue shoppingList = null; try { - shoppingList = delegator.findOne("ShoppingList", UtilMisc.toMap("shoppingListId", shoppingListId), false); + shoppingList = EntityQuery.use(delegator).from("ShoppingList").where("shoppingListId", shoppingListId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage());