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


Java ProductWorker.isShippableToAddress方法代码示例

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


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

示例1: isShippableToAddress

import org.ofbiz.product.product.ProductWorker; //导入方法依赖的package包/类
private boolean isShippableToAddress(ShoppingCartItem item) {
    if ("SALES_ORDER".equals(getOrderTypeId())) {
        // Verify if the new address is compatible with the ProductGeos rules of
        // the products already in the cart
        GenericValue shippingAddress = null;
        try {
            shippingAddress = item.getDelegator().findOne("PostalAddress", UtilMisc.toMap("contactMechId", this.internalContactMechId), false);
        } catch (GenericEntityException gee) {
            Debug.logError(gee, "Error retrieving the shipping address for contactMechId [" + this.internalContactMechId + "].", module);
        }
        if (shippingAddress != null) {
            GenericValue product = item.getProduct();
            if (UtilValidate.isNotEmpty(product)) {
                return ProductWorker.isShippableToAddress(product, shippingAddress);
            }
        }
    }
    return true;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:20,代码来源:ShoppingCart.java

示例2: setShippingContactMechId

import org.ofbiz.product.product.ProductWorker; //导入方法依赖的package包/类
/** Sets the shipping contact mech id. */
public void setShippingContactMechId(int idx, String shippingContactMechId) {
    CartShipInfo csi = this.getShipInfo(idx);
    if (isSalesOrder() && UtilValidate.isNotEmpty(shippingContactMechId)) {
        // Verify if the new address is compatible with the ProductGeos rules of
        // the products already in the cart
        GenericValue shippingAddress = null;
        try {
            shippingAddress = this.getDelegator().findOne("PostalAddress", UtilMisc.toMap("contactMechId", shippingContactMechId), false);
        } catch (GenericEntityException gee) {
            Debug.logError(gee, "Error retrieving the shipping address for contactMechId [" + shippingContactMechId + "].", module);
        }
        if (shippingAddress != null) {
            Set<ShoppingCartItem> shipItems = csi.getShipItems();
            if (UtilValidate.isNotEmpty(shipItems)) {
                for (ShoppingCartItem cartItem : shipItems) {
                    GenericValue product = cartItem.getProduct();
                    if (UtilValidate.isNotEmpty(product)) {
                        if (!ProductWorker.isShippableToAddress(product, shippingAddress)) {
                            throw new IllegalArgumentException("The shipping address is not compatible with ProductGeos rules.");
                        }
                    }
                }
            }
        }
    }
    csi.setContactMechId(shippingContactMechId);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:29,代码来源:ShoppingCart.java

示例3: setShippingContactMechId

import org.ofbiz.product.product.ProductWorker; //导入方法依赖的package包/类
/** Sets the shipping contact mech id. */
public void setShippingContactMechId(int idx, String shippingContactMechId) {
    CartShipInfo csi = this.getShipInfo(idx);
    if (isSalesOrder() && UtilValidate.isNotEmpty(shippingContactMechId)) {
        // Verify if the new address is compatible with the ProductGeos rules of
        // the products already in the cart
        GenericValue shippingAddress = null;
        try {
            shippingAddress = this.getDelegator().findOne("PostalAddress", UtilMisc.toMap("contactMechId", shippingContactMechId), false);
        } catch (GenericEntityException gee) {
            Debug.logError(gee, "Error retrieving the shipping address for contactMechId [" + shippingContactMechId + "].", module);
        }
        if (shippingAddress != null) {
            Set<ShoppingCartItem> shipItems = csi.getShipItems();
            if (UtilValidate.isNotEmpty(shipItems)) {
                for(ShoppingCartItem cartItem : shipItems) {
                    GenericValue product = cartItem.getProduct();
                    if (UtilValidate.isNotEmpty(product)) {
                        if (!ProductWorker.isShippableToAddress(product, shippingAddress)) {
                            throw new IllegalArgumentException("The shipping address is not compatible with ProductGeos rules.");
                        }
                    }
                }
            }
        }
    }
    csi.setContactMechId(shippingContactMechId);
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:29,代码来源:ShoppingCart.java


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