You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by le...@apache.org on 2014/10/30 05:18:08 UTC
svn commit: r1635383 [2/6] - in /ofbiz/trunk:
applications/order/src/org/ofbiz/order/order/
applications/order/src/org/ofbiz/order/quote/
applications/order/src/org/ofbiz/order/requirement/
applications/order/src/org/ofbiz/order/shoppingcart/ applicati...
Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java Thu Oct 30 04:18:05 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/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java Thu Oct 30 04:18:05 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/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java Thu Oct 30 04:18:05 2014
@@ -43,6 +43,7 @@ import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
import org.ofbiz.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/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java Thu Oct 30 04:18:05 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/trunk/applications/order/src/org/ofbiz/order/test/PurchaseOrderTest.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/test/PurchaseOrderTest.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/test/PurchaseOrderTest.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/test/PurchaseOrderTest.java Thu Oct 30 04:18:05 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/trunk/applications/order/src/org/ofbiz/order/test/SalesOrderTest.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/test/SalesOrderTest.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/test/SalesOrderTest.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/test/SalesOrderTest.java Thu Oct 30 04:18:05 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
Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java Thu Oct 30 04:18:05 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/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java (original)
+++ ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java Thu Oct 30 04:18:05 2014
@@ -62,6 +62,7 @@ import org.ofbiz.entity.condition.Entity
import org.ofbiz.entity.condition.EntityOperator;
import org.ofbiz.entity.util.EntityFindOptions;
import org.ofbiz.entity.util.EntityListIterator;
+import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.GenericServiceException;
@@ -87,7 +88,7 @@ public class CommunicationEventServices
try {
// find the communication event and make sure that it is actually an email
- GenericValue communicationEvent = delegator.findOne("CommunicationEvent", UtilMisc.toMap("communicationEventId", communicationEventId), false);
+ GenericValue communicationEvent = EntityQuery.use(delegator).from("CommunicationEvent").where("communicationEventId", communicationEventId).queryOne();
if (communicationEvent == null) {
String errMsg = UtilProperties.getMessage(resource,"commeventservices.communication_event_not_found_failure", locale);
return ServiceUtil.returnError(errMsg + " " + communicationEventId);
@@ -285,8 +286,8 @@ public class CommunicationEventServices
EntityListIterator eli = null;
try {
- GenericValue communicationEvent = delegator.findOne("CommunicationEvent", UtilMisc.toMap("communicationEventId", communicationEventId), false);
- GenericValue contactList = delegator.findOne("ContactList", UtilMisc.toMap("contactListId", contactListId), false);
+ GenericValue communicationEvent = EntityQuery.use(delegator).from("CommunicationEvent").where("communicationEventId", communicationEventId).queryOne();
+ GenericValue contactList = EntityQuery.use(delegator).from("ContactList").where("contactListId", contactListId).queryOne();
Map<String, Object> sendMailParams = new HashMap<String, Object>();
sendMailParams.put("sendFrom", communicationEvent.getRelatedOne("FromContactMech", false).getString("infoString"));
@@ -391,7 +392,7 @@ public class CommunicationEventServices
bodyParameters.put("content", communicationEvent.getString("content"));
NotificationServices.setBaseUrl(delegator, contactList.getString("verifyEmailWebSiteId"), bodyParameters);
- GenericValue webSite = delegator.findOne("WebSite", UtilMisc.toMap("webSiteId", contactList.getString("verifyEmailWebSiteId")), false);
+ GenericValue webSite = EntityQuery.use(delegator).from("WebSite").where("webSiteId", contactList.getString("verifyEmailWebSiteId")).queryOne();
if (UtilValidate.isNotEmpty(webSite)) {
GenericValue productStore = webSite.getRelatedOne("ProductStore", false);
if (UtilValidate.isNotEmpty(productStore)) {
@@ -445,7 +446,7 @@ public class CommunicationEventServices
} else {
// attach the parent communication event to the new event created when sending the mail
String thisCommEventId = (String) tmpResult.get("communicationEventId");
- GenericValue thisCommEvent = delegator.findOne("CommunicationEvent", false, "communicationEventId", thisCommEventId);
+ GenericValue thisCommEvent = EntityQuery.use(delegator).from("CommunicationEvent").where("communicationEventId", thisCommEventId).queryOne();
if (thisCommEvent != null) {
thisCommEvent.set("contactListId", contactListId);
thisCommEvent.set("parentCommEventId", communicationEventId);
@@ -1338,7 +1339,7 @@ public class CommunicationEventServices
Delegator delegator = (Delegator) request.getAttribute("delegator");
GenericValue communicationEvent = null;
try {
- communicationEvent = delegator.findOne("CommunicationEvent", UtilMisc.toMap("communicationEventId", communicationEventId), true);
+ communicationEvent = EntityQuery.use(delegator).from("CommunicationEvent").where("communicationEventId", communicationEventId).cache().queryOne();
} catch (GenericEntityException e) {
Debug.logError(e, module);
}
Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java (original)
+++ ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java Thu Oct 30 04:18:05 2014
@@ -41,6 +41,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.security.Security;
import org.ofbiz.service.DispatchContext;
@@ -157,7 +158,7 @@ public class ContactMechServices {
GenericValue partyContactMech = null;
try {
- contactMech = delegator.findOne("ContactMech", UtilMisc.toMap("contactMechId", contactMechId), false);
+ contactMech = EntityQuery.use(delegator).from("ContactMech").where("contactMechId", contactMechId).queryOne();
} catch (GenericEntityException e) {
Debug.logWarning(e.getMessage(), module);
contactMech = null;
@@ -417,7 +418,7 @@ public class ContactMechServices {
GenericValue partyContactMech = null;
try {
- contactMech = delegator.findOne("ContactMech", UtilMisc.toMap("contactMechId", contactMechId), false);
+ contactMech = EntityQuery.use(delegator).from("ContactMech").where("contactMechId", contactMechId).queryOne();
} catch (GenericEntityException e) {
Debug.logWarning(e.getMessage(), module);
contactMech = null;
@@ -455,7 +456,7 @@ public class ContactMechServices {
GenericValue addr = null;
try {
- addr = delegator.findOne("PostalAddress", UtilMisc.toMap("contactMechId", contactMechId), false);
+ addr = EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", contactMechId).queryOne();
} catch (GenericEntityException e) {
Debug.logWarning(e.toString(), module);
addr = null;
@@ -635,7 +636,7 @@ public class ContactMechServices {
GenericValue partyContactMech = null;
try {
- contactMech = delegator.findOne("ContactMech", UtilMisc.toMap("contactMechId", contactMechId), false);
+ contactMech = EntityQuery.use(delegator).from("ContactMech").where("contactMechId", contactMechId).queryOne();
// try to find a PartyContactMech with a valid date range
List<GenericValue> partyContactMechs = EntityUtil.filterByDate(delegator.findByAnd("PartyContactMech", UtilMisc.toMap("partyId", partyId, "contactMechId", contactMechId), UtilMisc.toList("fromDate"), false), true);
@@ -664,7 +665,7 @@ public class ContactMechServices {
GenericValue telNum = null;
try {
- telNum = delegator.findOne("TelecomNumber", UtilMisc.toMap("contactMechId", contactMechId), false);
+ telNum = EntityQuery.use(delegator).from("TelecomNumber").where("contactMechId", contactMechId).queryOne();
} catch (GenericEntityException e) {
Debug.logWarning(e.toString(), module);
telNum = null;
@@ -930,7 +931,7 @@ public class ContactMechServices {
GenericValue pcmp = null;
try {
- pcmp = delegator.findOne("PartyContactMechPurpose", UtilMisc.toMap("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId, "fromDate", fromDate), false);
+ pcmp = EntityQuery.use(delegator).from("PartyContactMechPurpose").where("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId, "fromDate", fromDate).queryOne();
if (pcmp == null) {
return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
"contactmechservices.could_not_delete_purpose_from_contact_mechanism_not_found", locale));
Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java (original)
+++ ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java Thu Oct 30 04:18:05 2014
@@ -39,6 +39,7 @@ import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.condition.EntityCondition;
+import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
import org.ofbiz.entity.util.EntityUtilProperties;
@@ -359,7 +360,7 @@ public class ContactMechWorker {
}
try {
- contactMech = delegator.findOne("ContactMech", UtilMisc.toMap("contactMechId", contactMechId), false);
+ contactMech = EntityQuery.use(delegator).from("ContactMech").where("contactMechId", contactMechId).queryOne();
} catch (GenericEntityException e) {
Debug.logWarning(e, module);
}
@@ -374,7 +375,7 @@ public class ContactMechWorker {
target.put("contactMechTypeId", contactMechTypeId);
try {
- GenericValue contactMechType = delegator.findOne("ContactMechType", UtilMisc.toMap("contactMechTypeId", contactMechTypeId), false);
+ GenericValue contactMechType = EntityQuery.use(delegator).from("ContactMechType").where("contactMechTypeId", contactMechTypeId).queryOne();
if (contactMechType != null)
target.put("contactMechType", contactMechType);
@@ -571,7 +572,7 @@ public class ContactMechWorker {
}
try {
- contactMech = delegator.findOne("ContactMech", UtilMisc.toMap("contactMechId", contactMechId), false);
+ contactMech = EntityQuery.use(delegator).from("ContactMech").where("contactMechId", contactMechId).queryOne();
} catch (GenericEntityException e) {
Debug.logWarning(e, module);
}
@@ -586,7 +587,7 @@ public class ContactMechWorker {
target.put("contactMechTypeId", contactMechTypeId);
try {
- GenericValue contactMechType = delegator.findOne("ContactMechType", UtilMisc.toMap("contactMechTypeId", contactMechTypeId), false);
+ GenericValue contactMechType = EntityQuery.use(delegator).from("ContactMechType").where("contactMechTypeId", contactMechTypeId).queryOne();
if (contactMechType != null)
target.put("contactMechType", contactMechType);
@@ -890,7 +891,7 @@ public class ContactMechWorker {
public static String getContactMechAttribute(Delegator delegator, String contactMechId, String attrName) {
GenericValue attr = null;
try {
- attr = delegator.findOne("ContactMechAttribute", UtilMisc.toMap("contactMechId", contactMechId, "attrName", attrName), false);
+ attr = EntityQuery.use(delegator).from("ContactMechAttribute").where("contactMechId", contactMechId, "attrName", attrName).queryOne();
} catch (GenericEntityException e) {
Debug.logError(e, module);
}
@@ -910,14 +911,14 @@ public class ContactMechWorker {
// no postalCodeGeoId, see if there is a Geo record matching the countryGeoId and postalCode fields
if (UtilValidate.isNotEmpty(postalAddress.getString("countryGeoId")) && UtilValidate.isNotEmpty(postalAddress.getString("postalCode"))) {
// first try the shortcut with the geoId convention for "{countryGeoId}-{postalCode}"
- GenericValue geo = delegator.findOne("Geo", UtilMisc.toMap("geoId", postalAddress.getString("countryGeoId") + "-" + postalAddress.getString("postalCode")), true);
+ GenericValue geo = EntityQuery.use(delegator).from("Geo").where("geoId", postalAddress.getString("countryGeoId") + "-" + postalAddress.getString("postalCode")).cache().queryOne();
if (geo != null) {
// save the value to the database for quicker future reference
if (postalAddress.isMutable()) {
postalAddress.set("postalCodeGeoId", geo.getString("geoId"));
postalAddress.store();
} else {
- GenericValue mutablePostalAddress = delegator.findOne("PostalAddress", UtilMisc.toMap("contactMechId", postalAddress.getString("contactMechId")), false);
+ GenericValue mutablePostalAddress = EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", postalAddress.getString("contactMechId")).queryOne();
mutablePostalAddress.set("postalCodeGeoId", geo.getString("geoId"));
mutablePostalAddress.store();
}
@@ -935,7 +936,7 @@ public class ContactMechWorker {
postalAddress.set("postalCodeGeoId", geoAssocAndGeoTo.getString("geoId"));
postalAddress.store();
} else {
- GenericValue mutablePostalAddress = delegator.findOne("PostalAddress", UtilMisc.toMap("contactMechId", postalAddress.getString("contactMechId")), false);
+ GenericValue mutablePostalAddress = EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", postalAddress.getString("contactMechId")).queryOne();
mutablePostalAddress.set("postalCodeGeoId", geoAssocAndGeoTo.getString("geoId"));
mutablePostalAddress.store();
}
Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java (original)
+++ ofbiz/trunk/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java Thu Oct 30 04:18:05 2014
@@ -25,6 +25,7 @@ import org.ofbiz.base.util.cache.UtilCac
import org.ofbiz.base.util.*;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.Delegator;
+import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
import org.ofbiz.entity.model.ModelUtil;
import org.ofbiz.entity.model.ModelEntity;
@@ -187,7 +188,7 @@ public class PartyContentWrapper impleme
ModelEntity partyPersonModel = delegator.getModelEntity("PartyAndPerson");
if (partyPersonModel != null && partyPersonModel.isField(candidateFieldName)) {
if (party == null) {
- party = delegator.findOne("PartyAndPerson", UtilMisc.toMap("partyId", partyId), true);
+ party = EntityQuery.use(delegator).from("PartyAndPerson").where("partyId", partyId).cache().queryOne();
}
if (party != null) {
String candidateValue = party.getString(candidateFieldName);
@@ -202,7 +203,7 @@ public class PartyContentWrapper impleme
ModelEntity partyGroupModel = delegator.getModelEntity("PartyAndGroup");
if (partyGroupModel != null && partyGroupModel.isField(candidateFieldName)) {
if (party == null) {
- party = delegator.findOne("PartyAndGroup", UtilMisc.toMap("partyId", partyId), true);
+ party = EntityQuery.use(delegator).from("PartyAndGroup").where("partyId", partyId).cache().queryOne();
}
if (party != null) {
String candidateValue = party.getString(candidateFieldName);
@@ -217,7 +218,7 @@ public class PartyContentWrapper impleme
// otherwise a content field
GenericValue partyContent;
if (contentId != null) {
- partyContent = delegator.findOne("PartyContent", UtilMisc.toMap("partyId", partyId, "contentId", contentId), true);
+ partyContent = EntityQuery.use(delegator).from("PartyContent").where("partyId", partyId, "contentId", contentId).cache().queryOne();
} else {
partyContent = getFirstPartyContentByType(partyId, party, partyContentTypeId, delegator);
}
Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyHelper.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyHelper.java (original)
+++ ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyHelper.java Thu Oct 30 04:18:05 2014
@@ -26,6 +26,7 @@ import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.model.ModelEntity;
+import org.ofbiz.entity.util.EntityQuery;
/**
* PartyHelper
@@ -43,7 +44,7 @@ public class PartyHelper {
public static String getPartyName(Delegator delegator, String partyId, boolean lastNameFirst) {
GenericValue partyObject = null;
try {
- partyObject = delegator.findOne("PartyNameView", UtilMisc.toMap("partyId", partyId), false);
+ partyObject = EntityQuery.use(delegator).from("PartyNameView").where("partyId", partyId).queryOne();
} catch (GenericEntityException e) {
Debug.logError(e, "Error finding PartyNameView in getPartyName", module);
}
Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyRelationshipServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyRelationshipServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyRelationshipServices.java (original)
+++ ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyRelationshipServices.java Thu Oct 30 04:18:05 2014
@@ -33,6 +33,7 @@ import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
import org.ofbiz.security.Security;
import org.ofbiz.service.DispatchContext;
@@ -126,14 +127,14 @@ public class PartyRelationshipServices {
// Before creating the partyRelationShip, create the partyRoles if they don't exist
GenericValue partyToRole = null;
- partyToRole = delegator.findOne("PartyRole", UtilMisc.toMap("partyId", partyIdTo, "roleTypeId", roleTypeIdTo), false);
+ partyToRole = EntityQuery.use(delegator).from("PartyRole").where("partyId", partyIdTo, "roleTypeId", roleTypeIdTo).queryOne();
if (partyToRole == null) {
partyToRole = delegator.makeValue("PartyRole", UtilMisc.toMap("partyId", partyIdTo, "roleTypeId", roleTypeIdTo));
partyToRole.create();
}
GenericValue partyFromRole= null;
- partyFromRole = delegator.findOne("PartyRole", UtilMisc.toMap("partyId", partyIdFrom, "roleTypeId", roleTypeIdFrom), false);
+ partyFromRole = EntityQuery.use(delegator).from("PartyRole").where("partyId", partyIdFrom, "roleTypeId", roleTypeIdFrom).queryOne();
if (partyFromRole == null) {
partyFromRole = delegator.makeValue("PartyRole", UtilMisc.toMap("partyId", partyIdFrom, "roleTypeId", roleTypeIdFrom));
partyFromRole.create();
Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java (original)
+++ ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java Thu Oct 30 04:18:05 2014
@@ -53,6 +53,7 @@ import org.ofbiz.entity.model.DynamicVie
import org.ofbiz.entity.model.ModelKeyMap;
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.service.DispatchContext;
@@ -137,7 +138,7 @@ public class PartyServices {
GenericValue party = null;
try {
- party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false);
+ party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
} catch (GenericEntityException e) {
Debug.logWarning(e.getMessage(), module);
}
@@ -178,7 +179,7 @@ public class PartyServices {
GenericValue person = null;
try {
- person = delegator.findOne("Person", UtilMisc.toMap("partyId", partyId), false);
+ person = EntityQuery.use(delegator).from("Person").where("partyId", partyId).queryOne();
} catch (GenericEntityException e) {
Debug.logWarning(e.getMessage(), module);
}
@@ -221,7 +222,7 @@ public class PartyServices {
}
try {
- GenericValue party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false);
+ GenericValue party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
String oldStatusId = party.getString("statusId");
if (!statusId.equals(oldStatusId)) {
@@ -232,7 +233,7 @@ public class PartyServices {
} else {
// check that status is defined as a valid change
- GenericValue statusValidChange = delegator.findOne("StatusValidChange", UtilMisc.toMap("statusId", party.getString("statusId"), "statusIdTo", statusId), false);
+ GenericValue statusValidChange = EntityQuery.use(delegator).from("StatusValidChange").where("statusId", party.getString("statusId"), "statusIdTo", statusId).queryOne();
if (statusValidChange == null) {
String errorMsg = "Cannot change party status from " + party.getString("statusId") + " to " + statusId;
Debug.logWarning(errorMsg, module);
@@ -294,8 +295,8 @@ public class PartyServices {
GenericValue party = null;
try {
- person = delegator.findOne("Person", UtilMisc.toMap("partyId", partyId), false);
- party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false);
+ person = EntityQuery.use(delegator).from("Person").where("partyId", partyId).queryOne();
+ party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
} catch (GenericEntityException e) {
Debug.logWarning(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
@@ -377,8 +378,8 @@ public class PartyServices {
try {
// check to see if party object exists, if so make sure it is PARTY_GROUP type party
- GenericValue party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false);
- GenericValue partyGroupPartyType = delegator.findOne("PartyType", UtilMisc.toMap("partyTypeId", "PARTY_GROUP"), true);
+ GenericValue party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
+ GenericValue partyGroupPartyType = EntityQuery.use(delegator).from("PartyType").where("partyTypeId", "PARTY_GROUP").cache().queryOne();
if (partyGroupPartyType == null) {
return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
@@ -397,7 +398,7 @@ public class PartyServices {
String partyTypeId = "PARTY_GROUP";
if (UtilValidate.isNotEmpty(context.get("partyTypeId"))) {
- GenericValue desiredPartyType = delegator.findOne("PartyType", UtilMisc.toMap("partyTypeId", context.get("partyTypeId")), true);
+ GenericValue desiredPartyType = EntityQuery.use(delegator).from("PartyType").where("partyTypeId", context.get("partyTypeId")).cache().queryOne();
if (desiredPartyType != null && EntityTypeUtil.isType(desiredPartyType, partyGroupPartyType)) {
partyTypeId = desiredPartyType.getString("partyTypeId");
} else {
@@ -428,7 +429,7 @@ public class PartyServices {
partyStat.create();
}
- GenericValue partyGroup = delegator.findOne("PartyGroup", UtilMisc.toMap("partyId", partyId), false);
+ GenericValue partyGroup = EntityQuery.use(delegator).from("PartyGroup").where("partyId", partyId).queryOne();
if (partyGroup != null) {
return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
"partyservices.cannot_create_party_group_already_exists", locale));
@@ -472,8 +473,8 @@ public class PartyServices {
GenericValue party = null;
try {
- partyGroup = delegator.findOne("PartyGroup", UtilMisc.toMap("partyId", partyId), false);
- party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false);
+ partyGroup = EntityQuery.use(delegator).from("PartyGroup").where("partyId", partyId).queryOne();
+ party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
} catch (GenericEntityException e) {
Debug.logWarning(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
@@ -551,7 +552,7 @@ public class PartyServices {
GenericValue party = null;
try {
- party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false);
+ party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
} catch (GenericEntityException e) {
Debug.logWarning(e.getMessage(), module);
}
@@ -564,7 +565,7 @@ public class PartyServices {
GenericValue affiliate = null;
try {
- affiliate = delegator.findOne("Affiliate", UtilMisc.toMap("partyId", partyId), false);
+ affiliate = EntityQuery.use(delegator).from("Affiliate").where("partyId", partyId).queryOne();
} catch (GenericEntityException e) {
Debug.logWarning(e.getMessage(), module);
}
@@ -611,7 +612,7 @@ public class PartyServices {
GenericValue affiliate = null;
try {
- affiliate = delegator.findOne("Affiliate", UtilMisc.toMap("partyId", partyId), false);
+ affiliate = EntityQuery.use(delegator).from("Affiliate").where("partyId", partyId).queryOne();
} catch (GenericEntityException e) {
Debug.logWarning(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
@@ -657,7 +658,7 @@ public class PartyServices {
//Make sure the note Id actually exists if one is passed to avoid a foreign key error below
if (noteId != null) {
try {
- GenericValue value = delegator.findOne("NoteData", UtilMisc.toMap("noteId", noteId), false);
+ GenericValue value = EntityQuery.use(delegator).from("NoteData").where("noteId", noteId).queryOne();
if (value == null) {
Debug.logError("ERROR: Note id does not exist for : " + noteId + ", autogenerating." , module);
noteId = null;
@@ -925,7 +926,7 @@ public class PartyServices {
GenericValue person = null;
try {
- person = delegator.findOne("Person", UtilMisc.toMap("partyId", partyId), true);
+ person = EntityQuery.use(delegator).from("Person").where("partyId", partyId).cache().queryOne();
} catch (GenericEntityException e) {
return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
"partyservices.cannot_get_party_entities_read",
@@ -972,8 +973,8 @@ public class PartyServices {
try {
// validate the existance of party and dataSource
- GenericValue party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false);
- GenericValue dataSource = delegator.findOne("DataSource", UtilMisc.toMap("dataSourceId", dataSourceId), false);
+ GenericValue party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
+ GenericValue dataSource = EntityQuery.use(delegator).from("DataSource").where("dataSourceId", dataSourceId).queryOne();
if (party == null || dataSource == null) {
List<String> errorList = UtilMisc.toList(UtilProperties.getMessage(resource,
"PartyCannotCreatePartyDataSource", locale));
@@ -1025,7 +1026,7 @@ public class PartyServices {
try {
roleTypeId = (String) context.get("roleTypeId");
if (UtilValidate.isNotEmpty(roleTypeId)) {
- GenericValue currentRole = delegator.findOne("RoleType", UtilMisc.toMap("roleTypeId", roleTypeId), true);
+ GenericValue currentRole = EntityQuery.use(delegator).from("RoleType").where("roleTypeId", roleTypeId).cache().queryOne();
result.put("currentRole", currentRole);
}
} catch (GenericEntityException e) {
@@ -1053,7 +1054,7 @@ public class PartyServices {
try {
partyTypeId = (String) context.get("partyTypeId");
if (UtilValidate.isNotEmpty(partyTypeId)) {
- GenericValue currentPartyType = delegator.findOne("PartyType", UtilMisc.toMap("partyTypeId", partyTypeId), true);
+ GenericValue currentPartyType = EntityQuery.use(delegator).from("PartyType").where("partyTypeId", partyTypeId).cache().queryOne();
result.put("currentPartyType", currentPartyType);
}
} catch (GenericEntityException e) {
@@ -1069,7 +1070,7 @@ public class PartyServices {
try {
stateProvinceGeoId = (String) context.get("stateProvinceGeoId");
if (UtilValidate.isNotEmpty(stateProvinceGeoId)) {
- GenericValue currentStateGeo = delegator.findOne("Geo", UtilMisc.toMap("geoId", stateProvinceGeoId), true);
+ GenericValue currentStateGeo = EntityQuery.use(delegator).from("Geo").where("geoId", stateProvinceGeoId).cache().queryOne();
result.put("currentStateGeo", currentStateGeo);
}
} catch (GenericEntityException e) {
@@ -1521,7 +1522,7 @@ public class PartyServices {
// get the from/to party records
GenericValue partyTo;
try {
- partyTo = delegator.findOne("Party", UtilMisc.toMap("partyId", partyIdTo), false);
+ partyTo = EntityQuery.use(delegator).from("Party").where("partyId", partyIdTo).queryOne();
} catch (GenericEntityException e) {
Debug.logInfo(e, module);
return ServiceUtil.returnError(e.getMessage());
@@ -1537,7 +1538,7 @@ public class PartyServices {
GenericValue party;
try {
- party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false);
+ party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
} catch (GenericEntityException e) {
Debug.logInfo(e, module);
return ServiceUtil.returnError(e.getMessage());
@@ -1929,12 +1930,12 @@ public class PartyServices {
}
if (UtilValidate.isNotEmpty(rec.get("contactMechTypeId")) &&
- delegator.findOne("ContactMechType", true, UtilMisc.toMap("contactMechTypeId", rec.get("contactMechTypeId"))) == null) {
+ EntityQuery.use(delegator).from("ContactMechType").where("contactMechTypeId", rec.get("contactMechTypeId")).cache().queryOne() == null) {
newErrMsgs.add("Line number " + rec.getRecordNumber() + ": partyId: " + currentPartyId + " contactMechTypeId code not found for: " + rec.get("contactMechTypeId"));
}
if (UtilValidate.isNotEmpty(rec.get("contactMechPurposeTypeId")) &&
- delegator.findOne("ContactMechPurposeType", true, UtilMisc.toMap("contactMechPurposeTypeId", rec.get("contactMechPurposeTypeId"))) == null) {
+ EntityQuery.use(delegator).from("ContactMechPurposeType").where("contactMechPurposeTypeId", rec.get("contactMechPurposeTypeId")).cache().queryOne() == null) {
newErrMsgs.add("Line number " + rec.getRecordNumber() + ": partyId: " + currentPartyId + "contactMechPurposeTypeId code not found for: " + rec.get("contactMechPurposeTypeId"));
}
Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyTypeHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyTypeHelper.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyTypeHelper.java (original)
+++ ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyTypeHelper.java Thu Oct 30 04:18:05 2014
@@ -25,6 +25,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;
/**
@@ -45,10 +46,10 @@ public class PartyTypeHelper {
GenericValue partyType = null;
GenericValue checkedTypeOfParty = null;
try {
- party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false);
+ party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
if (UtilValidate.isNotEmpty(party)) {
partyType = party.getRelatedOne("PartyType", true);
- checkedTypeOfParty = delegator.findOne("PartyType", UtilMisc.toMap("partyTypeId", checkedPartyType), true);
+ checkedTypeOfParty = EntityQuery.use(delegator).from("PartyType").where("partyTypeId", checkedPartyType).cache().queryOne();
} else {
return false;
}
Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyWorker.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyWorker.java (original)
+++ ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyWorker.java Thu Oct 30 04:18:05 2014
@@ -43,6 +43,7 @@ import org.ofbiz.entity.condition.Entity
import org.ofbiz.entity.condition.EntityFunction;
import org.ofbiz.entity.condition.EntityOperator;
import org.ofbiz.entity.model.ModelEntity;
+import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
/**
@@ -58,7 +59,7 @@ public class PartyWorker {
Delegator delegator = (Delegator) request.getAttribute("delegator");
Map<String, GenericValue> result = FastMap.newInstance();
try {
- GenericValue party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false);
+ GenericValue party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
if (party != null)
result.put(partyAttr, party);
@@ -67,7 +68,7 @@ public class PartyWorker {
}
try {
- GenericValue person = delegator.findOne("Person", UtilMisc.toMap("partyId", partyId), false);
+ GenericValue person = EntityQuery.use(delegator).from("Person").where("partyId", partyId).queryOne();
if (person != null)
result.put(personAttr, person);
@@ -76,7 +77,7 @@ public class PartyWorker {
}
try {
- GenericValue partyGroup = delegator.findOne("PartyGroup", UtilMisc.toMap("partyId", partyId), false);
+ GenericValue partyGroup = EntityQuery.use(delegator).from("PartyGroup").where("partyId", partyId).queryOne();
if (partyGroup != null)
result.put(partyGroupAttr, partyGroup);
@@ -260,7 +261,7 @@ public class PartyWorker {
for (GenericValue partyAndAddr: validFound) {
String partyId = partyAndAddr.getString("partyId");
if (UtilValidate.isNotEmpty(partyId)) {
- GenericValue p = delegator.findOne("Person", UtilMisc.toMap("partyId", partyId), false);
+ GenericValue p = EntityQuery.use(delegator).from("Person").where("partyId", partyId).queryOne();
if (p != null) {
String fName = p.getString("firstName");
String lName = p.getString("lastName");
@@ -493,7 +494,7 @@ public class PartyWorker {
// 1) look if the idToFind given is a real partyId
if (searchPartyFirst) {
- party = delegator.findOne("Party", UtilMisc.toMap("partyId", idToFind), true);
+ party = EntityQuery.use(delegator).from("Party").where("partyId", idToFind).cache().queryOne();
}
if (searchAllId || (searchPartyFirst && UtilValidate.isEmpty(party))) {
@@ -506,7 +507,7 @@ public class PartyWorker {
}
if (! searchPartyFirst) {
- party = delegator.findOne("Party", UtilMisc.toMap("partyId", idToFind), true);
+ party = EntityQuery.use(delegator).from("Party").where("partyId", idToFind).cache().queryOne();
}
if (UtilValidate.isNotEmpty(party)) {
@@ -549,7 +550,7 @@ public class PartyWorker {
GenericValue partyToAdd = party;
//retreive party GV if the actual genericValue came from viewEntity
if (! "Party".equals(party.getEntityName())) {
- partyToAdd = delegator.findOne("Party", UtilMisc.toMap("partyId", party.get("partyId")), true);
+ partyToAdd = EntityQuery.use(delegator).from("Party").where("partyId", party.get("partyId")).cache().queryOne();
}
if (UtilValidate.isEmpty(parties)) {
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java Thu Oct 30 04:18:05 2014
@@ -37,6 +37,7 @@ import org.ofbiz.webapp.website.WebSiteW
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.product.category.CategoryWorker;
import org.ofbiz.product.store.ProductStoreWorker;
@@ -213,7 +214,7 @@ public class CatalogWorker {
Delegator delegator = (Delegator) request.getAttribute("delegator");
try {
- GenericValue prodCatalog = delegator.findOne("ProdCatalog", UtilMisc.toMap("prodCatalogId", prodCatalogId), true);
+ GenericValue prodCatalog = EntityQuery.use(delegator).from("ProdCatalog").where("prodCatalogId", prodCatalogId).cache().queryOne();
if (prodCatalog != null) {
return prodCatalog.getString("catalogName");
@@ -252,7 +253,7 @@ public class CatalogWorker {
Delegator delegator = (Delegator) request.getAttribute("delegator");
try {
- return delegator.findOne("ProdCatalog", UtilMisc.toMap("prodCatalogId", prodCatalogId), true);
+ return EntityQuery.use(delegator).from("ProdCatalog").where("prodCatalogId", prodCatalogId).cache().queryOne();
} catch (GenericEntityException e) {
Debug.logError(e, "Error looking up name for prodCatalog with id " + prodCatalogId, module);
return null;
@@ -347,7 +348,7 @@ public class CatalogWorker {
Delegator delegator = (Delegator) request.getAttribute("delegator");
try {
- GenericValue prodCatalog = delegator.findOne("ProdCatalog", UtilMisc.toMap("prodCatalogId", prodCatalogId), true);
+ GenericValue prodCatalog = EntityQuery.use(delegator).from("ProdCatalog").where("prodCatalogId", prodCatalogId).cache().queryOne();
if (prodCatalog != null) {
return "Y".equals(prodCatalog.getString("useQuickAdd"));
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CatalogUrlFilter.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CatalogUrlFilter.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CatalogUrlFilter.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CatalogUrlFilter.java Thu Oct 30 04:18:05 2014
@@ -43,6 +43,7 @@ import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.condition.EntityCondition;
+import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
import org.ofbiz.product.product.ProductContentWrapper;
import org.ofbiz.webapp.control.ContextFilter;
@@ -339,7 +340,7 @@ public class CatalogUrlFilter extends Co
public static String makeCategoryUrl(HttpServletRequest request, String previousCategoryId, String productCategoryId, String productId, String viewSize, String viewIndex, String viewSort, String searchString) {
Delegator delegator = (Delegator) request.getAttribute("delegator");
try {
- GenericValue productCategory = delegator.findOne("ProductCategory", UtilMisc.toMap("productCategoryId", productCategoryId), true);
+ GenericValue productCategory = EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", productCategoryId).cache().queryOne();
CategoryContentWrapper wrapper = new CategoryContentWrapper(productCategory, request);
List<String> trail = CategoryWorker.getTrail(request);
return makeCategoryUrl(delegator, wrapper, trail, request.getContextPath(), previousCategoryId, productCategoryId, productId, viewSize, viewIndex, viewSort, searchString);
@@ -414,7 +415,7 @@ public class CatalogUrlFilter extends Co
Delegator delegator = (Delegator) request.getAttribute("delegator");
String url = null;
try {
- GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true);
+ GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne();
ProductContentWrapper wrapper = new ProductContentWrapper(product, request);
List<String> trail = CategoryWorker.getTrail(request);
url = makeProductUrl(delegator, wrapper, trail, request.getContextPath(), previousCategoryId, productCategoryId, productId);
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryContentWrapper.java Thu Oct 30 04:18:05 2014
@@ -42,6 +42,7 @@ import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.model.ModelEntity;
import org.ofbiz.entity.model.ModelUtil;
+import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
import org.ofbiz.service.LocalDispatcher;
@@ -129,7 +130,7 @@ public class CategoryContentWrapper impl
ModelEntity categoryModel = delegator.getModelEntity("ProductCategory");
if (categoryModel.isField(candidateFieldName)) {
if (productCategory == null) {
- productCategory = delegator.findOne("ProductCategory", UtilMisc.toMap("productCategoryId", productCategoryId), true);
+ productCategory = EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", productCategoryId).cache().queryOne();
}
if (productCategory != null) {
String candidateValue = productCategory.getString(candidateFieldName);
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java Thu Oct 30 04:18:05 2014
@@ -48,6 +48,7 @@ import org.ofbiz.entity.condition.Entity
import org.ofbiz.entity.model.ModelEntity;
import org.ofbiz.entity.util.EntityFindOptions;
import org.ofbiz.entity.util.EntityListIterator;
+import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
import org.ofbiz.product.catalog.CatalogWorker;
import org.ofbiz.product.product.ProductWorker;
@@ -71,7 +72,7 @@ public class CategoryServices {
List<GenericValue> members = null;
try {
- productCategory = delegator.findOne("ProductCategory", UtilMisc.toMap("productCategoryId", categoryId), true);
+ productCategory = EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", categoryId).cache().queryOne();
members = EntityUtil.filterByDate(productCategory.getRelated("ProductCategoryMember", null, UtilMisc.toList("sequenceNum"), true), true);
if (Debug.verboseOn()) Debug.logVerbose("Category: " + productCategory + " Member Size: " + members.size() + " Members: " + members, module);
} catch (GenericEntityException e) {
@@ -107,7 +108,7 @@ public class CategoryServices {
GenericValue productCategory;
List<GenericValue> productCategoryMembers;
try {
- productCategory = delegator.findOne("ProductCategory", UtilMisc.toMap("productCategoryId", categoryId), true);
+ productCategory = EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", categoryId).cache().queryOne();
productCategoryMembers = delegator.findByAnd(entityName, UtilMisc.toMap("productCategoryId", categoryId), orderByFields, true);
} catch (GenericEntityException e) {
Debug.logInfo(e, "Error finding previous/next product info: " + e.toString(), module);
@@ -257,7 +258,7 @@ public class CategoryServices {
GenericValue productCategory = null;
try {
- productCategory = delegator.findOne("ProductCategory", UtilMisc.toMap("productCategoryId", productCategoryId), true);
+ productCategory = EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", productCategoryId).cache().queryOne();
} catch (GenericEntityException e) {
Debug.logWarning(e.getMessage(), module);
productCategory = null;
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java Thu Oct 30 04:18:05 2014
@@ -43,6 +43,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.product.product.ProductWorker;
import org.ofbiz.service.DispatchContext;
@@ -366,7 +367,7 @@ public class CategoryWorker {
UtilMisc.toMap("productCategoryId", productCategoryId, "productId", productId), null, true), true);
if (UtilValidate.isEmpty(productCategoryMembers)) {
//before giving up see if this is a variant product, and if so look up the virtual product and check it...
- GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true);
+ GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne();
List<GenericValue> productAssocs = ProductWorker.getVariantVirtualAssocs(product);
//this does take into account that a product could be a variant of multiple products, but this shouldn't ever really happen...
if (productAssocs != null) {
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/category/OfbizCatalogAltUrlTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/category/OfbizCatalogAltUrlTransform.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/category/OfbizCatalogAltUrlTransform.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/category/OfbizCatalogAltUrlTransform.java Thu Oct 30 04:18:05 2014
@@ -31,6 +31,7 @@ import org.ofbiz.base.util.template.Free
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.product.product.ProductContentWrapper;
import org.ofbiz.service.LocalDispatcher;
import org.ofbiz.webapp.OfbizUrlBuilder;
@@ -131,11 +132,11 @@ public class OfbizCatalogAltUrlTransform
LocalDispatcher dispatcher = FreeMarkerWorker.getWrappedObject("dispatcher", env);
Locale locale = (Locale) args.get("locale");
if (UtilValidate.isNotEmpty(productId)) {
- GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false);
+ GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne();
ProductContentWrapper wrapper = new ProductContentWrapper(dispatcher, product, locale, "text/html");
url = CatalogUrlFilter.makeProductUrl(delegator, wrapper, null, ((StringModel) prefix).getAsString(), previousCategoryId, productCategoryId, productId);
} else {
- GenericValue productCategory = delegator.findOne("ProductCategory", UtilMisc.toMap("productCategoryId", productCategoryId), false);
+ GenericValue productCategory = EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", productCategoryId).queryOne();
CategoryContentWrapper wrapper = new CategoryContentWrapper(dispatcher, productCategory, locale, "text/html");
url = CatalogUrlFilter.makeCategoryUrl(delegator, wrapper, null, ((StringModel) prefix).getAsString(), previousCategoryId, productCategoryId, productId, viewSize, viewIndex, viewSort, searchString);
}
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigItemContentWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigItemContentWrapper.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigItemContentWrapper.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigItemContentWrapper.java Thu Oct 30 04:18:05 2014
@@ -40,6 +40,7 @@ import org.ofbiz.entity.DelegatorFactory
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.model.ModelEntity;
import org.ofbiz.entity.model.ModelUtil;
+import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
import org.ofbiz.service.LocalDispatcher;
import org.ofbiz.service.ServiceContainer;
@@ -150,7 +151,7 @@ public class ProductConfigItemContentWra
ModelEntity productConfigItemModel = delegator.getModelEntity("ProductConfigItem");
if (productConfigItemModel.isField(candidateFieldName)) {
if (productConfigItem == null) {
- productConfigItem = delegator.findOne("ProductConfigItem", UtilMisc.toMap("configItemId", configItemId), true);
+ productConfigItem = EntityQuery.use(delegator).from("ProductConfigItem").where("configItemId", configItemId).cache().queryOne();
}
if (productConfigItem != null) {
String candidateValue = productConfigItem.getString(candidateFieldName);
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java Thu Oct 30 04:18:05 2014
@@ -38,6 +38,7 @@ import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.DelegatorFactory;
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.LocalDispatcher;
import org.ofbiz.service.ServiceContainer;
@@ -96,7 +97,7 @@ public class ProductConfigWrapper implem
}
private void init(Delegator delegator, LocalDispatcher dispatcher, String productId, String productStoreId, String catalogId, String webSiteId, String currencyUomId, Locale locale, GenericValue autoUserLogin) throws Exception {
- product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false);
+ product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne();
if (product == null || !product.getString("productTypeId").equals("AGGREGATED") && !product.getString("productTypeId").equals("AGGREGATED_SERVICE")) {
throw new ProductConfigWrapperException("Product " + productId + " is not an AGGREGATED product.");
}
@@ -624,7 +625,7 @@ public class ProductConfigWrapper implem
String variantProductId = componentOptions.get(oneComponent.getString("productId"));
if (UtilValidate.isNotEmpty(variantProductId)) {
- oneComponentProduct = pcw.delegator.findOne("Product", UtilMisc.toMap("productId", variantProductId), false);
+ oneComponentProduct = EntityQuery.use(delegator).from("Product").where("productId", variantProductId).queryOne();
}
// Get the component's price
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/feature/ParametricSearch.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/feature/ParametricSearch.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/feature/ParametricSearch.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/feature/ParametricSearch.java Thu Oct 30 04:18:05 2014
@@ -37,6 +37,7 @@ import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.util.EntityListIterator;
+import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
/**
@@ -92,7 +93,7 @@ public class ParametricSearch {
for (GenericValue productFeatureCatGrpAppl: productFeatureCatGrpAppls) {
List<GenericValue> productFeatureGroupAppls = delegator.findByAnd("ProductFeatureGroupAppl", UtilMisc.toMap("productFeatureGroupId", productFeatureCatGrpAppl.get("productFeatureGroupId")), null, true);
for (GenericValue productFeatureGroupAppl: productFeatureGroupAppls) {
- GenericValue productFeature = delegator.findOne("ProductFeature", UtilMisc.toMap("productFeatureId", productFeatureGroupAppl.get("productFeatureId")), true);
+ GenericValue productFeature = EntityQuery.use(delegator).from("ProductFeature").where("productFeatureId", productFeatureGroupAppl.get("productFeatureId")).cache().queryOne();
String productFeatureTypeId = productFeature.getString("productFeatureTypeId");
Map<String, GenericValue> featuresByType = productFeaturesByTypeMap.get(productFeatureTypeId);
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/FrameImage.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/FrameImage.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/FrameImage.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/FrameImage.java Thu Oct 30 04:18:05 2014
@@ -54,6 +54,7 @@ import org.ofbiz.base.util.string.Flexib
import org.ofbiz.content.layout.LayoutWorker;
import org.ofbiz.entity.Delegator;
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;
@@ -97,7 +98,7 @@ public class FrameImage {
String frameImageName = null;
try {
- GenericValue contentDataResourceView = delegator.findOne("ContentDataResourceView", UtilMisc.toMap("contentId", frameContentId, "drDataResourceId", frameDataResourceId), false);
+ GenericValue contentDataResourceView = EntityQuery.use(delegator).from("ContentDataResourceView").where("contentId", frameContentId, "drDataResourceId", frameDataResourceId).queryOne();
frameImageName = contentDataResourceView.getString("contentName");
} catch (Exception e) {
Debug.logError(e, module);
@@ -357,7 +358,7 @@ public class FrameImage {
String frameImageName = null;
try {
- GenericValue contentDataResourceView = delegator.findOne("ContentDataResourceView", UtilMisc.toMap("contentId", frameContentId, "drDataResourceId", frameDataResourceId), false);
+ GenericValue contentDataResourceView = EntityQuery.use(delegator).from("ContentDataResourceView").where("contentId", frameContentId, "drDataResourceId", frameDataResourceId).queryOne();
frameImageName = contentDataResourceView.getString("contentName");
} catch (Exception e) {
request.setAttribute("_ERROR_MESSAGE_", e.getMessage());
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java Thu Oct 30 04:18:05 2014
@@ -60,6 +60,7 @@ import org.ofbiz.common.image.ImageTrans
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;
@@ -467,7 +468,7 @@ public class ImageManagementServices {
GenericValue content = null;
try {
- content = delegator.findOne("Content", UtilMisc.toMap("contentId", contentId), false);
+ content = EntityQuery.use(delegator).from("Content").where("contentId", contentId).queryOne();
} catch (GenericEntityException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(e.getMessage());
@@ -958,7 +959,7 @@ public class ImageManagementServices {
}
GenericValue content = null;
try {
- content = delegator.findOne("Content", UtilMisc.toMap("contentId", contentId), false);
+ content = EntityQuery.use(delegator).from("Content").where("contentId", contentId).queryOne();
} catch (GenericEntityException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(e.getMessage());
@@ -1017,7 +1018,7 @@ public class ImageManagementServices {
}
GenericValue contentAssocUp = null;
try {
- contentAssocUp = delegator.findOne("Content", UtilMisc.toMap("contentId", contentAssoc.get("contentIdTo")), false);
+ contentAssocUp = EntityQuery.use(delegator).from("Content").where("contentId", contentAssoc.get("contentIdTo")).queryOne();
} catch (GenericEntityException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(e.getMessage());
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageUrlServlet.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageUrlServlet.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageUrlServlet.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageUrlServlet.java Thu Oct 30 04:18:05 2014
@@ -36,6 +36,7 @@ import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
/**
* ControlServlet.java - Master servlet for the web application.
@@ -89,11 +90,11 @@ public class ImageUrlServlet extends Htt
GenericValue content = null;
try {
- GenericValue contentResult = delegator.findOne("Content", UtilMisc.toMap("contentId", contentId), false);
+ GenericValue contentResult = EntityQuery.use(delegator).from("Content").where("contentId", contentId).queryOne();
if (contentResult == null) {
- content = delegator.findOne("Content", UtilMisc.toMap("contentId", sizeTagElement), false);
+ content = EntityQuery.use(delegator).from("Content").where("contentId", sizeTagElement).queryOne();
} else {
- content = delegator.findOne("Content", UtilMisc.toMap("contentId", contentId), false);
+ content = EntityQuery.use(delegator).from("Content").where("contentId", contentId).queryOne();
}
} catch (GenericEntityException e) {
Debug.logError(e, module);