You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2008/11/11 03:16:46 UTC
svn commit: r712916 [1/3] -
/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/
Author: doogie
Date: Mon Nov 10 18:16:46 2008
New Revision: 712916
URL: http://svn.apache.org/viewvc?rev=712916&view=rev
Log:
First set of actual generics markup, only on product/product.
Modified:
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/KeywordIndex.java
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearch.java
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchEvents.java
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/VariantEvents.java
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/KeywordIndex.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/KeywordIndex.java?rev=712916&r1=712915&r2=712916&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/KeywordIndex.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/KeywordIndex.java Mon Nov 10 18:16:46 2008
@@ -83,10 +83,10 @@
String stopWordBagOr = KeywordSearchUtil.getStopWordBagOr();
String stopWordBagAnd = KeywordSearchUtil.getStopWordBagAnd();
boolean removeStems = KeywordSearchUtil.getRemoveStems();
- Set stemSet = KeywordSearchUtil.getStemSet();
+ Set<String> stemSet = KeywordSearchUtil.getStemSet();
- Map keywords = new TreeMap();
- List strings = FastList.newInstance();
+ Map<String, Long> keywords = new TreeMap<String, Long>();
+ List<String> strings = FastList.newInstance();
int pidWeight = 1;
try {
@@ -118,9 +118,9 @@
!"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.ProductFeatureAndAppl.abbrev", "0")) ||
!"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.ProductFeatureAndAppl.idCode", "0"))) {
// get strings from attributes and features
- Iterator productFeatureAndAppls = UtilMisc.toIterator(delegator.findByAnd("ProductFeatureAndAppl", UtilMisc.toMap("productId", productId)));
+ Iterator<GenericValue> productFeatureAndAppls = UtilMisc.toIterator(delegator.findByAnd("ProductFeatureAndAppl", UtilMisc.toMap("productId", productId)));
while (productFeatureAndAppls != null && productFeatureAndAppls.hasNext()) {
- GenericValue productFeatureAndAppl = (GenericValue) productFeatureAndAppls.next();
+ GenericValue productFeatureAndAppl = productFeatureAndAppls.next();
addWeightedKeywordSourceString(productFeatureAndAppl, "description", strings);
addWeightedKeywordSourceString(productFeatureAndAppl, "abbrev", strings);
addWeightedKeywordSourceString(productFeatureAndAppl, "idCode", strings);
@@ -130,9 +130,9 @@
// ProductAttribute
if (!"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.ProductAttribute.attrName", "0")) ||
!"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.ProductAttribute.attrValue", "0"))) {
- Iterator productAttributes = UtilMisc.toIterator(delegator.findByAnd("ProductAttribute", UtilMisc.toMap("productId", productId)));
+ Iterator<GenericValue> productAttributes = UtilMisc.toIterator(delegator.findByAnd("ProductAttribute", UtilMisc.toMap("productId", productId)));
while (productAttributes != null && productAttributes.hasNext()) {
- GenericValue productAttribute = (GenericValue) productAttributes.next();
+ GenericValue productAttribute = productAttributes.next();
addWeightedKeywordSourceString(productAttribute, "attrName", strings);
addWeightedKeywordSourceString(productAttribute, "attrValue", strings);
}
@@ -140,9 +140,9 @@
// GoodIdentification
if (!"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.GoodIdentification.idValue", "0"))) {
- Iterator goodIdentifications = UtilMisc.toIterator(delegator.findByAnd("GoodIdentification", UtilMisc.toMap("productId", productId)));
+ Iterator<GenericValue> goodIdentifications = UtilMisc.toIterator(delegator.findByAnd("GoodIdentification", UtilMisc.toMap("productId", productId)));
while (goodIdentifications != null && goodIdentifications.hasNext()) {
- GenericValue goodIdentification = (GenericValue) goodIdentifications.next();
+ GenericValue goodIdentification = goodIdentifications.next();
addWeightedKeywordSourceString(goodIdentification, "idValue", strings);
}
}
@@ -150,11 +150,11 @@
// Variant Product IDs
if ("Y".equals(product.getString("isVirtual"))) {
if (!"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.Variant.Product.productId", "0"))) {
- List variantProductAssocs = delegator.findByAnd("ProductAssoc", UtilMisc.toMap("productId", productId, "productAssocTypeId", "PRODUCT_VARIANT"));
+ List<GenericValue> variantProductAssocs = delegator.findByAnd("ProductAssoc", UtilMisc.toMap("productId", productId, "productAssocTypeId", "PRODUCT_VARIANT"));
variantProductAssocs = EntityUtil.filterByDate(variantProductAssocs);
- Iterator variantProductAssocsIt = variantProductAssocs.iterator();
+ Iterator<GenericValue> variantProductAssocsIt = variantProductAssocs.iterator();
while (variantProductAssocsIt.hasNext()) {
- GenericValue variantProductAssoc = (GenericValue) variantProductAssocsIt.next();
+ GenericValue variantProductAssoc = variantProductAssocsIt.next();
int weight = 1;
try {
weight = Integer.parseInt(UtilProperties.getPropertyValue("prodsearch", "index.weight.Variant.Product.productId", "0"));
@@ -169,10 +169,10 @@
}
String productContentTypes = UtilProperties.getPropertyValue("prodsearch", "index.include.ProductContentTypes");
- List productContentTypeList = Arrays.asList(productContentTypes.split(","));
- Iterator productContentTypeIter = productContentTypeList.iterator();
+ List<String> productContentTypeList = Arrays.asList(productContentTypes.split(","));
+ Iterator<String> productContentTypeIter = productContentTypeList.iterator();
while (productContentTypeIter.hasNext()) {
- String productContentTypeId = (String) productContentTypeIter.next();
+ String productContentTypeId = productContentTypeIter.next();
int weight = 1;
try {
@@ -182,33 +182,33 @@
Debug.logWarning("Could not parse weight number: " + e.toString(), module);
}
- List productContentAndInfos = delegator.findByAnd("ProductContentAndInfo", UtilMisc.toMap("productId", productId, "productContentTypeId", productContentTypeId), null);
- Iterator productContentAndInfoIter = productContentAndInfos.iterator();
+ List<GenericValue> productContentAndInfos = delegator.findByAnd("ProductContentAndInfo", UtilMisc.toMap("productId", productId, "productContentTypeId", productContentTypeId), null);
+ Iterator<GenericValue> productContentAndInfoIter = productContentAndInfos.iterator();
while (productContentAndInfoIter.hasNext()) {
- GenericValue productContentAndInfo = (GenericValue) productContentAndInfoIter.next();
+ GenericValue productContentAndInfo = productContentAndInfoIter.next();
addWeightedDataResourceString(productContentAndInfo, weight, strings, delegator, product);
- List alternateViews = productContentAndInfo.getRelated("ContentAssocDataResourceViewTo", UtilMisc.toMap("caContentAssocTypeId", "ALTERNATE_LOCALE"), UtilMisc.toList("-caFromDate"));
+ List<GenericValue> alternateViews = productContentAndInfo.getRelated("ContentAssocDataResourceViewTo", UtilMisc.toMap("caContentAssocTypeId", "ALTERNATE_LOCALE"), UtilMisc.toList("-caFromDate"));
alternateViews = EntityUtil.filterByDate(alternateViews, UtilDateTime.nowTimestamp(), "caFromDate", "caThruDate", true);
- Iterator alternateViewIter = alternateViews.iterator();
+ Iterator<GenericValue> alternateViewIter = alternateViews.iterator();
while (alternateViewIter.hasNext()) {
- GenericValue thisView = (GenericValue) alternateViewIter.next();
+ GenericValue thisView = alternateViewIter.next();
addWeightedDataResourceString(thisView, weight, strings, delegator, product);
}
}
}
- Iterator strIter = strings.iterator();
+ Iterator<String> strIter = strings.iterator();
while (strIter.hasNext()) {
- String str = (String) strIter.next();
+ String str = strIter.next();
// call process keywords method here
KeywordSearchUtil.processKeywordsForIndex(str, keywords, separators, stopWordBagAnd, stopWordBagOr, removeStems, stemSet);
}
- List toBeStored = FastList.newInstance();
- Iterator kiter = keywords.entrySet().iterator();
+ List<GenericValue> toBeStored = FastList.newInstance();
+ Iterator<Map.Entry<String, Long>> kiter = keywords.entrySet().iterator();
while (kiter.hasNext()) {
- Map.Entry entry = (Map.Entry) kiter.next();
+ Map.Entry<String, Long> entry = kiter.next();
GenericValue productKeyword = delegator.makeValue("ProductKeyword", UtilMisc.toMap("productId", product.getString("productId"), "keyword", entry.getKey(), "relevancyWeight", entry.getValue()));
toBeStored.add(productKeyword);
}
@@ -224,8 +224,8 @@
}
}
- public static void addWeightedDataResourceString(GenericValue drView, int weight, List strings, GenericDelegator delegator, GenericValue product) {
- Map drContext = UtilMisc.toMap("product", product);
+ public static void addWeightedDataResourceString(GenericValue drView, int weight, List<String> strings, GenericDelegator delegator, GenericValue product) {
+ Map<String, GenericValue> drContext = UtilMisc.toMap("product", product);
try {
String contentText = DataResourceWorker.renderDataResourceAsText(delegator, drView.getString("dataResourceId"), drContext, null, null, false);
for (int i = 0; i < weight; i++) {
@@ -238,7 +238,7 @@
}
}
- public static void addWeightedKeywordSourceString(GenericValue value, String fieldName, List strings) {
+ public static void addWeightedKeywordSourceString(GenericValue value, String fieldName, List<String> strings) {
if (value.getString(fieldName) != null) {
int weight = 1;
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java?rev=712916&r1=712915&r2=712916&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java Mon Nov 10 18:16:46 2008
@@ -53,7 +53,7 @@
public static final String module = ProductContentWrapper.class.getName();
public static final String SEPARATOR = "::"; // cache key separator
- public static UtilCache productContentCache = new UtilCache("product.content.rendered", true);
+ public static UtilCache<String, String> productContentCache = new UtilCache<String, String>("product.content.rendered", true);
public static ProductContentWrapper makeProductContentWrapper(GenericValue product, HttpServletRequest request) {
return new ProductContentWrapper(product, request);
@@ -107,7 +107,7 @@
String cacheKey = productContentTypeId + SEPARATOR + locale + SEPARATOR + mimeTypeId + SEPARATOR + product.get("productId");
try {
if (productContentCache.get(cacheKey) != null) {
- return (String) productContentCache.get(cacheKey);
+ return productContentCache.get(cacheKey);
}
Writer outWriter = new StringWriter();
@@ -175,12 +175,12 @@
}
}
- List productContentList = delegator.findByAndCache("ProductContent", UtilMisc.toMap("productId", productId, "productContentTypeId", productContentTypeId), UtilMisc.toList("-fromDate"));
+ List<GenericValue> productContentList = delegator.findByAndCache("ProductContent", UtilMisc.toMap("productId", productId, "productContentTypeId", productContentTypeId), UtilMisc.toList("-fromDate"));
productContentList = EntityUtil.filterByDate(productContentList);
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 inContext = FastMap.newInstance();
+ Map<String, Object> inContext = FastMap.newInstance();
inContext.put("product", product);
inContext.put("productContent", productContent);
ContentWorker.renderContentAsText(dispatcher, delegator, productContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, false);
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java?rev=712916&r1=712915&r2=712916&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java Mon Nov 10 18:16:46 2008
@@ -83,7 +83,7 @@
// check permissions before moving on...
if (!security.hasEntityPermission("CATALOG", "_" + updateMode, request.getSession())) {
- Map messageMap = UtilMisc.toMap("updateMode", updateMode);
+ Map<String, String> messageMap = UtilMisc.toMap("updateMode", updateMode);
errMsg = UtilProperties.getMessage(resource,"productevents.not_sufficient_permissions", messageMap, UtilHttp.getLocale(request));
request.setAttribute("_ERROR_MESSAGE_", errMsg);
return "error";
@@ -91,7 +91,7 @@
EntityCondition condition = null;
if (!"Y".equals(doAll)) {
- List condList = FastList.newInstance();
+ List<EntityCondition> condList = FastList.newInstance();
condList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("autoCreateKeywords", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("autoCreateKeywords", EntityOperator.NOT_EQUAL, "N")));
if ("true".equals(UtilProperties.getPropertyValue("prodsearch", "index.ignore.variants"))) {
condList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("isVariant", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("isVariant", EntityOperator.NOT_EQUAL, "Y")));
@@ -121,14 +121,14 @@
entityListIterator = delegator.find("Product", condition, null, null, null, null);
} catch (GenericEntityException gee) {
Debug.logWarning(gee, gee.getMessage(), module);
- Map messageMap = UtilMisc.toMap("gee", gee.toString());
+ Map<String, String> messageMap = UtilMisc.toMap("gee", gee.toString());
errMsg = UtilProperties.getMessage(resource,"productevents.error_getting_product_list", messageMap, UtilHttp.getLocale(request));
request.setAttribute("_ERROR_MESSAGE_", errMsg);
throw gee;
}
GenericValue product;
- while ((product = (GenericValue) entityListIterator.next()) != null) {
+ while ((product = entityListIterator.next()) != null) {
try {
KeywordIndex.indexKeywords(product, "Y".equals(doAll));
} catch (GenericEntityException e) {
@@ -176,12 +176,12 @@
}
if (errProds == 0) {
- Map messageMap = UtilMisc.toMap("numProds", Integer.toString(numProds));
+ Map<String, String> messageMap = UtilMisc.toMap("numProds", Integer.toString(numProds));
errMsg = UtilProperties.getMessage(resource,"productevents.keyword_creation_complete_for_products", messageMap, UtilHttp.getLocale(request));
request.setAttribute("_EVENT_MESSAGE_", errMsg);
return "success";
} else {
- Map messageMap = UtilMisc.toMap("numProds", Integer.toString(numProds));
+ Map<String, String> messageMap = UtilMisc.toMap("numProds", Integer.toString(numProds));
messageMap.put("errProds", Integer.toString(errProds));
errMsg = UtilProperties.getMessage(resource,"productevents.keyword_creation_complete_for_products_with_errors", messageMap, UtilHttp.getLocale(request));
request.setAttribute( "_ERROR_MESSAGE_", errMsg);
@@ -198,7 +198,7 @@
*/
public static String updateProductAssoc(HttpServletRequest request, HttpServletResponse response) {
String errMsg = "";
- List errMsgList = FastList.newInstance();
+ List<Object> errMsgList = FastList.newInstance();
GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
Security security = (Security) request.getAttribute("security");
@@ -213,7 +213,7 @@
// check permissions before moving on...
if (!security.hasEntityPermission("CATALOG", "_" + updateMode, request.getSession())) {
- Map messageMap = UtilMisc.toMap("updateMode", updateMode);
+ Map<String, String> messageMap = UtilMisc.toMap("updateMode", updateMode);
errMsg = UtilProperties.getMessage(resource,"productevents.not_sufficient_permissions", messageMap, UtilHttp.getLocale(request));
request.setAttribute("_ERROR_MESSAGE_", errMsg);
return "error";
@@ -227,11 +227,11 @@
try {
if (delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId)) == null) {
- Map messageMap = UtilMisc.toMap("productId", productId);
+ Map<String, String> messageMap = UtilMisc.toMap("productId", productId);
errMsgList.add(UtilProperties.getMessage(resource,"productevents.product_with_id_not_found", messageMap, UtilHttp.getLocale(request)));
}
if (delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productIdTo)) == null) {
- Map messageMap = UtilMisc.toMap("productIdTo", productIdTo);
+ Map<String, String> messageMap = UtilMisc.toMap("productIdTo", productIdTo);
errMsgList.add(UtilProperties.getMessage(resource,"productevents.product_To_with_id_not_found", messageMap, UtilHttp.getLocale(request)));
}
} catch (GenericEntityException e) {
@@ -377,7 +377,7 @@
return "error";
}
} else {
- Map messageMap = UtilMisc.toMap("updateMode", updateMode);
+ Map<String, String> messageMap = UtilMisc.toMap("updateMode", updateMode);
errMsg = UtilProperties.getMessage(resource,"productevents.specified_update_mode_not_supported", messageMap, UtilHttp.getLocale(request));
request.setAttribute("_ERROR_MESSAGE_", errMsg);
return "error";
@@ -449,7 +449,7 @@
Double ntwt = parseDoubleForEntity(request.getParameter("~ntwt"));
Double grams = parseDoubleForEntity(request.getParameter("~grams"));
- List currentProductFeatureAndAppls = EntityUtil.filterByDate(delegator.findByAnd("ProductFeatureAndAppl", UtilMisc.toMap("productId", productId, "productFeatureApplTypeId", "STANDARD_FEATURE")), true);
+ List<GenericValue> currentProductFeatureAndAppls = EntityUtil.filterByDate(delegator.findByAnd("ProductFeatureAndAppl", UtilMisc.toMap("productId", productId, "productFeatureApplTypeId", "STANDARD_FEATURE")), true);
setOrCreateProdFeature(delegator, productId, currentProductFeatureAndAppls, "VLIQ_ozUS", "AMOUNT", floz);
setOrCreateProdFeature(delegator, productId, currentProductFeatureAndAppls, "VLIQ_ml", "AMOUNT", ml);
setOrCreateProdFeature(delegator, productId, currentProductFeatureAndAppls, "WT_g", "AMOUNT", grams);
@@ -479,7 +479,7 @@
Double ntwt = parseDoubleForEntity(request.getParameter("~ntwt" + attribIdx));
Double grams = parseDoubleForEntity(request.getParameter("~grams" + attribIdx));
- List currentProductFeatureAndAppls = EntityUtil.filterByDate(delegator.findByAnd("ProductFeatureAndAppl", UtilMisc.toMap("productId", productId, "productFeatureApplTypeId", "STANDARD_FEATURE")), true);
+ List<GenericValue> currentProductFeatureAndAppls = EntityUtil.filterByDate(delegator.findByAnd("ProductFeatureAndAppl", UtilMisc.toMap("productId", productId, "productFeatureApplTypeId", "STANDARD_FEATURE")), true);
setOrCreateProdFeature(delegator, productId, currentProductFeatureAndAppls, "VLIQ_ozUS", "AMOUNT", floz);
setOrCreateProdFeature(delegator, productId, currentProductFeatureAndAppls, "VLIQ_ml", "AMOUNT", ml);
setOrCreateProdFeature(delegator, productId, currentProductFeatureAndAppls, "WT_g", "AMOUNT", grams);
@@ -526,7 +526,7 @@
* @return
* @throws GenericEntityException
*/
- private static void setOrCreateProdFeature(GenericDelegator delegator, String productId, List currentProductFeatureAndAppls,
+ private static void setOrCreateProdFeature(GenericDelegator delegator, String productId, List<GenericValue> currentProductFeatureAndAppls,
String uomId, String productFeatureTypeId, Double numberSpecified) throws GenericEntityException {
GenericValue productFeatureType = delegator.findByPrimaryKey("ProductFeatureType", UtilMisc.toMap("productFeatureTypeId", productFeatureTypeId));
@@ -535,13 +535,13 @@
Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
// filter list of features to the one we'll be editing
- List typeUomProductFeatureAndApplList = EntityUtil.filterByAnd(currentProductFeatureAndAppls, UtilMisc.toMap("productFeatureTypeId", productFeatureTypeId, "uomId", uomId));
+ List<GenericValue> typeUomProductFeatureAndApplList = EntityUtil.filterByAnd(currentProductFeatureAndAppls, UtilMisc.toMap("productFeatureTypeId", productFeatureTypeId, "uomId", uomId));
// go through each; need to remove? do it now
- Iterator typeUomProductFeatureAndApplIter = typeUomProductFeatureAndApplList.iterator();
+ Iterator<GenericValue> typeUomProductFeatureAndApplIter = typeUomProductFeatureAndApplList.iterator();
boolean foundOneEqual = false;
while (typeUomProductFeatureAndApplIter.hasNext()) {
- GenericValue typeUomProductFeatureAndAppl = (GenericValue) typeUomProductFeatureAndApplIter.next();
+ GenericValue typeUomProductFeatureAndAppl = typeUomProductFeatureAndApplIter.next();
if ((numberSpecified != null) && (numberSpecified.equals(typeUomProductFeatureAndAppl.getDouble("numberSpecified")))) {
foundOneEqual = true;
} else {
@@ -554,9 +554,9 @@
// NOTE: if numberSpecified is null then foundOneEqual will always be false, so need to check both
if (numberSpecified != null && !foundOneEqual) {
String productFeatureId = null;
- List existingProductFeatureList = delegator.findByAnd("ProductFeature", UtilMisc.toMap("productFeatureTypeId", productFeatureTypeId, "numberSpecified", numberSpecified, "uomId", uomId));
+ List<GenericValue> existingProductFeatureList = delegator.findByAnd("ProductFeature", UtilMisc.toMap("productFeatureTypeId", productFeatureTypeId, "numberSpecified", numberSpecified, "uomId", uomId));
if (existingProductFeatureList.size() > 0) {
- GenericValue existingProductFeature = (GenericValue) existingProductFeatureList.get(0);
+ GenericValue existingProductFeature = existingProductFeatureList.get(0);
productFeatureId = existingProductFeature.getString("productFeatureId");
} else {
// doesn't exist, so create it
@@ -623,7 +623,7 @@
description = null;
}
- Set variantDescRemoveToRemoveOnVirtual = FastSet.newInstance();
+ Set<String> variantDescRemoveToRemoveOnVirtual = FastSet.newInstance();
checkUpdateFeatureApplByDescription(variantProductId, variantProduct, description, productFeatureTypeId, productFeatureType, "STANDARD_FEATURE", nowTimestamp, delegator, null, variantDescRemoveToRemoveOnVirtual);
checkUpdateFeatureApplByDescription(productId, product, description, productFeatureTypeId, productFeatureType, "SELECTABLE_FEATURE", nowTimestamp, delegator, variantDescRemoveToRemoveOnVirtual, null);
@@ -659,38 +659,38 @@
protected static void checkUpdateFeatureApplByDescription(String productId, GenericValue product, String description,
String productFeatureTypeId, GenericValue productFeatureType, String productFeatureApplTypeId,
- Timestamp nowTimestamp, GenericDelegator delegator, Set descriptionsToRemove, Set descriptionsRemoved) throws GenericEntityException {
+ Timestamp nowTimestamp, GenericDelegator delegator, Set<String> descriptionsToRemove, Set<String> descriptionsRemoved) throws GenericEntityException {
if (productFeatureType == null) {
return;
}
GenericValue productFeatureAndAppl = null;
- Set descriptionsForThisType = FastSet.newInstance();
- List productFeatureAndApplList = EntityUtil.filterByDate(delegator.findByAnd("ProductFeatureAndAppl", UtilMisc.toMap("productId", productId,
+ Set<String> descriptionsForThisType = FastSet.newInstance();
+ List<GenericValue> productFeatureAndApplList = EntityUtil.filterByDate(delegator.findByAnd("ProductFeatureAndAppl", UtilMisc.toMap("productId", productId,
"productFeatureApplTypeId", productFeatureApplTypeId, "productFeatureTypeId", productFeatureTypeId)), true);
if (productFeatureAndApplList.size() > 0) {
- Iterator productFeatureAndApplIter = productFeatureAndApplList.iterator();
+ Iterator<GenericValue> productFeatureAndApplIter = productFeatureAndApplList.iterator();
while (productFeatureAndApplIter.hasNext()) {
- productFeatureAndAppl = (GenericValue) productFeatureAndApplIter.next();
+ productFeatureAndAppl = productFeatureAndApplIter.next();
GenericValue productFeatureAppl = delegator.makeValidValue("ProductFeatureAppl", productFeatureAndAppl);
// remove productFeatureAppl IFF: productFeatureAppl != null && (description is empty/null || description is different than existing)
if (productFeatureAppl != null && (description == null || !description.equals(productFeatureAndAppl.getString("description")))) {
// if descriptionsToRemove is not null, only remove if description is in that set
- if (descriptionsToRemove == null || (descriptionsToRemove != null && descriptionsToRemove.contains(productFeatureAndAppl.get("description")))) {
+ if (descriptionsToRemove == null || (descriptionsToRemove != null && descriptionsToRemove.contains(productFeatureAndAppl.getString("description")))) {
// okay, almost there: before removing it if this is a virtual product check to make SURE this feature's description doesn't exist on any of the variants; wouldn't want to remove something we should have kept around...
if ("Y".equals(product.getString("isVirtual"))) {
boolean foundFeatureOnVariant = false;
// get/check all the variants
- List variantAssocs = product.getRelatedByAnd("MainProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_VARIANT"));
+ List<GenericValue> variantAssocs = product.getRelatedByAnd("MainProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_VARIANT"));
variantAssocs = EntityUtil.filterByDate(variantAssocs);
- List variants = EntityUtil.getRelated("AssocProduct", variantAssocs);
- Iterator variantIter = variants.iterator();
+ List<GenericValue> variants = EntityUtil.getRelated("AssocProduct", variantAssocs);
+ Iterator<GenericValue> variantIter = variants.iterator();
while (!foundFeatureOnVariant && variantIter.hasNext()) {
- GenericValue variant = (GenericValue) variantIter.next();
+ GenericValue variant = variantIter.next();
// get the selectable features for the variant
- List variantProductFeatureAndAppls = variant.getRelated("ProductFeatureAndAppl",
+ List<GenericValue> variantProductFeatureAndAppls = variant.getRelated("ProductFeatureAndAppl",
UtilMisc.toMap("productFeatureTypeId", productFeatureTypeId,
"productFeatureApplTypeId", "STANDARD_FEATURE", "description", description), null);
if (variantProductFeatureAndAppls.size() > 0) {
@@ -705,7 +705,7 @@
}
if (descriptionsRemoved != null) {
- descriptionsRemoved.add(productFeatureAndAppl.get("description"));
+ descriptionsRemoved.add(productFeatureAndAppl.getString("description"));
}
productFeatureAppl.remove();
continue;
@@ -713,7 +713,7 @@
}
// we got here, is still a valid description associated with this product
- descriptionsForThisType.add(productFeatureAndAppl.get("description"));
+ descriptionsForThisType.add(productFeatureAndAppl.getString("description"));
}
}
@@ -722,9 +722,9 @@
// see if a feature exists with the type and description specified (if doesn't exist will create later)
String productFeatureId = null;
- List existingProductFeatureList = delegator.findByAnd("ProductFeature", UtilMisc.toMap("productFeatureTypeId", productFeatureTypeId, "description", description));
+ List<GenericValue> existingProductFeatureList = delegator.findByAnd("ProductFeature", UtilMisc.toMap("productFeatureTypeId", productFeatureTypeId, "description", description));
if (existingProductFeatureList.size() > 0) {
- GenericValue existingProductFeature = (GenericValue) existingProductFeatureList.get(0);
+ GenericValue existingProductFeature = existingProductFeatureList.get(0);
productFeatureId = existingProductFeature.getString("productFeatureId");
} else {
// doesn't exist, so create it
@@ -747,7 +747,7 @@
}
// check to see if the productFeatureId is already attached to the virtual or variant, if not attach them...
- List specificProductFeatureApplList = EntityUtil.filterByDate(delegator.findByAnd("ProductFeatureAppl", UtilMisc.toMap("productId", productId,
+ List<GenericValue> specificProductFeatureApplList = EntityUtil.filterByDate(delegator.findByAnd("ProductFeatureAppl", UtilMisc.toMap("productId", productId,
"productFeatureApplTypeId", productFeatureApplTypeId, "productFeatureId", productFeatureId)), true);
if (specificProductFeatureApplList.size() == 0) {
@@ -770,26 +770,26 @@
try {
GenericValue product = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId));
// get all the variants
- List variantAssocs = product.getRelatedByAnd("MainProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_VARIANT"));
+ List<GenericValue> variantAssocs = product.getRelatedByAnd("MainProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_VARIANT"));
variantAssocs = EntityUtil.filterByDate(variantAssocs);
- List variants = EntityUtil.getRelated("AssocProduct", variantAssocs);
- Iterator variantIter = variants.iterator();
+ List<GenericValue> variants = EntityUtil.getRelated("AssocProduct", variantAssocs);
+ Iterator<GenericValue> variantIter = variants.iterator();
while (variantIter.hasNext()) {
- GenericValue variant = (GenericValue) variantIter.next();
+ GenericValue variant = variantIter.next();
// get the selectable features for the variant
- List productFeatureAndAppls = variant.getRelated("ProductFeatureAndAppl", UtilMisc.toMap("productFeatureTypeId", productFeatureTypeId, "productFeatureApplTypeId", "STANDARD_FEATURE"), null);
- Iterator productFeatureAndApplIter = productFeatureAndAppls.iterator();
+ List<GenericValue> productFeatureAndAppls = variant.getRelated("ProductFeatureAndAppl", UtilMisc.toMap("productFeatureTypeId", productFeatureTypeId, "productFeatureApplTypeId", "STANDARD_FEATURE"), null);
+ Iterator<GenericValue> productFeatureAndApplIter = productFeatureAndAppls.iterator();
while (productFeatureAndApplIter.hasNext()) {
- GenericValue productFeatureAndAppl = (GenericValue) productFeatureAndApplIter.next();
+ GenericValue productFeatureAndAppl = productFeatureAndApplIter.next();
GenericPK productFeatureApplPK = delegator.makePK("ProductFeatureAppl");
productFeatureApplPK.setPKFields(productFeatureAndAppl);
delegator.removeByPrimaryKey(productFeatureApplPK);
}
}
- List productFeatureAndAppls = product.getRelated("ProductFeatureAndAppl", UtilMisc.toMap("productFeatureTypeId", productFeatureTypeId, "productFeatureApplTypeId", "SELECTABLE_FEATURE"), null);
- Iterator productFeatureAndApplIter = productFeatureAndAppls.iterator();
+ List<GenericValue> productFeatureAndAppls = product.getRelated("ProductFeatureAndAppl", UtilMisc.toMap("productFeatureTypeId", productFeatureTypeId, "productFeatureApplTypeId", "SELECTABLE_FEATURE"), null);
+ Iterator<GenericValue> productFeatureAndApplIter = productFeatureAndAppls.iterator();
while (productFeatureAndApplIter.hasNext()) {
- GenericValue productFeatureAndAppl = (GenericValue) productFeatureAndApplIter.next();
+ GenericValue productFeatureAndAppl = productFeatureAndApplIter.next();
GenericPK productFeatureApplPK = delegator.makePK("ProductFeatureAppl");
productFeatureApplPK.setPKFields(productFeatureAndAppl);
delegator.removeByPrimaryKey(productFeatureApplPK);
@@ -836,7 +836,7 @@
if (categoryId != null) {
for (int i = 0; i < categoryId.length; i++) {
try {
- List catMembs = delegator.findByAnd("ProductCategoryMember", UtilMisc.toMap(
+ List<GenericValue> catMembs = delegator.findByAnd("ProductCategoryMember", UtilMisc.toMap(
"productCategoryId", categoryId[i],
"productId", productId));
catMembs = EntityUtil.filterByDate(catMembs);
@@ -864,12 +864,12 @@
thruDate = UtilDateTime.nowTimestamp().toString();
}
try {
- List prodCatMembs = delegator.findByAnd("ProductCategoryMember",
+ List<GenericValue> prodCatMembs = delegator.findByAnd("ProductCategoryMember",
UtilMisc.toMap("productCategoryId", productCategoryId, "productId", productId));
prodCatMembs = EntityUtil.filterByDate(prodCatMembs);
if (prodCatMembs.size() > 0) {
// there is one to modify
- GenericValue prodCatMemb = (GenericValue)prodCatMembs.get(0);
+ GenericValue prodCatMemb = prodCatMembs.get(0);
prodCatMemb.setString("thruDate", thruDate);
prodCatMemb.store();
}
@@ -895,7 +895,7 @@
try {
for (int i = 0; i < productFeatureIdArray.length; i++) {
if (!productFeatureIdArray[i].equals("~~any~~")) {
- List featureAppls = delegator.findByAnd("ProductFeatureAppl",
+ List<GenericValue> featureAppls = delegator.findByAnd("ProductFeatureAppl",
UtilMisc.toMap("productId", productId,
"productFeatureId", productFeatureIdArray[i],
"productFeatureApplTypeId", productFeatureApplTypeId));
@@ -966,7 +966,7 @@
GenericValue productStore = ProductStoreWorker.getProductStore(request);
if (productStore != null && userLogin != null) {
if ("Y".equals(productStore.getString("requireCustomerRole"))) {
- List productStoreRoleList = null;
+ List<GenericValue> productStoreRoleList = null;
try {
productStoreRoleList = delegator.findByAnd("ProductStoreRole", UtilMisc.toMap("productStoreId", productStore.get("productStoreId"),
"partyId", userLogin.get("partyId"), "roleTypeId", "CUSTOMER"));
@@ -1024,11 +1024,11 @@
bodyScreenLocation = defaultScreenLocation;
}
- Map paramMap = UtilHttp.getParameterMap(request);
+ Map<String, Object> paramMap = UtilHttp.getParameterMap(request);
paramMap.put("locale", UtilHttp.getLocale(request));
paramMap.put("userLogin", session.getAttribute("userLogin"));
- Map context = FastMap.newInstance();
+ Map<String, Object> context = FastMap.newInstance();
context.put("bodyScreenUri", bodyScreenLocation);
context.put("bodyParameters", paramMap);
context.put("sendTo", paramMap.get("sendTo"));
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearch.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearch.java?rev=712916&r1=712915&r2=712916&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearch.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearch.java Mon Nov 10 18:16:46 2008
@@ -71,8 +71,8 @@
public static final String resource = "ProductUiLabels";
public static final String resourceCommon = "CommonUiLabels";
- public static ArrayList parametricKeywordSearch(Map featureIdByType, String keywordsString, GenericDelegator delegator, String productCategoryId, String visitId, boolean anyPrefix, boolean anySuffix, boolean isAnd) {
- Set featureIdSet = FastSet.newInstance();
+ public static ArrayList parametricKeywordSearch(Map<?, String> featureIdByType, String keywordsString, GenericDelegator delegator, String productCategoryId, String visitId, boolean anyPrefix, boolean anySuffix, boolean isAnd) {
+ Set<String> featureIdSet = FastSet.newInstance();
if (featureIdByType != null) {
featureIdSet.addAll(featureIdByType.values());
}
@@ -80,8 +80,8 @@
return parametricKeywordSearch(featureIdSet, keywordsString, delegator, productCategoryId, true, visitId, anyPrefix, anySuffix, isAnd);
}
- public static ArrayList parametricKeywordSearch(Set featureIdSet, String keywordsString, GenericDelegator delegator, String productCategoryId, boolean includeSubCategories, String visitId, boolean anyPrefix, boolean anySuffix, boolean isAnd) {
- List productSearchConstraintList = FastList.newInstance();
+ public static ArrayList parametricKeywordSearch(Set<String> featureIdSet, String keywordsString, GenericDelegator delegator, String productCategoryId, boolean includeSubCategories, String visitId, boolean anyPrefix, boolean anySuffix, boolean isAnd) {
+ List<ProductSearchConstraint> productSearchConstraintList = FastList.newInstance();
if (UtilValidate.isNotEmpty(productCategoryId)) {
productSearchConstraintList.add(new CategoryConstraint(productCategoryId, includeSubCategories, null));
@@ -92,9 +92,9 @@
}
if (UtilValidate.isNotEmpty(featureIdSet)) {
- Iterator featureIdIter = featureIdSet.iterator();
+ Iterator<String> featureIdIter = featureIdSet.iterator();
while (featureIdIter.hasNext()) {
- String productFeatureId = (String) featureIdIter.next();
+ String productFeatureId = featureIdIter.next();
productSearchConstraintList.add(new FeatureConstraint(productFeatureId, null));
}
}
@@ -102,17 +102,17 @@
return searchProducts(productSearchConstraintList, new SortKeywordRelevancy(), delegator, visitId);
}
- public static ArrayList searchProducts(List productSearchConstraintList, ResultSortOrder resultSortOrder, GenericDelegator delegator, String visitId) {
+ public static ArrayList<String> searchProducts(List<ProductSearchConstraint> productSearchConstraintList, ResultSortOrder resultSortOrder, GenericDelegator delegator, String visitId) {
ProductSearchContext productSearchContext = new ProductSearchContext(delegator, visitId);
productSearchContext.addProductSearchConstraints(productSearchConstraintList);
productSearchContext.setResultSortOrder(resultSortOrder);
- ArrayList productIds = productSearchContext.doSearch();
+ ArrayList<String> productIds = productSearchContext.doSearch();
return productIds;
}
- public static void getAllSubCategoryIds(String productCategoryId, Set productCategoryIdSet, GenericDelegator delegator, Timestamp nowTimestamp) {
+ public static void getAllSubCategoryIds(String productCategoryId, Set<String> productCategoryIdSet, GenericDelegator delegator, Timestamp nowTimestamp) {
if (nowTimestamp == null) {
nowTimestamp = UtilDateTime.nowTimestamp();
}
@@ -124,10 +124,11 @@
// now find all sub-categories, filtered by effective dates, and call this routine for them
try {
- List productCategoryRollupList = delegator.findByAndCache("ProductCategoryRollup", UtilMisc.toMap("parentProductCategoryId", productCategoryId));
- Iterator productCategoryRollupIter = productCategoryRollupList.iterator();
+ List<GenericValue> productCategoryRollupList = delegator.findByAndCache("ProductCategoryRollup", UtilMisc.toMap("parentProductCategoryId", productCategoryId));
+
+ Iterator<GenericValue> productCategoryRollupIter = productCategoryRollupList.iterator();
while (productCategoryRollupIter.hasNext()) {
- GenericValue productCategoryRollup = (GenericValue) productCategoryRollupIter.next();
+ GenericValue productCategoryRollup = productCategoryRollupIter.next();
String subProductCategoryId = productCategoryRollup.getString("productCategoryId");
if (productCategoryIdSet.contains(subProductCategoryId)) {
@@ -147,17 +148,17 @@
public static class ProductSearchContext {
public int index = 1;
- public List entityConditionList = FastList.newInstance();
- public List orderByList = FastList.newInstance();
- public List fieldsToSelect = UtilMisc.toList("mainProductId");
+ public List<EntityCondition> entityConditionList = FastList.newInstance();
+ public List<String> orderByList = FastList.newInstance();
+ 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 keywordFixedOrSetAndList = FastList.newInstance();
- public Set orKeywordFixedSet = FastSet.newInstance();
- public Set andKeywordFixedSet = FastSet.newInstance();
- public List productSearchConstraintList = FastList.newInstance();
+ public List<Set<String>> keywordFixedOrSetAndList = FastList.newInstance();
+ public Set<String> orKeywordFixedSet = FastSet.newInstance();
+ public Set<String> andKeywordFixedSet = FastSet.newInstance();
+ public List<GenericValue> productSearchConstraintList = FastList.newInstance();
public ResultSortOrder resultSortOrder = null;
public Integer resultOffset = null;
public Integer maxResults = null;
@@ -165,27 +166,27 @@
protected String visitId = null;
protected Integer totalResults = null;
- public Set includeCategoryIds = FastSet.newInstance();
- public Set excludeCategoryIds = FastSet.newInstance();
+ public Set<String> includeCategoryIds = FastSet.newInstance();
+ public Set<String> excludeCategoryIds = FastSet.newInstance();
public Set alwaysIncludeCategoryIds = FastSet.newInstance();
- public List includeCategoryIdOrSetAndList = FastList.newInstance();
- public List alwaysIncludeCategoryIdOrSetAndList = FastList.newInstance();
+ public List<Set<String>> includeCategoryIdOrSetAndList = FastList.newInstance();
+ public List<Set<String>> alwaysIncludeCategoryIdOrSetAndList = FastList.newInstance();
- public Set includeFeatureIds = FastSet.newInstance();
- public Set excludeFeatureIds = FastSet.newInstance();
- public Set alwaysIncludeFeatureIds = FastSet.newInstance();
+ public Set<String> includeFeatureIds = FastSet.newInstance();
+ public Set<String> excludeFeatureIds = FastSet.newInstance();
+ public Set<String> alwaysIncludeFeatureIds = FastSet.newInstance();
- public List includeFeatureIdOrSetAndList = FastList.newInstance();
- public List alwaysIncludeFeatureIdOrSetAndList = FastList.newInstance();
+ public List<Set<String>> includeFeatureIdOrSetAndList = FastList.newInstance();
+ public List<Set<String>> alwaysIncludeFeatureIdOrSetAndList = FastList.newInstance();
- public Set includeFeatureCategoryIds = FastSet.newInstance();
- public Set excludeFeatureCategoryIds = FastSet.newInstance();
- public Set alwaysIncludeFeatureCategoryIds = FastSet.newInstance();
-
- public Set includeFeatureGroupIds = FastSet.newInstance();
- public Set excludeFeatureGroupIds = FastSet.newInstance();
- public Set alwaysIncludeFeatureGroupIds = FastSet.newInstance();
+ public Set<String> includeFeatureCategoryIds = FastSet.newInstance();
+ public Set<String> excludeFeatureCategoryIds = FastSet.newInstance();
+ public Set<String> alwaysIncludeFeatureCategoryIds = FastSet.newInstance();
+
+ public Set<String> includeFeatureGroupIds = FastSet.newInstance();
+ public Set<String> excludeFeatureGroupIds = FastSet.newInstance();
+ public Set<String> alwaysIncludeFeatureGroupIds = FastSet.newInstance();
public ProductSearchContext(GenericDelegator delegator, String visitId) {
this.delegator = delegator;
@@ -199,11 +200,11 @@
return this.delegator;
}
- public void addProductSearchConstraints(List productSearchConstraintList) {
+ public void addProductSearchConstraints(List<ProductSearchConstraint> productSearchConstraintList) {
// Go through the constraints and add them in
- Iterator productSearchConstraintIter = productSearchConstraintList.iterator();
+ Iterator<ProductSearchConstraint> productSearchConstraintIter = productSearchConstraintList.iterator();
while (productSearchConstraintIter.hasNext()) {
- ProductSearchConstraint constraint = (ProductSearchConstraint) productSearchConstraintIter.next();
+ ProductSearchConstraint constraint = productSearchConstraintIter.next();
constraint.addConstraint(this);
}
}
@@ -224,12 +225,12 @@
return this.totalResults;
}
- public ArrayList doSearch() {
+ public ArrayList<String> doSearch() {
long startMillis = System.currentTimeMillis();
// do the query
EntityListIterator eli = this.doQuery(delegator);
- ArrayList productIds = this.makeProductIdList(eli);
+ ArrayList<String> productIds = this.makeProductIdList(eli);
if (eli != null) {
try {
eli.close();
@@ -262,9 +263,9 @@
}
// remove all or sets from the or set and list where the or set is size 1 and put them in the and list
- Iterator keywordFixedOrSetAndTestIter = keywordFixedOrSetAndList.iterator();
+ Iterator<Set<String>> keywordFixedOrSetAndTestIter = keywordFixedOrSetAndList.iterator();
while (keywordFixedOrSetAndTestIter.hasNext()) {
- Set keywordFixedOrSet = (Set) keywordFixedOrSetAndTestIter.next();
+ Set<String> keywordFixedOrSet = keywordFixedOrSetAndTestIter.next();
if (keywordFixedOrSet.size() == 0) {
keywordFixedOrSetAndTestIter.remove();
} else if (keywordFixedOrSet.size() == 1) {
@@ -282,9 +283,9 @@
if (andKeywordFixedSet.size() > 0) {
// add up the relevancyWeight fields from all keyword member entities for a total to sort by
- Iterator keywordIter = andKeywordFixedSet.iterator();
+ Iterator<String> keywordIter = andKeywordFixedSet.iterator();
while (keywordIter.hasNext()) {
- String keyword = (String) keywordIter.next();
+ String keyword = keywordIter.next();
// make index based values and increment
String entityAlias = "PK" + index;
@@ -311,9 +312,9 @@
}
}
if (keywordFixedOrSetAndList.size() > 0) {
- Iterator keywordFixedOrSetAndIter = keywordFixedOrSetAndList.iterator();
+ Iterator<Set<String>> keywordFixedOrSetAndIter = keywordFixedOrSetAndList.iterator();
while (keywordFixedOrSetAndIter.hasNext()) {
- Set keywordFixedOrSet = (Set) keywordFixedOrSetAndIter.next();
+ Set<String> keywordFixedOrSet = keywordFixedOrSetAndIter.next();
// make index based values and increment
String entityAlias = "PK" + index;
String prefix = "pk" + index;
@@ -322,10 +323,10 @@
dynamicViewEntity.addMemberEntity(entityAlias, "ProductKeyword");
dynamicViewEntity.addAlias(entityAlias, prefix + "Keyword", "keyword", null, null, null, null);
dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"));
- List keywordOrList = FastList.newInstance();
- Iterator keywordIter = keywordFixedOrSet.iterator();
+ List<EntityCondition> keywordOrList = FastList.newInstance();
+ Iterator<String> keywordIter = keywordFixedOrSet.iterator();
while (keywordIter.hasNext()) {
- String keyword = (String) keywordIter.next();
+ String keyword = keywordIter.next();
keywordOrList.add(EntityCondition.makeCondition(prefix + "Keyword", EntityOperator.LIKE, keyword));
}
entityConditionList.add(EntityCondition.makeCondition(keywordOrList, EntityOperator.OR));
@@ -358,18 +359,18 @@
// 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 incExcCondList = FastList.newInstance();
+ List<EntityCondition> incExcCondList = FastList.newInstance();
EntityCondition incExcCond = null;
- List alwIncCondList = FastList.newInstance();
+ List<EntityCondition> alwIncCondList = FastList.newInstance();
EntityCondition alwIncCond = null;
EntityCondition topCond = null;
if (includeCategoryIds.size() > 0) {
- Iterator includeCategoryIdIter = includeCategoryIds.iterator();
+ Iterator<String> includeCategoryIdIter = includeCategoryIds.iterator();
while (includeCategoryIdIter.hasNext()) {
- String includeCategoryId = (String) includeCategoryIdIter.next();
+ String includeCategoryId = includeCategoryIdIter.next();
String categoryPrefix = "pcm" + this.index;
String entityAlias = "PCM" + this.index;
this.index++;
@@ -385,9 +386,9 @@
}
}
if (includeFeatureIds.size() > 0) {
- Iterator includeFeatureIdIter = includeFeatureIds.iterator();
+ Iterator<String> includeFeatureIdIter = includeFeatureIds.iterator();
while (includeFeatureIdIter.hasNext()) {
- String includeFeatureId = (String) includeFeatureIdIter.next();
+ String includeFeatureId = includeFeatureIdIter.next();
String featurePrefix = "pfa" + this.index;
String entityAlias = "PFA" + this.index;
this.index++;
@@ -403,9 +404,9 @@
}
}
if (includeFeatureCategoryIds.size() > 0) {
- Iterator includeFeatureCategoryIdIter = includeFeatureCategoryIds.iterator();
+ Iterator<String> includeFeatureCategoryIdIter = includeFeatureCategoryIds.iterator();
while (includeFeatureCategoryIdIter.hasNext()) {
- String includeFeatureCategoryId = (String) includeFeatureCategoryIdIter.next();
+ String includeFeatureCategoryId = includeFeatureCategoryIdIter.next();
String featurePrefix = "pfa" + this.index;
String entityAlias = "PFA" + this.index;
String otherFeaturePrefix = "pfe" + this.index;
@@ -425,9 +426,9 @@
}
}
if (includeFeatureGroupIds.size() > 0) {
- Iterator includeFeatureGroupIdIter = includeFeatureGroupIds.iterator();
+ Iterator<String> includeFeatureGroupIdIter = includeFeatureGroupIds.iterator();
while (includeFeatureGroupIdIter.hasNext()) {
- String includeFeatureGroupId = (String) includeFeatureGroupIdIter.next();
+ String includeFeatureGroupId = includeFeatureGroupIdIter.next();
String featurePrefix = "pfa" + this.index;
String entityAlias = "PFA" + this.index;
String otherFeaturePrefix = "pfga" + this.index;
@@ -452,7 +453,7 @@
}
if (excludeCategoryIds.size() > 0) {
- List idExcludeCondList = FastList.newInstance();
+ List<EntityCondition> idExcludeCondList = FastList.newInstance();
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 +461,7 @@
incExcCondList.add(EntityCondition.makeCondition("mainProductId", EntityOperator.NOT_EQUAL, subSelCond));
}
if (excludeFeatureIds.size() > 0) {
- List idExcludeCondList = FastList.newInstance();
+ List<EntityCondition> idExcludeCondList = FastList.newInstance();
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 +469,7 @@
incExcCondList.add(EntityCondition.makeCondition("mainProductId", EntityOperator.NOT_EQUAL, subSelCond));
}
if (excludeFeatureCategoryIds.size() > 0) {
- List idExcludeCondList = FastList.newInstance();
+ List<EntityCondition> idExcludeCondList = FastList.newInstance();
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 +477,7 @@
incExcCondList.add(EntityCondition.makeCondition("mainProductId", EntityOperator.NOT_EQUAL, subSelCond));
}
if (excludeFeatureGroupIds.size() > 0) {
- List idExcludeCondList = FastList.newInstance();
+ List<EntityCondition> idExcludeCondList = FastList.newInstance();
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)));
@@ -515,9 +516,9 @@
alwIncCondList.add(EntityCondition.makeCondition(featurePrefix + "ProductFeatureId", EntityOperator.IN, alwaysIncludeFeatureIds));
}
if (alwaysIncludeFeatureCategoryIds.size() > 0) {
- Iterator alwaysIncludeFeatureCategoryIdIter = alwaysIncludeFeatureCategoryIds.iterator();
+ Iterator<String> alwaysIncludeFeatureCategoryIdIter = alwaysIncludeFeatureCategoryIds.iterator();
while (alwaysIncludeFeatureCategoryIdIter.hasNext()) {
- String alwaysIncludeFeatureCategoryId = (String) alwaysIncludeFeatureCategoryIdIter.next();
+ String alwaysIncludeFeatureCategoryId = alwaysIncludeFeatureCategoryIdIter.next();
String featurePrefix = "pfa" + this.index;
String entityAlias = "PFA" + this.index;
String otherFeaturePrefix = "pfe" + this.index;
@@ -537,9 +538,9 @@
}
}
if (alwaysIncludeFeatureGroupIds.size() > 0) {
- Iterator alwaysIncludeFeatureGroupIdIter = alwaysIncludeFeatureGroupIds.iterator();
+ Iterator<String> alwaysIncludeFeatureGroupIdIter = alwaysIncludeFeatureGroupIds.iterator();
while (alwaysIncludeFeatureGroupIdIter.hasNext()) {
- String alwaysIncludeFeatureGroupId = (String) alwaysIncludeFeatureGroupIdIter.next();
+ String alwaysIncludeFeatureGroupId = alwaysIncludeFeatureGroupIdIter.next();
String featurePrefix = "pfa" + this.index;
String entityAlias = "PFA" + this.index;
String otherFeaturePrefix = "pfga" + this.index;
@@ -565,9 +566,9 @@
// handle includeFeatureIdOrSetAndList and alwaysIncludeFeatureIdOrSetAndList
if (includeFeatureIdOrSetAndList.size() > 0) {
- Iterator includeFeatureIdOrSetAndIter = includeFeatureIdOrSetAndList.iterator();
+ Iterator<Set<String>> includeFeatureIdOrSetAndIter = includeFeatureIdOrSetAndList.iterator();
while (includeFeatureIdOrSetAndIter.hasNext()) {
- Set includeFeatureIdOrSet = (Set) includeFeatureIdOrSetAndIter.next();
+ Set<String> includeFeatureIdOrSet = includeFeatureIdOrSetAndIter.next();
String featurePrefix = "pfa" + this.index;
String entityAlias = "PFA" + this.index;
this.index++;
@@ -583,9 +584,9 @@
}
}
if (alwaysIncludeFeatureIdOrSetAndList.size() > 0) {
- Iterator alwaysIncludeFeatureIdOrSetAndIter = alwaysIncludeFeatureIdOrSetAndList.iterator();
+ Iterator<Set<String>> alwaysIncludeFeatureIdOrSetAndIter = alwaysIncludeFeatureIdOrSetAndList.iterator();
while (alwaysIncludeFeatureIdOrSetAndIter.hasNext()) {
- Set alwaysIncludeFeatureIdOrSet = (Set) alwaysIncludeFeatureIdOrSetAndIter.next();
+ Set<String> alwaysIncludeFeatureIdOrSet = alwaysIncludeFeatureIdOrSetAndIter.next();
String featurePrefix = "pfa" + this.index;
String entityAlias = "PFA" + this.index;
this.index++;
@@ -603,9 +604,9 @@
// handle includeCategoryIdOrSetAndList and alwaysIncludeCategoryIdOrSetAndList
if (includeCategoryIdOrSetAndList.size() > 0) {
- Iterator includeCategoryIdOrSetAndIter = includeCategoryIdOrSetAndList.iterator();
+ Iterator<Set<String>> includeCategoryIdOrSetAndIter = includeCategoryIdOrSetAndList.iterator();
while (includeCategoryIdOrSetAndIter.hasNext()) {
- Set includeCategoryIdOrSet = (Set) includeCategoryIdOrSetAndIter.next();
+ Set<String> includeCategoryIdOrSet = includeCategoryIdOrSetAndIter.next();
String categoryPrefix = "pcm" + this.index;
String entityAlias = "PCM" + this.index;
this.index++;
@@ -621,9 +622,9 @@
}
}
if (alwaysIncludeCategoryIdOrSetAndList.size() > 0) {
- Iterator alwaysIncludeCategoryIdOrSetAndIter = alwaysIncludeCategoryIdOrSetAndList.iterator();
+ Iterator<Set<String>> alwaysIncludeCategoryIdOrSetAndIter = alwaysIncludeCategoryIdOrSetAndList.iterator();
while (alwaysIncludeCategoryIdOrSetAndIter.hasNext()) {
- Set alwaysIncludeCategoryIdOrSet = (Set) alwaysIncludeCategoryIdOrSetAndIter.next();
+ Set<String> alwaysIncludeCategoryIdOrSet = alwaysIncludeCategoryIdOrSetAndIter.next();
String categoryPrefix = "pcm" + this.index;
String entityAlias = "PCM" + this.index;
this.index++;
@@ -686,8 +687,8 @@
return eli;
}
- public ArrayList makeProductIdList(EntityListIterator eli) {
- ArrayList productIds = new ArrayList(maxResults == null ? 100 : maxResults.intValue());
+ public ArrayList<String> makeProductIdList(EntityListIterator eli) {
+ ArrayList<String> productIds = new ArrayList<String>(maxResults == null ? 100 : maxResults.intValue());
if (eli == null) {
Debug.logWarning("The eli is null, returning zero results", module);
return productIds;
@@ -744,7 +745,7 @@
int numRetreived = 1;
int duplicatesFound = 0;
- Set productIdSet = FastSet.newInstance();
+ Set<String> productIdSet = FastSet.newInstance();
productIds.add(searchResult.getString("mainProductId"));
productIdSet.add(searchResult.getString("mainProductId"));
@@ -761,9 +762,9 @@
/*
StringBuilder lineMsg = new StringBuilder("Got search result line: ");
- Iterator fieldsToSelectIter = fieldsToSelect.iterator();
+ Iterator<String> fieldsToSelectIter = fieldsToSelect.iterator();
while (fieldsToSelectIter.hasNext()) {
- String fieldName = (String) fieldsToSelectIter.next();
+ String fieldName = fieldsToSelectIter.next();
lineMsg.append(fieldName);
lineMsg.append("=");
lineMsg.append(searchResult.get(fieldName));
@@ -822,10 +823,10 @@
productSearchResult.set("searchDate", nowTimestamp);
productSearchResult.create();
- Iterator productSearchConstraintIter = productSearchConstraintList.iterator();
+ Iterator<GenericValue> productSearchConstraintIter = productSearchConstraintList.iterator();
int seqId = 1;
while (productSearchConstraintIter.hasNext()) {
- GenericValue productSearchConstraint = (GenericValue) productSearchConstraintIter.next();
+ GenericValue productSearchConstraint = productSearchConstraintIter.next();
productSearchConstraint.set("productSearchResultId", productSearchResultId);
productSearchConstraint.set("constraintSeqId", Integer.toString(seqId));
productSearchConstraint.create();
@@ -860,18 +861,18 @@
public static class CatalogConstraint extends ProductSearchConstraint {
public static final String constraintName = "Catalog";
protected String prodCatalogId;
- protected List productCategories;
+ protected List<GenericValue> productCategories;
- public CatalogConstraint(String prodCatalogId, List productCategories) {
+ public CatalogConstraint(String prodCatalogId, List<GenericValue> productCategories) {
this.prodCatalogId = prodCatalogId;
this.productCategories = productCategories;
}
public void addConstraint(ProductSearchContext productSearchContext) {
- List productCategoryIds = FastList.newInstance();
- Iterator itCat = productCategories.iterator();
+ List<String> productCategoryIds = FastList.newInstance();
+ Iterator<GenericValue> itCat = productCategories.iterator();
while (itCat.hasNext()) {
- GenericValue category = (GenericValue)itCat.next();
+ GenericValue category = itCat.next();
productCategoryIds.add(category.getString("productCategoryId"));
}
@@ -901,7 +902,7 @@
Debug.logError(e, "Error finding ProdCatalog information for constraint pretty print", module);
}
StringBuilder ppBuf = new StringBuilder();
- ppBuf.append(UtilProperties.getMessage(resource, "ProductCatalog", locale)+": ");
+ ppBuf.append(UtilProperties.getMessage(resource, "ProductCatalog", locale)).append(": ");
if (prodCatalog != null) {
ppBuf.append(prodCatalog.getString("catalogName"));
}
@@ -948,7 +949,7 @@
}
public void addConstraint(ProductSearchContext productSearchContext) {
- Set productCategoryIdSet = FastSet.newInstance();
+ Set<String> productCategoryIdSet = FastSet.newInstance();
if (includeSubCategories) {
// find all sub-categories recursively, make a Set of productCategoryId
ProductSearch.getAllSubCategoryIds(productCategoryId, productCategoryIdSet, productSearchContext.getDelegator(), productSearchContext.nowTimestamp);
@@ -978,7 +979,7 @@
Debug.logError(e, "Error finding ProductCategory information for constraint pretty print", module);
}
StringBuilder ppBuf = new StringBuilder();
- ppBuf.append(UtilProperties.getMessage(resource, "ProductCategory", locale)+": ");
+ ppBuf.append(UtilProperties.getMessage(resource, "ProductCategory", locale)).append(": ");
if (productCategory != null) {
String catInfo = CategoryContentWrapper.getProductCategoryContentAsText(productCategory, "CATEGORY_NAME", locale, null);
if (UtilValidate.isEmpty(catInfo)) {
@@ -992,7 +993,7 @@
ppBuf.append("]");
}
if (includeSubCategories) {
- ppBuf.append(" ("+UtilProperties.getMessage(resource, "ProductIncludeAllSubCategories", locale)+")");
+ ppBuf.append(" (").append(UtilProperties.getMessage(resource, "ProductIncludeAllSubCategories", locale)).append(")");
}
return ppBuf.toString();
}
@@ -1061,11 +1062,11 @@
}
StringBuilder ppBuf = new StringBuilder();
if (productFeatureType == null) {
- ppBuf.append(UtilProperties.getMessage(resource, "ProductFeature", locale)+": ");
- ppBuf.append("[" + this.productFeatureId + "]");
+ ppBuf.append(UtilProperties.getMessage(resource, "ProductFeature", locale)).append(": ");
+ ppBuf.append("[").append(this.productFeatureId).append("]");
} else {
// TODO getString to be localized like get("description", locale)
- ppBuf.append(productFeatureType.getString("description") + ": ");
+ ppBuf.append(productFeatureType.getString("description")).append(": ");
ppBuf.append(productFeature.getString("description"));
}
if (this.exclude != null) {
@@ -1138,11 +1139,11 @@
}
StringBuilder ppBuf = new StringBuilder();
if (productFeatureCategory != null) {
- ppBuf.append(UtilProperties.getMessage(resource, "ProductFeatureCategory", locale)+": ");
+ ppBuf.append(UtilProperties.getMessage(resource, "ProductFeatureCategory", locale)).append(": ");
if(productFeatureCategory.get("description") != null) {
ppBuf.append(productFeatureCategory.get("description"));
} else {
- ppBuf.append("[" + this.productFeatureCategoryId + "]");
+ ppBuf.append("[").append(this.productFeatureCategoryId).append("]");
}
}
@@ -1215,11 +1216,11 @@
}
StringBuilder ppBuf = new StringBuilder();
if (productFeatureGroup != null) {
- ppBuf.append(UtilProperties.getMessage(resource, "ProductFeatureGroup", locale) + ": ");
+ ppBuf.append(UtilProperties.getMessage(resource, "ProductFeatureGroup", locale)).append(": ");
if(productFeatureGroup.get("description") != null) {
ppBuf.append(productFeatureGroup.get("description"));
} else {
- ppBuf.append("[" + this.productFeatureGroupId + "]");
+ ppBuf.append("[").append(this.productFeatureGroupId).append("]");
}
}
if (this.exclude != null) {
@@ -1255,7 +1256,7 @@
public static class FeatureSetConstraint extends ProductSearchConstraint {
public static final String constraintName = "Feature Set";
- protected Set productFeatureIdSet;
+ protected Set<String> productFeatureIdSet;
/** This is a tri-state variable: null = Include, true = Exclude, false = AlwaysInclude */
protected Boolean exclude;
@@ -1264,7 +1265,7 @@
* @param productFeatureIdSet
* @param exclude This is a tri-state variable: null = Include, true = Exclude, false = AlwaysInclude
*/
- public FeatureSetConstraint(Collection productFeatureIdSet, Boolean exclude) {
+ public FeatureSetConstraint(Collection<String> productFeatureIdSet, Boolean exclude) {
this.productFeatureIdSet = FastSet.newInstance();
this.productFeatureIdSet.addAll(productFeatureIdSet);
this.exclude = exclude;
@@ -1282,9 +1283,9 @@
// add in productSearchConstraint, don't worry about the productSearchResultId or constraintSeqId, those will be fill in later
StringBuilder featureIdInfo = new StringBuilder();
- Iterator featureIdIter = this.productFeatureIdSet.iterator();
+ Iterator<String> featureIdIter = this.productFeatureIdSet.iterator();
while (featureIdIter.hasNext()) {
- String featureId = (String) featureIdIter.next();
+ String featureId = featureIdIter.next();
featureIdInfo.append(featureId);
if (featureIdIter.hasNext()) {
featureIdInfo.append(",");
@@ -1297,9 +1298,9 @@
public String prettyPrintConstraint(GenericDelegator delegator, boolean detailed, Locale locale) {
StringBuilder infoOut = new StringBuilder();
try {
- Iterator featureIdIter = this.productFeatureIdSet.iterator();
+ Iterator<String> featureIdIter = this.productFeatureIdSet.iterator();
while (featureIdIter.hasNext()) {
- String featureId = (String) featureIdIter.next();
+ String featureId = featureIdIter.next();
GenericValue productFeature = delegator.findByPrimaryKeyCache("ProductFeature", UtilMisc.toMap("productFeatureId", featureId));
GenericValue productFeatureType = productFeature == null ? null : productFeature.getRelatedOneCache("ProductFeatureType");
if (productFeatureType == null) {
@@ -1367,15 +1368,15 @@
}
}
- public Set makeFullKeywordSet(GenericDelegator delegator) {
- Set keywordSet = KeywordSearchUtil.makeKeywordSet(this.keywordsString, null, true);
- Set fullKeywordSet = new TreeSet();
+ public Set<String> makeFullKeywordSet(GenericDelegator delegator) {
+ Set<String> keywordSet = KeywordSearchUtil.makeKeywordSet(this.keywordsString, null, true);
+ Set<String> fullKeywordSet = new TreeSet<String>();
// expand the keyword list according to the thesaurus and create a new set of keywords
- Iterator keywordIter = keywordSet.iterator();
+ Iterator<String> keywordIter = keywordSet.iterator();
while (keywordIter.hasNext()) {
- String keyword = (String) keywordIter.next();
- Set expandedSet = new TreeSet();
+ String keyword = keywordIter.next();
+ Set<String> expandedSet = new TreeSet<String>();
boolean replaceEntered = KeywordSearchUtil.expandKeywordForSearch(keyword, expandedSet, delegator);
fullKeywordSet.addAll(expandedSet);
if (!replaceEntered) {
@@ -1395,31 +1396,31 @@
//but then the sets should be and'ed to produce the overall expression; create the SQL for this
//needs some work as the current method only support a list of and'ed words and a list of or'ed words, not
//a list of or'ed sets to be and'ed together
- Set keywordSet = KeywordSearchUtil.makeKeywordSet(this.keywordsString, null, true);
+ Set<String> keywordSet = KeywordSearchUtil.makeKeywordSet(this.keywordsString, null, true);
// expand the keyword list according to the thesaurus and create a new set of keywords
- Iterator keywordIter = keywordSet.iterator();
+ Iterator<String> keywordIter = keywordSet.iterator();
while (keywordIter.hasNext()) {
- String keyword = (String) keywordIter.next();
- Set expandedSet = new TreeSet();
+ String keyword = keywordIter.next();
+ Set<String> expandedSet = new TreeSet<String>();
boolean replaceEntered = KeywordSearchUtil.expandKeywordForSearch(keyword, expandedSet, productSearchContext.getDelegator());
if (!replaceEntered) {
expandedSet.add(keyword);
}
- Set fixedSet = KeywordSearchUtil.fixKeywordsForSearch(expandedSet, anyPrefix, anySuffix, removeStems, isAnd);
- Set fixedKeywordSet = FastSet.newInstance();
+ Set<String> fixedSet = KeywordSearchUtil.fixKeywordsForSearch(expandedSet, anyPrefix, anySuffix, removeStems, isAnd);
+ Set<String> fixedKeywordSet = FastSet.newInstance();
fixedKeywordSet.addAll(fixedSet);
productSearchContext.keywordFixedOrSetAndList.add(fixedKeywordSet);
}
} else {
// when isAnd is false, just add all of the new entries to the big list
- Set keywordFirstPass = makeFullKeywordSet(productSearchContext.getDelegator()); // includes keyword expansion, etc
- Set keywordSet = KeywordSearchUtil.fixKeywordsForSearch(keywordFirstPass, anyPrefix, anySuffix, removeStems, isAnd);
+ Set<String> keywordFirstPass = makeFullKeywordSet(productSearchContext.getDelegator()); // includes keyword expansion, etc
+ Set<String> keywordSet = KeywordSearchUtil.fixKeywordsForSearch(keywordFirstPass, anyPrefix, anySuffix, removeStems, isAnd);
productSearchContext.orKeywordFixedSet.addAll(keywordSet);
}
// add in productSearchConstraint, don't worry about the productSearchResultId or constraintSeqId, those will be fill in later
- Map valueMap = UtilMisc.toMap("constraintName", constraintName, "infoString", this.keywordsString);
+ Map<String, String> valueMap = UtilMisc.toMap("constraintName", constraintName, "infoString", this.keywordsString);
valueMap.put("anyPrefix", this.anyPrefix ? "Y" : "N");
valueMap.put("anySuffix", this.anySuffix ? "Y" : "N");
valueMap.put("isAnd", this.isAnd ? "Y" : "N");
@@ -1430,8 +1431,8 @@
/** pretty print for log messages and even UI stuff */
public String prettyPrintConstraint(GenericDelegator delegator, boolean detailed, Locale locale) {
StringBuilder ppBuf = new StringBuilder();
- ppBuf.append(UtilProperties.getMessage(resource, "ProductKeywords", locale) + ": \"");
- ppBuf.append(this.keywordsString + "\", " + UtilProperties.getMessage(resource, "ProductKeywordWhere", locale) + " ");
+ ppBuf.append(UtilProperties.getMessage(resource, "ProductKeywords", locale)).append(": \"");
+ ppBuf.append(this.keywordsString).append("\", ").append(UtilProperties.getMessage(resource, "ProductKeywordWhere", locale)).append(" ");
ppBuf.append(isAnd ? UtilProperties.getMessage(resource, "ProductKeywordAllWordsMatch", locale) : UtilProperties.getMessage(resource, "ProductKeywordAnyWordMatches", locale));
return ppBuf.toString();
}
@@ -1554,9 +1555,9 @@
public String prettyPrintConstraint(GenericDelegator delegator, boolean detailed, Locale locale) {
StringBuilder buff = new StringBuilder();
buff.append("Product Store Mandatory Price Constraint: ");
- buff.append("Product Store Group ["+productStoreGroupId+"], ");
- buff.append("Product Price Type ["+productPriceTypeId+"], ");
- buff.append("Currency ["+currencyUomId+"].");
+ buff.append("Product Store Group [").append(productStoreGroupId).append("], ");
+ buff.append("Product Price Type [").append(productPriceTypeId).append("], ");
+ buff.append("Currency [").append(currencyUomId).append("].");
return buff.toString();
}
@@ -2096,9 +2097,9 @@
// add up the relevancyWeight fields from all keyword member entities for a total to sort by
ComplexAlias complexAlias = new ComplexAlias("+");
- Iterator keywordIter = keywordList.iterator();
+ Iterator<String> keywordIter = keywordList.iterator();
while (keywordIter.hasNext()) {
- String keyword = (String) keywordIter.next();
+ String keyword = keywordIter.next();
// make index based values and increment
String entityAlias = "PK" + index;
@@ -2128,10 +2129,10 @@
dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"));
orderByList.add("-totalRelevancy");
fieldsToSelect.add("totalRelevancy");
- List keywordOrList = new FastList.newInstance();
- Iterator keywordIter = keywordList.iterator();
+ List<EntityCondition> keywordOrList = new FastList.newInstance();
+ Iterator<String> keywordIter = keywordList.iterator();
while (keywordIter.hasNext()) {
- String keyword = (String) keywordIter.next();
+ String keyword = keywordIter.next();
keywordOrList.add(EntityCondition.makeCondition(prefix + "Keyword", EntityOperator.LIKE, keyword));
}
entityConditionList.add(EntityCondition.makeCondition(keywordOrList, EntityOperator.OR));
@@ -2142,10 +2143,9 @@
// Features
if (UtilValidate.isNotEmpty(featureIdSet)) {
- Iterator featureIdIter = featureIdSet.iterator();
+ Iterator<String> featureIdIter = featureIdSet.iterator();
while (featureIdIter.hasNext()) {
- String productFeatureId = (String) featureIdIter.next();
-
+ String productFeatureId = featureIdIter.next();
// make index based values and increment
String entityAlias = "PFA" + index;
String prefix = "pfa" + index;