Modified: ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java (original) +++ ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java Thu Oct 30 06:10:58 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/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreCustomerService.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreCustomerService.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreCustomerService.java (original) +++ ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreCustomerService.java Thu Oct 30 06:10:58 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/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreHelper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreHelper.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreHelper.java (original) +++ ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreHelper.java Thu Oct 30 06:10:58 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/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreInventoryServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreInventoryServices.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreInventoryServices.java (original) +++ ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreInventoryServices.java Thu Oct 30 06:10:58 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/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOrder.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOrder.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOrder.java (original) +++ ofbiz/branches/json-integration-refactoring/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOrder.java Thu Oct 30 06:10:58 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/branches/json-integration-refactoring/specialpurpose/ecommerce/data/DemoWebSitePublishPointData.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/ecommerce/data/DemoWebSitePublishPointData.xml?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/specialpurpose/ecommerce/data/DemoWebSitePublishPointData.xml (original) +++ ofbiz/branches/json-integration-refactoring/specialpurpose/ecommerce/data/DemoWebSitePublishPointData.xml Thu Oct 30 06:10:58 2014 @@ -25,39 +25,39 @@ under the License. <WebSiteContent webSiteId="WebStore" contentId="WebStoreCONTENT" webSiteContentTypeId="PUBLISH_POINT" fromDate="2001-01-01 00:00:00"/> <Content contentId="CNTGIZMOS" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="WebStoreCONTENT" contentName="Gizmos" description="Gizmos" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> - <ContentAssoc contentId="WebStoreCONTENT" contentIdTo="CNTGIZMOS" contentAssocTypeId="SUB_CONTENT" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> + <ContentAssoc contentId="WebStoreCONTENT" contentIdTo="CNTGIZMOS" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> <ContentAttribute contentId="CNTGIZMOS" attrName="publishOperation" attrValue="HAS_USER_ROLE"/> <Content contentId="CNTGIZMOSLRG" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="CNTGIZMOS" contentName="Large Gizmos" description="Large Widgets" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> - <ContentAssoc contentId="CNTGIZMOS" contentIdTo="CNTGIZMOSLRG" contentAssocTypeId="SUB_CONTENT" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> + <ContentAssoc contentId="CNTGIZMOS" contentIdTo="CNTGIZMOSLRG" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> <Content contentId="CNTGIZMOSSML" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="CNTGIZMOS" contentName="Small Gizmos" description="Large Widgets" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> - <ContentAssoc contentId="CNTGIZMOS" contentIdTo="CNTGIZMOSSML" contentAssocTypeId="SUB_CONTENT" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> + <ContentAssoc contentId="CNTGIZMOS" contentIdTo="CNTGIZMOSSML" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> <Content contentId="GIZMOSLRG" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="CNTGIZMOS" contentName="Advocacy" description="Advocacy" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> - <ContentAssoc contentId="CNTGIZMOS" contentIdTo="GIZMOSLRG" contentAssocTypeId="SUB_CONTENT" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> + <ContentAssoc contentId="CNTGIZMOS" contentIdTo="GIZMOSLRG" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> <Content contentId="GIZMOSSML" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="WebStoreCONTENT" contentName="Case Studies" description="Case Studies" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> - <ContentAssoc contentId="CNTGIZMOS" contentIdTo="GIZMOSSML" contentAssocTypeId="SUB_CONTENT" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> + <ContentAssoc contentId="CNTGIZMOS" contentIdTo="GIZMOSSML" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> <Content contentId="CNTWIDGETS" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="WebStoreCONTENT" contentName="Widgets" description="Widgets" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> <ContentAttribute contentId="CNTWIDGETS" attrName="publishOperation" attrValue="HAS_USER_ROLE"/> - <ContentAssoc contentId="WebStoreCONTENT" contentIdTo="CNTWIDGETS" contentAssocTypeId="SUB_CONTENT" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> + <ContentAssoc contentId="WebStoreCONTENT" contentIdTo="CNTWIDGETS" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> <Content contentId="WIDGETSSML" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="WebStoreCONTENT" contentName="Sightings" description="Sightings of Widgets" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> - <ContentAssoc contentId="CNTWIDGETS" contentIdTo="WIDGETSSML" contentAssocTypeId="SUB_CONTENT" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> + <ContentAssoc contentId="CNTWIDGETS" contentIdTo="WIDGETSSML" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> <Content contentId="WIDGETSLRG" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="WebStoreCONTENT" contentName="Care & Groom" description="Care and Grooming" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> - <ContentAssoc contentId="CNTWIDGETS" contentIdTo="WIDGETSLRG" contentAssocTypeId="SUB_CONTENT" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> + <ContentAssoc contentId="CNTWIDGETS" contentIdTo="WIDGETSLRG" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> <Content contentId="CNTWIDGETSLRG" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="CNTWIDGETS" contentName="Large Widgets" description="Large Widgets" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> - <ContentAssoc contentId="CNTWIDGETS" contentIdTo="CNTWIDGETSLRG" contentAssocTypeId="SUB_CONTENT" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> + <ContentAssoc contentId="CNTWIDGETS" contentIdTo="CNTWIDGETSLRG" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> <Content contentId="CNTWIDGETSSML" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="CNTWIDGETS" contentName="Small Widgets" description="Large Widgets" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> - <ContentAssoc contentId="CNTWIDGETS" contentIdTo="CNTWIDGETSSML" contentAssocTypeId="SUB_CONTENT" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> + <ContentAssoc contentId="CNTWIDGETS" contentIdTo="CNTWIDGETSSML" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> <Content contentId="POLICY" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="WebStoreCONTENT" contentName="Policies" description="Policies" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> - <ContentAssoc contentId="WebStoreCONTENT" contentIdTo="POLICY" contentAssocTypeId="SUB_CONTENT" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> + <ContentAssoc contentId="WebStoreCONTENT" contentIdTo="POLICY" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> <ContentAttribute contentId="POLICY" attrName="publishOperation" attrValue="HAS_USER_ROLE"/> <Content contentId="WebStoreFACTOID" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="" contentName="Factoids" description="Factoids" createdDate="2004-07-05 12:00:00.000" createdByUserLogin="admin"/> @@ -79,7 +79,7 @@ under the License. </ElectronicText> <Content contentId="STORE_POLICIES" contentTypeId="DOCUMENT" ownerContentId="WebStoreCONTENT" dataResourceId="STORE_POLICIES" contentName="Store Policies 1" description="Store Policies 1 Description" mimeTypeId="text/html" localeString="en_US" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> - <ContentAssoc contentId="WebStoreCONTENT" contentIdTo="STORE_POLICIES" mapKey="policies" contentAssocTypeId="SUB_CONTENT" + <ContentAssoc contentId="WebStoreCONTENT" contentIdTo="STORE_POLICIES" mapKey="policies" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> <DataResource dataResourceId="STORE_POLICIES2" dataResourceTypeId="ELECTRONIC_TEXT" mimeTypeId="text/html" localeString="en_US" isPublic="Y" dataResourceName="Store Policies"/> <ElectronicText dataResourceId="STORE_POLICIES2"> @@ -96,6 +96,6 @@ under the License. </ElectronicText> <Content contentId="STORE_POLICIES2" contentTypeId="DOCUMENT" ownerContentId="WebStoreCONTENT" dataResourceId="STORE_POLICIES2" contentName="Store Policies 2" description="Store Policies 2 Description" mimeTypeId="text/html" localeString="en_US" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> - <ContentAssoc contentId="WebStoreCONTENT" contentIdTo="STORE_POLICIES2" mapKey="policies2" contentAssocTypeId="SUB_CONTENT" + <ContentAssoc contentId="WebStoreCONTENT" contentIdTo="STORE_POLICIES2" mapKey="policies2" contentAssocTypeId="PUBLISH_LINK" fromDate="2001-05-13 12:00:00.000" createdDate="2001-05-13 12:00:00.000" createdByUserLogin="admin"/> </entity-engine-xml> Modified: ofbiz/branches/json-integration-refactoring/specialpurpose/ecommerce/script/org/ofbiz/ecommerce/data/topic.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/ecommerce/script/org/ofbiz/ecommerce/data/topic.ftl?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/specialpurpose/ecommerce/script/org/ofbiz/ecommerce/data/topic.ftl (original) +++ ofbiz/branches/json-integration-refactoring/specialpurpose/ecommerce/script/org/ofbiz/ecommerce/data/topic.ftl Thu Oct 30 06:10:58 2014 @@ -34,7 +34,7 @@ under the License. <#assign firstPart=internalNameParts[0] /> <#assign nowStamp=Static["org.ofbiz.base.util.UtilDateTime"].nowTimestamp()/> <#if firstPart == "WIDGETS"> - <ContentAssoc contentId="CNTWIDGETS" contentIdTo="${contentId}" contentAssocTypeId="SUB_CONTENT" fromDate="${nowStamp?string("yyyy-MM-dd HH:mm:ss")}"/> + <ContentAssoc contentId="CNTWIDGETS" contentIdTo="${contentId}" contentAssocTypeId="PUBLISH_LINK" fromDate="${nowStamp?string("yyyy-MM-dd HH:mm:ss")}"/> </#if> </#macro> Modified: ofbiz/branches/json-integration-refactoring/specialpurpose/ecommerce/src/org/ofbiz/ecommerce/janrain/JanrainHelper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/ecommerce/src/org/ofbiz/ecommerce/janrain/JanrainHelper.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/specialpurpose/ecommerce/src/org/ofbiz/ecommerce/janrain/JanrainHelper.java (original) +++ ofbiz/branches/json-integration-refactoring/specialpurpose/ecommerce/src/org/ofbiz/ecommerce/janrain/JanrainHelper.java Thu Oct 30 06:10:58 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/branches/json-integration-refactoring/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java (original) +++ ofbiz/branches/json-integration-refactoring/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java Thu Oct 30 06:10:58 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/branches/json-integration-refactoring/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java (original) +++ ofbiz/branches/json-integration-refactoring/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java Thu Oct 30 06:10:58 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/branches/json-integration-refactoring/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java (original) +++ ofbiz/branches/json-integration-refactoring/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java Thu Oct 30 06:10:58 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/branches/json-integration-refactoring/specialpurpose/ldap/src/org/ofbiz/ldap/commons/AbstractOFBizAuthenticationHandler.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/ldap/src/org/ofbiz/ldap/commons/AbstractOFBizAuthenticationHandler.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/specialpurpose/ldap/src/org/ofbiz/ldap/commons/AbstractOFBizAuthenticationHandler.java (original) +++ ofbiz/branches/json-integration-refactoring/specialpurpose/ldap/src/org/ofbiz/ldap/commons/AbstractOFBizAuthenticationHandler.java Thu Oct 30 06:10:58 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/branches/json-integration-refactoring/specialpurpose/lucene/src/org/ofbiz/content/search/ProductDocument.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/lucene/src/org/ofbiz/content/search/ProductDocument.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/specialpurpose/lucene/src/org/ofbiz/content/search/ProductDocument.java (original) +++ ofbiz/branches/json-integration-refactoring/specialpurpose/lucene/src/org/ofbiz/content/search/ProductDocument.java Thu Oct 30 06:10:58 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/branches/json-integration-refactoring/specialpurpose/lucene/src/org/ofbiz/content/test/LuceneTests.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/lucene/src/org/ofbiz/content/test/LuceneTests.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/specialpurpose/lucene/src/org/ofbiz/content/test/LuceneTests.java (original) +++ ofbiz/branches/json-integration-refactoring/specialpurpose/lucene/src/org/ofbiz/content/test/LuceneTests.java Thu Oct 30 06:10:58 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/branches/json-integration-refactoring/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java (original) +++ ofbiz/branches/json-integration-refactoring/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java Thu Oct 30 06:10:58 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)); Modified: ofbiz/branches/json-integration-refactoring/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java (original) +++ ofbiz/branches/json-integration-refactoring/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java Thu Oct 30 06:10:58 2014 @@ -57,6 +57,7 @@ import org.ofbiz.base.util.collections.M 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; @@ -128,7 +129,7 @@ public class OagisServices { 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", module); } @@ -486,7 +487,7 @@ public class OagisServices { Locale locale = (Locale) context.get("locale"); 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 with userLoginId system: "+e.toString(); Debug.logError(e, errMsg, module); Modified: ofbiz/branches/json-integration-refactoring/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java (original) +++ ofbiz/branches/json-integration-refactoring/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java Thu Oct 30 06:10:58 2014 @@ -51,6 +51,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.order.order.OrderReadHelper; import org.ofbiz.party.party.PartyWorker; @@ -97,7 +98,7 @@ public class OagisShipmentServices { 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 with userLoginId system: "+e.toString(); Debug.logError(e, errMsg, module); @@ -194,7 +195,7 @@ public class OagisShipmentServices { GenericValue shipment = null; try { - shipment = delegator.findOne("Shipment", UtilMisc.toMap("shipmentId", shipmentId), false); + shipment = EntityQuery.use(delegator).from("Shipment").where("shipmentId", shipmentId).queryOne(); } catch (GenericEntityException e) { String errMsg = "Error getting Shipment from database for ID [" + shipmentId + "]: " + e.toString(); Debug.logInfo(e, errMsg, module); @@ -252,7 +253,7 @@ public class OagisShipmentServices { String productId = UtilXml.childElementValue(invItemElement, "of:ITEM"); // of // 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)); @@ -297,7 +298,7 @@ public class OagisShipmentServices { // try getting it by the unit number, which is bogus but can be what some try IFF there is only one INVITEM in the SHPUNIT if (invitemMapList.size() == 1 && localInvItemElementList.size() == 1 && UtilValidate.isNotEmpty(possibleShipmentItemSeqId)) { - GenericValue shipmentItem = delegator.findOne("ShipmentItem", UtilMisc.toMap("shipmentId", shipmentId, "shipmentItemSeqId", possibleShipmentItemSeqId), false); + GenericValue shipmentItem = EntityQuery.use(delegator).from("ShipmentItem").where("shipmentId", shipmentId, "shipmentItemSeqId", possibleShipmentItemSeqId).queryOne(); if (shipmentItem != null && !productId.equals(shipmentItem.getString("productId"))) { // found an item, but it was for the wrong Product! shipmentItem = null; @@ -685,7 +686,7 @@ public class OagisShipmentServices { // the userLogin passed in will usually be the customer, so don't use it; use the system user instead 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", module); } @@ -714,7 +715,7 @@ public class OagisShipmentServices { return ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "OagisFoundExistingMessageSent", UtilMisc.toMap("orderId", orderId), locale) + EntityUtil.filterByAnd(previousOagisMessageInfoList, UtilMisc.toMap("processingStatusId", "OAGMP_SENT"))); } - 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, "OagisOrderIdNotFound", UtilMisc.toMap("orderId", orderId), locale)); } @@ -804,7 +805,7 @@ public class OagisShipmentServices { } else { Map<String, Object> cospResult= dispatcher.runSync("createOrderShipmentPlan", UtilMisc.<String, Object>toMap("orderId", orderId, "userLogin", userLogin)); shipmentId = (String) cospResult.get("shipmentId"); - shipment = delegator.findOne("Shipment", UtilMisc.toMap("shipmentId", shipmentId), false); + shipment = EntityQuery.use(delegator).from("Shipment").where("shipmentId", shipmentId).queryOne(); } bodyParameters.put("shipment", shipment); @@ -817,7 +818,7 @@ public class OagisShipmentServices { bodyParameters.put("emailString", emailString); String contactMechId = shipment.getString("destinationTelecomNumberId"); - GenericValue telecomNumber = delegator.findOne("TelecomNumber", UtilMisc.toMap("contactMechId", contactMechId), false); + GenericValue telecomNumber = EntityQuery.use(delegator).from("TelecomNumber").where("contactMechId", contactMechId).queryOne(); if (telecomNumber == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisOrderIdNotTelecomNumberFound", UtilMisc.toMap("orderId", orderId), locale)); } @@ -871,7 +872,7 @@ public class OagisShipmentServices { } // tracking shipper account, other Party info String partyId = shipment.getString("partyIdTo"); - bodyParameters.put("partyNameView", delegator.findOne("PartyNameView", UtilMisc.toMap("partyId", partyId), false)); + bodyParameters.put("partyNameView", EntityQuery.use(delegator).from("PartyNameView").where("partyId", partyId).queryOne()); List<GenericValue> partyCarrierAccounts = delegator.findByAnd("PartyCarrierAccount", UtilMisc.toMap("partyId", partyId), null, false); partyCarrierAccounts = EntityUtil.filterByDate(partyCarrierAccounts); if (partyCarrierAccounts != null) { @@ -1001,7 +1002,7 @@ public class OagisShipmentServices { 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 system userLogin", module); } @@ -1031,7 +1032,7 @@ public class OagisShipmentServices { return ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "OagisFoundExistingMessageForReturnSent", UtilMisc.toMap("returnId", returnId), locale) + EntityUtil.filterByAnd(previousOagisMessageInfoList, UtilMisc.toMap("processingStatusId", "OAGMP_SENT"))); } - GenericValue returnHeader = delegator.findOne("ReturnHeader", UtilMisc.toMap("returnId", returnId), false); + GenericValue returnHeader = EntityQuery.use(delegator).from("ReturnHeader").where("returnId", returnId).queryOne(); if (returnHeader == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisReturnIdNotFound", UtilMisc.toMap("returnId", returnId), locale)); } @@ -1079,15 +1080,15 @@ public class OagisShipmentServices { Debug.logError(e, errMsg, module); } - GenericValue orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + GenericValue orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); if (orderHeader == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisReturnIdNotValid", UtilMisc.toMap("orderId", orderId), locale)); } String partyId = returnHeader.getString("fromPartyId"); - GenericValue postalAddress = delegator.findOne("PostalAddress", UtilMisc.toMap("contactMechId", returnHeader.getString("originContactMechId")), false); + GenericValue postalAddress = EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", returnHeader.getString("originContactMechId")).queryOne(); bodyParameters.put("postalAddress", postalAddress); - bodyParameters.put("partyNameView", delegator.findOne("PartyNameView", UtilMisc.toMap("partyId", partyId), false)); + bodyParameters.put("partyNameView", EntityQuery.use(delegator).from("PartyNameView").where("partyId", partyId).queryOne()); // calculate total qty of return items in a shipping unit received, order associated with return double totalQty = 0.0;