本文整理汇总了Java中org.ofbiz.product.product.ProductSearch.ProductSearchConstraint类的典型用法代码示例。如果您正苦于以下问题:Java ProductSearchConstraint类的具体用法?Java ProductSearchConstraint怎么用?Java ProductSearchConstraint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ProductSearchConstraint类属于org.ofbiz.product.product.ProductSearch包,在下文中一共展示了ProductSearchConstraint类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: searchGetConstraintStrings
import org.ofbiz.product.product.ProductSearch.ProductSearchConstraint; //导入依赖的package包/类
public List<String> searchGetConstraintStrings(boolean detailed, Delegator delegator, Locale locale) {
List<ProductSearchConstraint> productSearchConstraintList = this.getConstraintList();
List<String> constraintStrings = FastList.newInstance();
if (productSearchConstraintList == null) {
return constraintStrings;
}
for (ProductSearchConstraint productSearchConstraint: productSearchConstraintList) {
if (productSearchConstraint == null) continue;
String constraintString = productSearchConstraint.prettyPrintConstraint(delegator, detailed, locale);
if (UtilValidate.isNotEmpty(constraintString)) {
constraintStrings.add(constraintString);
} else {
constraintStrings.add("Description not available");
}
}
return constraintStrings;
}
示例2: searchDo
import org.ofbiz.product.product.ProductSearch.ProductSearchConstraint; //导入依赖的package包/类
public static ArrayList<String> searchDo(HttpSession session, Delegator delegator, String prodCatalogId) {
String visitId = VisitHandler.getVisitId(session);
ProductSearchOptions productSearchOptions = getProductSearchOptions(session);
List<ProductSearchConstraint> productSearchConstraintList = productSearchOptions.getConstraintList();
if (UtilValidate.isEmpty(productSearchConstraintList)) {
// no constraints, don't do a search...
return new ArrayList<String>();
}
ResultSortOrder resultSortOrder = productSearchOptions.getResultSortOrder();
// if the search options have changed since the last search, put at the beginning of the options history list
checkSaveSearchOptionsHistory(session);
return ProductSearch.searchProducts(productSearchConstraintList, resultSortOrder, delegator, visitId);
}
示例3: addConstraint
import org.ofbiz.product.product.ProductSearch.ProductSearchConstraint; //导入依赖的package包/类
public static void addConstraint(ProductSearchConstraint productSearchConstraint, HttpSession session) {
ProductSearchOptions productSearchOptions = getProductSearchOptions(session);
if (productSearchOptions.constraintList == null) {
productSearchOptions.constraintList = FastList.newInstance();
}
if (!productSearchOptions.constraintList.contains(productSearchConstraint)) {
productSearchOptions.constraintList.add(productSearchConstraint);
productSearchOptions.changed = true;
}
}
示例4: removeConstraintsByType
import org.ofbiz.product.product.ProductSearch.ProductSearchConstraint; //导入依赖的package包/类
/**
* SCIPIO: Removes constraints by class type.
* Added 2017-09-14.
*/
public static void removeConstraintsByType(Class<? extends ProductSearchConstraint> constraintCls, HttpSession session) {
ProductSearchOptions productSearchOptions = getProductSearchOptions(session);
if (productSearchOptions.constraintList == null) {
productSearchOptions.constraintList = FastList.newInstance();
}
Iterator<ProductSearchConstraint> it = productSearchOptions.constraintList.iterator();
while(it.hasNext()) {
ProductSearchConstraint constraint = it.next();
if (constraintCls.isAssignableFrom(constraint.getClass())) it.remove();
}
}
示例5: extractConstraints
import org.ofbiz.product.product.ProductSearch.ProductSearchConstraint; //导入依赖的package包/类
/**
* SCIPIO: Returns (only) the constraints of specified class.
* Added 2017-08-24.
*/
@SuppressWarnings("unchecked")
protected static <T> List<T> extractConstraints(List<? extends ProductSearchConstraint> contraintList, Class<T> constraintCls) {
List<T> kwcList = new ArrayList<>();
if (contraintList != null) {
for(ProductSearchConstraint constraint : contraintList) {
if (constraintCls.isAssignableFrom(constraint.getClass())) kwcList.add((T) constraint);
}
}
return kwcList;
}
示例6: searchRemoveConstraint
import org.ofbiz.product.product.ProductSearch.ProductSearchConstraint; //导入依赖的package包/类
public static void searchRemoveConstraint(int index, HttpSession session) {
List<ProductSearchConstraint> productSearchConstraintList = ProductSearchOptions.getConstraintList(session);
if (productSearchConstraintList == null) {
return;
} else if (index >= productSearchConstraintList.size()) {
return;
} else {
productSearchConstraintList.remove(index);
}
}
示例7: getCategoryCostraintIndex
import org.ofbiz.product.product.ProductSearch.ProductSearchConstraint; //导入依赖的package包/类
public static int getCategoryCostraintIndex(HttpSession session) {
int index = 0;
List<ProductSearchConstraint> productSearchConstraintList = ProductSearchOptions.getConstraintList(session);
for (ProductSearchConstraint constraint: productSearchConstraintList) {
if (constraint instanceof CategoryConstraint) {
index++;
}
}
return index;
}
示例8: getConstraintList
import org.ofbiz.product.product.ProductSearch.ProductSearchConstraint; //导入依赖的package包/类
public List<ProductSearchConstraint> getConstraintList() {
return this.constraintList;
}
示例9: searchAddConstraint
import org.ofbiz.product.product.ProductSearch.ProductSearchConstraint; //导入依赖的package包/类
public static void searchAddConstraint(ProductSearchConstraint productSearchConstraint, HttpSession session) {
ProductSearchOptions.addConstraint(productSearchConstraint, session);
}
示例10: getConstraintsByType
import org.ofbiz.product.product.ProductSearch.ProductSearchConstraint; //导入依赖的package包/类
/**
* SCIPIO: Returns (only) the constraints of the given class.
* Added 2017-08-24.
*/
public <T extends ProductSearchConstraint> List<T> getConstraintsByType(Class<T> constraintCls) {
return Collections.unmodifiableList(extractConstraints(getConstraintList(), constraintCls));
}