|
Author: doogie
Date: Tue May 29 04:21:38 2012 New Revision: 1343532 URL: http://svn.apache.org/viewvc?rev=1343532&view=rev Log: Deprecate EntityUtil.getRelated(ByAnd|OrderBy)(|Cache), replaced with the single getRelated variant. EntityUtil.getRelatedByAnd(String, Map) replaced by EntityUtil.getRelated(String, Map, List, boolean) EntityUtil.getRelatedByAndCache(String, Map) replaced by EntityUtil.getRelated(String, Map, List, boolean) EntityUtil.getRelatedOrderBy(String, List) replaced by EntityUtil.getRelated(String, Map, List, boolean) EntityUtil.getRelatedOrderByCache(String, List) replaced by EntityUtil.getRelated(String, Map, List, boolean) Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactHelper.java ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/ProductCategories.groovy ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderHistory.groovy Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?rev=1343532&r1=1343531&r2=1343532&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java Tue May 29 04:21:38 2012 @@ -1293,7 +1293,7 @@ public class InvoiceServices { orderItemAssocs = delegator.findList("OrderItemAssoc", EntityCondition.makeCondition("toOrderId", EntityOperator.IN, purchaseOrderIds), null, null, null, false); // Get only the order items which are indirectly related to the purchase order - this limits the list to the drop ship group(s) - items = EntityUtil.getRelated("FromOrderItem", orderItemAssocs); + items = EntityUtil.getRelated("FromOrderItem", null, orderItemAssocs, false); } else { // If it's a purchase invoice being created, the order items for that purchase orders can be used directly Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java?rev=1343532&r1=1343531&r2=1343532&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java Tue May 29 04:21:38 2012 @@ -1070,8 +1070,8 @@ public class OrderReturnServices { try { // get the related product stores via the orders related to this return - List<GenericValue> orders = EntityUtil.getRelated("OrderHeader", returnItems); - List<GenericValue> productStores = EntityUtil.getRelated("ProductStore", orders); + List<GenericValue> orders = EntityUtil.getRelated("OrderHeader", null, returnItems, false); + List<GenericValue> productStores = EntityUtil.getRelated("ProductStore", null, orders, false); // find the minimum storeCreditValidDays of all the ProductStores associated with all the Orders on the Return, skipping null ones Long storeCreditValidDays = null; Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactHelper.java?rev=1343532&r1=1343531&r2=1343532&view=diff ============================================================================== --- ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactHelper.java (original) +++ ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactHelper.java Tue May 29 04:21:38 2012 @@ -64,16 +64,16 @@ public class ContactHelper { if (!includeOld) { list = EntityUtil.filterByDate(list, true); } - partyContactMechList = EntityUtil.getRelated("PartyContactMech", list); + partyContactMechList = EntityUtil.getRelated("PartyContactMech", null, list, false); } if (!includeOld) { partyContactMechList = EntityUtil.filterByDate(partyContactMechList, true); } partyContactMechList = EntityUtil.orderBy(partyContactMechList, UtilMisc.toList("fromDate DESC")); if (contactMechTypeId == null) { - return EntityUtil.getRelated("ContactMech", partyContactMechList); + return EntityUtil.getRelated("ContactMech", null, partyContactMechList, false); } else { - return EntityUtil.getRelatedByAnd("ContactMech", UtilMisc.toMap("contactMechTypeId", contactMechTypeId), partyContactMechList); + return EntityUtil.getRelated("ContactMech", UtilMisc.toMap("contactMechTypeId", contactMechTypeId), partyContactMechList, false); } } catch (GenericEntityException gee) { Debug.logWarning(gee, module); Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java?rev=1343532&r1=1343531&r2=1343532&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java Tue May 29 04:21:38 2012 @@ -686,7 +686,7 @@ public class ProductEvents { // get/check all the variants List<GenericValue> variantAssocs = product.getRelated("MainProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_VARIANT"), null, false); variantAssocs = EntityUtil.filterByDate(variantAssocs); - List<GenericValue> variants = EntityUtil.getRelated("AssocProduct", variantAssocs); + List<GenericValue> variants = EntityUtil.getRelated("AssocProduct", null, variantAssocs, false); Iterator<GenericValue> variantIter = variants.iterator(); while (!foundFeatureOnVariant && variantIter.hasNext()) { GenericValue variant = variantIter.next(); @@ -771,7 +771,7 @@ public class ProductEvents { // get all the variants List<GenericValue> variantAssocs = product.getRelated("MainProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_VARIANT"), null, false); variantAssocs = EntityUtil.filterByDate(variantAssocs); - List<GenericValue> variants = EntityUtil.getRelated("AssocProduct", variantAssocs); + List<GenericValue> variants = EntityUtil.getRelated("AssocProduct", null, variantAssocs, false); for (GenericValue variant: variants) { // get the selectable features for the variant List<GenericValue> productFeatureAndAppls = variant.getRelated("ProductFeatureAndAppl", UtilMisc.toMap("productFeatureTypeId", productFeatureTypeId, "productFeatureApplTypeId", "STANDARD_FEATURE"), null, false); Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java?rev=1343532&r1=1343531&r2=1343532&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java Tue May 29 04:21:38 2012 @@ -388,7 +388,7 @@ public class ProductWorker { } EntityCondition cond = EntityCondition.makeCondition(condList); productAppls = product.getDelegator().findList("ProductFeatureAppl", cond, null, null, null, false); - features = EntityUtil.getRelated("ProductFeature", productAppls); + features = EntityUtil.getRelated("ProductFeature", null, productAppls, false); features = EntityUtil.orderBy(features, UtilMisc.toList("description")); } catch (GenericEntityException e) { Debug.logError(e, module); @@ -691,7 +691,7 @@ public class ProductWorker { try { List<GenericValue> categoryMembers = product.getRelated("ProductCategoryMember", null, null, false); categoryMembers = EntityUtil.filterByDate(categoryMembers); - categories = EntityUtil.getRelated("ProductCategory", categoryMembers); + categories = EntityUtil.getRelated("ProductCategory", null, categoryMembers, false); } catch (GenericEntityException e) { Debug.logError(e, module); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java?rev=1343532&r1=1343531&r2=1343532&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java Tue May 29 04:21:38 2012 @@ -339,42 +339,44 @@ public class EntityUtil { return result; } + /** + * @deprecated use {@link #getRelated(String, Map, List, boolean)} + */ + @Deprecated public static List<GenericValue> getRelated(String relationName, List<GenericValue> values) throws GenericEntityException { - if (values == null) return null; - - List<GenericValue> result = FastList.newInstance(); - for (GenericValue value: values) { - result.addAll(value.getRelated(relationName, null, null, false)); - } - return result; + return getRelated(relationName, null, values, false); } + /** + * @deprecated use {@link #getRelated(String, Map, List, boolean)} + */ + @Deprecated public static List<GenericValue> getRelatedCache(String relationName, List<GenericValue> values) throws GenericEntityException { - if (values == null) return null; - - List<GenericValue> result = FastList.newInstance(); - for (GenericValue value: values) { - result.addAll(value.getRelated(relationName, null, null, true)); - } - return result; + return getRelated(relationName, null, values, true); } + /** + * @deprecated use {@link #getRelated(String, Map, List, boolean)} + */ + @Deprecated public static List<GenericValue> getRelatedByAnd(String relationName, Map<String, ? extends Object> fields, List<GenericValue> values) throws GenericEntityException { - if (values == null) return null; - - List<GenericValue> result = FastList.newInstance(); - for (GenericValue value: values) { - result.addAll(value.getRelated(relationName, fields, null, false)); - } - return result; + return getRelated(relationName, fields, values, false); } + /** + * @deprecated use {@link #getRelated(String, Map, List, boolean)} + */ + @Deprecated public static List<GenericValue> getRelatedByAndCache(String relationName, Map<String, ? extends Object> fields, List<GenericValue> values) throws GenericEntityException { + return getRelated(relationName, fields, values, true); + } + + public static List<GenericValue> getRelated(String relationName, Map<String, ? extends Object> fields, List<GenericValue> values, boolean useCache) throws GenericEntityException { if (values == null) return null; List<GenericValue> result = FastList.newInstance(); for (GenericValue value: values) { - result.addAll(value.getRelated(relationName, fields, null, true)); + result.addAll(value.getRelated(relationName, fields, null, useCache)); } return result; } Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/ProductCategories.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/ProductCategories.groovy?rev=1343532&r1=1343531&r2=1343532&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/ProductCategories.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/ProductCategories.groovy Tue May 29 04:21:38 2012 @@ -37,7 +37,7 @@ List fillTree(rootCat ,CatLvl, parentCat def listTree = FastList.newInstance(); for(root in rootCat) { preCatChilds = delegator.findByAnd("ProductCategoryRollup", ["parentProductCategoryId": root.productCategoryId], null, false); - catChilds = EntityUtil.getRelated("CurrentProductCategory",preCatChilds); + catChilds = EntityUtil.getRelated("CurrentProductCategory",null,preCatChilds,false); def childList = FastList.newInstance(); // CatLvl uses for identify the Category level for display different css class Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderHistory.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderHistory.groovy?rev=1343532&r1=1343531&r2=1343532&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderHistory.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderHistory.groovy Tue May 29 04:21:38 2012 @@ -27,7 +27,7 @@ if (partyRole) { if ("SUPPLIER".equals(partyRole.roleTypeId)) { /** drop shipper or supplier **/ porderRoleCollection = delegator.findByAnd("OrderRole", [partyId : userLogin.partyId, roleTypeId : "SUPPLIER_AGENT"], null, false); - porderHeaderList = EntityUtil.orderBy(EntityUtil.filterByAnd(EntityUtil.getRelated("OrderHeader", porderRoleCollection), + porderHeaderList = EntityUtil.orderBy(EntityUtil.filterByAnd(EntityUtil.getRelated("OrderHeader", null, porderRoleCollection, false), [EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"), EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "PURCHASE_ORDER")]), ["orderDate DESC"]); @@ -35,7 +35,7 @@ if (partyRole) { } } orderRoleCollection = delegator.findByAnd("OrderRole", [partyId : userLogin.partyId, roleTypeId : "PLACING_CUSTOMER"], null, false); -orderHeaderList = EntityUtil.orderBy(EntityUtil.filterByAnd(EntityUtil.getRelated("OrderHeader", orderRoleCollection), +orderHeaderList = EntityUtil.orderBy(EntityUtil.filterByAnd(EntityUtil.getRelated("OrderHeader", null, orderRoleCollection, false), [EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED")]), ["orderDate DESC"]); context.orderHeaderList = orderHeaderList; |
| Free forum by Nabble | Edit this page |
