当前位置: 首页>>代码示例>>Java>>正文


Java ProductWorker.getVariantVirtualAssocs方法代码示例

本文整理汇总了Java中org.ofbiz.product.product.ProductWorker.getVariantVirtualAssocs方法的典型用法代码示例。如果您正苦于以下问题:Java ProductWorker.getVariantVirtualAssocs方法的具体用法?Java ProductWorker.getVariantVirtualAssocs怎么用?Java ProductWorker.getVariantVirtualAssocs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.ofbiz.product.product.ProductWorker的用法示例。


在下文中一共展示了ProductWorker.getVariantVirtualAssocs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isProductInCategory

import org.ofbiz.product.product.ProductWorker; //导入方法依赖的package包/类
public static boolean isProductInCategory(Delegator delegator, String productId, String productCategoryId) throws GenericEntityException {
    if (productCategoryId == null) return false;
    if (UtilValidate.isEmpty(productId)) return false;

    List<GenericValue> productCategoryMembers = EntityUtil.filterByDate(delegator.findByAnd("ProductCategoryMember",
            UtilMisc.toMap("productCategoryId", productCategoryId, "productId", productId), null, true), true);
    if (UtilValidate.isEmpty(productCategoryMembers)) {
        //before giving up see if this is a variant product, and if so look up the virtual product and check it...
        GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true);
        List<GenericValue> productAssocs = ProductWorker.getVariantVirtualAssocs(product);
        //this does take into account that a product could be a variant of multiple products, but this shouldn't ever really happen...
        if (productAssocs != null) {
            for (GenericValue productAssoc: productAssocs) {
                if (isProductInCategory(delegator, productAssoc.getString("productId"), productCategoryId)) {
                    return true;
                }
            }
        }

        return false;
    } else {
        return true;
    }
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:25,代码来源:CategoryWorker.java

示例2: isProductInCategory

import org.ofbiz.product.product.ProductWorker; //导入方法依赖的package包/类
public static boolean isProductInCategory(Delegator delegator, String productId, String productCategoryId) throws GenericEntityException {
    if (productCategoryId == null)
        return false;
    if (UtilValidate.isEmpty(productId))
        return false;

    List<GenericValue> productCategoryMembers = EntityQuery.use(delegator).from("ProductCategoryMember")
            .where("productCategoryId", productCategoryId, "productId", productId).cache(true).filterByDate().queryList();
    if (UtilValidate.isEmpty(productCategoryMembers)) {
        // before giving up see if this is a variant product, and if so look
        // up the virtual product and check it...
        GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne();
        List<GenericValue> productAssocs = ProductWorker.getVariantVirtualAssocs(product);
        // this does take into account that a product could be a variant of
        // multiple products, but this shouldn't ever really happen...
        if (productAssocs != null) {
            for (GenericValue productAssoc : productAssocs) {
                if (isProductInCategory(delegator, productAssoc.getString("productId"), productCategoryId)) {
                    return true;
                }
            }
        }

        return false;
    } else {
        return true;
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:29,代码来源:CategoryWorker.java


注:本文中的org.ofbiz.product.product.ProductWorker.getVariantVirtualAssocs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。