Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java Thu Oct 30 04:18:05 2014 @@ -46,6 +46,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.widget.ModelWidget; import org.ofbiz.widget.ModelWidgetAction; import org.ofbiz.widget.PortalPageWorker; @@ -1045,7 +1046,7 @@ public abstract class ModelScreenWidget if (UtilValidate.isEmpty(expandedDataResourceId)) { if (UtilValidate.isNotEmpty(expandedContentId)) { - content = delegator.findOne("Content", UtilMisc.toMap("contentId", expandedContentId), true); + content = EntityQuery.use(delegator).from("Content").where("contentId", expandedContentId).cache().queryOne(); } else { String errMsg = "contentId is empty."; Debug.logError(errMsg, module); @@ -1062,7 +1063,7 @@ public abstract class ModelScreenWidget GenericValue dataResource = null; if (UtilValidate.isNotEmpty(expandedDataResourceId)) { - dataResource = delegator.findOne("DataResource", UtilMisc.toMap("dataResourceId", expandedDataResourceId), true); + dataResource = EntityQuery.use(delegator).from("DataResource").where("dataResourceId", expandedDataResourceId).cache().queryOne(); } String mimeTypeId = null; @@ -1621,7 +1622,7 @@ public abstract class ModelScreenWidget portalPage = PortalPageWorker.getPortalPage(expandedPortalPageId, context); } else { - portalPage = delegator.findOne("PortalPage", UtilMisc.toMap("portalPageId", expandedPortalPageId), true); + portalPage = EntityQuery.use(delegator).from("PortalPage").where("portalPageId", expandedPortalPageId).cache().queryOne(); } if (portalPage == null) { String errMsg = "Could not find PortalPage with portalPageId [" + expandedPortalPageId + "] ";
Modified: ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java (original) +++ ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java Thu Oct 30 04:18:05 2014 @@ -47,6 +47,7 @@ import org.ofbiz.base.util.UtilXml; 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.ShoppingCart; import org.ofbiz.party.contact.ContactHelper; @@ -69,7 +70,7 @@ public class EbayHelper { if (UtilValidate.isNotEmpty(productStoreId)) { GenericValue eBayConfig = null; try { - eBayConfig = delegator.findOne("EbayConfig", false, UtilMisc.toMap("productStoreId", productStoreId)); + eBayConfig = EntityQuery.use(delegator).from("EbayConfig").where(UtilMisc.toMap("productStoreId", productStoreId)).queryOne(); } catch (GenericEntityException e) { String errMsg = UtilProperties.getMessage(resource, "buildEbayConfig.unableToFindEbayConfig" + e.getMessage(), locale); return ServiceUtil.returnError(errMsg); @@ -171,7 +172,7 @@ public class EbayHelper { String partyId = "_NA_"; String shipmentMethodTypeId = "NO_SHIPPING"; try { - GenericValue ebayShippingMethod = delegator.findOne("EbayShippingMethod", UtilMisc.toMap("shipmentMethodName", shippingService, "productStoreId", productStoreId), false); + GenericValue ebayShippingMethod = EntityQuery.use(delegator).from("EbayShippingMethod").where("shipmentMethodName", shippingService, "productStoreId", productStoreId).queryOne(); if (UtilValidate.isNotEmpty(ebayShippingMethod)) { partyId = ebayShippingMethod.getString("carrierPartyId"); shipmentMethodTypeId = ebayShippingMethod.getString("shipmentMethodTypeId"); @@ -516,7 +517,7 @@ public class EbayHelper { GenericValue postalAddress; try { // get the postal address for this contact mech - postalAddress = delegator.findOne("PostalAddress", UtilMisc.toMap("contactMechId", contactMechId), false); + postalAddress = EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", contactMechId).queryOne(); // match values to compare by modifying them the same way they // were when they were created @@ -622,7 +623,7 @@ public class EbayHelper { titleFirstWord = title.substring(0, title.indexOf(' ')); } if (UtilValidate.isNotEmpty(titleFirstWord)) { - GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", titleFirstWord), false); + GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", titleFirstWord).queryOne(); if (UtilValidate.isNotEmpty(product)) { productId = product.getString("productId"); } Modified: ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java (original) +++ ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.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.EntityComparisonOperator; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.order.order.OrderChangeHelper; import org.ofbiz.order.shoppingcart.CheckOutHelper; @@ -992,7 +993,7 @@ public class EbayOrderServices { if (productStoreId == null) { return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.productStoreIdIsMandatory", locale)); } else { - GenericValue productStore = delegator.findOne("ProductStore", UtilMisc.toMap("productStoreId", productStoreId), false); + GenericValue productStore = EntityQuery.use(delegator).from("ProductStore").where("productStoreId", productStoreId).queryOne(); if (productStore != null) { defaultCurrencyUomId = productStore.getString("defaultCurrencyUomId"); payToPartyId = productStore.getString("payToPartyId"); @@ -1150,7 +1151,7 @@ public class EbayOrderServices { // if we get a party, check its contact information. if (UtilValidate.isNotEmpty(partyId)) { Debug.logInfo("Found existing party associated to the eBay buyer: " + partyId, module); - GenericValue party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false); + GenericValue party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne(); contactMechId = EbayHelper.setShippingAddressContactMech(dispatcher, delegator, party, userLogin, shippingAddressCtx); String emailBuyer = (String) context.get("emailBuyer"); @@ -1261,7 +1262,7 @@ public class EbayOrderServices { private static void addItem(ShoppingCart cart, Map<String, Object> orderItem, LocalDispatcher dispatcher, Delegator delegator, int groupIdx) throws GeneralException { String productId = (String) orderItem.get("productId"); - GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false); + GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); if (UtilValidate.isEmpty(product)) { String productMissingMsg = "The product having ID (" + productId + ") is misssing in the system."; orderImportFailureMessageList.add(productMissingMsg); Modified: ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java (original) +++ ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java Thu Oct 30 04:18:05 2014 @@ -39,6 +39,7 @@ import org.ofbiz.base.util.UtilXml; 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.entity.condition.EntityCondition; import org.ofbiz.entity.condition.EntityComparisonOperator; @@ -141,7 +142,7 @@ public class ImportOrdersFromEbay { if (UtilValidate.isNotEmpty(orderId)) { // Get the order header and verify if this order has been imported // from eBay (i.e. sales channel = EBAY_CHANNEL and externalId is set) - orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); if (orderHeader == null) { Debug.logError("Cannot find order with orderId [" + orderId + "]", module); return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.errorRetrievingOrderFromOrderId", locale)); @@ -600,7 +601,7 @@ public class ImportOrdersFromEbay { if (productStoreId == null) { return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.productStoreIdIsMandatory", locale)); } else { - GenericValue productStore = delegator.findOne("ProductStore", UtilMisc.toMap("productStoreId", productStoreId), false); + GenericValue productStore = EntityQuery.use(delegator).from("ProductStore").where("productStoreId", productStoreId).queryOne(); if (productStore != null) { defaultCurrencyUomId = productStore.getString("defaultCurrencyUomId"); payToPartyId = productStore.getString("payToPartyId"); @@ -658,7 +659,7 @@ public class ImportOrdersFromEbay { if (UtilValidate.isEmpty(productId)) { return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.productIdNotAvailable", locale)); } else { - GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false); + GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); if (UtilValidate.isEmpty(product)) { return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.productIdDoesNotExist", locale)); } @@ -735,7 +736,7 @@ public class ImportOrdersFromEbay { if (UtilValidate.isNotEmpty(partyAttribute)) { partyId = (String) partyAttribute.get("partyId"); Debug.logInfo("Found existing party associated to the eBay buyer: " + partyId, module); - GenericValue party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false); + GenericValue party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne(); contactMechId = EbayHelper.setShippingAddressContactMech(dispatcher, delegator, party, userLogin, parameters); String emailBuyer = (String) parameters.get("emailBuyer"); Modified: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayBestOfferAutoPref.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayBestOfferAutoPref.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayBestOfferAutoPref.java (original) +++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayBestOfferAutoPref.java Thu Oct 30 04:18:05 2014 @@ -28,6 +28,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; @@ -90,7 +91,7 @@ public class EbayBestOfferAutoPref { Map<String, Object> ebayCondition11 = UtilMisc.<String, Object>toMap("userLogin", userLogin); ebayCondition11.put("acceptanceCondition", condition11); - GenericValue productStorePref = delegator.findOne("EbayProductStorePref", UtilMisc.toMap("productStoreId", productStoreId, "autoPrefEnumId", "EBAY_AUTO_BEST_OFFER"), false); + GenericValue productStorePref = EntityQuery.use(delegator).from("EbayProductStorePref").where("productStoreId", productStoreId, "autoPrefEnumId", "EBAY_AUTO_BEST_OFFER").queryOne(); if (UtilValidate.isEmpty(productStorePref)) { String prefCondId1 = delegator.getNextSeqId("EbayProductStorePrefCond"); String parentPrefCondId = prefCondId1; Modified: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java (original) +++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java Thu Oct 30 04:18:05 2014 @@ -42,6 +42,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.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; @@ -196,7 +197,7 @@ public class EbayEvents { for (String productId : productIds) { AddItemCall addItemCall = new AddItemCall(apiContext); ItemType item = new ItemType(); - GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false); + GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); item.setTitle(product.getString("internalName")); item.setCurrency(CurrencyCodeType.USD); String productDescription = ""; @@ -544,7 +545,7 @@ public class EbayEvents { EbayStoreSiteFacade sf = null; // find is exiting product and set category into item in additem call try { - if (UtilValidate.isNotEmpty(delegator.findOne("Product", UtilMisc.toMap("productId", productId), false))) { + if (UtilValidate.isNotEmpty(EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne())) { ApiContext apiContext = getApiContext(request); Map<String,Object> addItemObject = getAddItemListingObject(request, apiContext); List<Map<String,Object>> addItemlist = UtilGenerics.checkList(addItemObject.get("itemListing")); Modified: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayFeedback.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayFeedback.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayFeedback.java (original) +++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayFeedback.java Thu Oct 30 04:18:05 2014 @@ -23,6 +23,7 @@ import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import java.util.*; @@ -80,7 +81,7 @@ public class EbayFeedback { FeedbackDetailType[] feedback = feedbackCall.getFeedback(); if (feedback != null) { String partyId = null; - GenericValue userLoginEx = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", userID), false); + GenericValue userLoginEx = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", userID).queryOne(); if (userLoginEx == null) { //Party GenericValue party = delegator.makeValue("Party"); @@ -109,7 +110,7 @@ public class EbayFeedback { //convert to ofbiz String contentId = feedback[i].getFeedbackID(); Date eBayDateTime = feedback[i].getCommentTime().getTime(); - GenericValue contentCheck = delegator.findOne("Content", UtilMisc.toMap("contentId", contentId), false); + GenericValue contentCheck = EntityQuery.use(delegator).from("Content").where("contentId", contentId).queryOne(); if (contentCheck != null) { continue; } Modified: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java (original) +++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java Thu Oct 30 04:18:05 2014 @@ -55,6 +55,7 @@ import org.ofbiz.ebay.ProductsExportToEb 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; @@ -281,7 +282,7 @@ public class EbayStore { if (ebayParentCategoryId != null) { List<GenericValue> productCategoryRollupList = delegator.findByAnd("ProductCategoryRollup", UtilMisc.toMap("parentProductCategoryId", productCategory.getString("productCategoryId")), UtilMisc.toList("sequenceNum ASC"), false); for (GenericValue productCategoryRollup : productCategoryRollupList) { - productCategory = delegator.findOne("ProductCategory", UtilMisc.toMap("productCategoryId", productCategoryRollup.getString("productCategoryId")), false); + productCategory = EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", productCategoryRollup.getString("productCategoryId")).queryOne(); StoreCustomCategoryType childCategoryType = new StoreCustomCategoryType(); String ebayChildCategoryId = EbayStoreHelper.retriveEbayCategoryIdByPartyId(delegator, productCategory.getString("productCategoryId"), context.get("partyId").toString()); if (ebayChildCategoryId == null) { @@ -324,7 +325,7 @@ public class EbayStore { if (ebayParentCategoryId != null) { List<GenericValue> productChildCategoryRollupList = delegator.findByAnd("ProductCategoryRollup", UtilMisc.toMap("parentProductCategoryId",productParentCategoryRollup.getString("productCategoryId")),UtilMisc.toList("sequenceNum ASC"), false); for (GenericValue productChildCategoryRollup : productChildCategoryRollupList) { - productCategory = delegator.findOne("ProductCategory", UtilMisc.toMap("productCategoryId", productChildCategoryRollup.getString("productCategoryId")), false); + productCategory = EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", productChildCategoryRollup.getString("productCategoryId")).queryOne(); StoreCustomCategoryType childCategoryType = new StoreCustomCategoryType(); String ebayChildCategoryId = EbayStoreHelper.retriveEbayCategoryIdByPartyId(delegator,productCategory.getString("productCategoryId"),context.get("partyId").toString()); if (ebayChildCategoryId == null) { @@ -523,7 +524,7 @@ public class EbayStore { //UtilXml.addChildElementValue(StoreCategoriesElem, "Country", (String)context.get("country"), storeDocument); GenericValue category = null; if (UtilValidate.isNotEmpty(context.get("prodCatalogId"))) { - category = delegator.findOne("ProductCategory", UtilMisc.toMap("productCategoryId", productCategoryId), true); + category = EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", productCategoryId).cache().queryOne(); } String categoryName = category.getString("productCategoryId").toString(); if (category.getString("categoryName").toString() != null) { @@ -1545,7 +1546,7 @@ public class EbayStore { Map<String, Object> eBayConfigResult = EbayHelper.buildEbayConfig(context, delegator); Map<String, Object> response = null; try { - GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", context.get("productId").toString()), false); + GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", context.get("productId").toString()).queryOne(); int intAtp = 1; String facilityId = ""; if (UtilValidate.isNotEmpty(context.get("requireEbayInventory")) && "on".equals(context.get("requireEbayInventory").toString())) { @@ -2464,7 +2465,7 @@ public class EbayStore { public static boolean checkExistProduct(Delegator delegator, String productId) { boolean checkResult = false; try { - GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false); + GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); if(UtilValidate.isNotEmpty(product)) { checkResult = true; } Modified: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java (original) +++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java Thu Oct 30 04:18:05 2014 @@ -51,6 +51,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.service.DispatchContext; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; @@ -142,7 +143,7 @@ public class EbayStoreAutoPreferences { try { ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator); - ebayProductStorePref = delegator.findOne("EbayProductStorePref", UtilMisc.toMap("productStoreId", productStoreId, "autoPrefEnumId", "EBAY_AUTO_PIT_FB"), false); + ebayProductStorePref = EntityQuery.use(delegator).from("EbayProductStorePref").where("productStoreId", productStoreId, "autoPrefEnumId", "EBAY_AUTO_PIT_FB").queryOne(); if (UtilValidate.isNotEmpty(ebayProductStorePref) && UtilValidate.isNotEmpty(ebayProductStorePref.getString("autoPrefJobId"))) { isAutoPositiveFeedback = ebayProductStorePref.getString("enabled"); // if isAutoPositiveFeedback is N that means not start this job run service @@ -242,7 +243,7 @@ public class EbayStoreAutoPreferences { GenericValue ebayProductStorePref = null; String comments = null; String autoPrefJobId = null; - GenericValue userLogin = delegator.findOne("UserLogin", false, "userLoginId", "system"); + GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne(); if ("Y".equals(isAutoPositiveFeedback)) { if ("PAYMENT_RECEIVED".equals(feedbackEventCode)) { condition = AutomatedLeaveFeedbackEventCodeType.PAYMENT_RECEIVED.toString(); @@ -267,7 +268,7 @@ public class EbayStoreAutoPreferences { } Map<String, Object> context = UtilMisc.<String, Object>toMap("userLogin", userLogin, "serviceName", "autoPrefLeaveFeedbackOption"); - ebayProductStorePref = delegator.findOne("EbayProductStorePref", UtilMisc.toMap("productStoreId", productStoreId, "autoPrefEnumId", "EBAY_AUTO_PIT_FB"), false); + ebayProductStorePref = EntityQuery.use(delegator).from("EbayProductStorePref").where("productStoreId", productStoreId, "autoPrefEnumId", "EBAY_AUTO_PIT_FB").queryOne(); context.put("productStoreId", productStoreId); context.put("autoPrefEnumId", "EBAY_AUTO_PIT_FB"); if (UtilValidate.isNotEmpty(ebayProductStorePref) && UtilValidate.isNotEmpty(ebayProductStorePref.getString("autoPrefJobId"))) { @@ -301,7 +302,7 @@ public class EbayStoreAutoPreferences { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); - GenericValue userLogin = delegator.findOne("UserLogin", false, "userLoginId", "system"); + GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne(); if (UtilValidate.isEmpty(context.get("productStoreId")) && UtilValidate.isEmpty(context.get("jobId"))) { return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "EbayStoreRequiredProductStoreId", locale)); } @@ -315,7 +316,7 @@ public class EbayStoreAutoPreferences { try { ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator); - ebayProductStorePref = delegator.findOne("EbayProductStorePref", UtilMisc.toMap("productStoreId", productStoreId, "autoPrefEnumId", "EBAY_AUTO_FB_RMD"), false); + ebayProductStorePref = EntityQuery.use(delegator).from("EbayProductStorePref").where("productStoreId", productStoreId, "autoPrefEnumId", "EBAY_AUTO_FB_RMD").queryOne(); if (UtilValidate.isNotEmpty(ebayProductStorePref) && UtilValidate.isNotEmpty(ebayProductStorePref.getString("autoPrefJobId"))) { isAutoFeedbackReminder = ebayProductStorePref.getString("enabled"); // if isAutoPositiveFeedback is N that means not start this job run service @@ -353,7 +354,7 @@ public class EbayStoreAutoPreferences { for (SellingManagerSoldOrderType item : items) { // call send Map<String, Object> sendMap = FastMap.newInstance(); - GenericValue productStoreEmail = delegator.findOne("ProductStoreEmailSetting", UtilMisc.toMap("productStoreId", productStoreId, "emailType", "EBAY_FEEBACK_REMIN"), false); + GenericValue productStoreEmail = EntityQuery.use(delegator).from("ProductStoreEmailSetting").where("productStoreId", productStoreId, "emailType", "EBAY_FEEBACK_REMIN").queryOne(); String bodyScreenLocation = productStoreEmail.getString("bodyScreenLocation"); sendMap.put("bodyScreenUri", bodyScreenLocation); String subjectString = productStoreEmail.getString("subject"); @@ -392,7 +393,7 @@ public class EbayStoreAutoPreferences { Locale locale = (Locale) context.get("locale"); String jobId = (String) context.get("jobId"); try { - GenericValue userLogin = delegator.findOne("UserLogin", false, "userLoginId", "system"); + GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne(); Map<String, Object> serviceMap = FastMap.newInstance(); serviceMap.put("userLogin", userLogin); //ProductStore @@ -410,7 +411,7 @@ public class EbayStoreAutoPreferences { serviceMap.put("productStoreId", productStoreId); Map<String, Object> eBayUserLogin = dispatcher.runSync("getEbayStoreUser", serviceMap); String eBayUserLoginId = (String) eBayUserLogin.get("userLoginId"); - GenericValue party = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", eBayUserLoginId), false); + GenericValue party = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", eBayUserLoginId).queryOne(); String partyId = party.getString("partyId"); //save sold items to OFbBiz product entity Map<String, Object> resultService = dispatcher.runSync("getEbaySoldItems", serviceMap); @@ -419,7 +420,7 @@ public class EbayStoreAutoPreferences { for (int itemCount = 0; itemCount < soldItems.size(); itemCount++) { Map<String, Object> soldItemMap = soldItems.get(itemCount); if (UtilValidate.isNotEmpty(soldItemMap.get("itemId"))) { - GenericValue productCheck = delegator.findOne("Product", UtilMisc.toMap("productId", soldItemMap.get("itemId")), false); + GenericValue productCheck = EntityQuery.use(delegator).from("Product").where("productId", soldItemMap.get("itemId")).queryOne(); if (productCheck == null) { Map<String, Object> inMap = FastMap.newInstance(); inMap.put("productId", soldItemMap.get("itemId")); @@ -487,7 +488,7 @@ public class EbayStoreAutoPreferences { itemToBeRelisted.setItemID(product.getString("productId")); relistItemCall.setItemToBeRelisted(itemToBeRelisted); relistItemCall.relistItem(); - GenericValue productStore = delegator.findOne("Product", UtilMisc.toMap("productId", product.getString("productId")), false); + GenericValue productStore = EntityQuery.use(delegator).from("Product").where("productId", product.getString("productId")).queryOne(); productStore.set("isVirtual", "Y"); productStore.store(); Debug.logInfo("Relisted Item - " + product.getString("productId"), module); @@ -507,7 +508,7 @@ public class EbayStoreAutoPreferences { Locale locale = (Locale) context.get("locale"); String jobId = (String) context.get("jobId"); try { - GenericValue userLogin = delegator.findOne("UserLogin", false, "userLoginId", "system"); + GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne(); List<GenericValue> productStores = delegator.findByAnd("EbayProductStorePref", UtilMisc.toMap("autoPrefJobId", jobId), null, false); if (productStores.size() != 0) { // get automatic setting @@ -578,7 +579,7 @@ public class EbayStoreAutoPreferences { Locale locale = (Locale) context.get("locale"); String jobId = (String) context.get("jobId"); try { - GenericValue userLogin = delegator.findOne("UserLogin", false, "userLoginId", "system"); + GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne(); List<GenericValue> productStores = delegator.findByAnd("EbayProductStorePref", UtilMisc.toMap("autoPrefJobId", jobId), null, false); if (productStores.size() != 0) { // get automatic setting @@ -648,7 +649,7 @@ public class EbayStoreAutoPreferences { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); - GenericValue userLogin = delegator.findOne("UserLogin", false, "userLoginId", "system"); + GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne(); if (UtilValidate.isEmpty(context.get("productStoreId")) && UtilValidate.isEmpty(context.get("jobId"))) { return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "EbayStoreRequiredProductStoreId", locale)); @@ -662,7 +663,7 @@ public class EbayStoreAutoPreferences { try { ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator); - ebayProductStorePref = delegator.findOne("EbayProductStorePref", UtilMisc.toMap("productStoreId", productStoreId, "autoPrefEnumId", "EBAY_AUTO_FB_RMD"), false); + ebayProductStorePref = EntityQuery.use(delegator).from("EbayProductStorePref").where("productStoreId", productStoreId, "autoPrefEnumId", "EBAY_AUTO_FB_RMD").queryOne(); if (UtilValidate.isNotEmpty(ebayProductStorePref) && UtilValidate.isNotEmpty(ebayProductStorePref.getString("autoPrefJobId"))) { isAutoSendEmail = ebayProductStorePref.getString("enabled"); // if isAutoPositiveFeedback is N that means not start this job run service @@ -687,7 +688,7 @@ public class EbayStoreAutoPreferences { for (SellingManagerSoldOrderType item : items) { // call send Map<String, Object> sendMap = FastMap.newInstance(); - GenericValue productStoreEmail = delegator.findOne("ProductStoreEmailSetting", UtilMisc.toMap("productStoreId", productStoreId, "emailType", "EBAY_PAY_RECIEVED"), false); + GenericValue productStoreEmail = EntityQuery.use(delegator).from("ProductStoreEmailSetting").where("productStoreId", productStoreId, "emailType", "EBAY_PAY_RECIEVED").queryOne(); String bodyScreenLocation = productStoreEmail.getString("bodyScreenLocation"); sendMap.put("bodyScreenUri", bodyScreenLocation); String subjectString = productStoreEmail.getString("subject"); @@ -728,13 +729,13 @@ public class EbayStoreAutoPreferences { Locale locale = (Locale) context.get("locale"); String productStoreId = (String) context.get("productStoreId"); try { - GenericValue userLogin = delegator.findOne("UserLogin", false, "userLoginId", "system"); + GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne(); ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator); GetSellingManagerSoldListingsCall sellingManagerSoldListings = new GetSellingManagerSoldListingsCall(apiContext); SellingManagerSoldOrderType[] sellingManagerSoldOrders = sellingManagerSoldListings.getSellingManagerSoldListings(); if (sellingManagerSoldOrders != null) { int soldOrderLength = sellingManagerSoldOrders.length; - GenericValue ebayPref = delegator.findOne("EbayProductStorePref", UtilMisc.toMap("productStoreId", productStoreId, "autoPrefEnumId", "ENA_COMB_ORD"), false); + GenericValue ebayPref = EntityQuery.use(delegator).from("EbayProductStorePref").where("productStoreId", productStoreId, "autoPrefEnumId", "ENA_COMB_ORD").queryOne(); if (UtilValidate.isNotEmpty(ebayPref)) { Timestamp beginDate = UtilDateTime.toTimestamp("01/01/2001 00:00:00"); @@ -914,7 +915,7 @@ public class EbayStoreAutoPreferences { Locale locale = (Locale) context.get("locale"); String productStoreId = (String) context.get("productStoreId"); try { - GenericValue userLogin = delegator.findOne("UserLogin", false, "userLoginId", "system"); + GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne(); Map<String, Object> resultSold = dispatcher.runSync("getEbaySoldItems", UtilMisc.toMap("productStoreId", productStoreId, "userLogin", userLogin)); List<Map<String, Object>> soldItems = UtilGenerics.checkList(resultSold.get("soldItems")); if (soldItems.size() != 0) { @@ -941,7 +942,7 @@ public class EbayStoreAutoPreferences { String buyerUserId = bidder.get("userId").toString(); Map<String, Object> sendMap = FastMap.newInstance(); - GenericValue productStoreEmail = delegator.findOne("ProductStoreEmailSetting", UtilMisc.toMap("productStoreId", productStoreId, "emailType", "EBAY_WIN_BUYER_NOTI"), false); + GenericValue productStoreEmail = EntityQuery.use(delegator).from("ProductStoreEmailSetting").where("productStoreId", productStoreId, "emailType", "EBAY_WIN_BUYER_NOTI").queryOne(); String bodyScreenLocation = productStoreEmail.getString("bodyScreenLocation"); sendMap.put("bodyScreenUri", bodyScreenLocation); String subjectString = productStoreEmail.getString("subject"); @@ -984,7 +985,7 @@ public class EbayStoreAutoPreferences { String productStoreId = (String) context.get("productStoreId"); try { - GenericValue userLogin = delegator.findOne("UserLogin", false, "userLoginId", "system"); + GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne(); context.put("userLogin", userLogin); Map<String, Object> resultSold = dispatcher.runSync("getEbaySoldItems", context); List<Map<String, Object>> soldItems = UtilGenerics.checkList(resultSold.get("soldItems")); @@ -1001,7 +1002,7 @@ public class EbayStoreAutoPreferences { String buyerEmail = item.get("buyerEmail").toString(); Map<String, Object> sendMap = FastMap.newInstance(); - GenericValue productStoreEmail = delegator.findOne("ProductStoreEmailSetting", UtilMisc.toMap("productStoreId", productStoreId, "emailType", "EBAY_ITEM_DISPATCH"), false); + GenericValue productStoreEmail = EntityQuery.use(delegator).from("ProductStoreEmailSetting").where("productStoreId", productStoreId, "emailType", "EBAY_ITEM_DISPATCH").queryOne(); String bodyScreenLocation = productStoreEmail.getString("bodyScreenLocation"); sendMap.put("bodyScreenUri", bodyScreenLocation); String subjectString = productStoreEmail.getString("subject"); @@ -1103,7 +1104,7 @@ public class EbayStoreAutoPreferences { Delegator delegator = dctx.getDelegator(); Locale locale = (Locale) context.get("locale"); try { - GenericValue userLogin = delegator.findOne("UserLogin", false, "userLoginId", "system"); + GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne(); EntityCondition expression1 = EntityCondition.makeCondition("autoRelisting", EntityOperator.EQUALS, "Y"); EntityCondition expression2 = EntityCondition.makeCondition("endDateTime", EntityOperator.LESS_THAN, UtilDateTime.nowTimestamp()); EntityCondition expression3 = EntityCondition.makeCondition("itemId", EntityOperator.NOT_EQUAL, null); @@ -1147,7 +1148,7 @@ public class EbayStoreAutoPreferences { Locale locale = (Locale) context.get("locale"); try { String productStoreId = (String) context.get("productStoreId"); - GenericValue ebayProductStorePref = delegator.findOne("EbayProductStorePref", UtilMisc.toMap("productStoreId", productStoreId, "autoPrefEnumId", "EBAY_AUTO_BEST_OFFER"), false); + GenericValue ebayProductStorePref = EntityQuery.use(delegator).from("EbayProductStorePref").where("productStoreId", productStoreId, "autoPrefEnumId", "EBAY_AUTO_BEST_OFFER").queryOne(); String parentPrefCondId = ebayProductStorePref.getString("parentPrefCondId"); List<GenericValue> ebayProductStorePrefCond = delegator.findByAnd("EbayProductStorePrefCond", UtilMisc.toMap("parentPrefCondId", parentPrefCondId), null, false); //Parameters @@ -1294,7 +1295,7 @@ public class EbayStoreAutoPreferences { String buyerMessage = bestOfferType.getBuyerMessage(); if (ignoreOfferMessage.equals("Y") && UtilValidate.isNotEmpty(buyerMessage)) { - GenericValue userOfferCheck = delegator.findOne("EbayUserBestOffer", UtilMisc.toMap("itemId", itemID, "userId", buyerUserID), false); + GenericValue userOfferCheck = EntityQuery.use(delegator).from("EbayUserBestOffer").where("itemId", itemID, "userId", buyerUserID).queryOne(); if (UtilValidate.isEmpty(userOfferCheck)) { GenericValue ebayUserBestOffer = delegator.makeValue("EbayUserBestOffer"); ebayUserBestOffer.put("productStoreId", productStoreId); Modified: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreCustomerService.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreCustomerService.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreCustomerService.java (original) +++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreCustomerService.java Thu Oct 30 04:18:05 2014 @@ -28,6 +28,7 @@ import org.ofbiz.base.util.UtilPropertie import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.ServiceUtil; @@ -130,7 +131,7 @@ public class EbayStoreCustomerService { } else { return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "EbayStoreRequiredContactStatusSetting", locale)); } - GenericValue ebayUserBestOffer = delegator.findOne("EbayUserBestOffer", UtilMisc.toMap("userId", userId, "itemId", itemId), false); + GenericValue ebayUserBestOffer = EntityQuery.use(delegator).from("EbayUserBestOffer").where("userId", userId, "itemId", itemId).queryOne(); ebayUserBestOffer.set("contactStatus", contactStatus); ebayUserBestOffer.store(); @@ -159,7 +160,7 @@ public class EbayStoreCustomerService { String itemId = (String) context.get("itemId"); String userId = (String) context.get("userId"); try { - GenericValue ebayUserBestOffer = delegator.findOne("EbayUserBestOffer", UtilMisc.toMap("itemId", itemId, "userId", userId), false); + GenericValue ebayUserBestOffer = EntityQuery.use(delegator).from("EbayUserBestOffer").where("itemId", itemId, "userId", userId).queryOne(); ebayUserBestOffer.remove(); result.put("productStoreId", productStoreId); } catch (Exception e) { Modified: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreHelper.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreHelper.java (original) +++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreHelper.java Thu Oct 30 04:18:05 2014 @@ -45,6 +45,7 @@ import org.ofbiz.entity.GenericEntityExc import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.serialize.SerializeException; import org.ofbiz.entity.serialize.XmlSerializer; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.GenericServiceException; @@ -173,7 +174,7 @@ public class EbayStoreHelper { Debug.logError("Require field partyId.",module); return false; } - partyRole = delegator.findOne("PartyRole", UtilMisc.toMap("partyId", partyId, "roleTypeId", "EBAY_ACCOUNT"), false); + partyRole = EntityQuery.use(delegator).from("PartyRole").where("partyId", partyId, "roleTypeId", "EBAY_ACCOUNT").queryOne(); if (partyRole == null) { Debug.logError("Party Id ".concat(partyId).concat("not have roleTypeId EBAY_ACCOUNT"),module); return false; @@ -273,7 +274,7 @@ public class EbayStoreHelper { String autoPrefEnumId = (String) context.get("autoPrefEnumId"); String serviceName = (String) context.get("serviceName"); try { - GenericValue ebayProductPref = delegator.findOne("EbayProductStorePref", UtilMisc.toMap("productStoreId", productStoreId, "autoPrefEnumId", autoPrefEnumId), false); + GenericValue ebayProductPref = EntityQuery.use(delegator).from("EbayProductStorePref").where("productStoreId", productStoreId, "autoPrefEnumId", autoPrefEnumId).queryOne(); String jobId = ebayProductPref.getString("autoPrefJobId"); if (UtilValidate.isNotEmpty(jobId)) { List<GenericValue> jobs = delegator.findByAnd("JobSandbox", UtilMisc.toMap("parentJobId", jobId, "statusId", "SERVICE_PENDING"), null, false); @@ -304,7 +305,7 @@ public class EbayStoreHelper { info = RecurrenceInfo.makeInfo(delegator, startTime, 4, 1, -1); infoId = info.primaryKey(); // set the persisted fields - GenericValue enumeration = delegator.findOne("Enumeration", UtilMisc.toMap("enumId", autoPrefEnumId), false); + GenericValue enumeration = EntityQuery.use(delegator).from("Enumeration").where("enumId", autoPrefEnumId).queryOne(); jobName = enumeration.getString("description"); if (jobName == null) { jobName = Long.toString((new Date().getTime())); @@ -355,7 +356,7 @@ public class EbayStoreHelper { String productStoreId = (String) context.get("productStoreId"); String autoPrefEnumId = (String) context.get("autoPrefEnumId"); try { - GenericValue ebayProductPref = delegator.findOne("EbayProductStorePref", UtilMisc.toMap("productStoreId", productStoreId, "autoPrefEnumId", autoPrefEnumId), false); + GenericValue ebayProductPref = EntityQuery.use(delegator).from("EbayProductStorePref").where("productStoreId", productStoreId, "autoPrefEnumId", autoPrefEnumId).queryOne(); String jobId = ebayProductPref.getString("autoPrefJobId"); List<GenericValue> jobs = delegator.findByAnd("JobSandbox", UtilMisc.toMap("parentJobId", jobId ,"statusId", "SERVICE_PENDING"), null, false); @@ -438,7 +439,7 @@ public class EbayStoreHelper { AddItemRequestType req = new AddItemRequestType(); AddItemResponseType resp = null; try { - GenericValue userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), false); + GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne(); ItemType item = addItemCall.getItem(); req.setItem(item); resp = (AddItemResponseType) addItemCall.execute(req); @@ -618,7 +619,7 @@ public class EbayStoreHelper { GetOrdersRequestType req = new GetOrdersRequestType(); GetOrdersResponseType resp = null; try { - GenericValue orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + GenericValue orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); if (UtilValidate.isNotEmpty(orderHeader)) { String externalId = orderHeader.getString("externalId").toString(); List<GenericValue> orderShipment = orderHeader.getRelated("OrderShipment", null, null, false); Modified: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreInventoryServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreInventoryServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreInventoryServices.java (original) +++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreInventoryServices.java Thu Oct 30 04:18:05 2014 @@ -29,6 +29,7 @@ import org.ofbiz.base.util.UtilPropertie 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; @@ -91,7 +92,7 @@ public class EbayStoreInventoryServices invenReq = new GetSellingManagerInventoryRequestType(); invenResp = (GetSellingManagerInventoryResponseType) invenCall.execute(invenReq); if (invenResp != null && "SUCCESS".equals(invenResp.getAck().toString())) { - GenericValue ebayProductStoreInventory = delegator.findOne("EbayProductStoreInventory", UtilMisc.toMap("productId", productId, "facilityId", context.get("facilityId"), "productStoreId", context.get("productStoreId")), false); + GenericValue ebayProductStoreInventory = EntityQuery.use(delegator).from("EbayProductStoreInventory").where("productId", productId, "facilityId", context.get("facilityId"), "productStoreId", context.get("productStoreId")).queryOne(); SellingManagerProductType[] sellingManagerProductTypeList = invenResp.getSellingManagerProduct(); for (SellingManagerProductType sellingManagerProductType : sellingManagerProductTypeList) { @@ -150,9 +151,9 @@ public class EbayStoreInventoryServices productReq = new AddSellingManagerProductRequestType(); productReq.setFolderID(new Long(folderId)); SellingManagerProductDetailsType sellingManagerProductDetailsType = new SellingManagerProductDetailsType(); - GenericValue ebayProductStoreInventory = delegator.findOne("EbayProductStoreInventory", UtilMisc.toMap("productId", productId, "facilityId", context.get("facilityId"), "productStoreId", context.get("productStoreId")), false); + GenericValue ebayProductStoreInventory = EntityQuery.use(delegator).from("EbayProductStoreInventory").where("productId", productId, "facilityId", context.get("facilityId"), "productStoreId", context.get("productStoreId")).queryOne(); - sellingManagerProductDetailsType.setProductName((delegator.findOne("Product", UtilMisc.toMap("productId", productId), false)).getString("internalName")); + sellingManagerProductDetailsType.setProductName((EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne()).getString("internalName")); //Must keep productId in SKU NUMBER because ebay allow productId field only long value. sellingManagerProductDetailsType.setCustomLabel(productId); if (ebayProductStoreInventory!=null) sellingManagerProductDetailsType.setQuantityAvailable(ebayProductStoreInventory.getBigDecimal("availableToPromiseListing").intValue()); @@ -197,7 +198,7 @@ public class EbayStoreInventoryServices ReviseSellingManagerProductCall call = new ReviseSellingManagerProductCall(EbayStoreHelper.getApiContext((String)context.get("productStoreId"), locale, delegator)); req = new ReviseSellingManagerProductRequestType(); SellingManagerProductDetailsType sellingManagerProductDetailsType = new SellingManagerProductDetailsType(); - GenericValue ebayProductStoreInventory = delegator.findOne("EbayProductStoreInventory", UtilMisc.toMap("productId", productId, "facilityId", context.get("facilityId"), "productStoreId", context.get("productStoreId")), false); + GenericValue ebayProductStoreInventory = EntityQuery.use(delegator).from("EbayProductStoreInventory").where("productId", productId, "facilityId", context.get("facilityId"), "productStoreId", context.get("productStoreId")).queryOne(); Long ebayProductId = null; if (ebayProductStoreInventory != null && ebayProductStoreInventory.getLong("ebayProductId") == null) { Debug.logError("Can not update product "+productId+" has no ebay product Id in EbayProductStoreInventory. ", module); @@ -208,7 +209,7 @@ public class EbayStoreInventoryServices } sellingManagerProductDetailsType.setProductID(ebayProductId); - sellingManagerProductDetailsType.setProductName((delegator.findOne("Product", UtilMisc.toMap("productId", productId), false)).getString("internalName")); + sellingManagerProductDetailsType.setProductName((EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne()).getString("internalName")); //Must keep productId in SKU NUMBER because ebay allow productId field only long value. sellingManagerProductDetailsType.setCustomLabel(productId); if (ebayProductStoreInventory!=null) sellingManagerProductDetailsType.setQuantityAvailable(ebayProductStoreInventory.getBigDecimal("availableToPromiseListing").intValue()); @@ -337,7 +338,7 @@ public class EbayStoreInventoryServices } try { if (productStoreId != null && ebayProductId != null) { - ebayProductStoreInventory = delegator.findOne("EbayProductStoreInventory", UtilMisc.toMap("productId", productId, "facilityId", facilityId, "productStoreId", productStoreId), false); + ebayProductStoreInventory = EntityQuery.use(delegator).from("EbayProductStoreInventory").where("productId", productId, "facilityId", facilityId, "productStoreId", productStoreId).queryOne(); GetSellingManagerInventoryCall call = new GetSellingManagerInventoryCall(EbayStoreHelper.getApiContext(productStoreId, locale, delegator)); req = new GetSellingManagerInventoryRequestType(); resp = (GetSellingManagerInventoryResponseType) call.execute(req); Modified: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOrder.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOrder.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOrder.java (original) +++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOrder.java Thu Oct 30 04:18:05 2014 @@ -41,6 +41,7 @@ import org.ofbiz.base.util.UtilValidate; import org.ofbiz.ebay.EbayHelper; 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.order.order.OrderChangeHelper; import org.ofbiz.order.shoppingcart.CheckOutHelper; @@ -104,7 +105,7 @@ public class EbayStoreOrder { if (UtilValidate.isEmpty(productStoreId)) { return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.productStoreIdIsMandatory", locale)); } else { - GenericValue productStore = delegator.findOne("ProductStore", UtilMisc.toMap("productStoreId", productStoreId), false); + GenericValue productStore = EntityQuery.use(delegator).from("ProductStore").where("productStoreId", productStoreId).queryOne(); if (UtilValidate.isNotEmpty(productStore)) { defaultCurrencyUomId = productStore.getString("defaultCurrencyUomId"); payToPartyId = productStore.getString("payToPartyId"); @@ -150,7 +151,7 @@ public class EbayStoreOrder { if (UtilValidate.isEmpty(productId)) { return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.productIdNotAvailable", locale)); } else { - GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false); + GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); if (UtilValidate.isEmpty(product)) { return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.productIdDoesNotExist", locale)); } @@ -219,7 +220,7 @@ public class EbayStoreOrder { if (UtilValidate.isNotEmpty(partyAttribute)) { partyId = (String) partyAttribute.get("partyId"); Debug.logInfo("Found existing party associated to the eBay buyer: " + partyId, module); - GenericValue party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false); + GenericValue party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne(); contactMechId = EbayHelper.setShippingAddressContactMech(dispatcher, delegator, party, userLogin, context); String emailBuyer = context.get("emailBuyer").toString(); @@ -315,7 +316,7 @@ public class EbayStoreOrder { if (productStoreId == null) { return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.productStoreIdIsMandatory", locale)); } else { - GenericValue productStore = delegator.findOne("ProductStore", UtilMisc.toMap("productStoreId", productStoreId), false); + GenericValue productStore = EntityQuery.use(delegator).from("ProductStore").where("productStoreId", productStoreId).queryOne(); if (productStore != null) { defaultCurrencyUomId = productStore.getString("defaultCurrencyUomId"); payToPartyId = productStore.getString("payToPartyId"); @@ -452,7 +453,7 @@ public class EbayStoreOrder { // if we get a party, check its contact information. if (UtilValidate.isNotEmpty(partyId)) { Debug.logInfo("Found existing party associated to the eBay buyer: " + partyId, module); - GenericValue party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false); + GenericValue party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne(); contactMechId = EbayHelper.setShippingAddressContactMech(dispatcher, delegator, party, userLogin, shippingAddressCtx); String emailBuyer = (String) context.get("emailBuyer"); @@ -541,7 +542,7 @@ public class EbayStoreOrder { private static void addItem(ShoppingCart cart, Map<String, Object> orderItem, LocalDispatcher dispatcher, Delegator delegator, int groupIdx) throws GeneralException { String productId = orderItem.get("productId").toString(); - GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false); + GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); if (UtilValidate.isEmpty(product)) { Debug.logError("The product having ID (" + productId + ") is misssing in the system.", module); } Modified: ofbiz/trunk/specialpurpose/ecommerce/src/org/ofbiz/ecommerce/janrain/JanrainHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/src/org/ofbiz/ecommerce/janrain/JanrainHelper.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/src/org/ofbiz/ecommerce/janrain/JanrainHelper.java (original) +++ ofbiz/trunk/specialpurpose/ecommerce/src/org/ofbiz/ecommerce/janrain/JanrainHelper.java Thu Oct 30 04:18:05 2014 @@ -52,6 +52,7 @@ import org.ofbiz.base.util.UtilXml; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.webapp.control.LoginWorker; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -231,7 +232,7 @@ public class JanrainHelper { request.setAttribute("userInfoMap", result); try { - GenericValue userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", preferredUsername), true); + GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", preferredUsername).cache().queryOne(); if (UtilValidate.isNotEmpty(userLogin)) { LoginWorker.doBasicLogin(userLogin, request); LoginWorker.autoLoginSet(request, response); Modified: ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java (original) +++ ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java Thu Oct 30 04:18:05 2014 @@ -49,6 +49,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.EntityUtilProperties; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.GenericServiceException; @@ -328,7 +329,7 @@ public class ProductsExportToGoogle { if (UtilValidate.isNotEmpty(productStoreId)) { GenericValue googleBaseConfig = null; try { - googleBaseConfig = delegator.findOne("GoogleBaseConfig", false, UtilMisc.toMap("productStoreId", productStoreId)); + googleBaseConfig = EntityQuery.use(delegator).from("GoogleBaseConfig").where(UtilMisc.toMap("productStoreId", productStoreId)).queryOne(); } catch (GenericEntityException e) { Debug.logError("Unable to find value for GoogleBaseConfig", module); e.printStackTrace(); @@ -436,7 +437,7 @@ public class ProductsExportToGoogle { if (productAndInfos.size() > 0) { for (GenericValue productContentAndInfo : productAndInfos ) { String dataReSourceId = productContentAndInfo.getString("dataResourceId"); - GenericValue electronicText = delegator.findOne("ElectronicText", UtilMisc.toMap("dataResourceId", dataReSourceId), false); + GenericValue electronicText = EntityQuery.use(delegator).from("ElectronicText").where("dataResourceId", dataReSourceId).queryOne(); if ("PRODUCT_NAME".equals(productContentAndInfo.getString("productContentTypeId"))) productName = electronicText.getString("textData"); if ("LONG_DESCRIPTION".equals(productContentAndInfo.getString("productContentTypeId"))) @@ -495,7 +496,7 @@ public class ProductsExportToGoogle { String googleProductId = null; if (!"insert".equals(actionType)) { try { - googleProduct = delegator.findOne("GoodIdentification", UtilMisc.toMap("productId", prod.getString("productId"), "goodIdentificationTypeId", "GOOGLE_ID_" + localeString), false); + googleProduct = EntityQuery.use(delegator).from("GoodIdentification").where("productId", prod.getString("productId"), "goodIdentificationTypeId", "GOOGLE_ID_" + localeString).queryOne(); if (UtilValidate.isNotEmpty(googleProduct)) { googleProductId = googleProduct.getString("idValue"); } @@ -583,7 +584,7 @@ public class ProductsExportToGoogle { UtilXml.addChildElementNSValue(entryElem, "g:brand", prod.getString("brandName"), feedDocument, googleBaseNSUrl); } try { - googleProduct = delegator.findOne("GoodIdentification", UtilMisc.toMap("productId", prod.getString("productId"), "goodIdentificationTypeId", "SKU"), false); + googleProduct = EntityQuery.use(delegator).from("GoodIdentification").where("productId", prod.getString("productId"), "goodIdentificationTypeId", "SKU").queryOne(); if (UtilValidate.isNotEmpty(googleProduct)) { UtilXml.addChildElementNSValue(entryElem, "g:ean", googleProduct.getString("idValue"), feedDocument, googleBaseNSUrl); } @@ -725,7 +726,7 @@ public class ProductsExportToGoogle { if (UtilValidate.isNotEmpty(productStoreId)) { GenericValue googleBaseConfig = null; try { - googleBaseConfig = delegator.findOne("GoogleBaseConfig", false, UtilMisc.toMap("productStoreId", productStoreId)); + googleBaseConfig = EntityQuery.use(delegator).from("GoogleBaseConfig").where(UtilMisc.toMap("productStoreId", productStoreId)).queryOne(); } catch (GenericEntityException e) { Debug.logError("Unable to find value for GoogleBaseConfig", module); e.printStackTrace(); @@ -775,7 +776,7 @@ public class ProductsExportToGoogle { UtilXml.addChildElementNSValue(entryElem, "g:online_only", "y", feedDocument, googleBaseNSUrl); //Add shipping weight if (UtilValidate.isNotEmpty(product.getString("weight")) && UtilValidate.isNotEmpty(product.getString("weightUomId"))) { - GenericValue uom = delegator.findOne("Uom", UtilMisc.toMap("uomId", product.getString("weightUomId")), false); + GenericValue uom = EntityQuery.use(delegator).from("Uom").where("uomId", product.getString("weightUomId")).queryOne(); String shippingWeight = product.getString("weight") + " " + uom.getString("description"); UtilXml.addChildElementNSValue(entryElem, "g:shipping_weight", shippingWeight, feedDocument, googleBaseNSUrl); } Modified: ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java (original) +++ ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java Thu Oct 30 04:18:05 2014 @@ -37,6 +37,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.order.OrderChangeHelper; import org.ofbiz.order.shoppingcart.CheckOutHelper; @@ -82,7 +83,7 @@ public class GoogleCheckoutHelper { this.delegator = delegator; try { - system = delegator.findOne("UserLogin", true, "userLoginId", "system"); + system = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); system = delegator.makeValue("UserLogin"); Modified: ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java (original) +++ ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java Thu Oct 30 04:18:05 2014 @@ -36,6 +36,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.ShoppingCart; import org.ofbiz.order.shoppingcart.ShoppingCartItem; @@ -434,7 +435,7 @@ public class GoogleRequestServices { if (order != null) { GenericValue orderItem = null; try { - orderItem = delegator.findOne("OrderItem", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId), false); + orderItem = EntityQuery.use(delegator).from("OrderItem").where("orderId", orderId, "orderItemSeqId", orderItemSeqId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); } @@ -576,7 +577,7 @@ public class GoogleRequestServices { public static GenericValue findGoogleOrder(Delegator delegator, String orderId) { GenericValue order = null; try { - order = delegator.findOne("OrderHeader", false, "orderId", orderId); + order = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); } @@ -594,7 +595,7 @@ public class GoogleRequestServices { public static String getProductStoreFromShipment(Delegator delegator, String shipmentId) { GenericValue shipment = null; try { - shipment = delegator.findOne("Shipment", false, "shipmentId", shipmentId); + shipment = EntityQuery.use(delegator).from("Shipment").where("shipmentId", shipmentId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); } @@ -616,7 +617,7 @@ public class GoogleRequestServices { if (productStoreId == null) return null; GenericValue config = null; try { - config = delegator.findOne("GoogleCoConfiguration", true, "productStoreId", productStoreId); + config = EntityQuery.use(delegator).from("GoogleCoConfiguration").where("productStoreId", productStoreId).cache().queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); } Modified: ofbiz/trunk/specialpurpose/ldap/src/org/ofbiz/ldap/commons/AbstractOFBizAuthenticationHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ldap/src/org/ofbiz/ldap/commons/AbstractOFBizAuthenticationHandler.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ldap/src/org/ofbiz/ldap/commons/AbstractOFBizAuthenticationHandler.java (original) +++ ofbiz/trunk/specialpurpose/ldap/src/org/ofbiz/ldap/commons/AbstractOFBizAuthenticationHandler.java Thu Oct 30 04:18:05 2014 @@ -39,6 +39,7 @@ import org.ofbiz.common.login.LoginServi import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.ldap.LdapLoginWorker; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; @@ -103,7 +104,7 @@ public abstract class AbstractOFBizAuthe userLoginToCreate.set("partyId", getPartyId(rootElement, result)); userLoginToCreate.set("currentPassword", useEncryption ? HashCrypt.cryptUTF8(LoginServices.getHashType(), null, password) : password); - GenericValue userTryToLogin = delegator.findOne("UserLogin", false, "userLoginId", username); + GenericValue userTryToLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", username).queryOne(); if (userTryToLogin == null) { // create the userLogin try { Modified: ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/search/ProductDocument.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/search/ProductDocument.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/search/ProductDocument.java (original) +++ ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/search/ProductDocument.java Thu Oct 30 04:18:05 2014 @@ -30,6 +30,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.apache.lucene.document.Document; @@ -68,7 +69,7 @@ public class ProductDocument implements public Document prepareDocument(Delegator delegator) { String productId = getDocumentIdentifier().text(); try { - GenericValue product = delegator.findOne("Product", false, "productId", productId); + GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); if (product == null) { // Return a null document (we will remove the document from the index) return null; Modified: ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/test/LuceneTests.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/test/LuceneTests.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/test/LuceneTests.java (original) +++ ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/test/LuceneTests.java Thu Oct 30 04:18:05 2014 @@ -39,6 +39,7 @@ import org.apache.lucene.store.FSDirecto import org.ofbiz.base.util.UtilMisc; import org.ofbiz.content.search.SearchWorker; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.service.ServiceUtil; import org.ofbiz.service.testtools.OFBizTestCase; @@ -52,7 +53,7 @@ public class LuceneTests extends OFBizTe @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/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java (original) +++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java Thu Oct 30 04:18:05 2014 @@ -42,6 +42,7 @@ import org.ofbiz.entity.condition.Entity import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.transaction.GenericTransactionException; import org.ofbiz.entity.transaction.TransactionUtil; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.product.product.ProductWorker; import org.ofbiz.service.DispatchContext; @@ -70,7 +71,7 @@ public class OagisInventoryServices { GenericValue userLogin = null; try { - userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), false); + userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne(); } catch (GenericEntityException e) { String errMsg = "Error Getting UserLogin: " + e.toString(); Debug.logError(e, errMsg, module); @@ -152,7 +153,7 @@ public class OagisInventoryServices { String itemStatus = UtilXml.childElementValue(inventoryElement, "of:ITEMSTATUS"); // make sure productId is valid - 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) { String errMsg = "Product with ID [" + productId + "] not found (invalid Product ID)."; errorMapList.add(UtilMisc.<String, String>toMap("reasonCode", "ProductIdNotValid", "description", errMsg)); @@ -237,7 +238,7 @@ public class OagisInventoryServices { GenericValue facilityContactMech = (GenericValue) fcmIter.next(); String contactMechId = facilityContactMech.getString("contactMechId"); try { - contactMech = delegator.findOne("ContactMech", UtilMisc.toMap("contactMechId", contactMechId), false); + contactMech = EntityQuery.use(delegator).from("ContactMech").where("contactMechId", contactMechId).queryOne(); } catch (GenericEntityException e) { String errMsg = "Error Getting ContactMech: " + e.toString(); errorMapList.add(UtilMisc.<String, String>toMap("reasonCode", "GenericEntityException", "description", errMsg)); @@ -253,7 +254,7 @@ public class OagisInventoryServices { if (UtilValidate.isNotEmpty(sendToEmail)) { String productStoreId = UtilProperties.getPropertyValue("oagis.properties", "Oagis.Warehouse.SyncInventoryProductStoreId"); - GenericValue productStoreEmail = delegator.findOne("ProductStoreEmailSetting", UtilMisc.toMap("productStoreId", productStoreId, "emailType", "PRDS_OAGIS_CONFIRM"), false); + GenericValue productStoreEmail = EntityQuery.use(delegator).from("ProductStoreEmailSetting").where("productStoreId", productStoreId, "emailType", "PRDS_OAGIS_CONFIRM").queryOne(); if (productStoreEmail != null) { String bodyScreenLocation = productStoreEmail.getString("bodyScreenLocation"); sendMap.put("bodyScreenUri", bodyScreenLocation); @@ -362,7 +363,7 @@ public class OagisInventoryServices { GenericValue userLogin = null; try { - userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), false); + userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne(); } catch (GenericEntityException e) { String errMsg = "Error Getting UserLogin: " + e.toString(); Debug.logError(e, errMsg, module); @@ -467,7 +468,7 @@ public class OagisInventoryServices { String productId = UtilXml.childElementValue(receiptLnElement, "of:ITEM"); // make sure productId is valid - 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) { String errMsg = "Product with ID [" + productId + "] not found (invalid Product ID)."; errorMapList.add(UtilMisc.<String, String>toMap("reasonCode", "ProductIdNotValid", "description", errMsg)); @@ -489,7 +490,7 @@ public class OagisInventoryServices { GenericValue orderHeader = null; if (orderId != null) { List<GenericValue> toStore = FastList.newInstance(); - orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); if (orderHeader != null) { // Case : update the record ripCtx.put("orderId", orderId); @@ -651,7 +652,7 @@ public class OagisInventoryServices { GenericValue userLogin = null; try { - userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), false); + userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Error Getting UserLogin: " + e.toString(), module); } @@ -772,7 +773,7 @@ public class OagisInventoryServices { Debug.logError(errMsg, module); } // make sure productId is valid - 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) { String errMsg = "Product with ID [" + productId + "] not found (invalid Product ID)."; errorMapList.add(UtilMisc.<String, String>toMap("reasonCode", "ProductIdNotValid", "description", errMsg)); @@ -793,7 +794,7 @@ public class OagisInventoryServices { String returnItemSeqId = UtilXml.childElementValue(documentRefElement, "of:LINENUM"); if (UtilValidate.isNotEmpty(returnItemSeqId)) { // if there is a LINENUM/returnItemSeqId make sure it is valid - GenericValue returnItem = delegator.findOne("ReturnItem", UtilMisc.toMap("returnId", returnId, "returnItemSeqId", returnItemSeqId), true); + GenericValue returnItem = EntityQuery.use(delegator).from("ReturnItem").where("returnId", returnId, "returnItemSeqId", returnItemSeqId).cache().queryOne(); if (returnItem == null) { String errMsg = "Return Item with ID [" + returnId + ":" + returnItemSeqId + "] not found (invalid Return/Item ID Combination)."; errorMapList.add(UtilMisc.<String, String>toMap("reasonCode", "ReturnAndItemIdNotValid", "description", errMsg)); @@ -828,7 +829,7 @@ public class OagisInventoryServices { Timestamp timestampItemReceived = OagisServices.parseIsoDateString(datetimeReceived, errorMapList); ripCtx.put("datetimeReceived", timestampItemReceived); - GenericValue returnHeader = delegator.findOne("ReturnHeader", UtilMisc.toMap("returnId", returnId), false); + GenericValue returnHeader = EntityQuery.use(delegator).from("ReturnHeader").where("returnId", returnId).queryOne(); if (returnHeader != null) { //getting ReturnHeader status @@ -1166,7 +1167,7 @@ public class OagisInventoryServices { GenericValue userLogin = null; try { - userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), false); + userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne(); } catch (GenericEntityException e) { String errMsg = "Error Getting UserLogin: " + e.toString(); Debug.logError(e, errMsg, module); @@ -1278,7 +1279,7 @@ public class OagisInventoryServices { Debug.logError(errMsg, module); } // make sure productId is valid - 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) { String errMsg = "Product with ID [" + productId + "] not found (invalid Product ID)."; errorMapList.add(UtilMisc.<String, String>toMap("reasonCode", "ProductIdNotValid", "description", errMsg));