本文整理匯總了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;
}
示例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);
}
示例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);
}