|
Modified: ofbiz/branches/20120329_portletWidget/applications/product/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/ofbiz-component.xml?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/ofbiz-component.xml (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/ofbiz-component.xml Tue Jun 19 21:36:11 2012 @@ -37,7 +37,7 @@ under the License. <entity-resource type="data" reader-name="seed" loader="main" location="data/ProductTypeData.xml"/> <entity-resource type="data" reader-name="seed" loader="main" location="data/ProductHelpData.xml"/> <entity-resource type="data" reader-name="seed" loader="main" location="data/ShipmentTypeData.xml"/> - <entity-resource type="data" reader-name="seed" loader="main" location="data/ProductSecurityData.xml"/> + <entity-resource type="data" reader-name="security" loader="main" location="data/ProductSecurityData.xml"/> <entity-resource type="data" reader-name="demo" loader="main" location="data/ProductDemoData.xml"/> <entity-resource type="data" reader-name="seed" loader="main" location="data/ApiSchemaDhl.xml"/> <entity-resource type="data" reader-name="seed" loader="main" location="data/DimensionTypeData.xml"/> Propchange: ofbiz/branches/20120329_portletWidget/applications/product/script/org/ofbiz/product/test/InventoryTests.xml ------------------------------------------------------------------------------ Merged /ofbiz/trunk/applications/product/script/org/ofbiz/product/test/InventoryTests.xml:r1340642-1346323 Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/category/CatalogUrlFilter.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/category/CatalogUrlFilter.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/category/CatalogUrlFilter.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/category/CatalogUrlFilter.java Tue Jun 19 21:36:11 2012 @@ -97,7 +97,7 @@ public class CatalogUrlFilter extends Co List<GenericValue> ContentAssocDataResourceViewTos = delegator.findByAnd("ContentAssocDataResourceViewTo", UtilMisc.toMap("contentIdStart", contentId, "caContentAssocTypeId", "ALTERNATE_LOCALE", "drDataResourceTypeId", "ELECTRONIC_TEXT"), null, true); if (UtilValidate.isNotEmpty(ContentAssocDataResourceViewTos)){ for (GenericValue ContentAssocDataResourceViewTo : ContentAssocDataResourceViewTos) { - GenericValue ElectronicText = ContentAssocDataResourceViewTo.getRelatedOneCache("ElectronicText"); + GenericValue ElectronicText = ContentAssocDataResourceViewTo.getRelatedOne("ElectronicText", true); if (UtilValidate.isNotEmpty(ElectronicText)) { String textData = (String) ElectronicText.get("textData"); textData = UrlServletHelper.invalidCharacter(textData); @@ -117,7 +117,7 @@ public class CatalogUrlFilter extends Co if (UtilValidate.isEmpty(productId)) { List<GenericValue> contentDataResourceViews = delegator.findByAnd("ContentDataResourceView", UtilMisc.toMap("contentId", contentId, "drDataResourceTypeId", "ELECTRONIC_TEXT"), null, true); for (GenericValue contentDataResourceView : contentDataResourceViews) { - GenericValue ElectronicText = contentDataResourceView.getRelatedOneCache("ElectronicText"); + GenericValue ElectronicText = contentDataResourceView.getRelatedOne("ElectronicText", true); if (UtilValidate.isNotEmpty(ElectronicText)) { String textData = (String) ElectronicText.get("textData"); if (UtilValidate.isNotEmpty(textData)) { @@ -152,7 +152,7 @@ public class CatalogUrlFilter extends Co List<GenericValue> ContentAssocDataResourceViewTos = delegator.findByAnd("ContentAssocDataResourceViewTo", UtilMisc.toMap("contentIdStart", contentId, "caContentAssocTypeId", "ALTERNATE_LOCALE", "drDataResourceTypeId", "ELECTRONIC_TEXT"), null, true); if (UtilValidate.isNotEmpty(ContentAssocDataResourceViewTos)){ for (GenericValue ContentAssocDataResourceViewTo : ContentAssocDataResourceViewTos) { - GenericValue ElectronicText = ContentAssocDataResourceViewTo.getRelatedOneCache("ElectronicText"); + GenericValue ElectronicText = ContentAssocDataResourceViewTo.getRelatedOne("ElectronicText", true); if (UtilValidate.isNotEmpty(ElectronicText)){ String textData = (String) ElectronicText.get("textData"); if (UtilValidate.isNotEmpty(textData)) { @@ -174,7 +174,7 @@ public class CatalogUrlFilter extends Co if (UtilValidate.isEmpty(productCategoryId)) { List<GenericValue> contentDataResourceViews = delegator.findByAnd("ContentDataResourceView", UtilMisc.toMap("contentId", contentId, "drDataResourceTypeId", "ELECTRONIC_TEXT"), null, true); for (GenericValue contentDataResourceView : contentDataResourceViews) { - GenericValue ElectronicText = contentDataResourceView.getRelatedOneCache("ElectronicText"); + GenericValue ElectronicText = contentDataResourceView.getRelatedOne("ElectronicText", true); if (UtilValidate.isNotEmpty(ElectronicText)) { String textData = (String) ElectronicText.get("textData"); if (UtilValidate.isNotEmpty(textData)) { Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/category/CategoryServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/category/CategoryServices.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/category/CategoryServices.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/category/CategoryServices.java Tue Jun 19 21:36:11 2012 @@ -70,7 +70,7 @@ public class CategoryServices { try { productCategory = delegator.findOne("ProductCategory", UtilMisc.toMap("productCategoryId", categoryId), true); - members = EntityUtil.filterByDate(productCategory.getRelatedCache("ProductCategoryMember", null, UtilMisc.toList("sequenceNum")), true); + members = EntityUtil.filterByDate(productCategory.getRelated("ProductCategoryMember", null, UtilMisc.toList("sequenceNum"), true), true); if (Debug.verboseOn()) Debug.logVerbose("Category: " + productCategory + " Member Size: " + members.size() + " Members: " + members, module); } catch (GenericEntityException e) { Debug.logError(e, "Problem reading product categories: " + e.getMessage(), module); Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/category/CategoryWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/category/CategoryWorker.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/category/CategoryWorker.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/category/CategoryWorker.java Tue Jun 19 21:36:11 2012 @@ -93,7 +93,7 @@ public class CategoryWorker { Collection<GenericValue> allCategories = delegator.findList("ProductCategory", null, null, null, null, false); for (GenericValue curCat: allCategories) { - Collection<GenericValue> parentCats = curCat.getRelatedCache("CurrentProductCategoryRollup"); + Collection<GenericValue> parentCats = curCat.getRelated("CurrentProductCategoryRollup", null, null, true); if (parentCats.isEmpty()) results.add(curCat); } @@ -164,7 +164,7 @@ public class CategoryWorker { GenericValue cv = null; try { - cv = parent.getRelatedOneCache("CurrentProductCategory"); + cv = parent.getRelatedOne("CurrentProductCategory", true); } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), module); } Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/config/ProductConfigWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/config/ProductConfigWorker.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/config/ProductConfigWorker.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/config/ProductConfigWorker.java Tue Jun 19 21:36:11 2012 @@ -52,7 +52,7 @@ public class ProductConfigWorker { public static final String resource = "ProductUiLabels"; public static final String SEPARATOR = "::"; // cache key separator - public static UtilCache<String, ProductConfigWrapper> productConfigCache = UtilCache.createUtilCache("product.config", true); // use soft reference to free up memory if needed + private static final UtilCache<String, ProductConfigWrapper> productConfigCache = UtilCache.createUtilCache("product.config", true); // use soft reference to free up memory if needed public static ProductConfigWrapper getProductConfigWrapper(String productId, String currencyUomId, HttpServletRequest request) { ProductConfigWrapper configWrapper = null; @@ -65,15 +65,16 @@ public class ProductConfigWorker { * productId::catalogId::webSiteId::currencyUomId, or whatever the SEPARATOR is defined above to be. */ String cacheKey = productId + SEPARATOR + productStoreId + SEPARATOR + catalogId + SEPARATOR + webSiteId + SEPARATOR + currencyUomId; - if (!productConfigCache.containsKey(cacheKey)) { + configWrapper = productConfigCache.get(cacheKey); + if (configWrapper == null) { configWrapper = new ProductConfigWrapper((Delegator)request.getAttribute("delegator"), (LocalDispatcher)request.getAttribute("dispatcher"), productId, productStoreId, catalogId, webSiteId, currencyUomId, UtilHttp.getLocale(request), autoUserLogin); - productConfigCache.put(cacheKey, new ProductConfigWrapper(configWrapper)); + configWrapper = productConfigCache.putIfAbsentAndGet(cacheKey, new ProductConfigWrapper(configWrapper)); } else { - configWrapper = new ProductConfigWrapper(productConfigCache.get(cacheKey)); + configWrapper = new ProductConfigWrapper(configWrapper); } } catch (ProductConfigWrapperException we) { configWrapper = null; Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java Tue Jun 19 21:36:11 2012 @@ -397,7 +397,7 @@ public class ProductConfigWrapper implem public ConfigItem(GenericValue questionAssoc) throws Exception { configItemAssoc = questionAssoc; - configItem = configItemAssoc.getRelatedOne("ConfigItemProductConfigItem"); + configItem = configItemAssoc.getRelatedOne("ConfigItemProductConfigItem", false); options = FastList.newInstance(); } @@ -559,12 +559,12 @@ public class ProductConfigWrapper implem public ConfigOption(Delegator delegator, LocalDispatcher dispatcher, GenericValue option, ConfigItem configItem, String catalogId, String webSiteId, String currencyUomId, GenericValue autoUserLogin) throws Exception { configOption = option; parentConfigItem = configItem; - componentList = option.getRelated("ConfigOptionProductConfigProduct"); + componentList = option.getRelated("ConfigOptionProductConfigProduct", null, null, false); for (GenericValue oneComponent: componentList) { BigDecimal listPrice = BigDecimal.ZERO; BigDecimal price = BigDecimal.ZERO; // Get the component's price - Map<String, Object> fieldMap = UtilMisc.toMap("product", oneComponent.getRelatedOne("ProductProduct"), "prodCatalogId", catalogId, "webSiteId", webSiteId, "currencyUomId", currencyUomId, "productPricePurposeId", "COMPONENT_PRICE", "autoUserLogin", autoUserLogin, "productStoreId",productStoreId); + Map<String, Object> fieldMap = UtilMisc.toMap("product", oneComponent.getRelatedOne("ProductProduct", false), "prodCatalogId", catalogId, "webSiteId", webSiteId, "currencyUomId", currencyUomId, "productPricePurposeId", "COMPONENT_PRICE", "autoUserLogin", autoUserLogin, "productStoreId",productStoreId); Map<String, Object> priceMap = dispatcher.runSync("calculateProductPrice", fieldMap); BigDecimal componentListPrice = (BigDecimal) priceMap.get("listPrice"); BigDecimal componentPrice = (BigDecimal) priceMap.get("price"); @@ -620,7 +620,7 @@ public class ProductConfigWrapper implem for (GenericValue oneComponent: componentList) { BigDecimal listPrice = BigDecimal.ZERO; BigDecimal price = BigDecimal.ZERO; - GenericValue oneComponentProduct = oneComponent.getRelatedOne("ProductProduct"); + GenericValue oneComponentProduct = oneComponent.getRelatedOne("ProductProduct", false); String variantProductId = componentOptions.get(oneComponent.getString("productId")); if (UtilValidate.isNotEmpty(variantProductId)) { @@ -744,7 +744,7 @@ public class ProductConfigWrapper implem int index = getComponents().indexOf(component); if (index != -1) { try { - GenericValue product = component.getRelatedOne("ProductProduct"); + GenericValue product = component.getRelatedOne("ProductProduct", false); return "Y".equals(product.getString("isVirtual")); } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), module); Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java Tue Jun 19 21:36:11 2012 @@ -476,7 +476,7 @@ public class ImageManagementServices { if (content != null) { GenericValue dataResource = null; try { - dataResource = content.getRelatedOne("DataResource"); + dataResource = content.getRelatedOne("DataResource", false); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -966,7 +966,7 @@ public class ImageManagementServices { if (content != null) { GenericValue dataResource = null; try { - dataResource = content.getRelatedOne("DataResource"); + dataResource = content.getRelatedOne("DataResource", false); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -1025,7 +1025,7 @@ public class ImageManagementServices { if (contentAssocUp != null) { GenericValue dataResourceAssocUp = null; try { - dataResourceAssocUp = contentAssocUp.getRelatedOne("DataResource"); + dataResourceAssocUp = contentAssocUp.getRelatedOne("DataResource", false); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/imagemanagement/ImageUrlServlet.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/imagemanagement/ImageUrlServlet.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/imagemanagement/ImageUrlServlet.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/imagemanagement/ImageUrlServlet.java Tue Jun 19 21:36:11 2012 @@ -102,7 +102,7 @@ public class ImageUrlServlet extends Htt if (content != null) { GenericValue dataResource = null; try { - dataResource = content.getRelatedOne("DataResource"); + dataResource = content.getRelatedOne("DataResource", false); } catch (GenericEntityException e) { Debug.logError(e, module); } Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/imagemanagement/WatermarkImage.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/imagemanagement/WatermarkImage.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/imagemanagement/WatermarkImage.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/imagemanagement/WatermarkImage.java Tue Jun 19 21:36:11 2012 @@ -289,7 +289,7 @@ public class WatermarkImage{ if (content != null) { GenericValue dataResource = null; try { - dataResource = content.getRelatedOne("DataResource"); + dataResource = content.getRelatedOne("DataResource", false); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java Tue Jun 19 21:36:11 2012 @@ -225,8 +225,8 @@ public class InventoryServices { try { inventoryTransfer = delegator.findOne("InventoryTransfer", UtilMisc.toMap("inventoryTransferId", inventoryTransferId), false); - inventoryItem = inventoryTransfer.getRelatedOne("InventoryItem"); - destinationFacility = inventoryTransfer.getRelatedOne("ToFacility"); + inventoryItem = inventoryTransfer.getRelatedOne("InventoryItem", false); + destinationFacility = inventoryTransfer.getRelatedOne("ToFacility", false); } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ProductInventoryItemLookupProblem", @@ -343,7 +343,7 @@ public class InventoryServices { "ProductInventoryItemTransferNotFound", UtilMisc.toMap("inventoryTransferId", inventoryTransferId), locale)); } - inventoryItem = inventoryTransfer.getRelatedOne("InventoryItem"); + inventoryItem = inventoryTransfer.getRelatedOne("InventoryItem", false); } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ProductInventoryItemLookupProblem", @@ -462,7 +462,7 @@ public class InventoryServices { // get the reservations in order of newest first List<GenericValue> reservations = null; try { - reservations = inventoryItem.getRelated("OrderItemShipGrpInvRes", null, UtilMisc.toList("-reservedDatetime")); + reservations = inventoryItem.getRelated("OrderItemShipGrpInvRes", null, UtilMisc.toList("-reservedDatetime"), false); } catch (GenericEntityException e) { Debug.logError(e, "Problem getting related reservations", module); return ServiceUtil.returnError(UtilProperties.getMessage(resource, @@ -608,7 +608,7 @@ public class InventoryServices { orderId), null, false); for (GenericValue assoc: orderItemShipGroupAssoc) { - GenericValue orderItem = assoc.getRelatedOne("OrderItem"); + GenericValue orderItem = assoc.getRelatedOne("OrderItem", false); if (orderItem != null) { orderItems.add(orderItem); } @@ -799,7 +799,7 @@ public class InventoryServices { GenericValue product = null; try { - product = orderItem.getRelatedOneCache("Product"); + product = orderItem.getRelatedOne("Product", true); } catch (GenericEntityException e) { Debug.logError(e, "Couldn't get product.", module); return ServiceUtil.returnError(UtilProperties.getMessage(resource, Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/price/PriceServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/price/PriceServices.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/price/PriceServices.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/price/PriceServices.java Tue Jun 19 21:36:11 2012 @@ -350,7 +350,7 @@ public class PriceServices { if ("ProductPrice".equals(defaultPriceValue.getEntityName()) && UtilValidate.isNotEmpty(defaultPriceValue.getString("customPriceCalcService"))) { GenericValue customMethod = null; try { - customMethod = defaultPriceValue.getRelatedOne("CustomMethod"); + customMethod = defaultPriceValue.getRelatedOne("CustomMethod", false); } catch (GenericEntityException gee) { Debug.logError(gee, "An error occurred while getting the customPriceCalcService", module); } @@ -842,11 +842,11 @@ public class PriceServices { // add condsDescription string entry condsDescription.append("["); - GenericValue inputParamEnum = productPriceCond.getRelatedOneCache("InputParamEnumeration"); + GenericValue inputParamEnum = productPriceCond.getRelatedOne("InputParamEnumeration", true); condsDescription.append(inputParamEnum.getString("enumCode")); // condsDescription.append(":"); - GenericValue operatorEnum = productPriceCond.getRelatedOneCache("OperatorEnumeration"); + GenericValue operatorEnum = productPriceCond.getRelatedOne("OperatorEnumeration", true); condsDescription.append(operatorEnum.getString("description")); // condsDescription.append(":"); Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/KeywordIndex.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/KeywordIndex.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/KeywordIndex.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/KeywordIndex.java Tue Jun 19 21:36:11 2012 @@ -176,7 +176,7 @@ public class KeywordIndex { for (GenericValue productContentAndInfo: productContentAndInfos) { addWeightedDataResourceString(productContentAndInfo, weight, strings, delegator, product); - List<GenericValue> alternateViews = productContentAndInfo.getRelated("ContentAssocDataResourceViewTo", UtilMisc.toMap("caContentAssocTypeId", "ALTERNATE_LOCALE"), UtilMisc.toList("-caFromDate")); + List<GenericValue> alternateViews = productContentAndInfo.getRelated("ContentAssocDataResourceViewTo", UtilMisc.toMap("caContentAssocTypeId", "ALTERNATE_LOCALE"), UtilMisc.toList("-caFromDate"), false); alternateViews = EntityUtil.filterByDate(alternateViews, UtilDateTime.nowTimestamp(), "caFromDate", "caThruDate", true); for (GenericValue thisView: alternateViews) { addWeightedDataResourceString(thisView, weight, strings, delegator, product); Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java Tue Jun 19 21:36:11 2012 @@ -54,7 +54,7 @@ public class ProductContentWrapper imple public static final String module = ProductContentWrapper.class.getName(); public static final String SEPARATOR = "::"; // cache key separator - public static UtilCache<String, String> productContentCache = UtilCache.createUtilCache("product.content.rendered", true); + private static final UtilCache<String, String> productContentCache = UtilCache.createUtilCache("product.content.rendered", true); public static ProductContentWrapper makeProductContentWrapper(GenericValue product, HttpServletRequest request) { return new ProductContentWrapper(product, request); @@ -107,18 +107,16 @@ public class ProductContentWrapper imple */ String cacheKey = productContentTypeId + SEPARATOR + locale + SEPARATOR + mimeTypeId + SEPARATOR + product.get("productId"); try { - if (productContentCache.get(cacheKey) != null) { - return productContentCache.get(cacheKey); + String cachedValue = productContentCache.get(cacheKey); + if (cachedValue != null) { + return cachedValue; } Writer outWriter = new StringWriter(); getProductContentAsText(null, product, productContentTypeId, locale, mimeTypeId, partyId, roleTypeId, delegator, dispatcher, outWriter); String outString = outWriter.toString(); if (outString.length() > 0) { - if (productContentCache != null) { - productContentCache.put(cacheKey, outString); - } - return outString; + return productContentCache.putIfAbsentAndGet(cacheKey, outString); } else { String candidateOut = product.getModelEntity().isField(candidateFieldName) ? product.getString(candidateFieldName): ""; return candidateOut == null? "" : candidateOut; Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductEvents.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductEvents.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductEvents.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductEvents.java Tue Jun 19 21:36:11 2012 @@ -684,16 +684,14 @@ public class ProductEvents { if ("Y".equals(product.getString("isVirtual"))) { boolean foundFeatureOnVariant = false; // get/check all the variants - List<GenericValue> variantAssocs = product.getRelatedByAnd("MainProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_VARIANT")); + 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(); // get the selectable features for the variant - List<GenericValue> variantProductFeatureAndAppls = variant.getRelated("ProductFeatureAndAppl", - UtilMisc.toMap("productFeatureTypeId", productFeatureTypeId, - "productFeatureApplTypeId", "STANDARD_FEATURE", "description", description), null); + List<GenericValue> variantProductFeatureAndAppls = variant.getRelated("ProductFeatureAndAppl", UtilMisc.toMap("productFeatureTypeId", productFeatureTypeId, "productFeatureApplTypeId", "STANDARD_FEATURE", "description", description), null, false); if (variantProductFeatureAndAppls.size() > 0) { foundFeatureOnVariant = true; } @@ -771,19 +769,19 @@ public class ProductEvents { try { GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false); // get all the variants - List<GenericValue> variantAssocs = product.getRelatedByAnd("MainProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_VARIANT")); + 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); + List<GenericValue> productFeatureAndAppls = variant.getRelated("ProductFeatureAndAppl", UtilMisc.toMap("productFeatureTypeId", productFeatureTypeId, "productFeatureApplTypeId", "STANDARD_FEATURE"), null, false); for (GenericValue productFeatureAndAppl: productFeatureAndAppls) { GenericPK productFeatureApplPK = delegator.makePK("ProductFeatureAppl"); productFeatureApplPK.setPKFields(productFeatureAndAppl); delegator.removeByPrimaryKey(productFeatureApplPK); } } - List<GenericValue> productFeatureAndAppls = product.getRelated("ProductFeatureAndAppl", UtilMisc.toMap("productFeatureTypeId", productFeatureTypeId, "productFeatureApplTypeId", "SELECTABLE_FEATURE"), null); + List<GenericValue> productFeatureAndAppls = product.getRelated("ProductFeatureAndAppl", UtilMisc.toMap("productFeatureTypeId", productFeatureTypeId, "productFeatureApplTypeId", "SELECTABLE_FEATURE"), null, false); for (GenericValue productFeatureAndAppl: productFeatureAndAppls) { GenericPK productFeatureApplPK = delegator.makePK("ProductFeatureAppl"); productFeatureApplPK.setPKFields(productFeatureAndAppl); @@ -1179,6 +1177,7 @@ public class ProductEvents { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); String productId = request.getParameter("productId"); String productTags = request.getParameter("productTags"); + String statusId = request.getParameter("statusId"); if (UtilValidate.isNotEmpty(productId) && UtilValidate.isNotEmpty(productTags)) { List<String> matchList = FastList.newInstance(); Pattern regex = Pattern.compile("[^\\s\"']+|\"([^\"]*)\"|'([^']*)'"); @@ -1195,10 +1194,14 @@ public class ProductEvents { return "error"; } + if(UtilValidate.isEmpty(statusId)) { + statusId = "KW_PENDING"; + } + if(UtilValidate.isNotEmpty(matchList)) { for (String keywordStr : matchList) { try { - dispatcher.runSync("createProductKeyword", UtilMisc.toMap("productId", productId, "keyword", keywordStr.trim(), "keywordTypeId", "KWT_TAG","statusId","KW_PENDING" , "userLogin", userLogin)); + dispatcher.runSync("createProductKeyword", UtilMisc.toMap("productId", productId, "keyword", keywordStr.trim(), "keywordTypeId", "KWT_TAG", "statusId", statusId, "userLogin", userLogin)); } catch (GenericServiceException e) { request.setAttribute("_ERROR_MESSAGE_", e.getMessage()); return "error"; Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductPromoContentWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductPromoContentWrapper.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductPromoContentWrapper.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductPromoContentWrapper.java Tue Jun 19 21:36:11 2012 @@ -58,7 +58,7 @@ public class ProductPromoContentWrapper public static final String module = ProductPromoContentWrapper.class.getName(); public static final String SEPARATOR = "::"; // cache key separator - public static UtilCache<String, String> productPromoContentCache = UtilCache.createUtilCache("product.promo.content.rendered", true); + private static final UtilCache<String, String> productPromoContentCache = UtilCache.createUtilCache("product.promo.content.rendered", true); public static ProductPromoContentWrapper makeProductPromoContentWrapper(GenericValue productPromo, HttpServletRequest request) { return new ProductPromoContentWrapper(productPromo, request); @@ -111,18 +111,16 @@ public class ProductPromoContentWrapper */ String cacheKey = productPromoContentTypeId + SEPARATOR + locale + SEPARATOR + mimeTypeId + SEPARATOR + productPromo.get("productPromoId"); try { - if (productPromoContentCache.get(cacheKey) != null) { - return productPromoContentCache.get(cacheKey); + String cachedValue = productPromoContentCache.get(cacheKey); + if (cachedValue != null) { + return cachedValue; } Writer outWriter = new StringWriter(); getProductPromoContentAsText(null, productPromo, productPromoContentTypeId, locale, mimeTypeId, partyId, roleTypeId, delegator, dispatcher, outWriter); String outString = outWriter.toString(); if (outString.length() > 0) { - if (productPromoContentCache != null) { - productPromoContentCache.put(cacheKey, outString); - } - return outString; + return productPromoContentCache.putIfAbsentAndGet(cacheKey, outString); } else { String candidateOut = productPromo.getModelEntity().isField(candidateFieldName) ? productPromo.getString(candidateFieldName): ""; return candidateOut == null? "" : candidateOut; Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductSearch.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductSearch.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductSearch.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductSearch.java Tue Jun 19 21:36:11 2012 @@ -1055,7 +1055,7 @@ public class ProductSearch { GenericValue productFeatureType = null; try { productFeature = delegator.findOne("ProductFeature", UtilMisc.toMap("productFeatureId", productFeatureId), true); - productFeatureType = productFeature == null ? null : productFeature.getRelatedOne("ProductFeatureType"); + productFeatureType = productFeature == null ? null : productFeature.getRelatedOne("ProductFeatureType", false); } catch (GenericEntityException e) { Debug.logError(e, "Error finding ProductFeature and Type information for constraint pretty print", module); } @@ -1312,7 +1312,7 @@ public class ProductSearch { infoOut.append(", "); } GenericValue productFeature = delegator.findOne("ProductFeature", UtilMisc.toMap("productFeatureId", featureId), true); - GenericValue productFeatureType = productFeature == null ? null : productFeature.getRelatedOneCache("ProductFeatureType"); + GenericValue productFeatureType = productFeature == null ? null : productFeature.getRelatedOne("ProductFeatureType", true); if (productFeatureType == null) { infoOut.append(UtilProperties.getMessage(resource, "ProductFeature", locale)).append(": "); } else { Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductServices.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductServices.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductServices.java Tue Jun 19 21:36:11 2012 @@ -413,8 +413,7 @@ public class ProductServices { GenericValue mainProduct = product; if (product.get("isVariant") != null && product.getString("isVariant").equalsIgnoreCase("Y")) { - List<GenericValue> c = product.getRelatedByAndCache("AssocProductAssoc", - UtilMisc.toMap("productAssocTypeId", "PRODUCT_VARIANT")); + List<GenericValue> c = product.getRelated("AssocProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_VARIANT"), null, true); //if (Debug.infoOn()) Debug.logInfo("Found related: " + c, module); c = EntityUtil.filterByDate(c); //if (Debug.infoOn()) Debug.logInfo("Found Filtered related: " + c, module); @@ -422,7 +421,7 @@ public class ProductServices { GenericValue asV = c.iterator().next(); //if (Debug.infoOn()) Debug.logInfo("ASV: " + asV, module); - mainProduct = asV.getRelatedOneCache("MainProduct"); + mainProduct = asV.getRelatedOne("MainProduct", true); //if (Debug.infoOn()) Debug.logInfo("Main product = " + mainProduct, module); } } @@ -520,9 +519,9 @@ public class ProductServices { productAssocs = delegator.findList("ProductAssoc", cond, null, orderBy, null, true); } else { if (productIdTo == null) { - productAssocs = product.getRelatedCache("MainProductAssoc", UtilMisc.toMap("productAssocTypeId", type), orderBy); + productAssocs = product.getRelated("MainProductAssoc", UtilMisc.toMap("productAssocTypeId", type), orderBy, true); } else { - productAssocs = product.getRelatedCache("AssocProductAssoc", UtilMisc.toMap("productAssocTypeId", type), orderBy); + productAssocs = product.getRelated("AssocProductAssoc", UtilMisc.toMap("productAssocTypeId", type), orderBy, true); } } // filter the list by date @@ -859,7 +858,7 @@ public class ProductServices { } for (GenericValue goodIdentification: goodIdentificationList) { - GenericValue giProduct = goodIdentification.getRelatedOne("Product"); + GenericValue giProduct = goodIdentification.getRelatedOne("Product", false); if (giProduct != null) { variantProductsById.put(giProduct.getString("productId"), giProduct); } @@ -1143,7 +1142,7 @@ public class ProductServices { if (content != null) { GenericValue dataResource = null; try { - dataResource = content.getRelatedOne("DataResource"); + dataResource = content.getRelatedOne("DataResource", false); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -1349,7 +1348,7 @@ public class ProductServices { if (UtilValidate.isNotEmpty(content)) { GenericValue dataResource = null; try { - dataResource = content.getRelatedOne("DataResource"); + dataResource = content.getRelatedOne("DataResource", false); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java Tue Jun 19 21:36:11 2012 @@ -443,7 +443,7 @@ public class ProductUtilServices { } protected static void duplicateRelated(GenericValue product, String title, String relatedEntityName, String productIdField, String variantProductId, Timestamp nowTimestamp, boolean removeOld, Delegator delegator, boolean test) throws GenericEntityException { - List<GenericValue> relatedList = EntityUtil.filterByDate(product.getRelated(title + relatedEntityName), nowTimestamp); + List<GenericValue> relatedList = EntityUtil.filterByDate(product.getRelated(title + relatedEntityName, null, null, false), nowTimestamp); for (GenericValue relatedValue: relatedList) { GenericValue newRelatedValue = (GenericValue) relatedValue.clone(); newRelatedValue.set(productIdField, variantProductId); Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductWorker.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductWorker.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/product/ProductWorker.java Tue Jun 19 21:36:11 2012 @@ -92,7 +92,7 @@ public class ProductWorker { Delegator delegator = product.getDelegator(); List<GenericValue> productGeos = null; try { - productGeos = product.getRelated("ProductGeo"); + productGeos = product.getRelated("ProductGeo", null, null, false); } catch (GenericEntityException e) { Debug.logError(e, module); } @@ -150,8 +150,7 @@ public class ProductWorker { GenericValue instanceProduct = delegator.findOne("Product", UtilMisc.toMap("productId", instanceProductId), false); if (UtilValidate.isNotEmpty(instanceProduct) && EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", instanceProduct.getString("productTypeId"), "parentTypeId", "AGGREGATED")) { - GenericValue productAssoc = EntityUtil.getFirst(EntityUtil.filterByDate(instanceProduct.getRelatedByAnd("AssocProductAssoc", - UtilMisc.toMap("productAssocTypeId", "PRODUCT_CONF")))); + GenericValue productAssoc = EntityUtil.getFirst(EntityUtil.filterByDate(instanceProduct.getRelated("AssocProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_CONF"), null, false))); if (UtilValidate.isNotEmpty(productAssoc)) { return productAssoc.getString("productId"); } @@ -163,7 +162,7 @@ public class ProductWorker { List<GenericValue> productAssocs = getAggregatedAssocs(delegator, aggregatedProductId); if (UtilValidate.isNotEmpty(productAssocs) && UtilValidate.isNotEmpty(configId)) { for (GenericValue productAssoc: productAssocs) { - GenericValue product = productAssoc.getRelatedOne("AssocProduct"); + GenericValue product = productAssoc.getRelatedOne("AssocProduct", false); if (configId.equals(product.getString("configId"))) { return productAssoc.getString("productIdTo"); } @@ -176,8 +175,7 @@ public class ProductWorker { GenericValue aggregatedProduct = delegator.findOne("Product", UtilMisc.toMap("productId", aggregatedProductId), false); if (UtilValidate.isNotEmpty(aggregatedProduct) && ("AGGREGATED".equals(aggregatedProduct.getString("productTypeId")) || "AGGREGATED_SERVICE".equals(aggregatedProduct.getString("productTypeId")))) { - List<GenericValue> productAssocs = EntityUtil.filterByDate(aggregatedProduct.getRelatedByAnd("MainProductAssoc", - UtilMisc.toMap("productAssocTypeId", "PRODUCT_CONF"))); + List<GenericValue> productAssocs = EntityUtil.filterByDate(aggregatedProduct.getRelated("MainProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_CONF"), null, false)); return productAssocs; } return null; @@ -198,8 +196,7 @@ public class ProductWorker { public static List<GenericValue> getVariantVirtualAssocs(GenericValue variantProduct) throws GenericEntityException { if (variantProduct != null && "Y".equals(variantProduct.getString("isVariant"))) { - List<GenericValue> productAssocs = EntityUtil.filterByDate(variantProduct.getRelatedByAndCache("AssocProductAssoc", - UtilMisc.toMap("productAssocTypeId", "PRODUCT_VARIANT"))); + List<GenericValue> productAssocs = EntityUtil.filterByDate(variantProduct.getRelated("AssocProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_VARIANT"), null, true)); return productAssocs; } return null; @@ -330,7 +327,7 @@ public class ProductWorker { if (nameBuf.length() > 0) { nameBuf.append(", "); } - GenericValue productFeatureType = productFeature.getRelatedOneCache("ProductFeatureType"); + GenericValue productFeatureType = productFeature.getRelatedOne("ProductFeatureType", true); if (productFeatureType != null) { nameBuf.append(productFeatureType.get("description", locale)); nameBuf.append(":"); @@ -391,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); @@ -638,7 +635,7 @@ public class ProductWorker { // lookup the reviews if we didn't pass them in if (reviews == null) { try { - reviews = product.getRelatedCache("ProductReview", reviewByAnd, UtilMisc.toList("-postedDateTime")); + reviews = product.getRelated("ProductReview", reviewByAnd, UtilMisc.toList("-postedDateTime"), true); } catch (GenericEntityException e) { Debug.logError(e, module); } @@ -692,9 +689,9 @@ public class ProductWorker { } List<GenericValue> categories = FastList.newInstance(); try { - List<GenericValue> categoryMembers = product.getRelated("ProductCategoryMember"); + 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); } @@ -719,7 +716,7 @@ public class ProductWorker { if (UtilValidate.isNotEmpty(virtualProductAssocs)) { //found one, set this first as the parent product GenericValue productAssoc = EntityUtil.getFirst(virtualProductAssocs); - _parentProduct = productAssoc.getRelatedOneCache("MainProduct"); + _parentProduct = productAssoc.getRelatedOne("MainProduct", true); } } catch (GenericEntityException e) { throw new RuntimeException("Entity Engine error getting Parent Product (" + e.getMessage() + ")"); @@ -732,7 +729,7 @@ public class ProductWorker { if (product != null) { GenericValue productType = null; try { - productType = product.getRelatedOneCache("ProductType"); + productType = product.getRelatedOne("ProductType", true); } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), module); } @@ -747,7 +744,7 @@ public class ProductWorker { if (product != null) { GenericValue productType = null; try { - productType = product.getRelatedOneCache("ProductType"); + productType = product.getRelatedOne("ProductType", true); } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), module); } Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/promo/PromoServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/promo/PromoServices.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/promo/PromoServices.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/promo/PromoServices.java Tue Jun 19 21:36:11 2012 @@ -236,16 +236,18 @@ public class PromoServices { public static Map<String, Object> importPromoCodeEmailsFromFile(DispatchContext dctx, Map<String, ? extends Object> context) { LocalDispatcher dispatcher = dctx.getDispatcher(); String productPromoCodeId = (String) context.get("productPromoCodeId"); - byte[] wrapper = (byte[]) context.get("uploadedFile"); GenericValue userLogin = (GenericValue) context.get("userLogin"); Locale locale = (Locale) context.get("locale"); - if (wrapper == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "ProductPromoCodeImportUploadedFileNotValid", locale)); + ByteBuffer bytebufferwrapper = (ByteBuffer) context.get("uploadedFile"); + + if (bytebufferwrapper == null) { + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ProductPromoCodeImportUploadedFileNotValid", locale)); } - // read the bytes into a reader + byte[] wrapper = bytebufferwrapper.array(); + + // read the bytes into a reader BufferedReader reader = new BufferedReader(new StringReader(new String(wrapper))); List<Object> errors = FastList.newInstance(); int lines = 0; Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java Tue Jun 19 21:36:11 2012 @@ -681,7 +681,7 @@ public class ProductStoreWorker { List<GenericValue> productFacilities = null; try { - productFacilities = delegator.getRelatedCache("ProductFacility", product); + productFacilities = product.getRelated("ProductFacility", null, null, true); } catch (GenericEntityException e) { Debug.logWarning(e, "Error invoking getRelatedCache in isCatalogInventoryAvailable", module); return false; Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java Tue Jun 19 21:36:11 2012 @@ -265,7 +265,7 @@ public class SubscriptionServices { } Timestamp orderCreatedDate = (Timestamp) orderHeader.get("orderDate"); subContext.put("orderCreatedDate", orderCreatedDate); - List<GenericValue> orderItemList = orderHeader.getRelated("OrderItem"); + List<GenericValue> orderItemList = orderHeader.getRelated("OrderItem", null, null, false); for (GenericValue orderItem: orderItemList) { BigDecimal qty = orderItem.getBigDecimal("quantity"); String productId = orderItem.getString("productId"); Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java Tue Jun 19 21:36:11 2012 @@ -71,14 +71,14 @@ public class SupplierProductServices { results.put("supplierProducts",null); return results; } - List<GenericValue> supplierProducts = product.getRelatedCache("SupplierProduct"); + List<GenericValue> supplierProducts = product.getRelated("SupplierProduct", null, null, true); // if there were no related SupplierProduct entities and the item is a variant, then get the SupplierProducts of the virtual parent product if (supplierProducts.size() == 0 && product.getString("isVariant") != null && product.getString("isVariant").equals("Y")) { String virtualProductId = ProductWorker.getVariantVirtualId(product); GenericValue virtualProduct = delegator.findOne("Product", UtilMisc.toMap("productId", virtualProductId), true); if (virtualProduct != null) { - supplierProducts = virtualProduct.getRelatedCache("SupplierProduct"); + supplierProducts = virtualProduct.getRelated("SupplierProduct", null, null, true); } } @@ -136,7 +136,7 @@ public class SupplierProductServices { // loop through all the features, find the related SupplierProductFeature for the given partyId, and // substitue description and idCode for (GenericValue nextFeature: features) { - List<GenericValue> supplierFeatures = EntityUtil.filterByAnd(nextFeature.getRelated("SupplierProductFeature"), + List<GenericValue> supplierFeatures = EntityUtil.filterByAnd(nextFeature.getRelated("SupplierProductFeature", null, null, false), UtilMisc.toMap("partyId", partyId)); GenericValue supplierFeature = null; Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java Tue Jun 19 21:36:11 2012 @@ -153,7 +153,7 @@ public class PackingSession implements j GenericValue res = i.next(); // Check that the inventory item product match with the current product to pack - if (!productId.equals(res.getRelatedOne("InventoryItem").getString("productId"))) { + if (!productId.equals(res.getRelatedOne("InventoryItem", false).getString("productId"))) { continue; } @@ -999,8 +999,8 @@ public class PackingSession implements j if ("PicklistItem".equals(v.getEntityName())) { quantity = v.getBigDecimal("quantity").setScale(2, BigDecimal.ROUND_HALF_UP); try { - orderItem = v.getRelatedOne("OrderItem"); - productId = v.getRelatedOne("InventoryItem").getString("productId"); + orderItem = v.getRelatedOne("OrderItem", false); + productId = v.getRelatedOne("InventoryItem", false).getString("productId"); } catch (GenericEntityException e) { Debug.logError(e, module); } Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java Tue Jun 19 21:36:11 2012 @@ -341,15 +341,15 @@ public class ShipmentServices { GenericValue pv = null; try { - wv = thisEstimate.getRelatedOne("WeightQuantityBreak"); + wv = thisEstimate.getRelatedOne("WeightQuantityBreak", false); } catch (GenericEntityException e) { } try { - qv = thisEstimate.getRelatedOne("QuantityQuantityBreak"); + qv = thisEstimate.getRelatedOne("QuantityQuantityBreak", false); } catch (GenericEntityException e) { } try { - pv = thisEstimate.getRelatedOne("PriceQuantityBreak"); + pv = thisEstimate.getRelatedOne("PriceQuantityBreak", false); } catch (GenericEntityException e) { } if (wv == null && qv == null && pv == null) { @@ -633,7 +633,7 @@ public class ShipmentServices { if ("SHIPMENT_PACKED".equals(shipmentStatusId)) { GenericValue address = null; try { - address = shipment.getRelatedOne("DestinationPostalAddress"); + address = shipment.getRelatedOne("DestinationPostalAddress", false); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -645,7 +645,7 @@ public class ShipmentServices { List<GenericValue> packages = null; try { - packages = shipment.getRelated("ShipmentPackage") ; + packages = shipment.getRelated("ShipmentPackage", null, null, false) ; } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -658,7 +658,7 @@ public class ShipmentServices { List<GenericValue> routeSegs = null; try { - routeSegs = shipment.getRelated("ShipmentRouteSegment"); + routeSegs = shipment.getRelated("ShipmentRouteSegment", null, null, false); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -1102,7 +1102,7 @@ public class ShipmentServices { BigDecimal packageContentValue = proportionOfInvoicedQuantity.multiply(invoicedAmount).setScale(decimals, rounding); // Convert the value to the shipment currency, if necessary - GenericValue orderHeader = packageContent.getRelatedOne("OrderHeader"); + GenericValue orderHeader = packageContent.getRelatedOne("OrderHeader", false); Map<String, Object> convertUomResult = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", orderHeader.getString("currencyUom"), "uomIdTo", currencyUomId, "originalValue", packageContentValue)); if (ServiceUtil.isError(convertUomResult)) { return convertUomResult; @@ -1226,7 +1226,7 @@ public class ShipmentServices { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ProductShipmentNotFoundId", locale) + shipmentId); } - GenericValue primaryOrderHeader = shipment.getRelatedOne("PrimaryOrderHeader"); + GenericValue primaryOrderHeader = shipment.getRelatedOne("PrimaryOrderHeader", false); if (primaryOrderHeader == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ProductShipmentPrimaryOrderHeaderNotFound", @@ -1238,7 +1238,7 @@ public class ShipmentServices { "ProductShipmentPrimaryOrderHeaderProductStoreNotFound", UtilMisc.toMap("productStoreId", productStoreId, "shipmentId", shipmentId), locale)); } - GenericValue primaryOrderItemShipGroup = shipment.getRelatedOne("PrimaryOrderItemShipGroup"); + GenericValue primaryOrderItemShipGroup = shipment.getRelatedOne("PrimaryOrderItemShipGroup", false); if (primaryOrderItemShipGroup == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ProductShipmentPrimaryOrderHeaderItemShipGroupNotFound", Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/shipment/shipment/ShipmentWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/shipment/shipment/ShipmentWorker.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/shipment/shipment/ShipmentWorker.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/shipment/shipment/ShipmentWorker.java Tue Jun 19 21:36:11 2012 @@ -58,8 +58,8 @@ public class ShipmentWorker { // lookup the issuance to find the order List<GenericValue> issuances = null; try { - GenericValue shipmentItem = shipmentPackageContent.getRelatedOne("ShipmentItem"); - issuances = shipmentItem.getRelated("ItemIssuance"); + GenericValue shipmentItem = shipmentPackageContent.getRelatedOne("ShipmentItem", false); + issuances = shipmentItem.getRelated("ItemIssuance", null, null, false); } catch (GenericEntityException e) { Debug.logError(e, module); } @@ -77,7 +77,7 @@ public class ShipmentWorker { // get the order item GenericValue orderItem = null; try { - orderItem = issuance.getRelatedOne("OrderItem"); + orderItem = issuance.getRelatedOne("OrderItem", false); } catch (GenericEntityException e) { Debug.logError(e, module); } Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/shipment/test/IssuanceTest.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/shipment/test/IssuanceTest.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/shipment/test/IssuanceTest.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/shipment/test/IssuanceTest.java Tue Jun 19 21:36:11 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, false); 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"), false); 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, false); 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, false); for ( GenericValue orderItem : orderItems ) assertEquals("ITEM_COMPLETED", orderItem.getString("statusId")); Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java Tue Jun 19 21:36:11 2012 @@ -549,13 +549,13 @@ public class DhlServices { } // Get Origin Info - GenericValue originPostalAddress = shipmentRouteSegment.getRelatedOne("OriginPostalAddress"); + GenericValue originPostalAddress = shipmentRouteSegment.getRelatedOne("OriginPostalAddress", false); if (originPostalAddress == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "FacilityShipmentRouteSegmentOriginPostalAddressNotFound", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), locale)); } - GenericValue originTelecomNumber = shipmentRouteSegment.getRelatedOne("OriginTelecomNumber"); + GenericValue originTelecomNumber = shipmentRouteSegment.getRelatedOne("OriginTelecomNumber", false); if (originTelecomNumber == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "FacilityShipmentRouteSegmentOriginTelecomNumberNotFound", @@ -570,7 +570,7 @@ public class DhlServices { originPhoneNumber = StringUtil.replaceString(originPhoneNumber, " ", ""); // lookup the two letter country code (in the geoCode field) - GenericValue originCountryGeo = originPostalAddress.getRelatedOne("CountryGeo"); + GenericValue originCountryGeo = originPostalAddress.getRelatedOne("CountryGeo", false); if (originCountryGeo == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "FacilityShipmentRouteSegmentOriginCountryGeoNotFound", @@ -578,7 +578,7 @@ public class DhlServices { } // Get Dest Info - GenericValue destPostalAddress = shipmentRouteSegment.getRelatedOne("DestPostalAddress"); + GenericValue destPostalAddress = shipmentRouteSegment.getRelatedOne("DestPostalAddress", false); if (destPostalAddress == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "FacilityShipmentRouteSegmentDestPostalAddressNotFound", @@ -587,7 +587,7 @@ public class DhlServices { // DHL requires destination phone number, default to sender # if no customer number String destPhoneNumber = originPhoneNumber; - GenericValue destTelecomNumber = shipmentRouteSegment.getRelatedOne("DestTelecomNumber"); + GenericValue destTelecomNumber = shipmentRouteSegment.getRelatedOne("DestTelecomNumber", false); if (destTelecomNumber != null) { destPhoneNumber = destTelecomNumber.getString("areaCode") + destTelecomNumber.getString("contactNumber"); // don't put on country code if not specified or is the US country code (UPS wants it this way) @@ -605,14 +605,14 @@ public class DhlServices { } // lookup the two letter country code (in the geoCode field) - GenericValue destCountryGeo = destPostalAddress.getRelatedOne("CountryGeo"); + GenericValue destCountryGeo = destPostalAddress.getRelatedOne("CountryGeo", false); if (destCountryGeo == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "FacilityShipmentRouteSegmentDestCountryGeoNotFound", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), locale)); } - List<GenericValue> shipmentPackageRouteSegs = shipmentRouteSegment.getRelated("ShipmentPackageRouteSeg", null, UtilMisc.toList("+shipmentPackageSeqId")); + List<GenericValue> shipmentPackageRouteSegs = shipmentRouteSegment.getRelated("ShipmentPackageRouteSeg", null, UtilMisc.toList("+shipmentPackageSeqId"), false); if (UtilValidate.isEmpty(shipmentPackageRouteSegs)) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "FacilityShipmentPackageRouteSegsNotFound", @@ -647,10 +647,10 @@ public class DhlServices { // loop through Shipment segments (NOTE: only one supported, loop is here for future refactoring reference) BigDecimal packageWeight = null; for (GenericValue shipmentPackageRouteSeg: shipmentPackageRouteSegs) { - GenericValue shipmentPackage = shipmentPackageRouteSeg.getRelatedOne("ShipmentPackage"); - GenericValue shipmentBoxType = shipmentPackage.getRelatedOne("ShipmentBoxType"); + GenericValue shipmentPackage = shipmentPackageRouteSeg.getRelatedOne("ShipmentPackage", false); + GenericValue shipmentBoxType = shipmentPackage.getRelatedOne("ShipmentBoxType", false); /* - List<GenericValue> carrierShipmentBoxTypes = shipmentPackage.getRelated("CarrierShipmentBoxType", UtilMisc.toMap("partyId", "DHL"), null); + List<GenericValue> carrierShipmentBoxTypes = shipmentPackage.getRelated("CarrierShipmentBoxType", UtilMisc.toMap("partyId", "DHL"), null, false); GenericValue carrierShipmentBoxType = null; if (carrierShipmentBoxTypes.size() > 0) { carrierShipmentBoxType = carrierShipmentBoxTypes.get(0); @@ -660,7 +660,7 @@ public class DhlServices { // TODO: determine what default UoM is (assuming inches) - there should be a defaultDimensionUomId in Facility if (shipmentBoxType != null) { /* - GenericValue dimensionUom = shipmentBoxType.getRelatedOne("DimensionUom"); + GenericValue dimensionUom = shipmentBoxType.getRelatedOne("DimensionUom", false); String length = shipmentBoxType.get("boxLength").toString(); String width = shipmentBoxType.get("boxWidth").toString(); String height = shipmentBoxType.get("boxHeight").toString(); Modified: ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java Tue Jun 19 21:36:11 2012 @@ -527,7 +527,7 @@ public class FedexServices { } // Get and validate origin postal address - GenericValue originPostalAddress = shipmentRouteSegment.getRelatedOne("OriginPostalAddress"); + GenericValue originPostalAddress = shipmentRouteSegment.getRelatedOne("OriginPostalAddress", false); if (UtilValidate.isEmpty(originPostalAddress)) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "FacilityShipmentRouteSegmentOriginPostalAddressNotFound", @@ -540,7 +540,7 @@ public class FedexServices { "FacilityShipmentRouteSegmentOriginPostalAddressNotComplete", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), locale)); } - GenericValue originCountryGeo = originPostalAddress.getRelatedOne("CountryGeo"); + GenericValue originCountryGeo = originPostalAddress.getRelatedOne("CountryGeo", false); if (UtilValidate.isEmpty(originCountryGeo)) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "FacilityShipmentRouteSegmentOriginCountryGeoNotFound", @@ -563,7 +563,7 @@ public class FedexServices { } // Get and validate origin telecom number - GenericValue originTelecomNumber = shipmentRouteSegment.getRelatedOne("OriginTelecomNumber"); + GenericValue originTelecomNumber = shipmentRouteSegment.getRelatedOne("OriginTelecomNumber", false); if (UtilValidate.isEmpty(originTelecomNumber)) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "FacilityShipmentRouteSegmentOriginTelecomNumberNotFound", @@ -579,13 +579,13 @@ public class FedexServices { // Get the origin contact name from the owner of the origin facility GenericValue partyFrom = null; - GenericValue originFacility = shipment.getRelatedOne("OriginFacility"); + GenericValue originFacility = shipment.getRelatedOne("OriginFacility", false); if (UtilValidate.isEmpty(originFacility)) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "FacilityShipmentFedexOriginFacilityRequired", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), locale)); } else { - partyFrom = originFacility.getRelatedOne("OwnerParty"); + partyFrom = originFacility.getRelatedOne("OwnerParty", false); if (UtilValidate.isEmpty(partyFrom)) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "FacilityShipmentFedexOwnerPartyRequired", @@ -603,7 +603,7 @@ public class FedexServices { } // Get and validate destination postal address - GenericValue destinationPostalAddress = shipmentRouteSegment.getRelatedOne("DestPostalAddress"); + GenericValue destinationPostalAddress = shipmentRouteSegment.getRelatedOne("DestPostalAddress", false); if (UtilValidate.isEmpty(destinationPostalAddress)) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "FacilityShipmentRouteSegmentDestPostalAddressNotFound", @@ -616,7 +616,7 @@ public class FedexServices { "FacilityShipmentRouteSegmentDestPostalAddressIncomplete", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), locale)); } - GenericValue destinationCountryGeo = destinationPostalAddress.getRelatedOne("CountryGeo"); + GenericValue destinationCountryGeo = destinationPostalAddress.getRelatedOne("CountryGeo", false); if (UtilValidate.isEmpty(destinationCountryGeo)) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "FacilityShipmentRouteSegmentDestCountryGeoNotFound", @@ -638,7 +638,7 @@ public class FedexServices { } // Get and validate destination telecom number - GenericValue destinationTelecomNumber = shipmentRouteSegment.getRelatedOne("DestTelecomNumber"); + GenericValue destinationTelecomNumber = shipmentRouteSegment.getRelatedOne("DestTelecomNumber", false); if (UtilValidate.isEmpty(destinationTelecomNumber)) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "FacilityShipmentRouteSegmentDestTelecomNumberNotFound", @@ -693,7 +693,7 @@ public class FedexServices { } } - List<GenericValue> shipmentPackageRouteSegs = shipmentRouteSegment.getRelated("ShipmentPackageRouteSeg", UtilMisc.toList("+shipmentPackageSeqId")); + List<GenericValue> shipmentPackageRouteSegs = shipmentRouteSegment.getRelated("ShipmentPackageRouteSeg", null, UtilMisc.toList("+shipmentPackageSeqId"), false); if (UtilValidate.isEmpty(shipmentPackageRouteSegs)) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "FacilityShipmentPackageRouteSegsNotFound", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), locale)); @@ -776,8 +776,8 @@ public class FedexServices { // Loop through Shipment segments (NOTE: only one supported, loop is here for future refactoring reference) for (GenericValue shipmentPackageRouteSeg: shipmentPackageRouteSegs) { - GenericValue shipmentPackage = shipmentPackageRouteSeg.getRelatedOne("ShipmentPackage"); - GenericValue shipmentBoxType = shipmentPackage.getRelatedOne("ShipmentBoxType"); + GenericValue shipmentPackage = shipmentPackageRouteSeg.getRelatedOne("ShipmentPackage", false); + GenericValue shipmentBoxType = shipmentPackage.getRelatedOne("ShipmentBoxType", false); // FedEx requires the packaging type String packaging = null; @@ -819,7 +819,7 @@ public class FedexServices { dimensionsHeight = shipmentBoxType.getBigDecimal("boxHeight"); String boxDimensionsUomId = null; - GenericValue boxDimensionsUom = shipmentBoxType.getRelatedOne("DimensionUom"); + GenericValue boxDimensionsUom = shipmentBoxType.getRelatedOne("DimensionUom", false); if (! UtilValidate.isEmpty(boxDimensionsUom)) { boxDimensionsUomId = boxDimensionsUom.getString("uomId"); } else { |
| Free forum by Nabble | Edit this page |
