本文整理匯總了Java中org.ofbiz.product.category.CategoryWorker.getCategoryRollupTrails方法的典型用法代碼示例。如果您正苦於以下問題:Java CategoryWorker.getCategoryRollupTrails方法的具體用法?Java CategoryWorker.getCategoryRollupTrails怎麽用?Java CategoryWorker.getCategoryRollupTrails使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.ofbiz.product.category.CategoryWorker
的用法示例。
在下文中一共展示了CategoryWorker.getCategoryRollupTrails方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getProductRollupTrails
import org.ofbiz.product.category.CategoryWorker; //導入方法依賴的package包/類
/**
* SCIPIO: Returns all rollups for a product that have the given top categories.
* TODO: REVIEW: maybe this can be optimized with a smarter algorithm?
* Added 2017-11-09.
*/
public static List<List<String>> getProductRollupTrails(Delegator delegator, String productId, Set<String> topCategoryIds, boolean useCache) {
List<GenericValue> prodCatMembers;
try {
prodCatMembers = EntityQuery.use(delegator).from("ProductCategoryMember")
.where("productId", productId).orderBy("-fromDate").filterByDate().cache(useCache).queryList();
} catch (GenericEntityException e) {
Debug.logError("Cannot generate trail from product '" + productId + "'", productId);
return new ArrayList<>();
}
if (prodCatMembers.size() == 0) return new ArrayList<>();
List<List<String>> possibleTrails = null;
for(GenericValue prodCatMember : prodCatMembers) {
List<List<String>> trails = CategoryWorker.getCategoryRollupTrails(delegator, prodCatMember.getString("productCategoryId"), topCategoryIds, useCache);
if (possibleTrails == null) possibleTrails = trails;
else possibleTrails.addAll(trails);
}
return possibleTrails;
}
示例2: getCategoryTrail
import org.ofbiz.product.category.CategoryWorker; //導入方法依賴的package包/類
public static List<List<String>> getCategoryTrail(String productCategoryId, DispatchContext dctx) {
return CategoryWorker.getCategoryRollupTrails(dctx.getDelegator(), productCategoryId, true);
}
示例3: getCategoryRollupTrails
import org.ofbiz.product.category.CategoryWorker; //導入方法依賴的package包/類
/**
* Return all paths from the given topCategoryIds to the category.
* <p>
* TODO?: perhaps can cache with UtilCache in future, or read from a cached category tree.
*/
protected List<List<String>> getCategoryRollupTrails(Delegator delegator, String productCategoryId, Set<String> topCategoryIds) {
return CategoryWorker.getCategoryRollupTrails(delegator, productCategoryId, topCategoryIds, true);
}