svn commit: r1635399 [9/9] - in /ofbiz/branches/json-integration-refactoring: ./ applications/content/data/ applications/manufacturing/src/org/ofbiz/manufacturing/bom/ applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ applications/manu...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1635399 [9/9] - in /ofbiz/branches/json-integration-refactoring: ./ applications/content/data/ applications/manufacturing/src/org/ofbiz/manufacturing/bom/ applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ applications/manu...

jacopoc
Modified: ofbiz/branches/json-integration-refactoring/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java?rev=1635399&r1=1635398&r2=1635399&view=diff
==============================================================================
--- ofbiz/branches/json-integration-refactoring/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java (original)
+++ ofbiz/branches/json-integration-refactoring/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java Thu Oct 30 06:10:58 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/branches/json-integration-refactoring/specialpurpose/scrum/src/org/ofbiz/scrum/ScrumServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/scrum/src/org/ofbiz/scrum/ScrumServices.java?rev=1635399&r1=1635398&r2=1635399&view=diff
==============================================================================
--- ofbiz/branches/json-integration-refactoring/specialpurpose/scrum/src/org/ofbiz/scrum/ScrumServices.java (original)
+++ ofbiz/branches/json-integration-refactoring/specialpurpose/scrum/src/org/ofbiz/scrum/ScrumServices.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.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/branches/json-integration-refactoring/specialpurpose/webpos/src/org/ofbiz/webpos/WebPosEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/specialpurpose/webpos/src/org/ofbiz/webpos/WebPosEvents.java?rev=1635399&r1=1635398&r2=1635399&view=diff
==============================================================================
--- ofbiz/branches/json-integration-refactoring/specialpurpose/webpos/src/org/ofbiz/webpos/WebPosEvents.java (original)
+++ ofbiz/branches/json-integration-refactoring/specialpurpose/webpos/src/org/ofbiz/webpos/WebPosEvents.java Thu Oct 30 06:10:58 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"));