You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2012/05/29 06:16:36 UTC
svn commit: r1343505 - in /ofbiz/trunk/applications:
order/src/org/ofbiz/order/order/OrderServices.java
product/src/org/ofbiz/product/store/ProductStoreWorker.java
product/src/org/ofbiz/shipment/test/IssuanceTest.java
Author: doogie
Date: Tue May 29 04:16:35 2012
New Revision: 1343505
URL: http://svn.apache.org/viewvc?rev=1343505&view=rev
Log:
OPTIMIZE: Replace Delegator.getRelated/getRelatedCache calls with
GenericValue.getRelated/getRelatedCache.
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/test/IssuanceTest.java
Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1343505&r1=1343504&r2=1343505&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Tue May 29 04:16:35 2012
@@ -1090,7 +1090,7 @@ public class OrderServices {
GenericValue productFacility = null;
try {
- productFacilities = delegator.getRelatedCache("ProductFacility", product);
+ productFacilities = product.getRelatedCache("ProductFacility");
} catch (GenericEntityException e) {
Debug.logWarning(e, "Error invoking getRelatedCache in isCatalogInventoryAvailable", module);
}
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java?rev=1343505&r1=1343504&r2=1343505&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java Tue May 29 04:16:35 2012
@@ -681,7 +681,7 @@ public class ProductStoreWorker {
List<GenericValue> productFacilities = null;
try {
- productFacilities = delegator.getRelatedCache("ProductFacility", product);
+ productFacilities = product.getRelatedCache("ProductFacility");
} catch (GenericEntityException e) {
Debug.logWarning(e, "Error invoking getRelatedCache in isCatalogInventoryAvailable", module);
return false;
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/test/IssuanceTest.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/test/IssuanceTest.java?rev=1343505&r1=1343504&r2=1343505&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/test/IssuanceTest.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/test/IssuanceTest.java Tue May 29 04:16:35 2012
@@ -64,7 +64,7 @@ public class IssuanceTest extends OFBizT
GenericValue orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), true);
// Test the OrderShipment is correct
- List<GenericValue> orderShipments = delegator.getRelated("OrderShipment", null, null, orderHeader);
+ List<GenericValue> orderShipments = orderHeader.getRelated("OrderShipment", null, null);
assertFalse("No OrderShipment for order", UtilValidate.isEmpty(orderShipments));
assertEquals( "Incorrect number of OrderShipments for order", 1, orderShipments.size());
@@ -78,7 +78,7 @@ public class IssuanceTest extends OFBizT
assertTrue("Incorrect quantity in OrderShipment. Expected 6.00000 actual " + actual, actual.compareTo(BigDecimal.valueOf(6L))==0);
// Test the ItemIssuances are correct
- List<GenericValue> itemIssuances = delegator.getRelated("ItemIssuance", null, UtilMisc.toList("itemIssuanceId"), orderHeader);
+ List<GenericValue> itemIssuances = orderHeader.getRelated("ItemIssuance", null, UtilMisc.toList("itemIssuanceId"));
assertFalse("No ItemIssuances for order", UtilValidate.isEmpty(itemIssuances));
assertEquals( "Incorrect number of ItemIssuances for order", 2, itemIssuances.size());
@@ -101,14 +101,14 @@ public class IssuanceTest extends OFBizT
assertTrue("Incorrect quantity in ItemIssuance. Expected 1.00000 actual " + actual, actual.compareTo(BigDecimal.valueOf(1L))==0);
// Test reservations have been removed
- List<GenericValue> reservations = delegator.getRelated("OrderItemShipGrpInvRes", null, null, orderHeader);
+ List<GenericValue> reservations = orderHeader.getRelated("OrderItemShipGrpInvRes", null, null);
assertTrue("Reservations exist for order - should have been deleted", UtilValidate.isEmpty(reservations));
// Test order header status is now ORDER_COMPLETED
assertEquals(orderHeader.getString("statusId"), "ORDER_COMPLETED");
// Test order items status are now ITEM_COMPLETED
- List<GenericValue> orderItems = delegator.getRelated("OrderItem", null, null, orderHeader);
+ List<GenericValue> orderItems = orderHeader.getRelated("OrderItem", null, null);
for ( GenericValue orderItem : orderItems )
assertEquals("ITEM_COMPLETED", orderItem.getString("statusId"));