Modified: ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java (original) +++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java Thu Oct 30 04:18:05 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/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java (original) +++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java Thu Oct 30 04:18:05 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; Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java Thu Oct 30 04:18:05 2014 @@ -56,6 +56,7 @@ import org.ofbiz.entity.transaction.Gene import org.ofbiz.entity.transaction.TransactionUtil; import org.ofbiz.entity.util.EntityFindOptions; import org.ofbiz.entity.util.EntityListIterator; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.guiapp.xui.XuiSession; import org.ofbiz.order.shoppingcart.CartItemModifyException; @@ -433,7 +434,7 @@ public class PosTransaction implements S try { Delegator delegator = cart.getDelegator(); GenericValue product = null; - product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true); + product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne(); if (UtilValidate.isNotEmpty(product) && ("AGGREGATED".equals(product.getString("productTypeId")) || "AGGREGATED_SERVICE".equals(product.getString("productTypeId")))) { return true; } @@ -492,7 +493,7 @@ public class PosTransaction implements S Delegator delegator = cart.getDelegator(); GenericValue product = null; ProductConfigWrapper pcw = null; - product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true); + product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne(); if (UtilValidate.isNotEmpty(product) && ("AGGREGATED".equals(product.getString("productTypeId"))||"AGGREGATED_SERVICE".equals(product.getString("productTypeId")))) { // if it's an aggregated item, load the configwrapper and set to defaults pcw = new ProductConfigWrapper(delegator, session.getDispatcher(), productId, null, null, null, null, null, null); @@ -966,7 +967,7 @@ public class PosTransaction implements S if (this.isAggregatedItem(item.getProductId())) { // put alterations here ProductConfigWrapper pcw = null; - // product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true); + // product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne(); // pcw = new ProductConfigWrapper(delegator, session.getDispatcher(), productId, null, null, null, null, null, null); pcw = item.getConfigWrapper(); List<ConfigOption> selected = pcw.getSelectedOptions(); Modified: ofbiz/trunk/specialpurpose/scrum/src/org/ofbiz/scrum/ScrumServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/src/org/ofbiz/scrum/ScrumServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/src/org/ofbiz/scrum/ScrumServices.java (original) +++ ofbiz/trunk/specialpurpose/scrum/src/org/ofbiz/scrum/ScrumServices.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.service.DispatchContext; import org.ofbiz.service.GenericServiceException; @@ -57,7 +58,7 @@ public class ScrumServices { if (UtilValidate.isNotEmpty(communicationEventId)) { try { - GenericValue communicationEvent = delegator.findOne("CommunicationEvent", UtilMisc.toMap("communicationEventId", communicationEventId), false); + GenericValue communicationEvent = EntityQuery.use(delegator).from("CommunicationEvent").where("communicationEventId", communicationEventId).queryOne(); if (UtilValidate.isNotEmpty(communicationEvent)) { String subject = communicationEvent.getString("subject"); if (UtilValidate.isNotEmpty(subject)) { @@ -70,9 +71,9 @@ public class ScrumServices { } String productId = subject.substring(pdLocation + 3, nonDigitLocation); // Debug.logInfo("=======================Product id found in subject: >>" + custRequestId + "<<", module); - 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)) { - GenericValue communicationEventProductMap = delegator.findOne("CommunicationEventProduct", UtilMisc.toMap("productId", productId, "communicationEventId", communicationEventId), false); + GenericValue communicationEventProductMap = EntityQuery.use(delegator).from("CommunicationEventProduct").where("productId", productId, "communicationEventId", communicationEventId).queryOne(); if (UtilValidate.isEmpty(communicationEventProductMap)) { GenericValue communicationEventProduct = delegator.makeValue("CommunicationEventProduct", UtilMisc.toMap("productId", productId, "communicationEventId", communicationEventId)); communicationEventProduct.create(); @@ -284,8 +285,8 @@ public class ScrumServices { if (UtilValidate.isNotEmpty(exclusions)) { for (GenericValue contentResourceMap : exclusions) { Debug.logInfo("Remove contentId ============== >>>>>>>>>>> "+ contentResourceMap.getString("contentId"), module); - GenericValue dataResourceMap = delegator.findOne("DataResource", UtilMisc.toMap("dataResourceId", contentResourceMap.getString("dataResourceId")), false); - GenericValue contentMap = delegator.findOne("Content", UtilMisc.toMap("contentId", contentResourceMap.getString("contentId")), false); + GenericValue dataResourceMap = EntityQuery.use(delegator).from("DataResource").where("dataResourceId", contentResourceMap.getString("dataResourceId")).queryOne(); + GenericValue contentMap = EntityQuery.use(delegator).from("Content").where("contentId", contentResourceMap.getString("contentId")).queryOne(); contentMap.removeRelated("WorkEffortContent"); contentMap.removeRelated("ContentRole"); contentMap.remove(); Modified: ofbiz/trunk/specialpurpose/webpos/src/org/ofbiz/webpos/WebPosEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/webpos/src/org/ofbiz/webpos/WebPosEvents.java?rev=1635383&r1=1635382&r2=1635383&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/webpos/src/org/ofbiz/webpos/WebPosEvents.java (original) +++ ofbiz/trunk/specialpurpose/webpos/src/org/ofbiz/webpos/WebPosEvents.java Thu Oct 30 04:18:05 2014 @@ -37,6 +37,7 @@ import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.order.shoppingcart.ShoppingCart; import org.ofbiz.order.shoppingcart.ShoppingCartEvents; import org.ofbiz.order.shoppinglist.ShoppingListEvents; @@ -161,7 +162,7 @@ public class WebPosEvents { GenericValue product = null; try { String productId = request.getParameter("productId"); - product = delegator.findOne("Product", false, "productId", productId); + product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); if (UtilValidate.isNotEmpty(product)) { request.setAttribute("product", product); if (UtilValidate.isNotEmpty(product.getString("isVirtual")) && "Y".equalsIgnoreCase(product.getString("isVirtual"))) { @@ -187,7 +188,7 @@ public class WebPosEvents { featureOrder = UtilMisc.toList(featureSet); for (int i=0; i < featureOrder.size(); i++) { String featureKey = featureOrder.get(i); - GenericValue featureValue = delegator.findOne("ProductFeatureType", UtilMisc.toMap("productFeatureTypeId", featureOrder.get(i)), true); + GenericValue featureValue = EntityQuery.use(delegator).from("ProductFeatureType").where("productFeatureTypeId", featureOrder.get(i)).cache().queryOne(); if (UtilValidate.isNotEmpty(featureValue) && UtilValidate.isNotEmpty(featureValue.get("description"))) { featureTypes.put(featureKey, featureValue.get("description"));