You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mb...@apache.org on 2017/12/16 13:56:19 UTC

svn commit: r1818406 [1/2] - /ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/

Author: mbrohl
Date: Sat Dec 16 13:56:19 2017
New Revision: 1818406

URL: http://svn.apache.org/viewvc?rev=1818406&view=rev
Log:
Improved: General refactoring and code improvements, package 
org.apache.ofbiz.product.product.
(OFBIZ-10073)

Thanks Julian Leichert for reporting and providing the patches.

Modified:
    ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/KeywordIndex.java
    ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductContentWrapper.java
    ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java
    ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductPromoContentWrapper.java
    ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearch.java
    ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchEvents.java
    ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java
    ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java
    ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductUtilServices.java
    ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java

Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/KeywordIndex.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/KeywordIndex.java?rev=1818406&r1=1818405&r2=1818406&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/KeywordIndex.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/KeywordIndex.java Sat Dec 16 13:56:19 2017
@@ -57,7 +57,9 @@ public class KeywordIndex {
     }
 
     public static void indexKeywords(GenericValue product, boolean doAll) throws GenericEntityException {
-        if (product == null) return;
+        if (product == null) {
+            return;
+        }
         Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
         Delegator delegator = product.getDelegator();
         if (!doAll) {
@@ -73,8 +75,10 @@ public class KeywordIndex {
                 return;
             }
         }
-        
-        if (delegator == null) return;
+
+        if (delegator == null) {
+            return;
+        }
         String productId = product.getString("productId");
 
         // get these in advance just once since they will be used many times for the multiple strings to index
@@ -84,8 +88,8 @@ public class KeywordIndex {
         boolean removeStems = KeywordSearchUtil.getRemoveStems();
         Set<String> stemSet = KeywordSearchUtil.getStemSet();
 
-        Map<String, Long> keywords = new TreeMap<String, Long>();
-        List<String> strings = new LinkedList<String>();
+        Map<String, Long> keywords = new TreeMap<>();
+        List<String> strings = new LinkedList<>();
 
         int pidWeight = 1;
         try {
@@ -189,7 +193,7 @@ public class KeywordIndex {
             }
         }
 
-        List<GenericValue> toBeStored = new LinkedList<GenericValue>();
+        List<GenericValue> toBeStored = new LinkedList<>();
         int keywordMaxLength = EntityUtilProperties.getPropertyAsInteger("prodsearch", "product.keyword.max.length", 0).intValue();
         for (Map.Entry<String, Long> entry: keywords.entrySet()) {
             if (entry.getKey().length() <= keywordMaxLength) {
@@ -198,7 +202,9 @@ public class KeywordIndex {
             }
         }
         if (toBeStored.size() > 0) {
-            if (Debug.verboseOn()) Debug.logVerbose("[KeywordIndex.indexKeywords] Storing " + toBeStored.size() + " keywords for productId " + product.getString("productId"), module);
+            if (Debug.verboseOn()) {
+                Debug.logVerbose("[KeywordIndex.indexKeywords] Storing " + toBeStored.size() + " keywords for productId " + product.getString("productId"), module);
+            }
 
             if ("true".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.delete.on_index", "false", delegator))) {
                 // delete all keywords if the properties file says to
@@ -216,9 +222,7 @@ public class KeywordIndex {
             for (int i = 0; i < weight; i++) {
                 strings.add(contentText);
             }
-        } catch (IOException e1) {
-            Debug.logError(e1, "Error getting content text to index", module);
-        } catch (GeneralException e1) {
+        } catch (GeneralException | IOException e1) {
             Debug.logError(e1, "Error getting content text to index", module);
         }
     }

Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductContentWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductContentWrapper.java?rev=1818406&r1=1818405&r2=1818406&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductContentWrapper.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductContentWrapper.java Sat Dec 16 13:56:19 2017
@@ -80,6 +80,7 @@ public class ProductContentWrapper imple
         this.mimeTypeId = EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", (Delegator) request.getAttribute("delegator"));
     }
 
+    @Override
     public StringUtil.StringWrapper get(String productContentTypeId, String encoderType) {
         if (this.product == null) {
             Debug.logWarning("Tried to get ProductContent for type [" + productContentTypeId + "] but the product field in the ProductContentWrapper is null", module);
@@ -98,7 +99,7 @@ public class ProductContentWrapper imple
         return getProductContentAsText(product, productContentTypeId, locale, null, null, null, null, dispatcher, encoderType);
     }
 
-    public static String getProductContentAsText(GenericValue product, String productContentTypeId, Locale locale, String mimeTypeId, String partyId, 
+    public static String getProductContentAsText(GenericValue product, String productContentTypeId, Locale locale, String mimeTypeId, String partyId,
             String roleTypeId, Delegator delegator, LocalDispatcher dispatcher, String encoderType) {
         if (product == null) {
             return null;
@@ -126,11 +127,7 @@ public class ProductContentWrapper imple
             outString = encoder.sanitize(outString, null);
             productContentCache.put(cacheKey, outString);
             return outString;
-        } catch (GeneralException e) {
-            Debug.logError(e, "Error rendering ProductContent, inserting empty String", module);
-            String candidateOut = product.getModelEntity().isField(candidateFieldName) ? product.getString(candidateFieldName): "";
-            return candidateOut == null? "" : encoder.sanitize(candidateOut, null);
-        } catch (IOException e) {
+        } catch (GeneralException | IOException e) {
             Debug.logError(e, "Error rendering ProductContent, inserting empty String", module);
             String candidateOut = product.getModelEntity().isField(candidateFieldName) ? product.getString(candidateFieldName): "";
             return candidateOut == null? "" : encoder.sanitize(candidateOut, null);
@@ -168,7 +165,7 @@ public class ProductContentWrapper imple
         GenericValue productContent = EntityUtil.getFirst(productContentList);
         if (productContent != null) {
             // when rendering the product content, always include the Product and ProductContent records that this comes from
-            Map<String, Object> inContext = new HashMap<String, Object>();
+            Map<String, Object> inContext = new HashMap<>();
             inContext.put("product", product);
             inContext.put("productContent", productContent);
             ContentWorker.renderContentAsText(dispatcher, productContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, partyId, roleTypeId, cache);
@@ -184,7 +181,7 @@ public class ProductContentWrapper imple
             Debug.logWarning("No Product entity found for productId: " + productId, module);
             return;
         }
-        
+
         if (productModel.isField(candidateFieldName)) {
                 String candidateValue = product.getString(candidateFieldName);
                 if (UtilValidate.isNotEmpty(candidateValue)) {

Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java?rev=1818406&r1=1818405&r2=1818406&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java Sat Dec 16 13:56:19 2017
@@ -95,7 +95,7 @@ public class ProductEvents {
 
         EntityCondition condition = null;
         if (!"Y".equals(doAll)) {
-            List<EntityCondition> condList = new LinkedList<EntityCondition>();
+            List<EntityCondition> condList = new LinkedList<>();
             condList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("autoCreateKeywords", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("autoCreateKeywords", EntityOperator.NOT_EQUAL, "N")));
             if ("true".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.ignore.variants", delegator))) {
                 condList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("isVariant", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("isVariant", EntityOperator.NOT_EQUAL, "Y")));
@@ -193,7 +193,7 @@ public class ProductEvents {
      */
     public static String updateProductAssoc(HttpServletRequest request, HttpServletResponse response) {
         String errMsg = "";
-        List<Object> errMsgList = new LinkedList<Object>();
+        List<Object> errMsgList = new LinkedList<>();
         Delegator delegator = (Delegator) request.getAttribute("delegator");
         Security security = (Security) request.getAttribute("security");
 
@@ -241,15 +241,19 @@ public class ProductEvents {
                 errMsgList.add("From Date not formatted correctly.");
             }
         }
-        if (UtilValidate.isEmpty(productId))
+        if (UtilValidate.isEmpty(productId)) {
             errMsgList.add(UtilProperties.getMessage(resource,"productevents.product_ID_missing", UtilHttp.getLocale(request)));
-        if (UtilValidate.isEmpty(productIdTo))
+        }
+        if (UtilValidate.isEmpty(productIdTo)) {
             errMsgList.add(UtilProperties.getMessage(resource,"productevents.product_ID_To_missing", UtilHttp.getLocale(request)));
-        if (UtilValidate.isEmpty(productAssocTypeId))
+        }
+        if (UtilValidate.isEmpty(productAssocTypeId)) {
             errMsgList.add(UtilProperties.getMessage(resource,"productevents.association_type_ID_missing", UtilHttp.getLocale(request)));
+        }
         // from date is only required if update mode is not CREATE
-        if (!"CREATE".equals(updateMode) && UtilValidate.isEmpty(fromDateStr))
+        if (!"CREATE".equals(updateMode) && UtilValidate.isEmpty(fromDateStr)) {
             errMsgList.add(UtilProperties.getMessage(resource,"productevents.from_date_missing", UtilHttp.getLocale(request)));
+        }
         if (errMsgList.size() > 0) {
             request.setAttribute("_ERROR_MESSAGE_LIST_", errMsgList);
             return "error";
@@ -615,7 +619,7 @@ public class ProductEvents {
                             description = null;
                         }
 
-                        Set<String> variantDescRemoveToRemoveOnVirtual = new HashSet<String>();
+                        Set<String> variantDescRemoveToRemoveOnVirtual = new HashSet<>();
                         checkUpdateFeatureApplByDescription(variantProductId, variantProduct, description, productFeatureTypeId, productFeatureType, "STANDARD_FEATURE", nowTimestamp, delegator, null, variantDescRemoveToRemoveOnVirtual);
                         checkUpdateFeatureApplByDescription(productId, product, description, productFeatureTypeId, productFeatureType, "SELECTABLE_FEATURE", nowTimestamp, delegator, variantDescRemoveToRemoveOnVirtual, null);
 
@@ -658,7 +662,7 @@ public class ProductEvents {
 
         GenericValue productFeatureAndAppl = null;
 
-        Set<String> descriptionsForThisType = new HashSet<String>();
+        Set<String> descriptionsForThisType = new HashSet<>();
         List<GenericValue> productFeatureAndApplList = EntityQuery.use(delegator).from("ProductFeatureAndAppl").where("productId", productId, "productFeatureApplTypeId", productFeatureApplTypeId, "productFeatureTypeId", productFeatureTypeId).filterByDate().queryList();
         if (productFeatureAndApplList.size() > 0) {
             Iterator<GenericValue> productFeatureAndApplIter = productFeatureAndApplList.iterator();
@@ -918,7 +922,7 @@ public class ProductEvents {
             if (localeStr == null && productStore.get("defaultLocaleString") != null) {
                 localeStr = productStore.getString("defaultLocaleString");
             }
-            
+
             // if timezone is not set, the store's default timezone is used
             if (timeZoneStr == null && productStore.get("defaultTimeZoneString") != null) {
                 timeZoneStr = productStore.getString("defaultTimeZoneString");
@@ -1009,7 +1013,7 @@ public class ProductEvents {
         paramMap.put("locale", UtilHttp.getLocale(request));
         paramMap.put("userLogin", session.getAttribute("userLogin"));
 
-        Map<String, Object> context = new HashMap<String, Object>();
+        Map<String, Object> context = new HashMap<>();
         context.put("bodyScreenUri", bodyScreenLocation);
         context.put("bodyParameters", paramMap);
         context.put("sendTo", paramMap.get("sendTo"));
@@ -1049,10 +1053,10 @@ public class ProductEvents {
         Object compareListObj = session.getAttribute("productCompareList");
         List<GenericValue> compareList = null;
         if (compareListObj == null) {
-            compareList = new LinkedList<GenericValue>();
+            compareList = new LinkedList<>();
         } else if (!(compareListObj instanceof List<?>)) {
             Debug.logWarning("Session attribute productCompareList contains something other than the expected product list, overwriting.", module);
-            compareList = new LinkedList<GenericValue>();
+            compareList = new LinkedList<>();
         } else {
             compareList = UtilGenerics.cast(compareListObj);
         }
@@ -1159,7 +1163,7 @@ public class ProductEvents {
         }
         return new BigDecimal(bigDecimalString);
     }
-    
+
     /** Event add product tags */
     public static String addProductTags (HttpServletRequest request, HttpServletResponse response) {
         Delegator delegator = (Delegator) request.getAttribute("delegator");
@@ -1168,13 +1172,13 @@ public class ProductEvents {
         String productTags = request.getParameter("productTags");
         String statusId = request.getParameter("statusId");
         if (UtilValidate.isNotEmpty(productId) && UtilValidate.isNotEmpty(productTags)) {
-            List<String> matchList = new LinkedList<String>();
+            List<String> matchList = new LinkedList<>();
             Pattern regex = Pattern.compile("[^\\s\"']+|\"([^\"]*)\"|'([^']*)'");
             Matcher regexMatcher = regex.matcher(productTags);
             while (regexMatcher.find()) {
                 matchList.add(regexMatcher.group().replace("'", ""));
             }
-            
+
             GenericValue userLogin = null;
             try {
                 userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne();
@@ -1182,11 +1186,11 @@ public class ProductEvents {
                 request.setAttribute("_ERROR_MESSAGE_", e.getMessage());
                 return "error";
             }
-            
+
             if(UtilValidate.isEmpty(statusId)) {
                 statusId = "KW_PENDING";
             }
-            
+
             if(UtilValidate.isNotEmpty(matchList)) {
                 for (String keywordStr : matchList) {
                     try {

Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductPromoContentWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductPromoContentWrapper.java?rev=1818406&r1=1818405&r2=1818406&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductPromoContentWrapper.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductPromoContentWrapper.java Sat Dec 16 13:56:19 2017
@@ -84,6 +84,7 @@ public class ProductPromoContentWrapper
         this.mimeTypeId = EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", (Delegator) request.getAttribute("delegator"));
     }
 
+    @Override
     public StringUtil.StringWrapper get(String productPromoContentTypeId, String encoderType) {
         if (UtilValidate.isEmpty(this.productPromo)) {
             Debug.logWarning("Tried to get ProductPromoContent for type [" + productPromoContentTypeId + "] but the productPromo field in the ProductPromoContentWrapper is null", module);
@@ -95,8 +96,8 @@ public class ProductPromoContentWrapper
     public static String getProductPromoContentAsText(GenericValue productPromo, String productPromoContentTypeId, HttpServletRequest request, String encoderType) {
         LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
         Delegator delegator = (Delegator) request.getAttribute("delegator");
-        return getProductPromoContentAsText(productPromo, productPromoContentTypeId, UtilHttp.getLocale(request), 
-                EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", delegator), 
+        return getProductPromoContentAsText(productPromo, productPromoContentTypeId, UtilHttp.getLocale(request),
+                EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", delegator),
                 null, null, productPromo.getDelegator(), dispatcher, encoderType);
     }
 
@@ -131,11 +132,7 @@ public class ProductPromoContentWrapper
             outString = encoder.sanitize(outString, null);
             productPromoContentCache.put(cacheKey, outString);
             return outString;
-        } catch (GeneralException e) {
-            Debug.logError(e, "Error rendering ProductPromoContent, inserting empty String", module);
-            String candidateOut = productPromo.getModelEntity().isField(candidateFieldName) ? productPromo.getString(candidateFieldName): "";
-            return candidateOut == null? "" : encoder.sanitize(candidateOut, null);
-        } catch (IOException e) {
+        } catch (GeneralException | IOException e) {
             Debug.logError(e, "Error rendering ProductPromoContent, inserting empty String", module);
             String candidateOut = productPromo.getModelEntity().isField(candidateFieldName) ? productPromo.getString(candidateFieldName): "";
             return candidateOut == null? "" : encoder.sanitize(candidateOut, null);
@@ -163,7 +160,7 @@ public class ProductPromoContentWrapper
             throw new GeneralRuntimeException("Unable to find a delegator to use!");
         }
 
-        List<EntityExpr> exprs = new ArrayList<EntityExpr>();
+        List<EntityExpr> exprs = new ArrayList<>();
         exprs.add(EntityCondition.makeCondition("productPromoId", EntityOperator.EQUALS, productPromoId));
         exprs.add(EntityCondition.makeCondition("productPromoContentTypeId", EntityOperator.EQUALS, productPromoContentTypeId));
 
@@ -175,13 +172,13 @@ public class ProductPromoContentWrapper
 
         if (productPromoContent != null) {
             // when rendering the product promo content, always include the ProductPromo and ProductPromoContent records that this comes from
-            Map<String, Object> inContext = new HashMap<String, Object>();
+            Map<String, Object> inContext = new HashMap<>();
             inContext.put("productPromo", productPromo);
             inContext.put("productPromoContent", productPromoContent);
             ContentWorker.renderContentAsText(dispatcher, productPromoContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, partyId, roleTypeId, cache);
             return;
         }
-        
+
         String candidateFieldName = ModelUtil.dbNameToVarName(productPromoContentTypeId);
         ModelEntity productModel = delegator.getModelEntity("ProductPromo");
         if (productModel.isField(candidateFieldName)) {
@@ -193,7 +190,7 @@ public class ProductPromoContentWrapper
                 if (UtilValidate.isNotEmpty(candidateValue)) {
                     outWriter.write(candidateValue);
                     return;
-                } 
+                }
             }
         }
     }

Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearch.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearch.java?rev=1818406&r1=1818405&r2=1818406&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearch.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearch.java Sat Dec 16 13:56:19 2017
@@ -70,7 +70,7 @@ public class ProductSearch {
     public static final String resourceCommon = "CommonUiLabels";
 
     public static ArrayList<String> parametricKeywordSearch(Map<?, String> featureIdByType, String keywordsString, Delegator delegator, String productCategoryId, String visitId, boolean anyPrefix, boolean anySuffix, boolean isAnd) {
-        Set<String> featureIdSet = new HashSet<String>();
+        Set<String> featureIdSet = new HashSet<>();
         if (featureIdByType != null) {
             featureIdSet.addAll(featureIdByType.values());
         }
@@ -79,7 +79,7 @@ public class ProductSearch {
     }
 
     public static ArrayList<String> parametricKeywordSearch(Set<String> featureIdSet, String keywordsString, Delegator delegator, String productCategoryId, boolean includeSubCategories, String visitId, boolean anyPrefix, boolean anySuffix, boolean isAnd) {
-        List<ProductSearchConstraint> productSearchConstraintList = new LinkedList<ProductSearch.ProductSearchConstraint>();
+        List<ProductSearchConstraint> productSearchConstraintList = new LinkedList<>();
 
         if (UtilValidate.isNotEmpty(productCategoryId)) {
             productSearchConstraintList.add(new CategoryConstraint(productCategoryId, includeSubCategories, null));
@@ -140,17 +140,17 @@ public class ProductSearch {
 
     public static class ProductSearchContext {
         public int index = 1;
-        public List<EntityCondition> entityConditionList = new LinkedList<EntityCondition>();
-        public List<String> orderByList = new LinkedList<String>();
+        public List<EntityCondition> entityConditionList = new LinkedList<>();
+        public List<String> orderByList = new LinkedList<>();
         public List<String> fieldsToSelect = UtilMisc.toList("mainProductId");
         public DynamicViewEntity dynamicViewEntity = new DynamicViewEntity();
         public boolean productIdGroupBy = false;
         public boolean includedKeywordSearch = false;
         public Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
-        public List<Set<String>> keywordFixedOrSetAndList = new LinkedList<Set<String>>();
-        public Set<String> orKeywordFixedSet = new HashSet<String>();
-        public Set<String> andKeywordFixedSet = new HashSet<String>();
-        public List<GenericValue> productSearchConstraintList = new LinkedList<GenericValue>();
+        public List<Set<String>> keywordFixedOrSetAndList = new LinkedList<>();
+        public Set<String> orKeywordFixedSet = new HashSet<>();
+        public Set<String> andKeywordFixedSet = new HashSet<>();
+        public List<GenericValue> productSearchConstraintList = new LinkedList<>();
         public ResultSortOrder resultSortOrder = null;
         public Integer resultOffset = null;
         public Integer maxResults = null;
@@ -158,29 +158,29 @@ public class ProductSearch {
         protected String visitId = null;
         protected Integer totalResults = null;
 
-        public Set<String> includeCategoryIds = new HashSet<String>();
-        public Set<String> excludeCategoryIds = new HashSet<String>();
-        public Set<String> alwaysIncludeCategoryIds = new HashSet<String>();
+        public Set<String> includeCategoryIds = new HashSet<>();
+        public Set<String> excludeCategoryIds = new HashSet<>();
+        public Set<String> alwaysIncludeCategoryIds = new HashSet<>();
 
-        public List<Set<String>> includeCategoryIdOrSetAndList = new LinkedList<Set<String>>();
-        public List<Set<String>> alwaysIncludeCategoryIdOrSetAndList = new LinkedList<Set<String>>();
+        public List<Set<String>> includeCategoryIdOrSetAndList = new LinkedList<>();
+        public List<Set<String>> alwaysIncludeCategoryIdOrSetAndList = new LinkedList<>();
 
-        public Set<String> includeFeatureIds = new HashSet<String>();
-        public Set<String> excludeFeatureIds = new HashSet<String>();
-        public Set<String> alwaysIncludeFeatureIds = new HashSet<String>();
+        public Set<String> includeFeatureIds = new HashSet<>();
+        public Set<String> excludeFeatureIds = new HashSet<>();
+        public Set<String> alwaysIncludeFeatureIds = new HashSet<>();
 
-        public List<Set<String>> includeFeatureIdOrSetAndList = new LinkedList<Set<String>>();
-        public List<Set<String>> alwaysIncludeFeatureIdOrSetAndList = new LinkedList<Set<String>>();
+        public List<Set<String>> includeFeatureIdOrSetAndList = new LinkedList<>();
+        public List<Set<String>> alwaysIncludeFeatureIdOrSetAndList = new LinkedList<>();
 
-        public Set<String> includeFeatureCategoryIds = new HashSet<String>();
-        public Set<String> excludeFeatureCategoryIds = new HashSet<String>();
-        public Set<String> alwaysIncludeFeatureCategoryIds = new HashSet<String>();
+        public Set<String> includeFeatureCategoryIds = new HashSet<>();
+        public Set<String> excludeFeatureCategoryIds = new HashSet<>();
+        public Set<String> alwaysIncludeFeatureCategoryIds = new HashSet<>();
 
-        public Set<String> includeFeatureGroupIds = new HashSet<String>();
-        public Set<String> excludeFeatureGroupIds = new HashSet<String>();
-        public Set<String> alwaysIncludeFeatureGroupIds = new HashSet<String>();
+        public Set<String> includeFeatureGroupIds = new HashSet<>();
+        public Set<String> excludeFeatureGroupIds = new HashSet<>();
+        public Set<String> alwaysIncludeFeatureGroupIds = new HashSet<>();
 
-        public List<String> keywordTypeIds = new LinkedList<String>();
+        public List<String> keywordTypeIds = new LinkedList<>();
         public String statusId = null;
 
         public ProductSearchContext(Delegator delegator, String visitId) {
@@ -282,34 +282,34 @@ public class ProductSearch {
 
                     dynamicViewEntity.addMemberEntity(entityAlias, "ProductKeyword");
                     dynamicViewEntity.addAlias(entityAlias, prefix + "Keyword", "keyword", null, null, null, null);
-                    
+
                     // keyword type filter
                     if (UtilValidate.isNotEmpty(keywordTypeIds)) {
                         dynamicViewEntity.addAlias(entityAlias, "keywordTypeId");
                     }
-                    
+
                     // keyword status filter
                     if (UtilValidate.isNotEmpty(statusId)) {
                         dynamicViewEntity.addAlias(entityAlias, "statusId");
                     }
-                    
+
                     dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"));
                     entityConditionList.add(EntityCondition.makeCondition(prefix + "Keyword", EntityOperator.LIKE, keyword));
-                    
+
                     // keyword type filter
                     if (UtilValidate.isNotEmpty(keywordTypeIds)) {
-                        List<EntityCondition> keywordTypeCons = new LinkedList<EntityCondition>();
+                        List<EntityCondition> keywordTypeCons = new LinkedList<>();
                         for (String keywordTypeId : keywordTypeIds) {
                             keywordTypeCons.add(EntityCondition.makeCondition("keywordTypeId", EntityOperator.EQUALS, keywordTypeId));
                         }
                         entityConditionList.add(EntityCondition.makeCondition(keywordTypeCons, EntityOperator.OR));
                     }
-                    
+
                     // keyword status filter
                     if (UtilValidate.isNotEmpty(statusId)) {
                         entityConditionList.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, statusId));
                     }
-                    
+
                     //don't add an alias for this, will be part of a complex alias: dynamicViewEntity.addAlias(entityAlias, prefix + "RelevancyWeight", "relevancyWeight", null, null, null, null);
                     //needed when doingBothAndOr or will get an SQL error
                     if (doingBothAndOr) {
@@ -334,7 +334,7 @@ public class ProductSearch {
                     dynamicViewEntity.addMemberEntity(entityAlias, "ProductKeyword");
                     dynamicViewEntity.addAlias(entityAlias, prefix + "Keyword", "keyword", null, null, null, null);
                     dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"));
-                    List<EntityCondition> keywordOrList = new LinkedList<EntityCondition>();
+                    List<EntityCondition> keywordOrList = new LinkedList<>();
                     for (String keyword: keywordFixedOrSet) {
                         keywordOrList.add(EntityCondition.makeCondition(prefix + "Keyword", EntityOperator.LIKE, keyword));
                     }
@@ -366,10 +366,10 @@ public class ProductSearch {
             // create new view members with logic:
             // ((each Id = category includes AND Id IN feature includes) AND (Id NOT IN category excludes AND Id NOT IN feature excludes))
             // OR (each Id = category alwaysIncludes AND each Id = feature alwaysIncludes)
-            List<EntityCondition> incExcCondList = new LinkedList<EntityCondition>();
+            List<EntityCondition> incExcCondList = new LinkedList<>();
             EntityCondition incExcCond = null;
 
-            List<EntityCondition> alwIncCondList = new LinkedList<EntityCondition>();
+            List<EntityCondition> alwIncCondList = new LinkedList<>();
             EntityCondition alwIncCond = null;
 
             EntityCondition topCond = null;
@@ -452,7 +452,7 @@ public class ProductSearch {
             }
 
             if (excludeCategoryIds.size() > 0) {
-                List<EntityCondition> idExcludeCondList = new LinkedList<EntityCondition>();
+                List<EntityCondition> idExcludeCondList = new LinkedList<>();
                 idExcludeCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, this.nowTimestamp)));
                 idExcludeCondList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, this.nowTimestamp));
                 idExcludeCondList.add(EntityCondition.makeCondition("productCategoryId", EntityOperator.IN, excludeCategoryIds));
@@ -460,7 +460,7 @@ public class ProductSearch {
                 incExcCondList.add(EntityCondition.makeCondition("mainProductId", EntityOperator.NOT_EQUAL, subSelCond));
             }
             if (excludeFeatureIds.size() > 0) {
-                List<EntityCondition> idExcludeCondList = new LinkedList<EntityCondition>();
+                List<EntityCondition> idExcludeCondList = new LinkedList<>();
                 idExcludeCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, this.nowTimestamp)));
                 idExcludeCondList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, this.nowTimestamp));
                 idExcludeCondList.add(EntityCondition.makeCondition("productFeatureId", EntityOperator.IN, excludeFeatureIds));
@@ -468,7 +468,7 @@ public class ProductSearch {
                 incExcCondList.add(EntityCondition.makeCondition("mainProductId", EntityOperator.NOT_EQUAL, subSelCond));
             }
             if (excludeFeatureCategoryIds.size() > 0) {
-                List<EntityCondition> idExcludeCondList = new LinkedList<EntityCondition>();
+                List<EntityCondition> idExcludeCondList = new LinkedList<>();
                 idExcludeCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, this.nowTimestamp)));
                 idExcludeCondList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, this.nowTimestamp));
                 idExcludeCondList.add(EntityCondition.makeCondition("productFeatureCategoryId", EntityOperator.IN, excludeFeatureCategoryIds));
@@ -476,7 +476,7 @@ public class ProductSearch {
                 incExcCondList.add(EntityCondition.makeCondition("mainProductId", EntityOperator.NOT_EQUAL, subSelCond));
             }
             if (excludeFeatureGroupIds.size() > 0) {
-                List<EntityCondition> idExcludeCondList = new LinkedList<EntityCondition>();
+                List<EntityCondition> idExcludeCondList = new LinkedList<>();
                 idExcludeCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, this.nowTimestamp)));
                 idExcludeCondList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, this.nowTimestamp));
                 idExcludeCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("groupThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("groupThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp)));
@@ -644,13 +644,15 @@ public class ProductSearch {
 
             this.entityConditionList.add(topCond);
 
-            if (Debug.infoOn()) Debug.logInfo("topCond=" + topCond.makeWhereString(null, new LinkedList<EntityConditionParam>(), EntityConfig.getDatasource(delegator.getEntityHelperName("Product"))), module);
+            if (Debug.infoOn()) {
+                Debug.logInfo("topCond=" + topCond.makeWhereString(null, new LinkedList<EntityConditionParam>(), EntityConfig.getDatasource(delegator.getEntityHelperName("Product"))), module);
+            }
         }
 
         /**
          * @param delegator the delegator
          * @return EntityListIterator representing the result of the query: NOTE THAT THIS MUST BE CLOSED WHEN YOU ARE
-         *      DONE WITH IT (preferably in a finally block), 
+         *      DONE WITH IT (preferably in a finally block),
          *      AND DON'T LEAVE IT OPEN TOO LONG BECAUSE IT WILL MAINTAIN A DATABASE CONNECTION.
          */
         public EntityListIterator doQuery(Delegator delegator) {
@@ -690,7 +692,7 @@ public class ProductSearch {
         }
 
         public ArrayList<String> makeProductIdList(EntityListIterator eli) {
-            ArrayList<String> productIds = new ArrayList<String>(maxResults == null ? 100 : maxResults.intValue());
+            ArrayList<String> productIds = new ArrayList<>(maxResults == null ? 100 : maxResults.intValue());
             if (eli == null) {
                 Debug.logWarning("The eli is null, returning zero results", module);
                 return productIds;
@@ -704,7 +706,9 @@ public class ProductSearch {
                     hasResults = true;
                 }
                 if (resultOffset != null && resultOffset.intValue() > 1) {
-                    if (Debug.infoOn()) Debug.logInfo("Before relative, current index=" + eli.currentIndex(), module);
+                    if (Debug.infoOn()) {
+                        Debug.logInfo("Before relative, current index=" + eli.currentIndex(), module);
+                    }
                     hasResults = eli.relative(resultOffset.intValue() - 1);
                     initialResult = null;
                 }
@@ -734,7 +738,7 @@ public class ProductSearch {
                 int numRetreived = 1;
                 int duplicatesFound = 0;
 
-                Set<String> productIdSet = new HashSet<String>();
+                Set<String> productIdSet = new HashSet<>();
 
                 productIds.add(searchResult.getString("mainProductId"));
                 productIdSet.add(searchResult.getString("mainProductId"));
@@ -839,7 +843,7 @@ public class ProductSearch {
 
         @Override
         public void addConstraint(ProductSearchContext productSearchContext) {
-            List<String> productCategoryIds = new LinkedList<String>();
+            List<String> productCategoryIds = new LinkedList<>();
             for (GenericValue category: productCategories) {
                 productCategoryIds.add(category.getString("productCategoryId"));
             }
@@ -941,7 +945,7 @@ public class ProductSearch {
 
         @Override
         public void addConstraint(ProductSearchContext productSearchContext) {
-            Set<String> productCategoryIdSet = new HashSet<String>();
+            Set<String> productCategoryIdSet = new HashSet<>();
             if (includeSubCategories) {
                 // find all sub-categories recursively, make a Set of productCategoryId
                 ProductSearch.getAllSubCategoryIds(productCategoryId, productCategoryIdSet, productSearchContext.getDelegator(), productSearchContext.nowTimestamp);
@@ -1350,7 +1354,7 @@ public class ProductSearch {
          * @param exclude This is a tri-state variable: null = Include, true = Exclude, false = AlwaysInclude
          */
         public FeatureSetConstraint(Collection<String> productFeatureIdSet, Boolean exclude) {
-            this.productFeatureIdSet = new HashSet<String>();
+            this.productFeatureIdSet = new HashSet<>();
             this.productFeatureIdSet.addAll(productFeatureIdSet);
             this.exclude = exclude;
         }
@@ -1473,11 +1477,11 @@ public class ProductSearch {
 
         public Set<String> makeFullKeywordSet(Delegator delegator) {
             Set<String> keywordSet = KeywordSearchUtil.makeKeywordSet(this.keywordsString, null, true);
-            Set<String> fullKeywordSet = new TreeSet<String>();
+            Set<String> fullKeywordSet = new TreeSet<>();
 
             // expand the keyword list according to the thesaurus and create a new set of keywords
             for (String keyword: keywordSet) {
-                Set<String> expandedSet = new TreeSet<String>();
+                Set<String> expandedSet = new TreeSet<>();
                 boolean replaceEntered = KeywordSearchUtil.expandKeywordForSearch(keyword, expandedSet, delegator);
                 fullKeywordSet.addAll(expandedSet);
                 if (!replaceEntered) {
@@ -1502,13 +1506,13 @@ public class ProductSearch {
 
                 // expand the keyword list according to the thesaurus and create a new set of keywords
                 for (String keyword: keywordSet) {
-                    Set<String> expandedSet = new TreeSet<String>();
+                    Set<String> expandedSet = new TreeSet<>();
                     boolean replaceEntered = KeywordSearchUtil.expandKeywordForSearch(keyword, expandedSet, productSearchContext.getDelegator());
                     if (!replaceEntered) {
                         expandedSet.add(keyword);
                     }
                     Set<String> fixedSet = KeywordSearchUtil.fixKeywordsForSearch(expandedSet, anyPrefix, anySuffix, removeStems, isAnd);
-                    Set<String> fixedKeywordSet = new HashSet<String>();
+                    Set<String> fixedKeywordSet = new HashSet<>();
                     fixedKeywordSet.addAll(fixedSet);
                     productSearchContext.keywordFixedOrSetAndList.add(fixedKeywordSet);
                 }
@@ -2215,8 +2219,9 @@ public class ProductSearch {
                     productSearchContext.orderByList.add("-totalRelevancy");
                     productSearchContext.fieldsToSelect.add("totalRelevancy");
                 }
-                if (productSearchContext.keywordFixedOrSetAndList.size() > 0)
+                if (productSearchContext.keywordFixedOrSetAndList.size() > 0) {
                     productSearchContext.productIdGroupBy = true;
+                }
             }
         }
 

Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchEvents.java?rev=1818406&r1=1818405&r2=1818406&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchEvents.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchEvents.java Sat Dec 16 13:56:19 2017
@@ -384,7 +384,7 @@ public class ProductSearchEvents {
     public static String searchExportProductList(HttpServletRequest request, HttpServletResponse response) {
         Delegator delegator = (Delegator) request.getAttribute("delegator");
         String errMsg = null;
-        List<Map<String, Object>> productExportList = new LinkedList<Map<String,Object>>();
+        List<Map<String, Object>> productExportList = new LinkedList<>();
 
         try {
             boolean beganTransaction = TransactionUtil.begin(DEFAULT_TX_TIMEOUT);
@@ -397,7 +397,7 @@ public class ProductSearchEvents {
 
                 GenericValue searchResultView = null;
                 while ((searchResultView = eli.next()) != null) {
-                    Map<String, Object> productMap = new HashMap<String, Object>();
+                    Map<String, Object> productMap = new HashMap<>();
                     String productId = searchResultView.getString("mainProductId");
                     productMap.put("productId", productId);
 
@@ -447,8 +447,7 @@ public class ProductSearchEvents {
             productSearchContext.setResultSortOrder(resultSortOrder);
 
             return productSearchContext.doQuery(delegator);
-        } else {
-            return null;
         }
+        return null;
     }
 }

Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java?rev=1818406&r1=1818405&r2=1818406&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java Sat Dec 16 13:56:19 2017
@@ -89,7 +89,7 @@ public class ProductSearchSession {
 
         /** Basic copy constructor */
         public ProductSearchOptions(ProductSearchOptions productSearchOptions) {
-            this.constraintList = new LinkedList<ProductSearch.ProductSearchConstraint>();
+            this.constraintList = new LinkedList<>();
             if (UtilValidate.isNotEmpty(productSearchOptions.constraintList)) {
                 this.constraintList.addAll(productSearchOptions.constraintList);
             }
@@ -111,7 +111,7 @@ public class ProductSearchSession {
         public static void addConstraint(ProductSearchConstraint productSearchConstraint, HttpSession session) {
             ProductSearchOptions productSearchOptions = getProductSearchOptions(session);
             if (productSearchOptions.constraintList == null) {
-                productSearchOptions.constraintList = new LinkedList<ProductSearch.ProductSearchConstraint>();
+                productSearchOptions.constraintList = new LinkedList<>();
             }
             if (!productSearchOptions.constraintList.contains(productSearchConstraint)) {
                 productSearchOptions.constraintList.add(productSearchConstraint);
@@ -280,12 +280,14 @@ public class ProductSearchSession {
 
         public List<String> searchGetConstraintStrings(boolean detailed, Delegator delegator, Locale locale) {
             List<ProductSearchConstraint> productSearchConstraintList = this.getConstraintList();
-            List<String> constraintStrings = new LinkedList<String>();
+            List<String> constraintStrings = new LinkedList<>();
             if (productSearchConstraintList == null) {
                 return constraintStrings;
             }
             for (ProductSearchConstraint productSearchConstraint: productSearchConstraintList) {
-                if (productSearchConstraint == null) continue;
+                if (productSearchConstraint == null) {
+                    continue;
+                }
                 String constraintString = productSearchConstraint.prettyPrintConstraint(delegator, detailed, locale);
                 if (UtilValidate.isNotEmpty(constraintString)) {
                     constraintStrings.add(constraintString);
@@ -318,7 +320,7 @@ public class ProductSearchSession {
     public static List<ProductSearchOptions> getSearchOptionsHistoryList(HttpSession session) {
         List<ProductSearchOptions> optionsHistoryList = UtilGenerics.checkList(session.getAttribute("_PRODUCT_SEARCH_OPTIONS_HISTORY_"));
         if (optionsHistoryList == null) {
-            optionsHistoryList = new LinkedList<ProductSearchSession.ProductSearchOptions>();
+            optionsHistoryList = new LinkedList<>();
             session.setAttribute("_PRODUCT_SEARCH_OPTIONS_HISTORY_", optionsHistoryList);
         }
         return optionsHistoryList;
@@ -384,14 +386,16 @@ public class ProductSearchSession {
         String productStoreId = ProductStoreWorker.getProductStoreId(request);
         if (productStoreId != null) {
             // get a Set of all keywords in the search, if there are any...
-            Set<String> keywords = new HashSet<String>();
+            Set<String> keywords = new HashSet<>();
             List<ProductSearchConstraint> constraintList = ProductSearchOptions.getConstraintList(session);
             if (constraintList != null) {
                 for (ProductSearchConstraint constraint: constraintList) {
                     if (constraint instanceof KeywordConstraint) {
                         KeywordConstraint keywordConstraint = (KeywordConstraint) constraint;
                         Set<String> keywordSet = keywordConstraint.makeFullKeywordSet(delegator);
-                        if (keywordSet != null) keywords.addAll(keywordSet);
+                        if (keywordSet != null) {
+                            keywords.addAll(keywordSet);
+                        }
                     }
                 }
             }
@@ -449,7 +453,7 @@ public class ProductSearchSession {
         List<ProductSearchConstraint> productSearchConstraintList = productSearchOptions.getConstraintList();
         if (UtilValidate.isEmpty(productSearchConstraintList)) {
             // no constraints, don't do a search...
-            return new ArrayList<String>();
+            return new ArrayList<>();
         }
 
         ResultSortOrder resultSortOrder = productSearchOptions.getResultSortOrder();
@@ -515,9 +519,8 @@ public class ProductSearchSession {
             productSearchOptions.setViewSize((String) parameters.get("VIEW_SIZE"));
             productSearchOptions.setPaging((String) parameters.get("PAGING"));
             return;
-        } else {
-            request.setAttribute("processSearchParametersAlreadyRun", Boolean.TRUE);
         }
+        request.setAttribute("processSearchParametersAlreadyRun", Boolean.TRUE);
 
         HttpSession session = request.getSession();
         boolean constraintsChanged = false;
@@ -715,7 +718,9 @@ public class ProductSearchSession {
         // add a supplier to the search
         if (UtilValidate.isNotEmpty(parameters.get("SEARCH_SUPPLIER_ID")) || UtilValidate.isNotEmpty(parameters.get("S_SUP"))) {
             String supplierPartyId = (String) parameters.get("SEARCH_SUPPLIER_ID");
-            if (UtilValidate.isEmpty(supplierPartyId)) supplierPartyId = (String) parameters.get("S_SUP");
+            if (UtilValidate.isEmpty(supplierPartyId)) {
+                supplierPartyId = (String) parameters.get("S_SUP");
+            }
             searchAddConstraint(new ProductSearch.SupplierConstraint(supplierPartyId), session);
             constraintsChanged = true;
         }
@@ -744,7 +749,9 @@ public class ProductSearchSession {
         }
         if (UtilValidate.isNotEmpty(parameters.get("LIST_PRICE_RANGE")) || UtilValidate.isNotEmpty(parameters.get("S_LPR"))) {
             String listPriceRangeStr = (String) parameters.get("LIST_PRICE_RANGE");
-            if (UtilValidate.isEmpty(listPriceRangeStr)) listPriceRangeStr = (String) parameters.get("S_LPR");
+            if (UtilValidate.isEmpty(listPriceRangeStr)) {
+                listPriceRangeStr = (String) parameters.get("S_LPR");
+            }
             int underscoreIndex = listPriceRangeStr.indexOf('_');
             String listPriceLowStr;
             String listPriceHighStr;
@@ -815,9 +822,13 @@ public class ProductSearchSession {
 
         // set the sort order
         String sortOrder = (String) parameters.get("sortOrder");
-        if (UtilValidate.isEmpty(sortOrder)) sortOrder = (String) parameters.get("S_O");
+        if (UtilValidate.isEmpty(sortOrder)) {
+            sortOrder = (String) parameters.get("S_O");
+        }
         String sortAscending = (String) parameters.get("sortAscending");
-        if (UtilValidate.isEmpty(sortAscending)) sortAscending = (String) parameters.get("S_A");
+        if (UtilValidate.isEmpty(sortAscending)) {
+            sortAscending = (String) parameters.get("S_A");
+        }
         boolean ascending = !"N".equals(sortAscending);
         if (sortOrder != null) {
             if ("SortKeywordRelevancy".equals(sortOrder) || "SKR".equals(sortOrder)) {
@@ -866,7 +877,7 @@ public class ProductSearchSession {
         String paging = "Y";
         int previousViewSize = 20;
         Map<String, Object> requestParams = UtilHttp.getCombinedMap(request);
-        List<String> keywordTypeIds = new LinkedList<String>();
+        List<String> keywordTypeIds = new LinkedList<>();
         if (requestParams.get("keywordTypeId") instanceof String) {
             keywordTypeIds.add((String) requestParams.get("keywordTypeId"));
         } else if (requestParams.get("keywordTypeId") instanceof List){
@@ -901,7 +912,7 @@ public class ProductSearchSession {
         highIndex = (viewIndex + 1) * viewSize;
 
         // ========== Do the actual search
-        List<String> productIds = new LinkedList<String>();
+        List<String> productIds = new LinkedList<>();
         String visitId = VisitHandler.getVisitId(session);
         List<ProductSearchConstraint> productSearchConstraintList = ProductSearchOptions.getConstraintList(session);
         String noConditionFind = (String) requestParams.get("noConditionFind");
@@ -919,7 +930,7 @@ public class ProductSearchSession {
             if (UtilValidate.isNotEmpty(addOnTopProdCategoryId)) {
                 // always include the members of the addOnTopProdCategoryId
                 Timestamp now = UtilDateTime.nowTimestamp();
-                List<EntityCondition> addOnTopProdCondList = new LinkedList<EntityCondition>();
+                List<EntityCondition> addOnTopProdCondList = new LinkedList<>();
                 addOnTopProdCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, now)));
                 addOnTopProdCondList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, now));
                 addOnTopProdCondList.add(EntityCondition.makeCondition("productCategoryId", EntityOperator.EQUALS, addOnTopProdCategoryId));
@@ -931,7 +942,7 @@ public class ProductSearchSession {
                         .cursorScrollInsensitive()
                         .distinct()
                         .maxRows(highIndex);
-                
+
                 try (EntityListIterator pli = eq.queryIterator()) {
                     addOnTopProductCategoryMembers = pli.getPartialList(lowIndex, viewSize);
                     addOnTopListSize = addOnTopProductCategoryMembers.size();
@@ -963,17 +974,17 @@ public class ProductSearchSession {
             productSearchContext.setResultSortOrder(resultSortOrder);
             productSearchContext.setResultOffset(resultOffset);
             productSearchContext.setMaxResults(maxResults);
-            
+
             if (UtilValidate.isNotEmpty(keywordTypeIds)) {
                 productSearchContext.keywordTypeIds = keywordTypeIds;
             } else {
                  productSearchContext.keywordTypeIds = UtilMisc.toList("KWT_KEYWORD");
             }
-            
+
             if (UtilValidate.isNotEmpty(statusId)) {
                 productSearchContext.statusId = statusId;
             }
-            
+
             List<String> foundProductIds = productSearchContext.doSearch();
             if (maxResultsInt > 0) {
                 productIds.addAll(foundProductIds);
@@ -994,7 +1005,7 @@ public class ProductSearchSession {
         String searchSortOrderString = searchGetSortOrderString(false, request);
 
         // ========== populate the result Map
-        Map<String, Object> result = new HashMap<String, Object>();
+        Map<String, Object> result = new HashMap<>();
 
         result.put("productIds", productIds);
         result.put("viewIndex", Integer.valueOf(viewIndex));
@@ -1019,7 +1030,7 @@ public class ProductSearchSession {
 
         List<ProductSearchConstraint> constraintList = productSearchOptions.getConstraintList();
         if (UtilValidate.isEmpty(constraintList)) {
-            constraintList = new ArrayList<ProductSearchConstraint>();
+            constraintList = new ArrayList<>();
         }
         int categoriesCount = 0;
         int featuresCount = 0;
@@ -1134,9 +1145,13 @@ public class ProductSearchSession {
                     }
                     searchParamString.append("S_LPR");
                     searchParamString.append("=");
-                    if (lprc.lowPrice != null) searchParamString.append(lprc.lowPrice);
+                    if (lprc.lowPrice != null) {
+                        searchParamString.append(lprc.lowPrice);
+                    }
                     searchParamString.append("_");
-                    if (lprc.highPrice != null) searchParamString.append(lprc.highPrice);
+                    if (lprc.highPrice != null) {
+                        searchParamString.append(lprc.highPrice);
+                    }
                 }
             } else if (psc instanceof ProductSearch.SupplierConstraint) {
                 ProductSearch.SupplierConstraint suppc = (ProductSearch.SupplierConstraint) psc;
@@ -1225,9 +1240,9 @@ public class ProductSearchSession {
                 .where(entityConditionList)
                 .orderBy(productSearchContext.orderByList)
                 .cursorScrollInsensitive();
-        
+
         try (EntityListIterator eli = eq.queryIterator()) {
-            featureCountList = new LinkedList<Map<String,String>>();
+            featureCountList = new LinkedList<>();
             GenericValue searchResult = null;
             while ((searchResult = eli.next()) != null) {
                 featureCountList.add(UtilMisc.<String, String>toMap("productFeatureId", (String) searchResult.get("pfacProductFeatureId"), "productFeatureTypeId", (String) searchResult.get("pfcProductFeatureTypeId"), "description", (String) searchResult.get("pfcDescription"), "featureCount", Long.toString((Long) searchResult.get("featureCount"))));
@@ -1273,7 +1288,7 @@ public class ProductSearchSession {
 
         DynamicViewEntity dynamicViewEntity = productSearchContext.dynamicViewEntity;
         List<EntityCondition> entityConditionList = productSearchContext.entityConditionList;
-        List<String> fieldsToSelect = new LinkedList<String>();
+        List<String> fieldsToSelect = new LinkedList<>();
 
         dynamicViewEntity.addMemberEntity("PPC", "ProductPrice");
         dynamicViewEntity.addAlias("PPC", "ppcProductPriceTypeId", "productPriceTypeId", null, null, null, null);
@@ -1329,7 +1344,7 @@ public class ProductSearchSession {
 
         DynamicViewEntity dynamicViewEntity = productSearchContext.dynamicViewEntity;
         List<EntityCondition> entityConditionList = productSearchContext.entityConditionList;
-        List<String> fieldsToSelect = new LinkedList<String>();
+        List<String> fieldsToSelect = new LinkedList<>();
 
         dynamicViewEntity.addMemberEntity("PCMC", "ProductCategoryMember");
         dynamicViewEntity.addAlias("PCMC", "pcmcProductCategoryId", "productCategoryId", null, null, null, null);
@@ -1341,7 +1356,7 @@ public class ProductSearchSession {
         entityConditionList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("pcmcThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("pcmcThruDate", EntityOperator.GREATER_THAN, productSearchContext.nowTimestamp)));
         entityConditionList.add(EntityCondition.makeCondition("pcmcFromDate", EntityOperator.LESS_THAN, productSearchContext.nowTimestamp));
 
-        Set<String> productCategoryIdSet = new HashSet<String>();
+        Set<String> productCategoryIdSet = new HashSet<>();
         ProductSearch.getAllSubCategoryIds(productCategoryId, productCategoryIdSet, delegator, productSearchContext.nowTimestamp);
         entityConditionList.add(EntityCondition.makeCondition("pcmcProductCategoryId", EntityOperator.IN, productCategoryIdSet));
 
@@ -1352,7 +1367,7 @@ public class ProductSearchSession {
                 .where(entityConditionList)
                 .orderBy(productSearchContext.orderByList)
                 .cursorScrollInsensitive();
-        
+
         try (EntityListIterator eli = eq.queryIterator()) {
             GenericValue searchResult = null;
             while ((searchResult = eli.next()) != null) {