Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/order/OrderServices.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/order/OrderServices.java Mon Nov 3 06:54:16 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()); @@ -306,7 +307,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); @@ -1106,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.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"); @@ -1152,13 +1153,61 @@ public class OrderServices { return successResult; } + + public static Map<String, Object> countProductQuantityOrdered(DispatchContext ctx, Map<String, Object> context) { + Delegator delegator = ctx.getDelegator(); + Locale locale = (Locale) context.get("locale"); + List<GenericValue> productCalculatedInfoList = null; + GenericValue productCalculatedInfo = null; + String productId = (String) context.get("productId"); + BigDecimal quantity = (BigDecimal) context.get("quantity"); + try { + productCalculatedInfoList = delegator.findByAnd("ProductCalculatedInfo", UtilMisc.toMap("productId", productId), null, false); + if (UtilValidate.isEmpty(productCalculatedInfoList)) { + productCalculatedInfo = delegator.makeValue("ProductCalculatedInfo"); + productCalculatedInfo.set("productId", productId); + productCalculatedInfo.set("totalQuantityOrdered", quantity); + productCalculatedInfo.create(); + } else { + productCalculatedInfo = productCalculatedInfoList.get(0); + BigDecimal totalQuantityOrdered = productCalculatedInfo.getBigDecimal("totalQuantityOrdered"); + if (totalQuantityOrdered == null) { + productCalculatedInfo.set("totalQuantityOrdered", quantity); + } else { + productCalculatedInfo.set("totalQuantityOrdered", totalQuantityOrdered.add(quantity)); + } + } + productCalculatedInfo.store(); + } catch (GenericEntityException e) { + Debug.logError(e, "Error calling countProductQuantityOrdered service", module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + "OrderErrorCallingCountProductQuantityOrderedService",locale) + e.toString()); + + } + + String virtualProductId = null; + try { + GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true); + virtualProductId = ProductWorker.getVariantVirtualId(product); + } catch (GenericEntityException e) { + Debug.logError(e, "Error calling countProductQuantityOrdered service", module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + "OrderErrorCallingCountProductQuantityOrderedService",locale) + e.toString()); + } + + if (UtilValidate.isNotEmpty(virtualProductId)) { + context.put("productId", virtualProductId); + countProductQuantityOrdered(ctx, context); + } + return ServiceUtil.returnSuccess(); + } public static void reserveInventory(Delegator delegator, LocalDispatcher dispatcher, GenericValue userLogin, Locale locale, List<GenericValue> orderItemShipGroupInfo, List<String> dropShipGroupIds, Map<String, GenericValue> itemValuesBySeqId, String orderTypeId, String productStoreId, List<String> resErrorMessages) throws GeneralException { boolean isImmediatelyFulfilled = false; 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", @@ -1265,7 +1314,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); @@ -1361,7 +1410,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); @@ -1422,7 +1471,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); @@ -1442,7 +1491,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", @@ -1557,7 +1606,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()); @@ -1624,7 +1673,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")); @@ -1729,7 +1778,7 @@ public class OrderServices { if (UtilValidate.isNotEmpty(orderItemSeqId)) { createOrderAdjContext.put("orderItemSeqId", orderItemSeqId); } else { - createOrderAdjContext.put("orderItemSeqId", "_NA_"); + createOrderAdjContext.put("orderItemSeqId", "_NA_"); } createOrderAdjContext.put("shipGroupSeqId", "_NA_"); createOrderAdjContext.put("description", "Tax adjustment due to order change"); @@ -1773,7 +1822,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()); @@ -1872,7 +1921,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); } @@ -1933,7 +1982,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)) { @@ -2278,7 +2327,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, @@ -2381,7 +2430,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); @@ -2525,7 +2574,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); } @@ -2542,7 +2591,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); } @@ -2666,10 +2715,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)); @@ -2679,7 +2728,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)); @@ -2799,7 +2848,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, @@ -2822,7 +2871,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, @@ -2862,7 +2911,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) { @@ -3120,7 +3169,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, @@ -3204,7 +3253,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) { @@ -3355,7 +3404,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; @@ -4104,7 +4153,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) { @@ -4248,7 +4297,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()); @@ -4499,7 +4548,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", @@ -4614,7 +4663,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()); @@ -4656,7 +4705,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()); @@ -4960,7 +5009,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; @@ -4975,7 +5024,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"); } @@ -5023,7 +5072,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, @@ -5095,7 +5144,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, @@ -5323,14 +5372,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); @@ -5435,10 +5484,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)); @@ -5787,4 +5836,4 @@ public class OrderServices { return ServiceUtil.returnSuccess(); } -} \ No newline at end of file +} Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/quote/QuoteServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/quote/QuoteServices.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/quote/QuoteServices.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/quote/QuoteServices.java Mon Nov 3 06:54:16 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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java Mon Nov 3 06:54:16 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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java Mon Nov 3 06:54:16 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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Mon Nov 3 06:54:16 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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Mon Nov 3 06:54:16 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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java Mon Nov 3 06:54:16 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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java Mon Nov 3 06:54:16 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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java Mon Nov 3 06:54:16 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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java Mon Nov 3 06:54:16 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()); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java Mon Nov 3 06:54:16 2014 @@ -50,6 +50,7 @@ import org.ofbiz.entity.GenericEntityExc 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.CartItemModifyException; import org.ofbiz.order.shoppingcart.ShoppingCart; @@ -105,7 +106,7 @@ public class ProductPromoWorker { String productStoreId = cart.getProductStoreId(); 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) { Debug.logError(e, "Error looking up store with id " + productStoreId, module); } @@ -167,7 +168,7 @@ public class ProductPromoWorker { String productStoreId = cart.getProductStoreId(); 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) { Debug.logError(e, "Error looking up store with id " + productStoreId, module); } @@ -205,7 +206,7 @@ public class ProductPromoWorker { String productStoreId = cart.getProductStoreId(); 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) { Debug.logError(e, "Error looking up store with id " + productStoreId, module); } @@ -248,7 +249,7 @@ public class ProductPromoWorker { String agreementId = cart.getAgreementId(); GenericValue agreement = null; try { - agreement = delegator.findOne("Agreement", UtilMisc.toMap("agreementId", agreementId), true); + agreement = EntityQuery.use(delegator).from("Agreement").where("agreementId", agreementId).cache().queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Error looking up agreement with id " + agreementId, module); } @@ -336,7 +337,7 @@ public class ProductPromoWorker { Map<String, Long> usesPerPromo = new HashMap<String, Long>(); int indexOfFirstOrderTotalPromo = -1; for (ProductPromoUseInfo promoUse: sortedPromoUses) { - GenericValue productPromo = delegator.findOne("ProductPromo", UtilMisc.toMap("productPromoId", promoUse.getProductPromoId()), true); + GenericValue productPromo = EntityQuery.use(delegator).from("ProductPromo").where("productPromoId", promoUse.getProductPromoId()).cache().queryOne(); GenericValue newProductPromo = (GenericValue)productPromo.clone(); if (!usesPerPromo.containsKey(promoUse.getProductPromoId())) { usesPerPromo.put(promoUse.getProductPromoId(), 0l); @@ -596,7 +597,7 @@ public class ProductPromoWorker { public static String checkCanUsePromoCode(String productPromoCodeId, String partyId, Delegator delegator, ShoppingCart cart, Locale locale) { try { - GenericValue productPromoCode = delegator.findOne("ProductPromoCode", UtilMisc.toMap("productPromoCodeId", productPromoCodeId), false); + GenericValue productPromoCode = EntityQuery.use(delegator).from("ProductPromoCode").where("productPromoCodeId", productPromoCodeId).queryOne(); if (productPromoCode == null) { return UtilProperties.getMessage(resource_error, "productpromoworker.promotion_code_not_valid", UtilMisc.toMap("productPromoCodeId", productPromoCodeId), locale); } @@ -625,7 +626,7 @@ public class ProductPromoWorker { // check partyId if (UtilValidate.isNotEmpty(partyId)) { - if (delegator.findOne("ProductPromoCodeParty", UtilMisc.toMap("productPromoCodeId", productPromoCodeId, "partyId", partyId), false) != null) { + if (EntityQuery.use(delegator).from("ProductPromoCodeParty").where("productPromoCodeId", productPromoCodeId, "partyId", partyId).queryOne() != null) { // found party associated with the code, looks good... return null; } @@ -709,7 +710,7 @@ public class ProductPromoWorker { if (UtilValidate.isEmpty(messageContext.get("productId"))) messageContext.put("productId", "any"); if (UtilValidate.isEmpty(messageContext.get("partyId"))) messageContext.put("partyId", "any"); - GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true); + GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne(); if (product != null) { messageContext.put("productName", ProductContentWrapper.getProductContentAsText(product, "PRODUCT_NAME", locale, null)); } @@ -1249,7 +1250,7 @@ public class ProductPromoWorker { } else if ("PPIP_RECURRENCE".equals(inputParamEnumId)) { if (UtilValidate.isNotEmpty(condValue)) { compareBase = Integer.valueOf(1); - GenericValue recurrenceInfo = delegator.findOne("RecurrenceInfo", UtilMisc.toMap("recurrenceInfoId", condValue), true); + GenericValue recurrenceInfo = EntityQuery.use(delegator).from("RecurrenceInfo").where("recurrenceInfoId", condValue).cache().queryOne(); if (recurrenceInfo != null) { RecurrenceInfo recurrence = null; try { @@ -1470,7 +1471,7 @@ public class ProductPromoWorker { GenericValue product = null; if (UtilValidate.isNotEmpty(productId)) { // Debug.logInfo("======== Got GWP productId [" + productId + "]", module); - product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true); + product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne(); if (product == null) { String errMsg = "GWP Product not found with ID [" + productId + "] for ProductPromoAction [" + productPromoAction.get("productPromoId") + ":" + productPromoAction.get("productPromoRuleId") + ":" + productPromoAction.get("productPromoActionSeqId") + "]"; Debug.logError(errMsg, module); @@ -1557,7 +1558,7 @@ public class ProductPromoWorker { } optionProductIds.remove(alternateGwpProductId); productId = alternateGwpProductId; - product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true); + product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne(); } else { Debug.logWarning(UtilProperties.getMessage(resource_error,"OrderAnAlternateGwpProductIdWasInPlaceButWasEitherNotValidOrIsNoLongerInStockForId", UtilMisc.toMap("alternateGwpProductId",alternateGwpProductId), cart.getLocale()), module); } @@ -1569,7 +1570,7 @@ public class ProductPromoWorker { Iterator<String> optionProductIdTempIter = optionProductIds.iterator(); productId = optionProductIdTempIter.next(); optionProductIdTempIter.remove(); - product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true); + product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne(); } if (product == null) { @@ -1942,7 +1943,7 @@ public class ProductPromoWorker { // get the promoText / promoName to set as a descr of the orderAdj GenericValue prodPromo; try { - prodPromo = delegator.findOne("ProductPromo", UtilMisc.toMap("productPromoId", prodPromoId), true); + prodPromo = EntityQuery.use(delegator).from("ProductPromo").where("productPromoId", prodPromoId).cache().queryOne(); if (UtilValidate.isNotEmpty(prodPromo.get("promoText"))) { return (String) prodPromo.get("promoText"); } @@ -2070,7 +2071,7 @@ public class ProductPromoWorker { } protected static boolean isProductOld(String productId, Delegator delegator, Timestamp nowTimestamp) throws GenericEntityException { - GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true); + GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne(); if (product != null) { Timestamp salesDiscontinuationDate = product.getTimestamp("salesDiscontinuationDate"); if (salesDiscontinuationDate != null && salesDiscontinuationDate.before(nowTimestamp)) { Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java Mon Nov 3 06:54:16 2014 @@ -39,6 +39,7 @@ import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.condition.EntityCondition; import org.ofbiz.entity.condition.EntityConditionList; 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.ShoppingCart; @@ -279,7 +280,7 @@ public class ShippingEvents { String serviceName = null; GenericValue customMethod = null; try { - customMethod = delegator.findOne("CustomMethod", UtilMisc.toMap("customMethodId", shipmentCustomMethodId), false); + customMethod = EntityQuery.use(delegator).from("CustomMethod").where("customMethodId", shipmentCustomMethodId).queryOne(); if (UtilValidate.isNotEmpty(customMethod)) { serviceName = customMethod.getString("customMethodName"); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java Mon Nov 3 06:54:16 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.order.shoppingcart.CartItemModifyException; import org.ofbiz.order.shoppingcart.ItemNotFoundException; @@ -214,7 +215,7 @@ public class ShoppingListEvents { GenericValue shoppingList = null; List<GenericValue> shoppingListItems = null; try { - shoppingList = delegator.findOne("ShoppingList", UtilMisc.toMap("shoppingListId", shoppingListId), false); + shoppingList = EntityQuery.use(delegator).from("ShoppingList").where("shoppingListId", shoppingListId).queryOne(); if (shoppingList == null) { errMsg = UtilProperties.getMessage(resource_error,"shoppinglistevents.error_getting_shopping_list_and_items", cart.getLocale()); throw new IllegalArgumentException(errMsg); @@ -404,7 +405,7 @@ public class ShoppingListEvents { autoSaveListId = getAutoSaveListId(delegator, dispatcher, null, userLogin, cart.getProductStoreId()); cart.setAutoSaveListId(autoSaveListId); } - GenericValue shoppingList = delegator.findOne("ShoppingList", UtilMisc.toMap("shoppingListId", autoSaveListId), false); + GenericValue shoppingList = EntityQuery.use(delegator).from("ShoppingList").where("shoppingListId", autoSaveListId).queryOne(); Integer currentListSize = 0; if (UtilValidate.isNotEmpty(shoppingList)) { List<GenericValue> shoppingListItems = shoppingList.getRelated("ShoppingListItem", null, null, false); @@ -505,7 +506,7 @@ public class ShoppingListEvents { if (!okayToLoad && lastLoad != null) { GenericValue shoppingList = null; try { - shoppingList = delegator.findOne("ShoppingList", UtilMisc.toMap("shoppingListId", autoSaveListId), false); + shoppingList = EntityQuery.use(delegator).from("ShoppingList").where("shoppingListId", autoSaveListId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java Mon Nov 3 06:54:16 2014 @@ -41,6 +41,7 @@ import org.ofbiz.entity.condition.Entity import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.transaction.TransactionUtil; 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.order.OrderReadHelper; @@ -271,7 +272,7 @@ public class ShoppingListServices { beganTransaction = TransactionUtil.begin(); GenericValue orderHeader = null; - orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); if (orderHeader == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderUnableToLocateOrder", UtilMisc.toMap("orderId",orderId), locale)); @@ -312,7 +313,7 @@ public class ShoppingListServices { } GenericValue shoppingList = null; - shoppingList = delegator.findOne("ShoppingList", UtilMisc.toMap("shoppingListId", shoppingListId), false); + shoppingList = EntityQuery.use(delegator).from("ShoppingList").where("shoppingListId", shoppingListId).queryOne(); if (shoppingList == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderNoShoppingListAvailable",locale)); @@ -335,7 +336,7 @@ public class ShoppingListServices { orderItem.get("productId"), "quantity", orderItem.get("quantity")); 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"); ctx.put("configId", configId); String aggregatedProductId = ProductWorker.getInstanceAggregatedId(delegator, productId); @@ -539,7 +540,7 @@ public class ShoppingListServices { Delegator delegator = dispatcher.getDelegator(); 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); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/test/PurchaseOrderTest.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/test/PurchaseOrderTest.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/test/PurchaseOrderTest.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/test/PurchaseOrderTest.java Mon Nov 3 06:54:16 2014 @@ -27,6 +27,7 @@ import javolution.util.FastMap; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.service.testtools.OFBizTestCase; public class PurchaseOrderTest extends OFBizTestCase { @@ -41,7 +42,7 @@ public class PurchaseOrderTest extends O @Override protected void setUp() throws Exception { - userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), false); + userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne(); } @Override Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/test/SalesOrderTest.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/test/SalesOrderTest.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/test/SalesOrderTest.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/test/SalesOrderTest.java Mon Nov 3 06:54:16 2014 @@ -27,6 +27,7 @@ import javolution.util.FastMap; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.service.testtools.OFBizTestCase; public class SalesOrderTest extends OFBizTestCase { @@ -39,7 +40,7 @@ public class SalesOrderTest extends OFBi @Override protected void setUp() throws Exception { - userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), false); + userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne(); } @Override @@ -114,8 +115,16 @@ public class SalesOrderTest extends OFBi orderItem.set("unitPrice", new BigDecimal("38.4")); orderItem.set("unitListPrice", new BigDecimal("48.0")); orderItem.set("statusId", "ITEM_CREATED"); - orderItems.add(orderItem); + + orderItem = delegator.makeValue("OrderItem", UtilMisc.toMap("orderItemSeqId", "00002", "orderItemTypeId", "PRODUCT_ORDER_ITEM", "prodCatalogId", "DemoCatalog", "productId", "GZ-1006-1", "quantity", BigDecimal.ONE, "selectedAmount", BigDecimal.ZERO)); + orderItem.set("isPromo", "N"); + orderItem.set("isModifiedPrice", "N"); + orderItem.set("unitPrice", new BigDecimal("1.99")); + orderItem.set("unitListPrice", new BigDecimal("5.99")); + orderItem.set("statusId", "ITEM_CREATED"); + orderItems.add(orderItem); + ctx.put("orderItems", orderItems); List<GenericValue> orderTerms = FastList.newInstance(); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java Mon Nov 3 06:54:16 2014 @@ -35,6 +35,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.order.shoppingcart.ShoppingCart; import org.ofbiz.order.shoppingcart.ShoppingCartEvents; import org.ofbiz.product.store.ProductStoreWorker; @@ -102,7 +103,7 @@ public class ExpressCheckoutEvents { } if (paymentGatewayConfigId != null) { try { - payPalGatewayConfig = delegator.findOne("PaymentGatewayPayPal", true, "paymentGatewayConfigId", paymentGatewayConfigId); + payPalGatewayConfig = EntityQuery.use(delegator).from("PaymentGatewayPayPal").where("paymentGatewayConfigId", paymentGatewayConfigId).cache().queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/config/PartyUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/config/PartyUiLabels.xml?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/config/PartyUiLabels.xml (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/config/PartyUiLabels.xml Mon Nov 3 06:54:16 2014 @@ -8981,9 +8981,9 @@ <value xml:lang="en">No product store(s) found for this party.</value> <value xml:lang="fr">Aucun centre de profit trouvé pour cet acteur</value> <value xml:lang="ja">ãã®åå¼å ã«è£½ååºèã¯ããã¾ããã</value> - <value xml:lang="zh_TW">æ¤å髿²æç¢åååº.</value> <value xml:lang="vi">Không tìm thấy cá»a hà ng cho tác nhân nà y.</value> <value xml:lang="zh">æ²¡ææ¾å°è¿ä¸ªä¼åç产ååºéºã</value> + <!--value xml:lang="zh_TW">æ¤å髿²æç¢åååº.</value--> <value xml:lang="zh_TW">æ²ææ¾å°ééååé«çç¢åååº.</value> </property> <property key="PartyNoServerHitsFound"> |
Free forum by Nabble | Edit this page |