Package org.apache.beehive.samples.petstore.model

Examples of org.apache.beehive.samples.petstore.model.Cart


                                                       required = false)
                                 }),
                    @Jpf.Forward(name="cart", path="cart.jsp")
                })
    protected Forward addItemToCart(CartForm form) throws InvalidIdentifierException {
        Cart cart = form.getCart();
        if (cart.containsItemId(form.getWorkingItemId()))
        {
            cart.incrementQuantityByItemId(form.getWorkingItemId());
        }
        else
        {
            Item toAddItem = _catalogControl.getItem(form.getWorkingItemId());
            if (toAddItem != null)
            {
                //toAddItem.setProduct(_currentProduct);
                cart.addItem(toAddItem);
            }
            /* todo: error handling path */
        }

        return new Forward("cart", "product", _currentProduct);
View Full Code Here


        return _myList;
    }

    public Cart getCart() {
        if(_cart == null)
            _cart = new Cart();

        return _cart;
    }
View Full Code Here

        String workingItemId = lookupCurrentItemId();

        if(workingItemId == null)
            throw new InvalidIdentifierException("Could not find working item identifier");

        Cart cart = lookupCart();
        if (cart.containsItemId(workingItemId))
            cart.incrementQuantityByItemId(workingItemId);
        else {
            Item toAddItem = _catalogControl.getItem(workingItemId);
            if (toAddItem != null)
                cart.addItem(toAddItem);
        }

        _cartForm = new CartForm();
        _cartForm.setCart(lookupCart());
        Forward forward = setupCartForward();
View Full Code Here

    @Jpf.Action
    public Forward removeItemFromCart() {
        String itemId = lookupCurrentItemId();
       
        Cart cart = lookupCart();
        if(cart.containsItemId(itemId))
            cart.removeItemById(itemId);

        Forward forward = setupCartForward();
        forward.addActionOutput("product", _currentProduct);
        return forward;
    }
View Full Code Here

        return _myList;
    }

    public Cart getCart() {
        if(_cart == null)
            _cart = new Cart();

        return _cart;
    }
View Full Code Here

TOP

Related Classes of org.apache.beehive.samples.petstore.model.Cart

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.