本文整理汇总了Java中org.ofbiz.product.config.ProductConfigWrapper类的典型用法代码示例。如果您正苦于以下问题:Java ProductConfigWrapper类的具体用法?Java ProductConfigWrapper怎么用?Java ProductConfigWrapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ProductConfigWrapper类属于org.ofbiz.product.config包,在下文中一共展示了ProductConfigWrapper类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isProductInventoryAvailableByFacility
import org.ofbiz.product.config.ProductConfigWrapper; //导入依赖的package包/类
/**
* Invokes the getInventoryAvailableByFacility service, returns true if specified quantity is available for all the selected parts, else false.
* Also, set the available flag for all the product configuration's options.
**/
public static boolean isProductInventoryAvailableByFacility(ProductConfigWrapper productConfig, String inventoryFacilityId, BigDecimal quantity, LocalDispatcher dispatcher) {
boolean available = true;
List<ConfigOption> options = productConfig.getSelectedOptions();
for (ConfigOption ci: options) {
List<GenericValue> products = ci.getComponents();
for (GenericValue product: products) {
String productId = product.getString("productId");
BigDecimal cmpQuantity = product.getBigDecimal("quantity");
BigDecimal neededQty = BigDecimal.ZERO;
if (cmpQuantity != null) {
neededQty = quantity.multiply(cmpQuantity);
}
if (!isProductInventoryAvailableByFacility(productId, inventoryFacilityId, neededQty, dispatcher)) {
ci.setAvailable(false);
}
}
if (!ci.isAvailable()) {
available = false;
}
}
return available;
}
示例2: getConfigDetailsEvent
import org.ofbiz.product.config.ProductConfigWrapper; //导入依赖的package包/类
public static String getConfigDetailsEvent(HttpServletRequest request, HttpServletResponse response) {
Delegator delegator = (Delegator) request.getAttribute("delegator");
String productId = request.getParameter("product_id");
String currencyUomId = ShoppingCartEvents.getCartObject(request).getCurrency();
ProductConfigWrapper configWrapper = ProductConfigWorker.getProductConfigWrapper(productId, currencyUomId, request);
if (configWrapper == null) {
Debug.logWarning("configWrapper is null", module);
request.setAttribute("_ERROR_MESSAGE_", "configWrapper is null");
return "error";
}
ProductConfigWorker.fillProductConfigWrapper(configWrapper, request);
if (configWrapper.isCompleted()) {
ProductConfigWorker.storeProductConfigWrapper(configWrapper, delegator);
request.setAttribute("configId", configWrapper.getConfigId());
}
request.setAttribute("totalPrice", org.ofbiz.base.util.UtilFormatOut.formatCurrency(configWrapper.getTotalPrice(), currencyUomId, UtilHttp.getLocale(request)));
return "success";
}
示例3: makeItem
import org.ofbiz.product.config.ProductConfigWrapper; //导入依赖的package包/类
/**
* Makes a ShoppingCartItem and adds it to the cart.
* @param accommodationMapId Optional. reservations add into workeffort
* @param accommodationSpotId Optional. reservations add into workeffort
*/
public static ShoppingCartItem makeItem(Integer cartLocation, String productId, BigDecimal selectedAmount, BigDecimal quantity, BigDecimal unitPrice,
Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons,String accommodationMapId,String accommodationSpotId, Timestamp shipBeforeDate, Timestamp shipAfterDate,
Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes, String prodCatalogId, ProductConfigWrapper configWrapper,
String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, LocalDispatcher dispatcher, ShoppingCart cart, Boolean triggerExternalOpsBool, Boolean triggerPriceRulesBool, String parentProductId, Boolean skipInventoryChecks, Boolean skipProductChecks)
throws CartItemModifyException, ItemNotFoundException {
Delegator delegator = cart.getDelegator();
GenericValue product = findProduct(delegator, skipProductChecks.booleanValue(), prodCatalogId, productId, cart.getLocale());
GenericValue parentProduct = null;
if (parentProductId != null)
{
try
{
parentProduct = EntityQuery.use(delegator).from("Product").where("productId", parentProductId).cache().queryOne();
} catch (GenericEntityException e) {
Debug.logWarning(e.toString(), module);
}
}
return makeItem(cartLocation, product, selectedAmount, quantity, unitPrice,
reservStart, reservLength, reservPersons, accommodationMapId, accommodationSpotId, shipBeforeDate, shipAfterDate,
additionalProductFeatureAndAppls, attributes, prodCatalogId, configWrapper,
itemType, itemGroup, dispatcher, cart, triggerExternalOpsBool, triggerPriceRulesBool, parentProduct, skipInventoryChecks, skipProductChecks);
}
示例4: makeItem
import org.ofbiz.product.config.ProductConfigWrapper; //导入依赖的package包/类
/**
* Makes a ShoppingCartItem and adds it to the cart.
* @param accommodationMapId Optional. reservations add into workeffort
* @param accommodationSpotId Optional. reservations add into workeffort
*/
public static ShoppingCartItem makeItem(Integer cartLocation, String productId, BigDecimal selectedAmount, BigDecimal quantity, BigDecimal unitPrice,
Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons,String accommodationMapId,String accommodationSpotId, Timestamp shipBeforeDate, Timestamp shipAfterDate,
Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes, String prodCatalogId, ProductConfigWrapper configWrapper,
String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, LocalDispatcher dispatcher, ShoppingCart cart, Boolean triggerExternalOpsBool, Boolean triggerPriceRulesBool, String parentProductId, Boolean skipInventoryChecks, Boolean skipProductChecks)
throws CartItemModifyException, ItemNotFoundException {
Delegator delegator = cart.getDelegator();
GenericValue product = findProduct(delegator, skipProductChecks.booleanValue(), prodCatalogId, productId, cart.getLocale());
GenericValue parentProduct = null;
if (parentProductId != null)
{
try
{
parentProduct = delegator.findOne("Product", UtilMisc.toMap("productId", parentProductId), true);
} catch (GenericEntityException e) {
Debug.logWarning(e.toString(), module);
}
}
return makeItem(cartLocation, product, selectedAmount, quantity, unitPrice,
reservStart, reservLength, reservPersons, accommodationMapId, accommodationSpotId, shipBeforeDate, shipAfterDate,
additionalProductFeatureAndAppls, attributes, prodCatalogId, configWrapper,
itemType, itemGroup, dispatcher, cart, triggerExternalOpsBool, triggerPriceRulesBool, parentProduct, skipInventoryChecks, skipProductChecks);
}
示例5: isStoreInventoryAvailable
import org.ofbiz.product.config.ProductConfigWrapper; //导入依赖的package包/类
public static boolean isStoreInventoryAvailable(ServletRequest request, ProductConfigWrapper productConfig, BigDecimal quantity) {
GenericValue productStore = getProductStore(request);
if (productStore == null) {
Debug.logWarning("No ProductStore found, return false for inventory check", module);
return false;
}
String productStoreId = productStore.getString("productStoreId");
Delegator delegator = (Delegator) request.getAttribute("delegator");
LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
return isStoreInventoryAvailable(productStoreId, productConfig, quantity, delegator, dispatcher);
}
示例6: addToCart
import org.ofbiz.product.config.ProductConfigWrapper; //导入依赖的package包/类
/** Event to add an item to the shopping cart. */
public Map<String, Object> addToCart(String catalogId, String shoppingListId, String shoppingListItemSeqId, String productId,
String productCategoryId, String itemType, String itemDescription,
BigDecimal price, BigDecimal amount, BigDecimal quantity,
java.sql.Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons,
java.sql.Timestamp shipBeforeDate, java.sql.Timestamp shipAfterDate,
ProductConfigWrapper configWrapper, String itemGroupNumber, Map<String, ? extends Object> context, String parentProductId) {
return addToCart(catalogId,shoppingListId,shoppingListItemSeqId,productId,
productCategoryId,itemType,itemDescription,price,amount,quantity,
reservStart,reservLength,reservPersons,null,null,shipBeforeDate,shipAfterDate,
configWrapper,itemGroupNumber,context,parentProductId);
}
示例7: ShoppingCartItem
import org.ofbiz.product.config.ProductConfigWrapper; //导入依赖的package包/类
/** Creates new ShoppingCartItem object. */
protected ShoppingCartItem(GenericValue product, Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes, String prodCatalogId, ProductConfigWrapper configWrapper, Locale locale, String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, GenericValue parentProduct) {
this._product = product;
this.productId = _product.getString("productId");
this._parentProduct = parentProduct;
if (parentProduct != null)
this.parentProductId = _parentProduct.getString("productId");
if (UtilValidate.isEmpty(itemType)) {
if (UtilValidate.isNotEmpty(_product.getString("productTypeId"))) {
if ("ASSET_USAGE".equals(_product.getString("productTypeId"))) {
this.itemType = "RENTAL_ORDER_ITEM"; // will create additional workeffort/asset usage records
} else if ("ASSET_USAGE_OUT_IN".equals(_product.getString("productTypeId"))) {
this.itemType = "RENTAL_ORDER_ITEM";
} else {
this.itemType = "PRODUCT_ORDER_ITEM";
}
} else {
// NOTE DEJ20100111: it seems safe to assume here that because a product is passed in that even if the product has no type this type of item still applies; thanks to whoever wrote the previous code, that's a couple of hours tracking this down that I wouldn't have minded doing something else with... :)
this.itemType = "PRODUCT_ORDER_ITEM";
}
} else {
this.itemType = itemType;
}
this.itemGroup = itemGroup;
this.prodCatalogId = prodCatalogId;
this.attributes = (attributes == null ? new HashMap<String, Object>() : attributes);
this.delegator = _product.getDelegator();
this.delegatorName = _product.getDelegator().getDelegatorName();
this.addAllProductFeatureAndAppls(additionalProductFeatureAndAppls);
this.locale = locale;
if (UtilValidate.isNotEmpty(configWrapper)) {
this.configWrapper = configWrapper;
if (UtilValidate.isEmpty(configWrapper.getConfigId())) { //new product configuration. Persist it
ProductConfigWorker.storeProductConfigWrapper(configWrapper, getDelegator());
}
}
}
示例8: addOrIncreaseItem
import org.ofbiz.product.config.ProductConfigWrapper; //导入依赖的package包/类
/** Add an item to the shopping cart, or if already there, increase the quantity.
* @return the new/increased item index
* @throws CartItemModifyException
*/
public int addOrIncreaseItem(String productId, BigDecimal selectedAmount, BigDecimal quantity, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons,
Timestamp shipBeforeDate, Timestamp shipAfterDate, Map<String, GenericValue> features, Map<String, Object> attributes, String prodCatalogId,
ProductConfigWrapper configWrapper, String itemType, String itemGroupNumber, String parentProductId, LocalDispatcher dispatcher) throws CartItemModifyException, ItemNotFoundException {
return addOrIncreaseItem(productId,selectedAmount,quantity,reservStart,reservLength,reservPersons,
null,null,shipBeforeDate,shipAfterDate,features,attributes,prodCatalogId,
configWrapper,itemType,itemGroupNumber,parentProductId,dispatcher);
}
示例9: getConfigWrapper
import org.ofbiz.product.config.ProductConfigWrapper; //导入依赖的package包/类
public ProductConfigWrapper getConfigWrapper() {
return configWrapper;
}
示例10: equals
import org.ofbiz.product.config.ProductConfigWrapper; //导入依赖的package包/类
/** Compares the specified object with this cart item. Defaults isPromo to false. */
public boolean equals(String productId, Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes, String prodCatalogId, ProductConfigWrapper configWrapper, String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, BigDecimal selectedAmount) {
return equals(productId, null, BigDecimal.ZERO, BigDecimal.ZERO, null, null, additionalProductFeatureAndAppls, attributes, prodCatalogId, selectedAmount, configWrapper, itemType, itemGroup, false);
}
示例11: addItemToEnd
import org.ofbiz.product.config.ProductConfigWrapper; //导入依赖的package包/类
/** Add an item to the shopping cart. */
public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, HashMap<String, GenericValue> features, HashMap<String, Object> attributes, String prodCatalogId, String itemType, ProductConfigWrapper configWrapper, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules) throws CartItemModifyException, ItemNotFoundException {
return addItemToEnd(ShoppingCartItem.makeItem(null, productId, amount, quantity, unitPrice, null, null, null, null, null, features, attributes, prodCatalogId, configWrapper, itemType, null, dispatcher, this, triggerExternalOps, triggerPriceRules, null, Boolean.FALSE, Boolean.FALSE));
}