Author: ashish Date: Sat Sep 17 10:34:57 2016 New Revision: 1761181 URL: http://svn.apache.org/viewvc?rev=1761181&view=rev Log: Improved: Clean up commented out code in Java source for Product. (OFBIZ-7856) Thanks: Harsh for the contribution.
Modified: ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogUrlSeoTransform.java ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigItemContentWrapper.java ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/feature/ParametricSearch.java ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/feature/ProductFeatureServices.java ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryServices.java ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearch.java ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductUtilServices.java ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreWorker.java ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java Modified: ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java?rev=1761181&r1=1761180&r2=1761181&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java (original) +++ ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java Sat Sep 17 10:34:57 2016 @@ -155,9 +155,7 @@ public final class CategoryWorker { Debug.logWarning(e.getMessage(), module); } if (rollups != null) { - // Debug.logInfo("Rollup size: " + rollups.size(), module); for (GenericValue parent: rollups) { - // Debug.logInfo("Adding child of: " + parent.getString("parentProductCategoryId"), module); GenericValue cv = null; try { @@ -168,7 +166,6 @@ public final class CategoryWorker { if (cv != null) { if (excludeEmpty) { if (!isCategoryEmpty(cv)) { - //Debug.logInfo("Child : " + cv.getString("productCategoryId") + " is not empty.", module); categories.add(cv); if (recursive) { categories.addAll(getRelatedCategoriesRet(delegator, attributeName, cv.getString("productCategoryId"), limitView, excludeEmpty, recursive)); @@ -189,14 +186,12 @@ public final class CategoryWorker { public static boolean isCategoryEmpty(GenericValue category) { boolean empty = true; long members = categoryMemberCount(category); - //Debug.logInfo("Category : " + category.get("productCategoryId") + " has " + members + " members", module); if (members > 0) { empty = false; } if (empty) { long rollups = categoryRollupCount(category); - //Debug.logInfo("Category : " + category.get("productCategoryId") + " has " + rollups + " rollups", module); if (rollups > 0) { empty = false; } @@ -279,9 +274,6 @@ public final class CategoryWorker { if (cindex < (trail.size() - 1)) { for (int i = trail.size() - 1; i > cindex; i--) { trail.remove(i); - //FIXME can be removed ? - // String deadCat = trail.remove(i); - //if (Debug.infoOn()) Debug.logInfo("[CategoryWorker.setTrail] Removed after current category index: " + i + " catname: " + deadCat, module); } } return trail; @@ -292,13 +284,11 @@ public final class CategoryWorker { if (UtilValidate.isNotEmpty(previousCategoryId)) { trail.add(previousCategoryId); } - //if (Debug.infoOn()) Debug.logInfo("[CategoryWorker.setTrail] Starting new list, added TOP and previousCategory: " + previousCategoryId, module); } } if (!trail.contains(previousCategoryId)) { // previous category was NOT in the list, ERROR, start over - //if (Debug.infoOn()) Debug.logInfo("[CategoryWorker.setTrail] previousCategory (" + previousCategoryId + ") was not in the crumb list, position is lost, starting over with TOP", module); trail.clear(); trail.add("TOP"); if (UtilValidate.isNotEmpty(previousCategoryId)) { @@ -310,9 +300,6 @@ public final class CategoryWorker { if (index < (trail.size() - 1)) { for (int i = trail.size() - 1; i > index; i--) { trail.remove(i); - //FIXME can be removed ? - // String deadCat = trail.remove(i); - //if (Debug.infoOn()) Debug.logInfo("[CategoryWorker.setTrail] Removed after current category index: " + i + " catname: " + deadCat, module); } } } Modified: ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogUrlSeoTransform.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogUrlSeoTransform.java?rev=1761181&r1=1761180&r2=1761181&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogUrlSeoTransform.java (original) +++ ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogUrlSeoTransform.java Sat Sep 17 10:34:57 2016 @@ -309,7 +309,6 @@ public class CatalogUrlSeoTransform impl } } try { - //SeoConfigUtil.addSpecialProductId(productId); urlBuilder.append(productId); } catch (Exception e) { urlBuilder.append(productId); @@ -557,11 +556,7 @@ public class CatalogUrlSeoTransform impl try { List<EntityExpr> exprs = new LinkedList<EntityExpr>(); exprs.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, lastPathElement)); -// if (SeoConfigUtil.isSpecialProductId(tempProductId)) { -// exprs.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, SeoConfigUtil.getSpecialProductId(tempProductId))); -// } else { - exprs.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, tempProductId)); -// } + exprs.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, tempProductId)); List<GenericValue> products = delegator.findList("Product", EntityCondition.makeCondition(exprs, EntityOperator.OR), UtilMisc.toSet("productId", "productName"), null, null, true); if (products != null && products.size() > 0) { @@ -741,7 +736,6 @@ public class CatalogUrlSeoTransform impl } } try { - //SeoConfigUtil.addSpecialProductId(productId); urlBuilder.append(productId); } catch (Exception e) { urlBuilder.append(productId); Modified: ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigItemContentWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigItemContentWrapper.java?rev=1761181&r1=1761180&r2=1761181&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigItemContentWrapper.java (original) +++ ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigItemContentWrapper.java Sat Sep 17 10:34:57 2016 @@ -182,7 +182,6 @@ public class ProductConfigItemContentWra } String candidateFieldName = ModelUtil.dbNameToVarName(confItemContentTypeId); - //Debug.logInfo("candidateFieldName=" + candidateFieldName, module); ModelEntity productConfigItemModel = delegator.getModelEntity("ProductConfigItem"); if (productConfigItemModel.isField(candidateFieldName)) { if (productConfigItem == null) { Modified: ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/feature/ParametricSearch.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/feature/ParametricSearch.java?rev=1761181&r1=1761180&r2=1761181&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/feature/ParametricSearch.java (original) +++ ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/feature/ParametricSearch.java Sat Sep 17 10:34:57 2016 @@ -48,10 +48,6 @@ public class ParametricSearch { public static final int DEFAULT_PER_TYPE_MAX_SIZE = 1000; - // DEJ20060427 not used right now, could be removed if that circumstance persists - //public static UtilCache featureAllCache = UtilCache.createUtilCache("custom.FeaturePerTypeAll", 0, 600000, true); - //public static UtilCache featureByCategoryCache = UtilCache.createUtilCache("custom.FeaturePerTypeByCategory", 0, 600000, true); - /** Gets all features associated with the specified category through: * ProductCategory -> ProductFeatureCategoryAppl -> ProductFeatureCategory -> ProductFeature. * Returns a Map of Lists of ProductFeature GenericValue objects organized by productFeatureTypeId. Modified: ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/feature/ProductFeatureServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/feature/ProductFeatureServices.java?rev=1761181&r1=1761180&r2=1761181&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/feature/ProductFeatureServices.java (original) +++ ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/feature/ProductFeatureServices.java Sat Sep 17 10:34:57 2016 @@ -150,15 +150,12 @@ public class ProductFeatureServices { "productFeatureId", productFeatureAndAppl, "productFeatureApplTypeId", "STANDARD_FEATURE"); - //Debug.logInfo("Using findByMap: " + findByMap); - List<GenericValue> standardProductFeatureAndAppls = EntityQuery.use(delegator).from("ProductFeatureAppl").where(findByMap).filterByDate().queryList(); if (UtilValidate.isEmpty(standardProductFeatureAndAppls)) { - // Debug.logInfo("Does NOT have this standard feature"); hasAllFeatures = false; break; } else { - // Debug.logInfo("DOES have this standard feature"); + } } Modified: ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java?rev=1761181&r1=1761180&r2=1761181&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java (original) +++ ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java Sat Sep 17 10:34:57 2016 @@ -381,8 +381,6 @@ public class ImageManagementServices { ImageIO.write(bufNewImg, imgExtension, new File(imageServerPath + "/" + productId + "/" + filenameToUse)); File deleteFile = new File(imageServerPath + "/" + filenameToUse); deleteFile.delete(); - //FIXME can be removed ? - // boolean check = deleteFile.delete(); } catch (IllegalArgumentException e) { String errMsg = UtilProperties.getMessage(resourceError, "ScaleImage.one_parameter_is_null", locale) + e.toString(); Debug.logError(errMsg, module); @@ -488,8 +486,6 @@ public class ImageManagementServices { LocalDispatcher dispatcher = dctx.getDispatcher(); Delegator delegator = dctx.getDelegator(); Locale locale = (Locale) context.get("locale"); - //FIXME can be removed ? - // String imageFilenameFormat = UtilProperties.getPropertyValue("catalog", "image.filename.format"); String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", delegator), context); String nameOfThumb = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.nameofthumbnail", delegator), context); @@ -506,36 +502,7 @@ public class ImageManagementServices { } String contentIdThumb = (String) contentThumbResult.get("contentId"); - result.put("contentIdThumb", contentIdThumb); - - /*// File to use for image thumbnail - FlexibleStringExpander filenameExpanderThumb = FlexibleStringExpander.getInstance(imageFilenameFormat); - String fileLocationThumb = filenameExpanderThumb.expandString(UtilMisc.toMap("location", "products", "type", "small", "id", contentIdThumb)); - String filenameToUseThumb = fileLocationThumb; - if (fileLocationThumb.lastIndexOf("/") != -1) { - filenameToUseThumb = fileLocationThumb.substring(fileLocationThumb.lastIndexOf("/") + 1); - } - - String fileContentType = (String) context.get("_uploadedFile_contentType"); - if (fileContentType.equals("image/pjpeg")) { - fileContentType = "image/jpeg"; - } else if (fileContentType.equals("image/x-png")) { - fileContentType = "image/png"; - } - - List<GenericValue> fileExtensionThumb = new LinkedList(); - try { - fileExtensionThumb = delegator.findByAnd("FileExtension", UtilMisc.toMap("mimeTypeId", fileContentType), null, false); - } catch (GenericEntityException e) { - Debug.logError(e, module); - return ServiceUtil.returnError(e.getMessage()); - } - - GenericValue extensionThumb = EntityUtil.getFirst(fileExtensionThumb); - if (extensionThumb != null) { - filenameToUseThumb += "." + extensionThumb.getString("fileExtensionId"); - }*/ - //String uploadFileName = (String) context.get("_uploadedFile_fileName"); + result.put("contentIdThumb", contentIdThumb); String filenameToUseThumb = imageName.substring(0 , imageName.indexOf(".")) + nameOfThumb; String fileContentType = (String) context.get("_uploadedFile_contentType"); if (fileContentType.equals("image/pjpeg")) { Modified: ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryServices.java?rev=1761181&r1=1761180&r2=1761181&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryServices.java (original) +++ ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryServices.java Sat Sep 17 10:34:57 2016 @@ -410,15 +410,6 @@ public class InventoryServices { LocalDispatcher dispatcher = dctx.getDispatcher(); GenericValue userLogin = (GenericValue) context.get("userLogin"); Locale locale = (Locale) context.get("locale"); - - /* TODO: NOTE: This method has been updated, but testing requires many eyes. See http://jira.undersunconsulting.com/browse/OFBIZ-662 - boolean skipThisNeedsUpdating = true; - if (skipThisNeedsUpdating) { - Debug.logWarning("NOT Running the checkInventoryAvailability service, no backorders or such will be automatically created; the reason is that this serice needs to be updated to use OrderItemShipGroup instead of OrderShipmentPreference which it currently does.", module); - return ServiceUtil.returnSuccess(); - } - */ - Map<String, Map<String, Timestamp>> ordersToUpdate = new HashMap<String, Map<String,Timestamp>>(); Map<String, Map<String, Timestamp>> ordersToCancel = new HashMap<String, Map<String,Timestamp>>(); @@ -866,21 +857,18 @@ public class InventoryServices { try { product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); } catch (GenericEntityException e) { - // TODO Auto-generated catch block e.printStackTrace(); } if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.getString("productTypeId"), "parentTypeId", "MARKETING_PKG")) { try { resultOutput = dispatcher.runSync("getMktgPackagesAvailable", contextInput); } catch (GenericServiceException e) { - // TODO Auto-generated catch block e.printStackTrace(); } } else { try { resultOutput = dispatcher.runSync("getInventoryAvailableByFacility", contextInput); } catch (GenericServiceException e) { - // TODO Auto-generated catch block e.printStackTrace(); } } @@ -910,7 +898,6 @@ public class InventoryServices { try { productPrices = EntityQuery.use(delegator).from("ProductPrice").where("productId",productId).orderBy("-fromDate").cache(true).queryList(); } catch (GenericEntityException e) { - // TODO Auto-generated catch block e.printStackTrace(); } //change this for product price @@ -977,7 +964,6 @@ public class InventoryServices { EntityOperator.AND); salesUsageIt = EntityQuery.use(delegator).from(salesUsageViewEntity).where(cond).queryIterator(); } catch (GenericEntityException e2) { - // TODO Auto-generated catch block e2.printStackTrace(); } @@ -996,7 +982,6 @@ public class InventoryServices { try { salesUsageIt.close(); } catch (GenericEntityException e2) { - // TODO Auto-generated catch block e2.printStackTrace(); } @@ -1013,7 +998,6 @@ public class InventoryServices { EntityOperator.AND); productionUsageIt = EntityQuery.use(delegator).from(productionUsageViewEntity).where(conditions).queryIterator(); } catch (GenericEntityException e1) { - // TODO Auto-generated catch block e1.printStackTrace(); } @@ -1032,7 +1016,6 @@ public class InventoryServices { try { productionUsageIt.close(); } catch (GenericEntityException e) { - // TODO Auto-generated catch block e.printStackTrace(); } Modified: ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java?rev=1761181&r1=1761180&r2=1761181&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java (original) +++ ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java Sat Sep 17 10:34:57 2016 @@ -79,10 +79,6 @@ public class PriceServices { * </ul> */ public static Map<String, Object> calculateProductPrice(DispatchContext dctx, Map<String, ? extends Object> context) { - // UtilTimer utilTimer = new UtilTimer(); - // utilTimer.timerString("Starting price calc", module); - // utilTimer.setLog(false); - Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); Map<String, Object> result = new HashMap<String, Object>(); @@ -264,8 +260,6 @@ public class PriceServices { if ("Y".equals(product.getString("isVirtual"))) { // only do this if there is no default price, consider the others optional for performance reasons if (defaultPriceValue == null) { - // Debug.logInfo("Product isVirtual and there is no default price for ID " + productId + ", trying variant prices", module); - //use the cache to find the variant with the lowest default price try { List<GenericValue> variantAssocList = EntityQuery.use(delegator).from("ProductAssoc").where("productId", product.get("productId"), "productAssocTypeId", "PRODUCT_VARIANT").orderBy("-fromDate").cache(true).filterByDate().queryList(); @@ -286,7 +280,6 @@ public class PriceServices { if (salesDiscontinuationDate == null || salesDiscontinuationDate.after(nowTimestamp)) { minDefaultPrice = curDefaultPrice; variantProductPrices = curVariantPriceList; - // Debug.logInfo("Found new lowest price " + minDefaultPrice + " for variant with ID " + variantProductId, module); } } } @@ -329,18 +322,14 @@ public class PriceServices { } } - //boolean validPromoPriceFound = false; BigDecimal promoPrice = BigDecimal.ZERO; if (promoPriceValue != null && promoPriceValue.get("price") != null) { promoPrice = promoPriceValue.getBigDecimal("price"); - //validPromoPriceFound = true; } - //boolean validWholesalePriceFound = false; BigDecimal wholesalePrice = BigDecimal.ZERO; if (wholesalePriceValue != null && wholesalePriceValue.get("price") != null) { wholesalePrice = wholesalePriceValue.getBigDecimal("price"); - //validWholesalePriceFound = true; } boolean validPriceFound = false; @@ -572,7 +561,6 @@ public class PriceServices { } } - // utilTimer.timerString("Finished price calc [productId=" + productId + "]", module); return result; } @@ -649,7 +637,6 @@ public class PriceServices { // Genercally I don't think that rule sets will get that big though, so the default is optimize for smaller rule set. if (optimizeForLargeRuleSet) { // ========= find all rules that must be run for each input type; this is kind of like a pre-filter to slim down the rules to run ========= - // utilTimer.timerString("Before create rule id list", module); TreeSet<String> productPriceRuleIds = new TreeSet<String>(); // ------- These are all of the conditions that DON'T depend on the current inputs ------- @@ -777,11 +764,6 @@ public class PriceServices { productPriceRules.add(productPriceRule); } } else { - // this would be nice, but we can't cache this so easily... - // List pprExprs = UtilMisc.toList(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), - // EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, UtilDateTime.nowTimestamp())); - // productPriceRules = delegator.findByOr("ProductPriceRule", pprExprs); - productPriceRules = EntityQuery.use(delegator).from("ProductPriceRule").cache(true).queryList(); if (productPriceRules == null) productPriceRules = new LinkedList<GenericValue>(); } @@ -801,7 +783,6 @@ public class PriceServices { boolean isSale = false; // ========= go through each price rule by id and eval all conditions ========= - // utilTimer.timerString("Before eval rules", module); int totalConds = 0; int totalActions = 0; int totalRules = 0; @@ -1275,9 +1256,6 @@ public class PriceServices { priceInfoDescription.append(productSupplier.getBigDecimal("lastPrice")); priceInfoDescription.append("]"); GenericValue orderItemPriceInfo = delegator.makeValue("OrderItemPriceInfo"); - //orderItemPriceInfo.set("productPriceRuleId", productPriceAction.get("productPriceRuleId")); - //orderItemPriceInfo.set("productPriceActionSeqId", productPriceAction.get("productPriceActionSeqId")); - //orderItemPriceInfo.set("modifyAmount", modifyAmount); // make sure description is <= than 250 chars String priceInfoDescriptionString = priceInfoDescription.toString(); if (priceInfoDescriptionString.length() > 250) { Modified: ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java?rev=1761181&r1=1761180&r2=1761181&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java (original) +++ ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java Sat Sep 17 10:34:57 2016 @@ -76,7 +76,6 @@ public class ProductEvents { * @return String specifying the exit status of this event */ public static String updateAllKeywords(HttpServletRequest request, HttpServletResponse response) { - //String errMsg = ""; Delegator delegator = (Delegator) request.getAttribute("delegator"); Security security = (Security) request.getAttribute("security"); Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); @@ -137,8 +136,6 @@ public class ProductEvents { try { KeywordIndex.indexKeywords(product, "Y".equals(doAll)); } catch (GenericEntityException e) { - //errMsg = UtilProperties.getMessage(resource,"productevents.could_not_create_keywords_write", UtilHttp.getLocale(request)); - //request.setAttribute("_ERROR_MESSAGE_", errMsg); Debug.logWarning("[ProductEvents.updateAllKeywords] Could not create product-keyword (write error); message: " + e.getMessage(), module); errProds++; } @@ -591,7 +588,6 @@ public class ProductEvents { public static String updateProductQuickAdminSelFeat(HttpServletRequest request, HttpServletResponse response) { Delegator delegator = (Delegator) request.getAttribute("delegator"); Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); - //GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin"); String productId = request.getParameter("productId"); String variantProductId = request.getParameter("productId0"); String useImagesProdId = request.getParameter("useImages"); @@ -761,8 +757,6 @@ public class ProductEvents { public static String removeFeatureApplsByFeatureTypeId(HttpServletRequest request, HttpServletResponse response) { Delegator delegator = (Delegator) request.getAttribute("delegator"); - //Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); - //GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin"); String productId = request.getParameter("productId"); String productFeatureTypeId = request.getParameter("productFeatureTypeId"); @@ -797,8 +791,6 @@ public class ProductEvents { public static String removeProductFeatureAppl(HttpServletRequest request, HttpServletResponse response) { Delegator delegator = (Delegator) request.getAttribute("delegator"); - //Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); - //GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin"); String productId = request.getParameter("productId"); String productFeatureId = request.getParameter("productFeatureId"); Modified: ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearch.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearch.java?rev=1761181&r1=1761180&r2=1761181&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearch.java (original) +++ ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearch.java Sat Sep 17 10:34:57 2016 @@ -695,19 +695,6 @@ public class ProductSearch { try { boolean hasResults = false; Object initialResult = null; - - /* this method has been replaced by the following to address issue with SAP DB and possibly other DBs - if (resultOffset != null) { - Debug.logInfo("Before relative, current index=" + eli.currentIndex(), module); - hasResults = eli.relative(resultOffset.intValue()); - } else { - initialResult = eli.next(); - if (initialResult != null) { - hasResults = true; - } - } - */ - initialResult = eli.next(); if (initialResult != null) { hasResults = true; @@ -757,19 +744,6 @@ public class ProductSearch { } else { duplicatesFound++; } - - /* - StringBuilder lineMsg = new StringBuilder("Got search result line: "); - for (String fieldName: fieldsToSelect) { - lineMsg.append(fieldName); - lineMsg.append("="); - lineMsg.append(searchResult.get(fieldName)); - if (fieldsToSelectIter.hasNext()) { - lineMsg.append(", "); - } - } - Debug.logInfo(lineMsg.toString(), module); - */ } if (searchResult != null) { @@ -2194,143 +2168,4 @@ public class ProductSearch { return this.ascending; } } - /** A rather large and verbose method that doesn't use the cool constraint and sort order objects */ - /* - public static ArrayList parametricKeywordSearchStandAlone(Set featureIdSet, String keywordsString, Delegator delegator, String productCategoryId, boolean includeSubCategories, String visitId, boolean anyPrefix, boolean anySuffix, boolean isAnd) { - // TODO: implement this for the new features - boolean removeStems = UtilProperties.propertyValueEquals("prodsearch", "remove.stems", "true"); - - Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); - - // make view-entity & EntityCondition - int index = 1; - List entityConditionList = new LinkedList(); - List orderByList = new LinkedList(); - List fieldsToSelect = UtilMisc.toList("productId"); - DynamicViewEntity dynamicViewEntity = new DynamicViewEntity(); - dynamicViewEntity.addMemberEntity("PROD", "Product"); - dynamicViewEntity.addAlias("PROD", "productName"); - boolean productIdGroupBy = false; - - // Category - if (UtilValidate.isNotEmpty(productCategoryId)) { - List productCategoryIdList = null; - if (includeSubCategories) { - // find all sub-categories recursively, make a Set of productCategoryId - Set productCategoryIdSet = new HashSet(); - getAllSubCategoryIds(productCategoryId, productCategoryIdSet, delegator, nowTimestamp); - productCategoryIdList = UtilMisc.makeListWritable(productCategoryIdSet); - } else { - productCategoryIdList = UtilMisc.toList(productCategoryId); - } - - // make index based values and increment - String entityAlias = "PCM" + index; - String prefix = "pcm" + index; - index++; - - dynamicViewEntity.addMemberEntity(entityAlias, "ProductCategoryMember"); - dynamicViewEntity.addAlias(entityAlias, prefix + "ProductCategoryId", "productCategoryId", null, null, null, null); - dynamicViewEntity.addAlias(entityAlias, prefix + "FromDate", "fromDate", null, null, null, null); - dynamicViewEntity.addAlias(entityAlias, prefix + "ThruDate", "thruDate", null, null, null, null); - dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); - entityConditionList.add(EntityCondition.makeCondition(prefix + "ProductCategoryId", EntityOperator.IN, productCategoryIdList)); - entityConditionList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.GREATER_THAN, nowTimestamp))); - entityConditionList.add(EntityCondition.makeCondition(prefix + "FromDate", EntityOperator.LESS_THAN, nowTimestamp)); - } - - // Keyword - List keywordFirstPass = KeywordSearch.makeKeywordList(keywordsString); - List keywordList = KeywordSearch.fixKeywords(keywordFirstPass, anyPrefix, anySuffix, removeStems, isAnd); - - if (keywordList.size() > 0) { - if (isAnd) { - // add up the relevancyWeight fields from all keyword member entities for a total to sort by - ComplexAlias complexAlias = new ComplexAlias("+"); - - for (String keyword: keywordList) { - // make index based values and increment - String entityAlias = "PK" + index; - String prefix = "pk" + index; - index++; - - dynamicViewEntity.addMemberEntity(entityAlias, "ProductKeyword"); - dynamicViewEntity.addAlias(entityAlias, prefix + "Keyword", "keyword", null, null, null, null); - dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); - entityConditionList.add(EntityCondition.makeCondition(prefix + "Keyword", EntityOperator.LIKE, keyword)); - - //don't add an alias for this, will be part of a complex alias: dynamicViewEntity.addAlias(entityAlias, prefix + "RelevancyWeight", "relevancyWeight", null, null, null, null); - complexAlias.addComplexAliasMember(new ComplexAliasField(entityAlias, "relevancyWeight")); - } - dynamicViewEntity.addAlias(null, "totalRelevancy", null, null, null, null, null, complexAlias); - orderByList.add("-totalRelevancy"); - fieldsToSelect.add("totalRelevancy"); - } else { - // make index based values and increment - String entityAlias = "PK" + index; - String prefix = "pk" + index; - index++; - - dynamicViewEntity.addMemberEntity(entityAlias, "ProductKeyword"); - dynamicViewEntity.addAlias(entityAlias, "totalRelevancy", "relevancyWeight", null, null, null, "sum"); - dynamicViewEntity.addAlias(entityAlias, prefix + "Keyword", "keyword", null, null, null, null); - dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); - orderByList.add("-totalRelevancy"); - fieldsToSelect.add("totalRelevancy"); - List<EntityCondition> keywordOrList = new LinkedList(); - for (String keyword: keywordList) { - keywordOrList.add(EntityCondition.makeCondition(prefix + "Keyword", EntityOperator.LIKE, keyword)); - } - entityConditionList.add(EntityCondition.makeCondition(keywordOrList, EntityOperator.OR)); - - productIdGroupBy = true; - } - } - - // Features - if (UtilValidate.isNotEmpty(featureIdSet)) { - for (String productFeatureID: featureIdSet) { - // make index based values and increment - String entityAlias = "PFA" + index; - String prefix = "pfa" + index; - index++; - - dynamicViewEntity.addMemberEntity(entityAlias, "ProductFeatureAppl"); - dynamicViewEntity.addAlias(entityAlias, prefix + "ProductFeatureId", "productFeatureId", null, null, null, null); - dynamicViewEntity.addAlias(entityAlias, prefix + "FromDate", "fromDate", null, null, null, null); - dynamicViewEntity.addAlias(entityAlias, prefix + "ThruDate", "thruDate", null, null, null, null); - dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); - entityConditionList.add(EntityCondition.makeCondition(prefix + "ProductFeatureId", EntityOperator.EQUALS, productFeatureId)); - entityConditionList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(prefix + "ThruDate", EntityOperator.GREATER_THAN, nowTimestamp))); - entityConditionList.add(EntityCondition.makeCondition(prefix + "FromDate", EntityOperator.LESS_THAN, nowTimestamp)); - } - } - - dynamicViewEntity.addAlias("PROD", "productId", null, null, null, Boolean.valueOf(productIdGroupBy), null); - EntityCondition whereCondition = EntityCondition.makeCondition(entityConditionList, EntityOperator.AND); - EntityFindOptions efo = new EntityFindOptions(); - efo.setDistinct(true); - - EntityListIterator eli = null; - try { - eli = delegator.findListIteratorByCondition(dynamicViewEntity, whereCondition, null, fieldsToSelect, orderByList, efo); - } catch (GenericEntityException e) { - Debug.logError(e, "Error in product search", module); - return null; - } - - ArrayList productIds = new LinkedList(); - Set productIdSet = new HashSet(); - GenericValue searchResult = null; - while ((searchResult = (GenericValue) eli.next()) != null) { - String productId = searchResult.getString("productId"); - if (!productIdSet.contains(productId)) { - productIds.add(productId); - productIdSet.add(productId); - } - } - - return productIds; - } - */ } Modified: ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java?rev=1761181&r1=1761180&r2=1761181&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java (original) +++ ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java Sat Sep 17 10:34:57 2016 @@ -519,8 +519,6 @@ public class ProductSearchSession { request.setAttribute("processSearchParametersAlreadyRun", Boolean.TRUE); } - //Debug.logInfo("Processing Product Search parameters: " + parameters, module); - HttpSession session = request.getSession(); boolean constraintsChanged = false; GenericValue productStore = ProductStoreWorker.getProductStore(request); @@ -654,7 +652,6 @@ public class ProductSearchSession { String paramNameExt = parameterName.substring("S_PFI".length()); String searchCategoryExc = (String) parameters.get("S_PFX" + paramNameExt); Boolean exclude = UtilValidate.isEmpty(searchCategoryExc) ? null : Boolean.valueOf(!"N".equals(searchCategoryExc)); - //Debug.logInfo("parameterName=" + parameterName + ", paramNameExt=" + paramNameExt + ", searchCategoryExc=" + searchCategoryExc + ", exclude=" + exclude, module); searchAddConstraint(new ProductSearch.FeatureConstraint(productFeatureId, exclude), session); constraintsChanged = true; } @@ -1080,10 +1077,6 @@ public class ProductSearchSession { searchParamString.append("="); searchParamString.append(fc.exclude.booleanValue() ? "Y" : "N"); } - /* No way to specify parameters for these right now, so table until later - } else if (psc instanceof ProductSearch.FeatureSetConstraint) { - ProductSearch.FeatureSetConstraint fsc = (ProductSearch.FeatureSetConstraint) psc; - */ } else if (psc instanceof ProductSearch.FeatureCategoryConstraint) { ProductSearch.FeatureCategoryConstraint pfcc = (ProductSearch.FeatureCategoryConstraint) psc; featureCategoriesCount++; @@ -1178,7 +1171,6 @@ public class ProductSearchSession { ResultSortOrder resultSortOrder = productSearchOptions.getResultSortOrder(); if (resultSortOrder != null) { if (resultSortOrder instanceof ProductSearch.SortKeywordRelevancy) { - //ProductSearch.SortKeywordRelevancy skr = (ProductSearch.SortKeywordRelevancy) resultSortOrder; searchParamString.append("&S_O=SKR"); } else if (resultSortOrder instanceof ProductSearch.SortProductField) { ProductSearch.SortProductField spf = (ProductSearch.SortProductField) resultSortOrder; Modified: ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java?rev=1761181&r1=1761180&r2=1761181&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java (original) +++ ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java Sat Sep 17 10:34:57 2016 @@ -77,7 +77,6 @@ public class ProductServices { * Creates a Collection of product entities which are variant products from the specified product ID. */ public static Map<String, Object> prodFindAllVariants(DispatchContext dctx, Map<String, ? extends Object> context) { - // * String productId -- Parent (virtual) product ID Map<String, Object> subContext = UtilMisc.makeMapWritable(context); subContext.put("type", "PRODUCT_VARIANT"); return prodFindAssociatedByType(dctx, subContext); @@ -87,8 +86,6 @@ public class ProductServices { * Finds a specific product or products which contain the selected features. */ public static Map<String, Object> prodFindSelectedVariant(DispatchContext dctx, Map<String, ? extends Object> context) { - // * String productId -- Parent (virtual) product ID - // * Map selectedFeatures -- Selected features Delegator delegator = dctx.getDelegator(); Locale locale = (Locale) context.get("locale"); Map<String, String> selectedFeatures = UtilGenerics.checkMap(context.get("selectedFeatures")); @@ -141,8 +138,6 @@ public class ProductServices { * Finds product variants based on a product ID and a distinct feature. */ public static Map<String, Object> prodFindDistinctVariants(DispatchContext dctx, Map<String, ? extends Object> context) { - // * String productId -- Parent (virtual) product ID - // * String feature -- Distinct feature name //TODO This service has not yet been implemented. return ServiceUtil.returnFailure(); } @@ -151,7 +146,6 @@ public class ProductServices { * Finds a Set of feature types in sequence. */ public static Map<String, Object> prodFindFeatureTypes(DispatchContext dctx, Map<String, ? extends Object> context) { - // * String productId -- Product ID to look up feature types Delegator delegator = dctx.getDelegator(); String productId = (String) context.get("productId"); String productFeatureApplTypeId = (String) context.get("productFeatureApplTypeId"); @@ -167,7 +161,6 @@ public class ProductServices { for (GenericValue v: features) { featureSet.add(v.getString("productFeatureTypeId")); } - //if (Debug.infoOn()) Debug.logInfo("" + featureSet, module); } catch (GenericEntityException e) { Map<String, String> messageMap = UtilMisc.toMap("errProductFeatures", e.toString()); errMsg = UtilProperties.getMessage(resourceError,"productservices.problem_reading_product_features_errors", messageMap, locale); @@ -179,7 +172,6 @@ public class ProductServices { errMsg = UtilProperties.getMessage(resourceError,"productservices.problem_reading_product_features", locale); // ToDo DO 2004-02-23 Where should the errMsg go? Debug.logWarning(errMsg + " for product " + productId, module); - //return ServiceUtil.returnError(errMsg); } Map<String, Object> result = ServiceUtil.returnSuccess(); result.put("featureSet", featureSet); @@ -190,10 +182,6 @@ public class ProductServices { * Builds a variant feature tree. */ public static Map<String, Object> prodMakeFeatureTree(DispatchContext dctx, Map<String, ? extends Object> context) { - // * String productId -- Parent (virtual) product ID - // * List featureOrder -- Order of features - // * Boolean checkInventory-- To calculate available inventory. - // * String productStoreId -- Product Store ID for Inventory String productStoreId = (String) context.get("productStoreId"); Locale locale = (Locale) context.get("locale"); @@ -352,9 +340,6 @@ public class ProductServices { * Gets the product features of a product. */ public static Map<String, Object> prodGetFeatures(DispatchContext dctx, Map<String, ? extends Object> context) { - // * String productId -- Product ID to find - // * String type -- Type of feature (STANDARD_FEATURE, SELECTABLE_FEATURE) - // * String distinct -- Distinct feature (SIZE, COLOR) Delegator delegator = dctx.getDelegator(); Map<String, Object> result = new HashMap<String, Object>(); String productId = (String) context.get("productId"); @@ -386,7 +371,6 @@ public class ProductServices { * Finds a product by product ID. */ public static Map<String, Object> prodFindProduct(DispatchContext dctx, Map<String, ? extends Object> context) { - // * String productId -- Product ID to find Delegator delegator = dctx.getDelegator(); Map<String, Object> result = new HashMap<String, Object>(); String productId = (String) context.get("productId"); @@ -407,15 +391,10 @@ public class ProductServices { if (product.get("isVariant") != null && product.getString("isVariant").equalsIgnoreCase("Y")) { 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); if (c.size() > 0) { GenericValue asV = c.iterator().next(); - - //if (Debug.infoOn()) Debug.logInfo("ASV: " + asV, module); mainProduct = asV.getRelatedOne("MainProduct", true); - //if (Debug.infoOn()) Debug.logInfo("Main product = " + mainProduct, module); } } result.put("product", mainProduct); @@ -436,8 +415,6 @@ public class ProductServices { * Finds associated products by product ID and association ID. */ public static Map<String, Object> prodFindAssociatedByType(DispatchContext dctx, Map<String, ? extends Object> context) { - // * String productId -- Current Product ID - // * String type -- Type of association (ie PRODUCT_UPGRADE, PRODUCT_COMPLEMENT, PRODUCT_VARIANT) Delegator delegator = dctx.getDelegator(); Map<String, Object> result = new HashMap<String, Object>(); String productId = (String) context.get("productId"); @@ -548,7 +525,6 @@ public class ProductServices { // Builds a product feature tree private static Map<String, Object> makeGroup(Delegator delegator, Map<String, List<String>> featureList, List<String> items, List<String> order, int index) throws IllegalArgumentException, IllegalStateException { - //List featureKey = new LinkedList(); Map<String, List<String>> tempGroup = new HashMap<String, List<String>>(); Map<String, Object> group = new LinkedHashMap<String, Object>(); String orderKey = order.get(index); @@ -621,7 +597,6 @@ public class ProductServices { // no groups; no tree if (group.size() == 0) { return group; - //throw new IllegalStateException("Cannot create tree from group list; error on '" + orderKey + "'"); } if (index + 1 == order.size()) { @@ -637,7 +612,6 @@ public class ProductServices { group.put(key, subGroup); } else { // do nothing, ie put nothing in the Map - //throw new IllegalStateException("Cannot create tree from an empty list; error on '" + key + "'"); } } return group; Modified: ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductUtilServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductUtilServices.java?rev=1761181&r1=1761180&r2=1761181&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductUtilServices.java (original) +++ ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductUtilServices.java Sat Sep 17 10:34:57 2016 @@ -236,16 +236,13 @@ public final class ProductUtilServices { DynamicViewEntity dve = new DynamicViewEntity(); dve.addMemberEntity("PVIRT", "Product"); dve.addMemberEntity("PVA", "ProductAssoc"); - //dve.addMemberEntity("PVAR", "Product"); dve.addViewLink("PVIRT", "PVA", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("productId", "productId"))); - //dve.addViewLink("PVA", "PVAR", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("productIdTo", "productId"))); dve.addAlias("PVIRT", "productId", null, null, null, Boolean.TRUE, null); dve.addAlias("PVIRT", "salesDiscontinuationDate", null, null, null, null, null); dve.addAlias("PVA", "productAssocTypeId", null, null, null, null, null); dve.addAlias("PVA", "fromDate", null, null, null, null, null); dve.addAlias("PVA", "thruDate", null, null, null, null, null); dve.addAlias("PVA", "productIdToCount", "productIdTo", null, null, null, "count-distinct"); - //dve.addAlias("PVAR", "variantProductId", "productId", null, null, null, null); try { EntityCondition condition = EntityCondition.makeCondition(UtilMisc.toList( @@ -271,9 +268,6 @@ public final class ProductUtilServices { if (paList.size() != 1) { Debug.logInfo("Virtual product with ID " + productId + " should have 1 assoc, has " + paList.size(), module); } else { - //if (numWithOneOnly < 100) { - // Debug.logInfo("Virtual product ID to make stand-alone: " + productId, module); - //} // for all virtuals with one variant move all info from virtual to variant and remove virtual, make variant as not a variant dispatcher.runSync("mergeVirtualWithSingleVariant", UtilMisc.<String, Object>toMap("productId", productId, "removeOld", Boolean.TRUE, "userLogin", userLogin)); @@ -462,7 +456,6 @@ public final class ProductUtilServices { if (modelEntity.isField("fromDate")) { GenericPK findValue = newRelatedValue.getPrimaryKey(); // can't just set to null, need to remove the value so it isn't a constraint in the query - //findValue.set("fromDate", null); findValue.remove("fromDate"); List<GenericValue> existingValueList = EntityQuery.use(delegator).from(relatedEntityName).where(findValue).filterByDate(nowTimestamp).queryList(); if (existingValueList.size() > 0) { @@ -594,28 +587,6 @@ public final class ProductUtilServices { return ServiceUtil.returnSuccess(); } - // set category descriptions from longDescriptions - /* -allCategories = delegator.findList("ProductCategory", null, null, null, null, false); -allCatIter = allCategories.iterator(); -while (allCatIter.hasNext()) { - cat = allCatIter.next(); - if (UtilValidate.isEmpty(cat.getString("description"))) { - StringBuilder description = new StringBuilder(cat.getString("longDescription").toLowerCase()); - description.setCharAt(0, Character.toUpperCase(description.charAt(0))); - for (int i=0; i<description.length() - 1; i++) { - if (description.charAt(i) == ' ') { - description.setCharAt(i+1, Character.toUpperCase(description.charAt(i+1))); - } - } - Debug.logInfo("new description: " + description, "ctc.bsh"); - cat.put("description", description.toString()); - cat.store(); - } -} - */ - - public static Map<String, Object> attachProductFeaturesToCategory(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); Modified: ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java?rev=1761181&r1=1761180&r2=1761181&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java (original) +++ ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java Sat Sep 17 10:34:57 2016 @@ -291,7 +291,6 @@ public final class ProductWorker { Set<GenericValue> distFeatures = new HashSet<GenericValue>(); List<GenericValue> variantDistinguishingFeatures = EntityQuery.use(delegator).from("ProductFeatureAndAppl").where("productId", variantProduct.get("productId"), "productFeatureApplTypeId", "DISTINGUISHING_FEAT").cache(true).queryList(); - // Debug.logInfo("Found variantDistinguishingFeatures: " + variantDistinguishingFeatures, module); for (GenericValue variantDistinguishingFeature: EntityUtil.filterByDate(variantDistinguishingFeatures)) { GenericValue dummyFeature = delegator.makeValue("ProductFeature"); @@ -300,7 +299,6 @@ public final class ProductWorker { } List<GenericValue> virtualSelectableFeatures = EntityQuery.use(delegator).from("ProductFeatureAndAppl").where("productId", virtualProductId, "productFeatureApplTypeId", "SELECTABLE_FEATURE").cache(true).queryList(); - // Debug.logInfo("Found virtualSelectableFeatures: " + virtualSelectableFeatures, module); Set<String> virtualSelectableFeatureIds = new HashSet<String>(); for (GenericValue virtualSelectableFeature: EntityUtil.filterByDate(virtualSelectableFeatures)) { @@ -308,7 +306,6 @@ public final class ProductWorker { } List<GenericValue> variantStandardFeatures = EntityQuery.use(delegator).from("ProductFeatureAndAppl").where("productId", variantProduct.get("productId"), "productFeatureApplTypeId", "STANDARD_FEATURE").cache(true).queryList(); - // Debug.logInfo("Found variantStandardFeatures: " + variantStandardFeatures, module); for (GenericValue variantStandardFeature: EntityUtil.filterByDate(variantStandardFeatures)) { if (virtualSelectableFeatureIds.contains(variantStandardFeature.get("productFeatureId"))) { @@ -332,8 +329,6 @@ public final class ProductWorker { if ("Y".equals(alternativeOptionProduct.getString("isVariant"))) { Set<GenericValue> distFeatures = getVariantDistinguishingFeatures(alternativeOptionProduct); if (UtilValidate.isNotEmpty(distFeatures)) { - // Debug.logInfo("Found distinguishing features: " + distFeatures, module); - StringBuilder nameBuf = new StringBuilder(); for (GenericValue productFeature: distFeatures) { if (nameBuf.length() > 0) { @@ -352,7 +347,6 @@ public final class ProductWorker { // got to here, default to PRODUCT_NAME String alternativeProductName = ProductContentWrapper.getProductContentAsText(alternativeOptionProduct, "PRODUCT_NAME", locale, dispatcher, "html"); - // Debug.logInfo("Using PRODUCT_NAME: " + alternativeProductName, module); return alternativeProductName; } } catch (GenericEntityException e) { @@ -436,8 +430,6 @@ public final class ProductWorker { List <List<Map<String,String>>> featureTypeFeatures = new LinkedList<List<Map<String,String>>>(); try { Delegator delegator = product.getDelegator(); - //List<GenericValue> features = delegator.findByAnd("ProductFeatureAndAppl", fields, order, true); - //List<GenericValue> featuresSorted = EntityUtil.orderBy(features, order); List<GenericValue> featuresSorted = EntityQuery.use(delegator) .from("ProductFeatureAndAppl") .where("productId", product.getString("productId"), "productFeatureApplTypeId", "SELECTABLE_FEATURE") @@ -1052,7 +1044,6 @@ public final class ProductWorker { } } // find variant - // Debug.logInfo("=====try to find variant for product: " + productId + " and features: " + selectedFeatures); List<GenericValue> productAssocs = EntityQuery.use(delegator).from("ProductAssoc").where("productId", productId, "productAssocTypeId","PRODUCT_VARIANT").filterByDate().queryList(); boolean productFound = false; nextProd: @@ -1067,8 +1058,6 @@ nextProd: variantProductId = productAssoc.getString("productIdTo"); break; } -// if (productFound) -// Debug.logInfo("=====product found:" + productId + " and features: " + selectedFeatures); /** * 1. variant not found so create new variant product and use the virtual product as basis, new one is a variant type and not a virtual type. Modified: ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreWorker.java?rev=1761181&r1=1761180&r2=1761181&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreWorker.java (original) +++ ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreWorker.java Sat Sep 17 10:34:57 2016 @@ -278,12 +278,10 @@ public final class ProductStoreWorker { BigDecimal maxWeight = method.getBigDecimal("maxWeight"); if (minWeight != null && minWeight.compareTo(BigDecimal.ZERO) > 0 && minWeight.compareTo(weight) > 0) { returnShippingMethods.remove(method); - //Debug.logInfo("Removed shipping method due to not enough weight", module); continue; } if (maxWeight != null && maxWeight.compareTo(BigDecimal.ZERO) > 0 && maxWeight.compareTo(weight) < 0) { returnShippingMethods.remove(method); - //Debug.logInfo("Removed shipping method due to too much weight", module); continue; } @@ -292,12 +290,10 @@ public final class ProductStoreWorker { BigDecimal maxTotal = method.getBigDecimal("maxTotal"); if (minTotal != null && minTotal.compareTo(BigDecimal.ZERO) > 0 && minTotal.compareTo(orderTotal) > 0) { returnShippingMethods.remove(method); - //Debug.logInfo("Removed shipping method due to not enough order total", module); continue; } if (maxTotal != null && maxTotal.compareTo(BigDecimal.ZERO) > 0 && maxTotal.compareTo(orderTotal) < 0) { returnShippingMethods.remove(method); - //Debug.logInfo("Removed shipping method due to too much shipping total", module); continue; } @@ -316,7 +312,6 @@ public final class ProductStoreWorker { } if (!allMatch) { returnShippingMethods.remove(method); - //Debug.logInfo("Removed shipping method because not all products are less then min size", module); continue; } } @@ -332,7 +327,6 @@ public final class ProductStoreWorker { } if (!allMatch) { returnShippingMethods.remove(method); - //Debug.logInfo("Removed shipping method because one or more products were more then max size", module); continue; } } @@ -343,12 +337,10 @@ public final class ProductStoreWorker { boolean isUspsAddress = ContactMechWorker.isUspsAddress(shippingAddress); if ("N".equals(allowUspsAddr) && isUspsAddress) { returnShippingMethods.remove(method); - //Debug.logInfo("Remove shipping method due to USPS address", module); continue; } if ("Y".equals(requireUspsAddr) && !isUspsAddress) { returnShippingMethods.remove(method); - //Debug.logInfo("Removed shipping method due to NON-USPS address", module); continue; } @@ -359,12 +351,10 @@ public final class ProductStoreWorker { boolean isCompanyAddress = ContactMechWorker.isCompanyAddress(shippingAddress, companyPartyId); if ("N".equals(allowCompanyAddr) && isCompanyAddress) { returnShippingMethods.remove(method); - //Debug.logInfo("Removed shipping method due to Company address", module); continue; } if ("Y".equals(requireCompanyAddr) && !isCompanyAddress) { returnShippingMethods.remove(method); - //Debug.logInfo("Removed shipping method due to NON-Company address", module); continue; } @@ -373,7 +363,6 @@ public final class ProductStoreWorker { if (includeFreeShipping != null && "N".equalsIgnoreCase(includeFreeShipping)) { if (UtilValidate.isEmpty(itemSizes) && orderTotal.compareTo(BigDecimal.ZERO) == 0) { returnShippingMethods.remove(method); - //Debug.logInfo("Removed shipping method due to all items being exempt from shipping", module); continue; } } @@ -384,7 +373,6 @@ public final class ProductStoreWorker { if (UtilValidate.isNotEmpty(includeGeoId) || UtilValidate.isNotEmpty(excludeGeoId)) { if (shippingAddress == null) { returnShippingMethods.remove(method); - //Debug.logInfo("Removed shipping method due to empty shipping adresss (may not have been selected yet)", module); continue; } } @@ -395,7 +383,6 @@ public final class ProductStoreWorker { !GeoWorker.containsGeo(includeGeoGroup, shippingAddress.getString("postalCodeGeoId"), delegator)) { // not in required included geos returnShippingMethods.remove(method); - //Debug.logInfo("Removed shipping method due to being outside the included GEO", module); continue; } } @@ -406,7 +393,6 @@ public final class ProductStoreWorker { GeoWorker.containsGeo(excludeGeoGroup, shippingAddress.getString("postalCodeGeoId"), delegator)) { // in excluded geos returnShippingMethods.remove(method); - //Debug.logInfo("Removed shipping method due to being inside the excluded GEO", module); continue; } } @@ -431,7 +417,6 @@ public final class ProductStoreWorker { } if (!foundOne) { returnShippingMethods.remove(method); - //Debug.logInfo("Removed shipping method due to no required features found", module); continue; } } @@ -447,7 +432,6 @@ public final class ProductStoreWorker { for (GenericValue appl: excludedFeatures) { if (featureIdMap.containsKey(appl.getString("productFeatureId"))) { returnShippingMethods.remove(method); - //Debug.logInfo("Removed shipping method due to an exluded feature being found : " + appl.getString("productFeatureId"), module); continue; } } Modified: ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java?rev=1761181&r1=1761180&r2=1761181&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java (original) +++ ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java Sat Sep 17 10:34:57 2016 @@ -622,8 +622,6 @@ public class PackingSession implements j public String complete(boolean force) throws GeneralException { // clear out empty lines - // this.checkEmptyLines(); // removing, this seems to be causeing issues - mja - // check to see if there is anything to process if (this.getLines().size() == 0) { return "EMPTY"; Modified: ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java?rev=1761181&r1=1761180&r2=1761181&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java (original) +++ ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java Sat Sep 17 10:34:57 2016 @@ -154,29 +154,6 @@ public class ShipmentServices { "ProductShipmentCostEstimateRemoveError", UtilMisc.toMap("errorString", e.toString()), locale)); } - /* Commented out this code because QuantityBreak may be used by other records - try { - if (estimate.get("weightBreakId") != null) { - delegator.removeRelated("WeightQuantityBreak", estimate); - } - } catch (GenericEntityException e) { - Debug.logInfo("Not removing WeightQuantityBreak records related to ShipmentCostEstimate [" + shipmentCostEstimateId + "] because they are used by other entities.", module); - } - try { - if (estimate.get("quantityBreakId") != null) { - delegator.removeRelated("QuantityQuantityBreak", estimate); - } - } catch (GenericEntityException e) { - Debug.logInfo("Not removing QuantityQuantityBreak records related to ShipmentCostEstimate [" + shipmentCostEstimateId + "] because they are used by other entities.", module); - } - try { - if (estimate.get("priceBreakId") != null) { - delegator.removeRelated("PriceQuantityBreak", estimate); - } - } catch (GenericEntityException e) { - Debug.logInfo("Not removing PriceQuantityBreak records related to ShipmentCostEstimate [" + shipmentCostEstimateId + "] because they are used by other entities.", module); - } - */ return ServiceUtil.returnSuccess(); } @@ -236,9 +213,6 @@ public class ShipmentServices { String shippingCountryCode = (String) context.get("shippingCountryCode"); List<Map<String, Object>> shippableItemInfo = UtilGenerics.checkList(context.get("shippableItemInfo")); - //Map shippableFeatureMap = (Map) context.get("shippableFeatureMap"); - //List shippableItemSizes = (List) context.get("shippableItemSizes"); - BigDecimal shippableTotal = (BigDecimal) context.get("shippableTotal"); BigDecimal shippableQuantity = (BigDecimal) context.get("shippableQuantity"); BigDecimal shippableWeight = (BigDecimal) context.get("shippableWeight"); @@ -333,12 +307,6 @@ public class ShipmentServices { GeoWorker.containsGeo(toGeoList, shipAddress.getString("stateProvinceGeoId"), delegator) || GeoWorker.containsGeo(toGeoList, shipAddress.getString("postalCodeGeoId"), delegator)) { - /* - if (toGeo == null || toGeo.equals("") || toGeo.equals(shipAddress.getString("countryGeoId")) || - toGeo.equals(shipAddress.getString("stateProvinceGeoId")) || - toGeo.equals(shipAddress.getString("postalCodeGeoId"))) { - */ - GenericValue wv = null; GenericValue qv = null; GenericValue pv = null; @@ -468,7 +436,6 @@ public class ShipmentServices { if (estimateList.size() > 1) { TreeMap<Integer, GenericValue> estimatePriority = new TreeMap<Integer, GenericValue>(); - //int estimatePriority[] = new int[estimateList.size()]; for (GenericValue currentEstimate: estimateList) { int prioritySum = 0; @@ -503,8 +470,6 @@ public class ShipmentServices { // Grab the estimate and work with it. GenericValue estimate = estimateList.get(estimateIndex); - //Debug.logInfo("[ShippingEvents.getShipEstimate] Working with estimate [" + estimateIndex + "]: " + estimate, module); - // flat fees BigDecimal orderFlat = BigDecimal.ZERO; if (estimate.getBigDecimal("orderFlatPrice") != null) { @@ -677,10 +642,6 @@ public class ShipmentServices { // to store list List<GenericValue> toStore = new LinkedList<GenericValue>(); - //String shipGroupSeqId = shipment.getString("primaryShipGroupSeqId"); - //String orderId = shipment.getString("primaryOrderId"); - //String orderInfoKey = orderId + "/" + shipGroupSeqId; - // make the staging records GenericValue stageShip = delegator.makeValue("OdbcShipmentOut"); stageShip.set("shipmentId", shipment.get("shipmentId")); Modified: ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java?rev=1761181&r1=1761180&r2=1761181&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java (original) +++ ofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java Sat Sep 17 10:34:57 2016 @@ -327,7 +327,6 @@ public class DhlServices { } // handle Response element info Element responseElement = UtilXml.firstChildElement(rateResponseElement, "Shipment"); - //Element responseResultElement = UtilXml.firstChildElement(responseElement, "Result"); Element responseEstimateDetailElement = UtilXml.firstChildElement(responseElement, "EstimateDetail"); DhlServices.handleErrors(responseElement, errorList, locale); @@ -335,11 +334,6 @@ public class DhlServices { return ServiceUtil.returnError(errorList); } - /* - String responseStatusCode = UtilXml.childElementValue(responseResultElement, "Code"); - String responseStatusDescription = UtilXml.childElementValue(responseResultElement, "Desc"); - */ - String dateGenerated = UtilXml.childElementValue( responseEstimateDetailElement, "DateGenerated"); @@ -484,18 +478,11 @@ public class DhlServices { } // handle Response element info Element responseElement = UtilXml.firstChildElement(registerResponseElement, "Register"); - //Element responseResultElement = UtilXml.firstChildElement(responseElement, "Result"); - DhlServices.handleErrors(responseElement, errorList, locale); if (UtilValidate.isNotEmpty(errorList)) { return ServiceUtil.returnError(errorList); } - //String responseStatusCode = UtilXml.childElementValue(responseResultElement, "Code"); - //String responseStatusDescription = UtilXml.childElementValue(responseResultElement, "Desc"); - String responseShippingKey = UtilXml.childElementValue(responseElement,"ShippingKey"); - //String responsePostalCode = UtilXml.childElementValue(responseElement,"PostalCode"); - Map<String, Object> result = ServiceUtil.returnSuccess(); result.put("shippingKey", responseShippingKey); return result; @@ -650,22 +637,9 @@ public class DhlServices { for (GenericValue shipmentPackageRouteSeg: shipmentPackageRouteSegs) { GenericValue shipmentPackage = shipmentPackageRouteSeg.getRelatedOne("ShipmentPackage", false); GenericValue shipmentBoxType = shipmentPackage.getRelatedOne("ShipmentBoxType", false); - /* - List<GenericValue> carrierShipmentBoxTypes = shipmentPackage.getRelated("CarrierShipmentBoxType", UtilMisc.toMap("partyId", "DHL"), null, false); - GenericValue carrierShipmentBoxType = null; - if (carrierShipmentBoxTypes.size() > 0) { - carrierShipmentBoxType = carrierShipmentBoxTypes.get(0); - } - */ - // TODO: determine what default UoM is (assuming inches) - there should be a defaultDimensionUomId in Facility if (shipmentBoxType != null) { - /* - GenericValue dimensionUom = shipmentBoxType.getRelatedOne("DimensionUom", false); - String length = shipmentBoxType.get("boxLength").toString(); - String width = shipmentBoxType.get("boxWidth").toString(); - String height = shipmentBoxType.get("boxHeight").toString(); - */ + // TODO: determine what default UoM is (assuming inches) - there should be a defaultDimensionUomId in Facility } // next step is weight determination, so skip if we have a billing weight @@ -890,18 +864,6 @@ public class DhlServices { "FacilityShipmentDhlShipmentConfirmed", locale)); } - /* - private static BigDecimal getWeight(List<Map<String, Object>> shippableItemInfo) { - BigDecimal totalWeight = BigDecimal.ZERO; - if (shippableItemInfo != null) { - for (Map<String, Object> itemInfo: shippableItemInfo) { - BigDecimal weight = ((BigDecimal) itemInfo.get("weight")); - totalWeight = totalWeight.add(weight); - } - } - return totalWeight; - } - */ public static Document createAccessRequestDocument(Delegator delegator, String shipmentGatewayConfigId, String resource) { Document eCommerceRequestDocument = UtilXml.makeEmptyXmlDocument("eCommerce");