當前位置: 首頁>>代碼示例>>Java>>正文


Java ProductConfigWrapper類代碼示例

本文整理匯總了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;
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:27,代碼來源:ProductWorker.java

示例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";
    }
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:21,代碼來源:ShoppingCartEvents.java

示例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);
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:29,代碼來源:ShoppingCartItem.java

示例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);
}
 
開發者ID:gildaslemoal,項目名稱:elpi,代碼行數:29,代碼來源:ShoppingCartItem.java

示例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);
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:14,代碼來源:ProductStoreWorker.java

示例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);
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:14,代碼來源:ShoppingCartHelper.java

示例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());
        }
    }
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:38,代碼來源:ShoppingCartItem.java

示例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);
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:13,代碼來源:ShoppingCart.java

示例9: getConfigWrapper

import org.ofbiz.product.config.ProductConfigWrapper; //導入依賴的package包/類
public ProductConfigWrapper getConfigWrapper() {
    return configWrapper;
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:4,代碼來源:ShoppingCartItem.java

示例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);
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:5,代碼來源:ShoppingCartItem.java

示例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));
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:5,代碼來源:ShoppingCart.java


注:本文中的org.ofbiz.product.config.ProductConfigWrapper類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。