Author: doogie
Date: Sat May 12 21:19:35 2012 New Revision: 1337669 URL: http://svn.apache.org/viewvc?rev=1337669&view=rev Log: DEPRECATION: applications/order: findByPrimaryKey variants replaced with findOne Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/finaccount/FinAccountHelper.java ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java 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/shoppinglist/ShoppingListEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/task/TaskWorker.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/webapp/ordermgr/WEB-INF/actions/entry/AdditionalPartyListing.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/BillSettings.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/CheckInits.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/CheckoutOptions.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/CheckoutPayment.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/CheckoutReview.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/OptionSettings.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShowCart.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/ShowPromotionDetails.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/AdvancedSearchOptions.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Category.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/InlineProductDetail.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductSummary.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductUomDropDownOnly.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/QuickAdd.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/FindOrders.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderDeliveryScheduleInfo.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderHistory.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/SendConfirmationEmail.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ViewImage.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/reports/OpenOrderItemsReport.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/QuickReturn.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnHeader.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnItems.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/setup/PaymentSetup.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/task/OrderTaskList.groovy ofbiz/trunk/applications/order/webapp/ordermgr/entry/SetItemShipGroups.ftl ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/advancedsearch.ftl ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productsummary.ftl ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/quickadd.ftl ofbiz/trunk/applications/order/webapp/ordermgr/entry/optionsettings.ftl ofbiz/trunk/applications/order/webapp/ordermgr/entry/order/shipGroupConfirmSummary.ftl ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl ofbiz/trunk/applications/order/webapp/ordermgr/quote/ViewQuoteItemInfo.ftl ofbiz/trunk/applications/order/webapp/ordermgr/reports/CouponSalesReport.rptdesign ofbiz/trunk/applications/order/webapp/ordermgr/reports/Last3MonthsSalesReport.rptdesign ofbiz/trunk/applications/order/webapp/ordermgr/reports/OrderDiscountCodeReport.rptdesign 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=1337669&r1=1337668&r2=1337669&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java Sat May 12 21:19:35 2012 @@ -135,7 +135,7 @@ public class OrderManagerEvents { // get the order header & payment preferences GenericValue orderHeader = null; try { - orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); } catch (GenericEntityException e) { Debug.logError(e, "Problems reading order header from datasource.", module); request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderProblemsReadingOrderHeaderInformation", locale)); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/finaccount/FinAccountHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/finaccount/FinAccountHelper.java?rev=1337669&r1=1337668&r2=1337669&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/finaccount/FinAccountHelper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/finaccount/FinAccountHelper.java Sat May 12 21:19:35 2012 @@ -249,7 +249,7 @@ public class FinAccountHelper { public static boolean validatePin(Delegator delegator, String finAccountId, String pinNumber) { GenericValue finAccount = null; try { - finAccount = delegator.findByPrimaryKey("FinAccount", UtilMisc.toMap("finAccountId", finAccountId)); + finAccount = delegator.findOne("FinAccount", UtilMisc.toMap("finAccountId", finAccountId), false); } catch (GenericEntityException e) { Debug.logError(e, module); } @@ -306,7 +306,7 @@ public class FinAccountHelper { } private static boolean checkIsNumberInDatabase(Delegator delegator, String number) throws GenericEntityException { - GenericValue finAccount = delegator.findByPrimaryKey("FinAccount", UtilMisc.toMap("finAccountId", number)); + GenericValue finAccount = delegator.findOne("FinAccount", UtilMisc.toMap("finAccountId", number), false); return finAccount == null; } Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java?rev=1337669&r1=1337668&r2=1337669&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java Sat May 12 21:19:35 2012 @@ -172,7 +172,7 @@ public class OrderChangeHelper { Delegator delegator = dispatcher.getDelegator(); GenericValue orderHeader = null; try { - orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); } catch (GenericEntityException e) { Debug.logError(e, "ERROR: Unable to get OrderHeader for OrderID : " + orderId, module); } @@ -248,7 +248,7 @@ public class OrderChangeHelper { public static void createReceivedPayments(LocalDispatcher dispatcher, GenericValue userLogin, String orderId) throws GenericEntityException, GenericServiceException { GenericValue orderHeader = null; try { - orderHeader = dispatcher.getDelegator().findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + orderHeader = dispatcher.getDelegator().findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); } catch (GenericEntityException e) { Debug.logError(e, module); } @@ -281,7 +281,7 @@ public class OrderChangeHelper { public static void createOrderInvoice(LocalDispatcher dispatcher, GenericValue userLogin, String orderId) throws GenericServiceException { GenericValue orderHeader = null; try { - orderHeader = dispatcher.getDelegator().findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + orderHeader = dispatcher.getDelegator().findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); } catch (GenericEntityException e) { Debug.logError(e, module); } Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java?rev=1337669&r1=1337668&r2=1337669&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java Sat May 12 21:19:35 2012 @@ -250,7 +250,7 @@ public class OrderLookupServices { if (UtilValidate.isNotEmpty(userLoginId) && UtilValidate.isEmpty(partyId)) { GenericValue ul = null; try { - ul = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", userLoginId)); + ul = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", userLoginId), true); } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), module); } @@ -366,7 +366,7 @@ public class OrderLookupServices { } else { GenericValue product = null; try { - product = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId)); + product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false); } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), module); } Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=1337669&r1=1337668&r2=1337669&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Sat May 12 21:19:35 2012 @@ -94,8 +94,8 @@ public class OrderReadHelper { this.orderItems = orderItems; if (this.orderHeader != null && !this.orderHeader.getEntityName().equals("OrderHeader")) { try { - this.orderHeader = orderHeader.getDelegator().findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", - orderHeader.getString("orderId"))); + this.orderHeader = orderHeader.getDelegator().findOne("OrderHeader", UtilMisc.toMap("orderId", + orderHeader.getString("orderId")), false); } catch (GenericEntityException e) { Debug.logError(e, module); this.orderHeader = null; @@ -129,7 +129,7 @@ public class OrderReadHelper { public OrderReadHelper(Delegator delegator, String orderId) { try { - this.orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + this.orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); } catch (GenericEntityException e) { String errMsg = "Error finding order with ID [" + orderId + "]: " + e.toString(); Debug.logError(e, errMsg, module); @@ -163,7 +163,7 @@ public class OrderReadHelper { String productStoreId = orderHeader.getString("productStoreId"); try { Delegator delegator = orderHeader.getDelegator(); - GenericValue productStore = delegator.findByPrimaryKeyCache("ProductStore", UtilMisc.toMap("productStoreId", productStoreId)); + GenericValue productStore = delegator.findOne("ProductStore", UtilMisc.toMap("productStoreId", productStoreId), true); return productStore; } catch (GenericEntityException ex) { Debug.logError(ex, "Failed to get product store for order header [" + orderHeader + "] due to exception "+ ex.getMessage(), module); @@ -342,8 +342,8 @@ public class OrderReadHelper { public String getShippingMethod(String shipGroupSeqId) { try { - GenericValue shipGroup = orderHeader.getDelegator().findByPrimaryKey("OrderItemShipGroup", - UtilMisc.toMap("orderId", orderHeader.getString("orderId"), "shipGroupSeqId", shipGroupSeqId)); + GenericValue shipGroup = orderHeader.getDelegator().findOne("OrderItemShipGroup", + UtilMisc.toMap("orderId", orderHeader.getString("orderId"), "shipGroupSeqId", shipGroupSeqId), false); if (shipGroup != null) { GenericValue carrierShipmentMethod = shipGroup.getRelatedOne("CarrierShipmentMethod"); @@ -366,8 +366,8 @@ public class OrderReadHelper { public String getShippingMethodCode(String shipGroupSeqId) { try { - GenericValue shipGroup = orderHeader.getDelegator().findByPrimaryKey("OrderItemShipGroup", - UtilMisc.toMap("orderId", orderHeader.getString("orderId"), "shipGroupSeqId", shipGroupSeqId)); + GenericValue shipGroup = orderHeader.getDelegator().findOne("OrderItemShipGroup", + UtilMisc.toMap("orderId", orderHeader.getString("orderId"), "shipGroupSeqId", shipGroupSeqId), false); if (shipGroup != null) { GenericValue carrierShipmentMethod = shipGroup.getRelatedOne("CarrierShipmentMethod"); @@ -409,8 +409,8 @@ public class OrderReadHelper { public GenericValue getOrderItemShipGroup(String shipGroupSeqId) { try { - return orderHeader.getDelegator().findByPrimaryKey("OrderItemShipGroup", - UtilMisc.toMap("orderId", orderHeader.getString("orderId"), "shipGroupSeqId", shipGroupSeqId)); + return orderHeader.getDelegator().findOne("OrderItemShipGroup", + UtilMisc.toMap("orderId", orderHeader.getString("orderId"), "shipGroupSeqId", shipGroupSeqId), false); } catch (GenericEntityException e) { Debug.logWarning(e, module); } @@ -433,8 +433,8 @@ public class OrderReadHelper { for(GenericValue ocm : shippingCms) { if (ocm != null) { try { - GenericValue addr = ocm.getDelegator().findByPrimaryKey("PostalAddress", - UtilMisc.toMap("contactMechId", ocm.getString("contactMechId"))); + GenericValue addr = ocm.getDelegator().findOne("PostalAddress", + UtilMisc.toMap("contactMechId", ocm.getString("contactMechId")), false); if (addr != null) { shippingLocations.add(addr); } @@ -449,8 +449,8 @@ public class OrderReadHelper { public GenericValue getShippingAddress(String shipGroupSeqId) { try { - GenericValue shipGroup = orderHeader.getDelegator().findByPrimaryKey("OrderItemShipGroup", - UtilMisc.toMap("orderId", orderHeader.getString("orderId"), "shipGroupSeqId", shipGroupSeqId)); + GenericValue shipGroup = orderHeader.getDelegator().findOne("OrderItemShipGroup", + UtilMisc.toMap("orderId", orderHeader.getString("orderId"), "shipGroupSeqId", shipGroupSeqId), false); if (shipGroup != null) { return shipGroup.getRelatedOne("PostalAddress"); @@ -489,8 +489,8 @@ public class OrderReadHelper { for(GenericValue ocm : billingCms) { if (ocm != null) { try { - GenericValue addr = ocm.getDelegator().findByPrimaryKey("PostalAddress", - UtilMisc.toMap("contactMechId", ocm.getString("contactMechId"))); + GenericValue addr = ocm.getDelegator().findOne("PostalAddress", + UtilMisc.toMap("contactMechId", ocm.getString("contactMechId")), false); if (addr != null) { billingLocations.add(addr); } @@ -732,10 +732,10 @@ public class OrderReadHelper { GenericValue orderRole = EntityUtil.getFirst(orderHeader.getRelatedByAnd("OrderRole", UtilMisc.toMap("roleTypeId", roleTypeId))); if (orderRole != null) { - partyObject = delegator.findByPrimaryKey("Person", UtilMisc.toMap("partyId", orderRole.getString("partyId"))); + partyObject = delegator.findOne("Person", UtilMisc.toMap("partyId", orderRole.getString("partyId")), false); if (partyObject == null) { - partyObject = delegator.findByPrimaryKey("PartyGroup", UtilMisc.toMap("partyId", orderRole.getString("partyId"))); + partyObject = delegator.findOne("PartyGroup", UtilMisc.toMap("partyId", orderRole.getString("partyId")), false); } } } catch (GenericEntityException e) { @@ -1000,7 +1000,7 @@ public class OrderReadHelper { try { String virtualId = ProductWorker.getVariantVirtualId(product); if (UtilValidate.isNotEmpty(virtualId)) { - GenericValue virtual = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", virtualId)); + GenericValue virtual = delegator.findOne("Product", UtilMisc.toMap("productId", virtualId), true); if (virtual != null) { weight = virtual.getBigDecimal("weight"); } @@ -1116,7 +1116,7 @@ public class OrderReadHelper { try { String virtualId = ProductWorker.getVariantVirtualId(product); if (UtilValidate.isNotEmpty(virtualId)) { - GenericValue virtual = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", virtualId)); + GenericValue virtual = delegator.findOne("Product", UtilMisc.toMap("productId", virtualId), true); if (virtual != null) { if (height == null) height = virtual.getBigDecimal("shippingHeight"); if (width == null) width = virtual.getBigDecimal("shippingWidth"); @@ -1384,7 +1384,7 @@ public class OrderReadHelper { Delegator delegator = orderHeader.getDelegator(); GenericValue orderDeliverySchedule = null; try { - orderDeliverySchedule = delegator.findByPrimaryKey("OrderDeliverySchedule", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", "_NA_")); + orderDeliverySchedule = delegator.findOne("OrderDeliverySchedule", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", "_NA_"), false); } catch (GenericEntityException e) { } Timestamp estimatedShipDate = null; @@ -2180,7 +2180,7 @@ public class OrderReadHelper { GenericValue orderHeader = null; if (orderId != null && delegator != null) { try { - orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); } catch (GenericEntityException e) { Debug.logError(e, "Cannot get order header", module); } @@ -2225,7 +2225,7 @@ public class OrderReadHelper { GenericValue productStore = null; if (orderHeader.get("productStoreId") != null) { try { - productStore = delegator.findByPrimaryKeyCache("ProductStore", UtilMisc.toMap("productStoreId", orderHeader.getString("productStoreId"))); + productStore = delegator.findOne("ProductStore", UtilMisc.toMap("productStoreId", orderHeader.getString("productStoreId")), true); } catch (GenericEntityException e) { Debug.logError(e, "Cannot locate ProductStore from OrderHeader", module); } 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=1337669&r1=1337668&r2=1337669&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 Sat May 12 21:19:35 2012 @@ -142,7 +142,7 @@ public class OrderReturnServices { // get the return item information GenericValue returnItem = null; try { - returnItem = delegator.findByPrimaryKey("ReturnItem", UtilMisc.toMap("returnId", returnId, "returnItemSeqId", returnItemSeqId)); + returnItem = delegator.findOne("ReturnItem", UtilMisc.toMap("returnId", returnId, "returnItemSeqId", returnItemSeqId), false); } catch (GenericEntityException e) { Debug.logError(e, module); throw new GeneralRuntimeException(e.getMessage()); @@ -202,7 +202,7 @@ public class OrderReturnServices { // get the return header GenericValue returnHeader = null; try { - returnHeader = delegator.findByPrimaryKey("ReturnHeader", UtilMisc.toMap("returnId", returnId)); + returnHeader = delegator.findOne("ReturnHeader", UtilMisc.toMap("returnId", returnId), false); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, @@ -250,7 +250,7 @@ public class OrderReturnServices { GenericValue productStoreEmail = null; try { - productStoreEmail = delegator.findByPrimaryKey("ProductStoreEmailSetting", UtilMisc.toMap("productStoreId", productStoreId, "emailType", emailType)); + productStoreEmail = delegator.findOne("ProductStoreEmailSetting", UtilMisc.toMap("productStoreId", productStoreId, "emailType", emailType), false); } catch (GenericEntityException e) { Debug.logError(e, module); } @@ -466,7 +466,7 @@ public class OrderReturnServices { GenericValue orderHeader = null; try { - orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, @@ -610,7 +610,7 @@ public class OrderReturnServices { GenericValue returnHeader = null; List<GenericValue> returnItems = null; try { - returnHeader = delegator.findByPrimaryKey("ReturnHeader", UtilMisc.toMap("returnId", returnId)); + returnHeader = delegator.findOne("ReturnHeader", UtilMisc.toMap("returnId", returnId), false); if (returnHeader != null) { returnItems = returnHeader.getRelated("ReturnItem"); } @@ -703,7 +703,7 @@ public class OrderReturnServices { GenericValue returnHeader = null; List<GenericValue> returnItems = null; try { - returnHeader = delegator.findByPrimaryKey("ReturnHeader", UtilMisc.toMap("returnId", returnId)); + returnHeader = delegator.findOne("ReturnHeader", UtilMisc.toMap("returnId", returnId), false); if (returnHeader != null) { returnItems = returnHeader.getRelatedByAnd("ReturnItem", UtilMisc.toMap("returnTypeId", "RTN_CREDIT")); } @@ -1013,7 +1013,7 @@ public class OrderReturnServices { */ public static BigDecimal getBillingAccountBalance(String billingAccountId, DispatchContext dctx) throws GenericEntityException { Delegator delegator = dctx.getDelegator(); - GenericValue billingAccount = delegator.findByPrimaryKey("BillingAccount", UtilMisc.toMap("billingAccountId", billingAccountId)); + GenericValue billingAccount = delegator.findOne("BillingAccount", UtilMisc.toMap("billingAccountId", billingAccountId), false); BigDecimal balance = ZERO; BigDecimal accountLimit = ZERO; @@ -1131,7 +1131,7 @@ public class OrderReturnServices { GenericValue orderHeader = null; List<GenericValue> orderPayPrefs = FastList.newInstance(); try { - orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); orderPayPrefs = orderHeader.getRelated("OrderPaymentPreference", UtilMisc.toList("-maxAmount")); } catch (GenericEntityException e) { Debug.logError("Problem looking up order information for orderId #" + orderId, module); @@ -1191,7 +1191,7 @@ public class OrderReturnServices { GenericValue returnHeader = null; List<GenericValue> returnItems = null; try { - returnHeader = delegator.findByPrimaryKey("ReturnHeader", UtilMisc.toMap("returnId", returnId)); + returnHeader = delegator.findOne("ReturnHeader", UtilMisc.toMap("returnId", returnId), false); if (returnHeader != null) { returnItems = returnHeader.getRelatedByAnd("ReturnItem", UtilMisc.toMap("returnTypeId", returnTypeId)); } @@ -1232,7 +1232,7 @@ public class OrderReturnServices { GenericValue orderHeader = null; List<GenericValue> orderPayPrefs = null; try { - orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); // sort these desending by maxAmount orderPayPrefs = orderHeader.getRelated("OrderPaymentPreference", UtilMisc.toList("-maxAmount")); @@ -1244,7 +1244,7 @@ public class OrderReturnServices { List<GenericValue> orderItemAssocs = delegator.findByAnd("OrderItemAssoc", UtilMisc.toMap("toOrderId", orderId, "orderItemAssocTypeId", "REPLACEMENT")); if (UtilValidate.isNotEmpty(orderItemAssocs)) { String originalOrderId = EntityUtil.getFirst(orderItemAssocs).getString("orderId"); - orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", originalOrderId)); + orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", originalOrderId), false); orderPayPrefs = orderHeader.getRelated("OrderPaymentPreference", UtilMisc.toList("-maxAmount")); orderPayPrefs = EntityUtil.filterByOr(orderPayPrefs, exprs); orderId = originalOrderId; @@ -1619,7 +1619,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.findByPrimaryKey("ReturnItemResponse", UtilMisc.toMap("returnItemResponseId", responseId)); + GenericValue response = delegator.findOne("ReturnItemResponse", UtilMisc.toMap("returnItemResponseId", responseId), false); if (response == null) { return ServiceUtil.returnError(errorMsg + "Return Item Response not found with ID [" + responseId + "]."); } @@ -1703,7 +1703,7 @@ public class OrderReturnServices { GenericValue returnHeader = null; List<GenericValue> returnItems = null; try { - returnHeader = delegator.findByPrimaryKey("ReturnHeader", UtilMisc.toMap("returnId", returnId)); + returnHeader = delegator.findOne("ReturnHeader", UtilMisc.toMap("returnId", returnId), false); if (returnHeader != null) { returnItems = returnHeader.getRelatedByAnd("ReturnItem", UtilMisc.toMap("returnTypeId", returnTypeId)); } @@ -1727,7 +1727,7 @@ public class OrderReturnServices { // get order header & payment prefs GenericValue orderHeader = null; try { - orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); } catch (GenericEntityException e) { Debug.logError(e, "Cannot get Order details for #" + orderId, module); continue; @@ -2189,7 +2189,7 @@ public class OrderReturnServices { GenericValue returnHeader; List<GenericValue> returnItems = null; try { - returnHeader = delegator.findByPrimaryKey("ReturnHeader", UtilMisc.toMap("returnId", returnId)); + returnHeader = delegator.findOne("ReturnHeader", UtilMisc.toMap("returnId", returnId), false); if (returnHeader != null) { returnItems = returnHeader.getRelatedByAnd("ReturnItem", UtilMisc.toMap("returnTypeId", "RTN_REFUND")); } @@ -2403,20 +2403,20 @@ public class OrderReturnServices { // if orderAdjustment is not empty, then copy most return adjustment information from orderAdjustment's if (orderAdjustmentId != null) { try { - orderAdjustment = delegator.findByPrimaryKey("OrderAdjustment", UtilMisc.toMap("orderAdjustmentId", orderAdjustmentId)); + orderAdjustment = delegator.findOne("OrderAdjustment", UtilMisc.toMap("orderAdjustmentId", orderAdjustmentId), false); // get returnHeaderTypeId from ReturnHeader and then use it to figure out return item type mapping - returnHeader = delegator.findByPrimaryKey("ReturnHeader", UtilMisc.toMap("returnId", returnId)); + returnHeader = delegator.findOne("ReturnHeader", UtilMisc.toMap("returnId", returnId), false); String returnHeaderTypeId = ((returnHeader != null) && (returnHeader.getString("returnHeaderTypeId") != null)) ? returnHeader.getString("returnHeaderTypeId") : "CUSTOMER_RETURN"; - returnItemTypeMap = delegator.findByPrimaryKey("ReturnItemTypeMap", - UtilMisc.toMap("returnHeaderTypeId", returnHeaderTypeId, "returnItemMapKey", orderAdjustment.get("orderAdjustmentTypeId"))); + returnItemTypeMap = delegator.findOne("ReturnItemTypeMap", + UtilMisc.toMap("returnHeaderTypeId", returnHeaderTypeId, "returnItemMapKey", orderAdjustment.get("orderAdjustmentTypeId")), false); returnAdjustmentType = returnItemTypeMap.getRelatedOne("ReturnAdjustmentType"); if (returnAdjustmentType != null && UtilValidate.isEmpty(description)) { description = returnAdjustmentType.getString("description"); } if ((returnItemSeqId != null) && !("_NA_".equals(returnItemSeqId))) { - returnItem = delegator.findByPrimaryKey("ReturnItem", - UtilMisc.toMap("returnId", returnId, "returnItemSeqId", returnItemSeqId)); + returnItem = delegator.findOne("ReturnItem", + UtilMisc.toMap("returnId", returnId, "returnItemSeqId", returnItemSeqId), false); Debug.logInfo("returnId:" + returnId + ",returnItemSeqId:" + returnItemSeqId, module); orderItem = returnItem.getRelatedOne("OrderItem"); } else { @@ -2504,10 +2504,10 @@ public class OrderReturnServices { try { - returnAdjustment = delegator.findByPrimaryKey("ReturnAdjustment", UtilMisc.toMap("returnAdjustmentId", context.get("returnAdjustmentId"))); + returnAdjustment = delegator.findOne("ReturnAdjustment", UtilMisc.toMap("returnAdjustmentId", context.get("returnAdjustmentId")), false); if (returnAdjustment != null) { - returnItem = delegator.findByPrimaryKey("ReturnItem", - UtilMisc.toMap("returnId", returnAdjustment.get("returnId"), "returnItemSeqId", returnAdjustment.get("returnItemSeqId"))); + returnItem = delegator.findOne("ReturnItem", + UtilMisc.toMap("returnId", returnAdjustment.get("returnId"), "returnItemSeqId", returnAdjustment.get("returnItemSeqId")), false); returnAdjustmentTypeId = returnAdjustment.getString("returnAdjustmentTypeId"); } 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=1337669&r1=1337668&r2=1337669&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 Sat May 12 21:19:35 2012 @@ -133,7 +133,7 @@ public class OrderServices { GenericValue placingCustomer = null; try { Map<String, Object> placingCustomerFields = UtilMisc.<String, Object>toMap("orderId", orderId, "partyId", userLogin.getString("partyId"), "roleTypeId", "PLACING_CUSTOMER"); - placingCustomer = delegator.findByPrimaryKey("OrderRole", placingCustomerFields); + placingCustomer = delegator.findOne("OrderRole", placingCustomerFields, false); } catch (GenericEntityException e) { Debug.logError("Could not select OrderRoles for order " + orderId + " due to " + e.getMessage(), module); } @@ -214,7 +214,7 @@ public class OrderServices { GenericValue productStore = null; if ((orderTypeId.equals("SALES_ORDER")) && (UtilValidate.isNotEmpty(productStoreId))) { try { - productStore = delegator.findByPrimaryKeyCache("ProductStore", UtilMisc.toMap("productStoreId", productStoreId)); + productStore = delegator.findOne("ProductStore", UtilMisc.toMap("productStoreId", productStoreId), true); } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "OrderErrorCouldNotFindProductStoreWithID",UtilMisc.toMap("productStoreId",productStoreId),locale) + e.toString()); @@ -232,7 +232,7 @@ public class OrderServices { // lookup the order type entity GenericValue orderType = null; try { - orderType = delegator.findByPrimaryKeyCache("OrderType", UtilMisc.toMap("orderTypeId", orderTypeId)); + orderType = delegator.findOne("OrderType", UtilMisc.toMap("orderTypeId", orderTypeId), true); } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "OrderErrorOrderTypeLookupFailed",locale) + e.toString()); @@ -307,7 +307,7 @@ public class OrderServices { GenericValue product = null; try { - product = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", currentProductId)); + product = delegator.findOne("Product", UtilMisc.toMap("productId", currentProductId), true); } catch (GenericEntityException e) { String errMsg = UtilProperties.getMessage(resource_error, "product.not_found", new Object[] { currentProductId }, locale); Debug.logError(e, errMsg, module); @@ -670,8 +670,8 @@ public class OrderServices { // find fixed asset supplied on the workeffort map GenericValue fixedAsset = null; Debug.logInfo("find the fixedAsset",module); - try { fixedAsset = delegator.findByPrimaryKey("FixedAsset", - UtilMisc.toMap("fixedAssetId", workEffort.get("fixedAssetId"))); + try { fixedAsset = delegator.findOne("FixedAsset", + UtilMisc.toMap("fixedAssetId", workEffort.get("fixedAssetId")), false); } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, @@ -738,8 +738,8 @@ public class OrderServices { // find an existing Day exception record Timestamp exceptionDateStartTime = UtilDateTime.getDayStart(new Timestamp(estimatedStartDate.getTime()),(int)dayCount); try { - techDataCalendarExcDay = delegator.findByPrimaryKey("TechDataCalendarExcDay", - UtilMisc.toMap("calendarId", fixedAsset.get("calendarId"), "exceptionDateStartTime", exceptionDateStartTime)); + techDataCalendarExcDay = delegator.findOne("TechDataCalendarExcDay", + UtilMisc.toMap("calendarId", fixedAsset.get("calendarId"), "exceptionDateStartTime", exceptionDateStartTime), false); } catch (GenericEntityException e) { Debug.logInfo(" techData excday record not found so creating........", module); @@ -1107,7 +1107,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.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "system")); + GenericValue permUserLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), true); ripCtx.put("productId", productId); ripCtx.put("facilityId", inventoryFacilityId); ripCtx.put("inventoryItemTypeId", "SERIALIZED_INV_ITEM"); @@ -1157,7 +1157,7 @@ public class OrderServices { GenericValue productStore = null; if (UtilValidate.isNotEmpty(productStoreId)) { try { - productStore = delegator.findByPrimaryKeyCache("ProductStore", UtilMisc.toMap("productStoreId", productStoreId)); + productStore = delegator.findOne("ProductStore", UtilMisc.toMap("productStoreId", productStoreId), true); } catch (GenericEntityException e) { throw new GeneralException(UtilProperties.getMessage(resource_error, "OrderErrorCouldNotFindProductStoreWithID", @@ -1264,7 +1264,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.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "system")); + GenericValue permUserLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), true); Map<String, Object> inputMap = new HashMap<String, Object>(); if (UtilValidate.isNotEmpty(shipGroupFacilityId)) { inputMap.put("facilityId", shipGroupFacilityId); @@ -1360,7 +1360,7 @@ public class OrderServices { } if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.getString("productTypeId"), "parentTypeId", "MARKETING_PKG_AUTO")) { - GenericValue permUserLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "system")); + GenericValue permUserLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), true); Map<String, Object> inputMap = new HashMap<String, Object>(); if (UtilValidate.isNotEmpty(shipGroupFacilityId)) { inputMap.put("facilityId", shipGroupFacilityId); @@ -1421,7 +1421,7 @@ public class OrderServices { GenericValue orderHeader = null; try { - orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); } catch (GenericEntityException e) { String errMsg = "ERROR: Could not set grantTotal on OrderHeader entity: " + e.toString(); Debug.logError(e, errMsg, module); @@ -1441,7 +1441,7 @@ public class OrderServices { if (UtilValidate.isNotEmpty(productStoreId)) { GenericValue productStore = null; try { - productStore = delegator.findByPrimaryKeyCache("ProductStore", UtilMisc.toMap("productStoreId", productStoreId)); + productStore = delegator.findOne("ProductStore", UtilMisc.toMap("productStoreId", productStoreId), true); } catch (GenericEntityException e) { String errorMessage = UtilProperties.getMessage(resource_error, "OrderErrorCouldNotFindProductStoreWithID", @@ -1555,7 +1555,7 @@ public class OrderServices { // get the order header GenericValue orderHeader = null; try { - orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "OrderErrorCannotGetOrderHeaderEntity",locale) + e.getMessage()); @@ -1622,7 +1622,7 @@ public class OrderServices { GenericValue orderItem = validOrderItems.get(i); String productId = orderItem.getString("productId"); try { - products.add(i, delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId))); // get the product entity + products.add(i, delegator.findOne("Product", UtilMisc.toMap("productId", productId), false)); // 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")); @@ -1652,8 +1652,8 @@ public class OrderServices { GenericValue facilityContactMech = ContactMechWorker.getFacilityContactMechByPurpose(delegator, facilityId, UtilMisc.toList("SHIP_ORIG_LOCATION", "PRIMARY_LOCATION")); if (facilityContactMech != null) { try { - shippingAddress = delegator.findByPrimaryKey("PostalAddress", - UtilMisc.toMap("contactMechId", facilityContactMech.getString("contactMechId"))); + shippingAddress = delegator.findOne("PostalAddress", + UtilMisc.toMap("contactMechId", facilityContactMech.getString("contactMechId")), false); } catch (GenericEntityException e) { Debug.logError(e, module); } @@ -1767,7 +1767,7 @@ public class OrderServices { // get the order header GenericValue orderHeader = null; try { - orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "OrderErrorCannotGetOrderHeaderEntity",locale) + e.getMessage()); @@ -1866,7 +1866,7 @@ public class OrderServices { // get the order header GenericValue orderHeader = null; try { - orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); } catch (GenericEntityException e) { Debug.logError(e, "Cannot get OrderHeader record", module); } @@ -1927,7 +1927,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.findByPrimaryKey("ProductStore", UtilMisc.toMap("productStoreId", orderHeader.getString("productStoreId"))); + GenericValue productStore = delegator.findOne("ProductStore", UtilMisc.toMap("productStoreId", orderHeader.getString("productStoreId")), false); if (productStore != null) { String headerApprovedStatus = productStore.getString("headerApprovedStatus"); if (UtilValidate.isNotEmpty(headerApprovedStatus)) { @@ -2203,7 +2203,7 @@ public class OrderServices { try { Map<String, String> statusFields = UtilMisc.<String, String>toMap("statusId", orderItem.getString("statusId"), "statusIdTo", statusId); - GenericValue statusChange = delegator.findByPrimaryKeyCache("StatusValidChange", statusFields); + GenericValue statusChange = delegator.findOne("StatusValidChange", statusFields, true); if (statusChange == null) { Debug.logWarning(UtilProperties.getMessage(resource_error, @@ -2266,7 +2266,7 @@ public class OrderServices { } try { - GenericValue orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + GenericValue orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); if (orderHeader == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, @@ -2286,7 +2286,7 @@ public class OrderServices { } try { Map<String, String> statusFields = UtilMisc.<String, String>toMap("statusId", orderHeader.getString("statusId"), "statusIdTo", statusId); - GenericValue statusChange = delegator.findByPrimaryKeyCache("StatusValidChange", statusFields); + GenericValue statusChange = delegator.findOne("StatusValidChange", statusFields, true); if (statusChange == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "OrderErrorCouldNotChangeOrderStatusStatusIsNotAValidChange", locale) + ": [" + statusFields.get("statusId") + "] -> [" + statusFields.get("statusIdTo") + "]"); @@ -2368,7 +2368,7 @@ public class OrderServices { //Locale locale = (Locale) context.get("locale"); try { - GenericValue shipGroup = delegator.findByPrimaryKey("OrderItemShipGroup", UtilMisc.toMap("orderId", orderId, "shipGroupSeqId", shipGroupSeqId)); + GenericValue shipGroup = delegator.findOne("OrderItemShipGroup", UtilMisc.toMap("orderId", orderId, "shipGroupSeqId", shipGroupSeqId), false); if (shipGroup == null) { result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR); @@ -2410,7 +2410,7 @@ public class OrderServices { try { // first check and see if we are already there; if so, just return success - GenericValue testValue = delegator.findByPrimaryKey("OrderRole", fields); + GenericValue testValue = delegator.findOne("OrderRole", fields, false); if (testValue != null) { ServiceUtil.returnSuccess(); } else { @@ -2439,7 +2439,7 @@ public class OrderServices { GenericValue testValue = null; try { - testValue = delegator.findByPrimaryKey("OrderRole", fields); + testValue = delegator.findOne("OrderRole", fields, false); } catch (GenericEntityException e) { result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR); result.put(ModelService.ERROR_MESSAGE, "ERROR: Could not add role to order (" + e.getMessage() + ")."); @@ -2452,7 +2452,7 @@ public class OrderServices { } try { - GenericValue value = delegator.findByPrimaryKey("OrderRole", fields); + GenericValue value = delegator.findOne("OrderRole", fields, false); value.remove(); } catch (GenericEntityException e) { @@ -2512,7 +2512,7 @@ public class OrderServices { // get the order header and store GenericValue orderHeader = null; try { - orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); } catch (GenericEntityException e) { Debug.logError(e, "Problem getting OrderHeader", module); } @@ -2529,7 +2529,7 @@ public class OrderServices { GenericValue productStoreEmail = null; try { - productStoreEmail = delegator.findByPrimaryKey("ProductStoreEmailSetting", UtilMisc.toMap("productStoreId", orderHeader.get("productStoreId"), "emailType", emailType)); + productStoreEmail = delegator.findOne("ProductStoreEmailSetting", UtilMisc.toMap("productStoreId", orderHeader.get("productStoreId"), "emailType", emailType), false); } catch (GenericEntityException e) { Debug.logError(e, "Problem getting the ProductStoreEmailSetting for productStoreId=" + orderHeader.get("productStoreId") + " and emailType=" + emailType, module); } @@ -2653,10 +2653,10 @@ public class OrderServices { // get the order/workflow info try { - workEffort = delegator.findByPrimaryKey("WorkEffort", UtilMisc.toMap("workEffortId", workEffortId)); + workEffort = delegator.findOne("WorkEffort", UtilMisc.toMap("workEffortId", workEffortId), false); String sourceReferenceId = workEffort.getString("sourceReferenceId"); if (sourceReferenceId != null) - orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", sourceReferenceId)); + orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", sourceReferenceId), false); } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "OrderProblemWithEntityLookup", locale)); @@ -2666,7 +2666,7 @@ public class OrderServices { GenericValue party = null; Collection<GenericValue> assignedToEmails = null; try { - party = delegator.findByPrimaryKey("Party", UtilMisc.toMap("partyId", assignedToUser)); + party = delegator.findOne("Party", UtilMisc.toMap("partyId", assignedToUser), false); } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "OrderProblemWithEntityLookup", locale)); @@ -2786,7 +2786,7 @@ public class OrderServices { GenericValue orderHeader = null; try { - orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); } catch (GenericEntityException e) { Debug.logError(e, "Problem getting order header detial", module); return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, @@ -2809,7 +2809,7 @@ public class OrderServices { GenericValue orderHeader = null; try { - orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, @@ -2849,7 +2849,7 @@ public class OrderServices { //Locale locale = (Locale) context.get("locale"); try { - orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); if (orderHeader != null) result.put("orderHeader", orderHeader); } catch (GenericEntityException e) { @@ -2942,7 +2942,7 @@ public class OrderServices { GenericValue placingCustomer = null; try { Map<String, Object> placingCustomerFields = UtilMisc.<String, Object>toMap("orderId", orderId, "partyId", userLogin.getString("partyId"), "roleTypeId", "PLACING_CUSTOMER"); - placingCustomer = delegator.findByPrimaryKey("OrderRole", placingCustomerFields); + placingCustomer = delegator.findOne("OrderRole", placingCustomerFields, false); } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "OrderErrorCannotGetOrderRoleEntity", locale) + e.getMessage()); @@ -2956,7 +2956,7 @@ public class OrderServices { GenericValue shipGroup = null; try { Map<String, String> fields = UtilMisc.<String, String>toMap("orderId", orderId, "shipGroupSeqId", shipGroupSeqId); - shipGroup = delegator.findByPrimaryKey("OrderItemShipGroup", fields); + shipGroup = delegator.findOne("OrderItemShipGroup", fields, false); } catch (GenericEntityException e) { Debug.logError(e, "Problems getting OrderItemShipGroup for : " + orderId + " / " + shipGroupSeqId, module); return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, @@ -3109,7 +3109,7 @@ public class OrderServices { // need the order header GenericValue orderHeader = null; try { - orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); } catch (GenericEntityException e) { Debug.logError(e, "ERROR: Unable to get OrderHeader for orderId : " + orderId, module); return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, @@ -3193,7 +3193,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.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", "system")); + GenericValue permUserLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), false); Map<String, Object> invoiceContext = UtilMisc.<String, Object>toMap("orderId", orderId, "billItems", itemsToInvoice, "userLogin", permUserLogin); invoiceResult = dispatcher.runSync("createInvoiceForOrder", invoiceContext); } catch (GenericEntityException e) { @@ -4049,7 +4049,7 @@ public class OrderServices { String billingAccountId = cart.getBillingAccountId(); if (UtilValidate.isNotEmpty(billingAccountId)) { try { - GenericValue orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + GenericValue orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); orderHeader.set("billingAccountId", billingAccountId); toStore.add(orderHeader); } catch (GenericEntityException e) { @@ -4187,7 +4187,7 @@ public class OrderServices { } GenericValue oldOrderItem = null; try { - oldOrderItem = delegator.findByPrimaryKey("OrderItem", UtilMisc.toMap("orderId", valueObj.getString("orderId"), "orderItemSeqId", valueObj.getString("orderItemSeqId"))); + oldOrderItem = delegator.findOne("OrderItem", UtilMisc.toMap("orderId", valueObj.getString("orderId"), "orderItemSeqId", valueObj.getString("orderItemSeqId")), false); } catch (GenericEntityException e) { Debug.logError(e, module); throw new GeneralException(e.getMessage()); @@ -4422,7 +4422,7 @@ public class OrderServices { } try { // get the order payment preference - GenericValue orderPaymentPreference = delegator.findByPrimaryKey("OrderPaymentPreference", UtilMisc.toMap("orderPaymentPreferenceId", orderPaymentPreferenceId)); + GenericValue orderPaymentPreference = delegator.findOne("OrderPaymentPreference", UtilMisc.toMap("orderPaymentPreferenceId", orderPaymentPreferenceId), false); if (orderPaymentPreference == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OrderOrderPaymentCannotBeCreated", @@ -4537,7 +4537,7 @@ public class OrderServices { } GenericValue orderHeader = null; try { - orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -4579,7 +4579,7 @@ public class OrderServices { } GenericValue orderHeader = null; try { - orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -4883,7 +4883,7 @@ public class OrderServices { String statusId = (String) context.get("statusId"); try { - GenericValue opp = delegator.findByPrimaryKey("OrderPaymentPreference", UtilMisc.toMap("orderPaymentPreferenceId", orderPaymentPreferenceId)); + GenericValue opp = delegator.findOne("OrderPaymentPreference", UtilMisc.toMap("orderPaymentPreferenceId", orderPaymentPreferenceId), false); String paymentMethodId = null; String paymentMethodTypeId = null; @@ -4898,7 +4898,7 @@ public class OrderServices { } } if (paymentMethodTypeId == null) { - GenericValue method = delegator.findByPrimaryKey("PaymentMethod", UtilMisc.toMap("paymentMethodTypeId", paymentMethodTypeId)); + GenericValue method = delegator.findOne("PaymentMethod", UtilMisc.toMap("paymentMethodTypeId", paymentMethodTypeId), false); paymentMethodId = checkOutPaymentId; paymentMethodTypeId = (String) method.get("paymentMethodTypeId"); } @@ -4946,7 +4946,7 @@ public class OrderServices { try { - GenericValue orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + GenericValue orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); if (UtilValidate.isEmpty(orderHeader)) { String errorMessage = UtilProperties.getMessage(resource_error, @@ -5018,7 +5018,7 @@ public class OrderServices { try { - GenericValue orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + GenericValue orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); if (UtilValidate.isEmpty(orderHeader)) { String errorMessage = UtilProperties.getMessage(resource_error, @@ -5246,14 +5246,14 @@ public class OrderServices { BigDecimal invoicedQuantity = ZERO; // Quantity invoiced for the target order item try { - orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); if (UtilValidate.isEmpty(orderHeader)) { String errorMessage = UtilProperties.getMessage(resource_error, "OrderErrorOrderIdNotFound", context, locale); Debug.logError(errorMessage, module); return ServiceUtil.returnError(errorMessage); } - orderItemToCheck = delegator.findByPrimaryKey("OrderItem", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId)); + orderItemToCheck = delegator.findOne("OrderItem", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId), false); if (UtilValidate.isEmpty(orderItemToCheck)) { String errorMessage = UtilProperties.getMessage(resource_error, "OrderErrorOrderItemNotFound", context, locale); @@ -5358,10 +5358,10 @@ public class OrderServices { String changeReason = (String) context.get("changeReason"); Locale locale = (Locale) context.get("locale"); try { - GenericValue orderPaymentPreference = delegator.findByPrimaryKey("OrderPaymentPreference", UtilMisc.toMap("orderPaymentPreferenceId", orderPaymentPreferenceId)); + GenericValue orderPaymentPreference = delegator.findOne("OrderPaymentPreference", UtilMisc.toMap("orderPaymentPreferenceId", orderPaymentPreferenceId), false); String orderId = orderPaymentPreference.getString("orderId"); String statusUserLogin = orderPaymentPreference.getString("createdByUserLogin"); - GenericValue orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + GenericValue orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); 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=1337669&r1=1337668&r2=1337669&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 Sat May 12 21:19:35 2012 @@ -63,7 +63,7 @@ public class QuoteServices { // get the quote and store GenericValue quote = null; try { - quote = delegator.findByPrimaryKey("Quote", UtilMisc.toMap("quoteId", quoteId)); + quote = delegator.findOne("Quote", UtilMisc.toMap("quoteId", quoteId), false); } catch (GenericEntityException e) { Debug.logError(e, "Problem getting Quote", module); } @@ -76,7 +76,7 @@ public class QuoteServices { GenericValue productStoreEmail = null; try { - productStoreEmail = delegator.findByPrimaryKey("ProductStoreEmailSetting", UtilMisc.toMap("productStoreId", quote.get("productStoreId"), "emailType", emailType)); + productStoreEmail = delegator.findOne("ProductStoreEmailSetting", UtilMisc.toMap("productStoreId", quote.get("productStoreId"), "emailType", emailType), false); } 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=1337669&r1=1337668&r2=1337669&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 Sat May 12 21:19:35 2012 @@ -133,7 +133,7 @@ public class RequirementServices { // for good identification, get the UPCA type (UPC code) GenericValue gid = gids.get(productId); if (gid == null) { - gid = delegator.findByPrimaryKey("GoodIdentification", UtilMisc.toMap("goodIdentificationTypeId", "UPCA", "productId", requirement.get("productId"))); + gid = delegator.findOne("GoodIdentification", UtilMisc.toMap("goodIdentificationTypeId", "UPCA", "productId", requirement.get("productId")), false); gids.put(productId, gid); } if (gid != null) union.put("idValue", gid.get("idValue")); @@ -208,7 +208,7 @@ public class RequirementServices { String orderId = (String) context.get("orderId"); try { - GenericValue order = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + GenericValue order = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); GenericValue productStore = order.getRelatedOneCache("ProductStore"); if (productStore == null) { Debug.logInfo("ProductStore for order ID " + orderId + " not found, requirements not created", module); @@ -267,7 +267,7 @@ public class RequirementServices { */ String orderId = (String) context.get("orderId"); try { - GenericValue order = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + GenericValue order = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); GenericValue productStore = order.getRelatedOneCache("ProductStore"); if (productStore == null) { Debug.logInfo("ProductStore for order ID " + orderId + " not found, ATP requirements not created", module); @@ -288,7 +288,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.findByPrimaryKey("ProductFacility", UtilMisc.toMap("facilityId", facilityId, "productId", product.get("productId"))); + GenericValue productFacility = delegator.findOne("ProductFacility", UtilMisc.toMap("facilityId", facilityId, "productId", product.get("productId")), false); 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=1337669&r1=1337668&r2=1337669&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 Sat May 12 21:19:35 2012 @@ -508,7 +508,7 @@ public class CheckOutEvents { ShoppingCart cart = ShoppingCartEvents.getCartObject(request); GenericValue productStore = null; try { - productStore = delegator.findByPrimaryKeyCache("ProductStore", UtilMisc.toMap("productStoreId", cart.getProductStoreId())); + productStore = delegator.findOne("ProductStore", UtilMisc.toMap("productStoreId", cart.getProductStoreId()), true); Debug.logInfo("checkShipmentNeeded: reqShipAddrForDigItems=" + productStore.getString("reqShipAddrForDigItems"), module); } catch (GenericEntityException e) { Debug.logError(e, "Error getting ProductStore: " + e.toString(), module); @@ -758,7 +758,7 @@ public class CheckOutEvents { // no userLogin means we are an anonymous shopper; fake the UL for service calls if (userLogin == null) { try { - userLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", "anonymous")); + userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "anonymous"), false); } 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=1337669&r1=1337668&r2=1337669&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 Sat May 12 21:19:35 2012 @@ -635,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.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "system")); + GenericValue permUserLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), true); GenericValue productStore = ProductStoreWorker.getProductStore(productStoreId, delegator); - GenericValue product = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId)); + GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false); 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>(); @@ -697,7 +697,7 @@ public class CheckOutHelper { GenericValue party = null; try { - party = this.delegator.findByPrimaryKey("Party", UtilMisc.toMap("partyId", partyId)); + party = this.delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false); } catch (GenericEntityException e) { Debug.logWarning(e, UtilProperties.getMessage(resource_error,"OrderProblemsGettingPartyRecord", cart.getLocale()), module); } @@ -858,8 +858,8 @@ public class CheckOutHelper { GenericValue facilityContactMech = ContactMechWorker.getFacilityContactMechByPurpose(delegator, originFacilityId, UtilMisc.toList("SHIP_ORIG_LOCATION", "PRIMARY_LOCATION")); if (facilityContactMech != null) { try { - shipAddress = delegator.findByPrimaryKey("PostalAddress", - UtilMisc.toMap("contactMechId", facilityContactMech.getString("contactMechId"))); + shipAddress = delegator.findOne("PostalAddress", + UtilMisc.toMap("contactMechId", facilityContactMech.getString("contactMechId")), false); } catch (GenericEntityException e) { Debug.logError(e, module); } @@ -1268,7 +1268,7 @@ public class CheckOutHelper { userLogin.set("enabled", "N"); userLogin.store(); } else { - userLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "system")); + userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), true); } } catch (GenericEntityException e) { Debug.logError(e, module); @@ -1294,7 +1294,7 @@ public class CheckOutHelper { // you cannot accept multiple payment type when using an external gateway GenericValue orderHeader = null; try { - orderHeader = this.delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + orderHeader = this.delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); } 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())); |
Free forum by Nabble | Edit this page |