PurchaseController.java

// license-header java merge-point
// Generated by andromda-jsf cartridge (controllers\Controller.java.vsl) DO NOT EDIT!
package my.onlinestore.purchase;

import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
import javax.servlet.http.HttpSession;
import org.andromda.samples.onlinestore.ControllerBase;
import org.andromda.samples.onlinestore.JsfUtils;

/**
 * <p>
 * TODO: Model Documentation for PurchaseController
 * </p>
 */
public abstract class PurchaseController
    extends ControllerBase
    implements Serializable
{
    /**
     * The serial version UID of this class. Needed for serialization.
     */
    private static final long serialVersionUID = 1L;

    /**
     * Returns an instance from the JSF context
     *
     */
    public static PurchaseController instance()
    {
        return (PurchaseController)JsfUtils.resolveVariable("purchaseController");
    }
    
    /**
     * Populate action form and page variables
     *
     * @param currentView the current view
     * @param forward the forward view
     * @param sourceForm the source form
     * @throws IllegalAccessException
     * @throws InvocationTargetException
     * @throws NoSuchMethodException
     */
    private void populateActionFormsAndPageVariables(final String currentView, String forward, final Object sourceForm) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
    {
        if(forward == null)
        {
            forward=currentView;
        }
        
        final Map<String,Object> pageVariables=this.getPageVariables(forward);
        if("/my/onlinestore/purchase/enter-name-and-password.jsf".equals(forward))
        {
            PurchaseItemsViewPopulator.populateForm(sourceForm,this.getEnterNameAndPasswordProceedForm());
        }
        else
        if("/my/onlinestore/purchase/select-items-to-purchase.jsf".equals(forward))
        {
            PurchaseItemsViewPopulator.populateForm(sourceForm,this.getSelectItemsToPurchaseProceedForm());
            PurchaseItemsViewPopulator.populateForm(sourceForm,this.getSelectItemsToPurchaseBuyForm());
            PurchaseItemsViewPopulator.populateForm(sourceForm,this.getSelectItemsToPurchaseDetailsForm());
            PurchaseItemsViewPopulator.populateForm(sourceForm,this.getSelectItemsToPurchaseGoForm());
            PurchaseItemsViewPopulator.populateForm(sourceForm,this.getSelectItemsToPurchaseRememberSelectionForm());
            PurchaseItemsViewPopulator.populateSelectItemsToPurchasePageVariables(sourceForm,pageVariables);
        }
        else
        if("/my/onlinestore/purchase/enter-user-details.jsf".equals(forward))
        {
            PurchaseItemsViewPopulator.populateForm(sourceForm,this.getEnterUserDetailsPurchaseForm());
        }
        ControllerBase.getUseCaseScope().put(CURRENT_PAGE_VARIABLES_KEY, pageVariables);
    }
    
    /**
     * <p>
     * TODO: Model Documentation for my.onlinestore.purchase.addItemsToBasket
     * </p>
     *
     * @param form the associated form
     * @throws Throwable
     */
    public abstract void addItemsToBasket()
        throws Throwable;

    /**
     * <p>
     * TODO: Model Documentation for my.onlinestore.purchase.closeUserSession
     * </p>
     *
     * @param form the associated form
     * @throws Throwable
     */
    public abstract void closeUserSession()
        throws Throwable;

    /**
     * <p>
     * TODO: Model Documentation for my.onlinestore.purchase.loadItems
     * </p>
     *
     * @param form the associated form
     * @throws Throwable
     */
    public abstract void loadItems(LoadItemsForm form)
        throws Throwable;

    /**
     * <p>
     * TODO: Model Documentation for my.onlinestore.purchase.openUserSession
     * </p>
     *
     * @param form the associated form
     * @throws Throwable
     */
    public abstract void openUserSession()
        throws Throwable;

    /**
     * <p>
     * TODO: Model Documentation for my.onlinestore.purchase.prepareForShipping
     * </p>
     *
     * @param form the associated form
     * @throws Throwable
     */
    public abstract void prepareForShipping()
        throws Throwable;

    /**
     * <p>
     * TODO: Model Documentation for my.onlinestore.purchase.loadAvailableItems
     * </p>
     *
     * @param form the associated form
     * @throws Throwable
     */
    public abstract void loadAvailableItems(LoadAvailableItemsForm form)
        throws Throwable;

    /**
     * <p>
     * TODO: Model Documentation for my.onlinestore.purchase.rememberSelection
     * </p>
     *
     * @param form the associated form
     * @throws Throwable
     */
    public abstract void rememberSelection(RememberSelectionForm form)
        throws Throwable;

    /**
     * <p>
     * TODO: Model Documentation for my.onlinestore.purchase.loadLanguages
     * </p>
     *
     * @param form the associated form
     * @throws Throwable
     */
    public abstract void loadLanguages(LoadLanguagesForm form)
        throws Throwable;


    /**
     * Retrieves the {@link EnterNameAndPasswordProceedFormImpl} form instance 
     *
     * @return EnterNameAndPasswordProceedFormImpl
     */
    protected EnterNameAndPasswordProceedFormImpl getEnterNameAndPasswordProceedForm()
    {
        return (EnterNameAndPasswordProceedFormImpl)JsfUtils.resolveVariable("purchaseItemsEnterNameAndPasswordProceedForm");
    }

    /**
     * <p>
     * TODO: Model Documentation for proceed
     * </p>
     * This method is called when 'proceed' is triggered in the view 'enter name and password'.
     * It can be safely overridden in descendant classes.
     *
     * @param form the associated form
     */
    protected void _enterNameAndPassword_proceed(EnterNameAndPasswordProceedFormImpl form)
    {
        //this method can be overridden
    }

    /**
     * Retrieves enterNameAndPasswordProceed()
     *    
     * @return enterNameAndPasswordProceed
     * @throws Throwable
     */
    public String enterNameAndPasswordProceed()
        throws Throwable
    {
        this.setLastPostedFormClientId("purchaseItemsEnterNameAndPasswordProceedForm");
        
        String forward=null;
        final EnterNameAndPasswordProceedFormImpl form =
            this.getEnterNameAndPasswordProceedForm();
            
        //trigger method execution
        _enterNameAndPassword_proceed(form);

        forward = _openUserSession(form);
        populateActionFormsAndPageVariables("/my/onlinestore/purchase/enter-name-and-password.jsf",forward,form);
        if(forward != null)
        {
            if("/my/onlinestore/purchase/enter-name-and-password.jsf".equals(forward))
            {
                forward = null; //the destination form is the same, stay on the current view
            }
        }
        
        return forward;
    }

    /**
     * <p>
     * TODO: Model Documentation for open user session
     * </p>
     *
     * @param form the associated form
     * @return the forward view
     * @throws Throwable
     */
    protected String _openUserSession(final EnterNameAndPasswordProceedFormImpl form)
        throws Throwable
    {
        String forward = null;
    
        openUserSession();
        forward = _loadItemsForSale(form);
        return forward;
    }

    /**
     * <p>
     * TODO: Model Documentation for load items for sale
     * </p>
     *
     * @param form the associated form
     * @return the forward view
     * @throws Throwable
     */
    protected String _loadItemsForSale(final EnterNameAndPasswordProceedFormImpl form)
        throws Throwable
    {
        String forward = null;
    
        loadItems(form);
        forward = _promptUserWithItemList(form);
        return forward;
    }

    /**
     * <p>
     * TODO: Model Documentation for prompt user with item list
     * </p>
     *
     * @param form the associated form
     * @return the forward view
     * @throws Throwable
     */
    protected String _promptUserWithItemList(final EnterNameAndPasswordProceedFormImpl form)
        throws Throwable
    {
        String forward = null;
        forward = "/my/onlinestore/purchase/select-items-to-purchase.jsf";
        return forward;
    }

    /**
     * Retrieves the {@link SelectItemsToPurchaseProceedFormImpl} form instance 
     *
     * @return SelectItemsToPurchaseProceedFormImpl
     */
    protected SelectItemsToPurchaseProceedFormImpl getSelectItemsToPurchaseProceedForm()
    {
        return (SelectItemsToPurchaseProceedFormImpl)JsfUtils.resolveVariable("purchaseItemsSelectItemsToPurchaseProceedForm");
    }

    /**
     * <p>
     * TODO: Model Documentation for proceed
     * </p>
     * This method is called when 'proceed' is triggered in the view 'select items to purchase'.
     * It can be safely overridden in descendant classes.
     *
     * @param form the associated form
     */
    protected void _selectItemsToPurchase_proceed(SelectItemsToPurchaseProceedFormImpl form)
    {
        //this method can be overridden
    }

    /**
     * Retrieves selectItemsToPurchaseProceed()
     *    
     * @return selectItemsToPurchaseProceed
     * @throws Throwable
     */
    public String selectItemsToPurchaseProceed()
        throws Throwable
    {
        this.setLastPostedFormClientId("purchaseItemsSelectItemsToPurchaseProceedForm");
        
        String forward=null;
        final SelectItemsToPurchaseProceedFormImpl form =
            this.getSelectItemsToPurchaseProceedForm();
            
        //trigger method execution
        _selectItemsToPurchase_proceed(form);

        forward = _addItemsToBasket(form);
        populateActionFormsAndPageVariables("/my/onlinestore/purchase/select-items-to-purchase.jsf",forward,form);
        if(forward != null)
        {
            if("/my/onlinestore/purchase/select-items-to-purchase.jsf".equals(forward))
            {
                forward = null; //the destination form is the same, stay on the current view
            }
        }
        
        return forward;
    }

    /**
     * <p>
     * TODO: Model Documentation for add items to basket
     * </p>
     *
     * @param form the associated form
     * @return the forward view
     * @throws Throwable
     */
    protected String _addItemsToBasket(final SelectItemsToPurchaseProceedFormImpl form)
        throws Throwable
    {
        String forward = null;
        forward = _askForUserDetails(form);
        return forward;
    }

    /**
     * <p>
     * TODO: Model Documentation for ask for user details
     * </p>
     *
     * @param form the associated form
     * @return the forward view
     * @throws Throwable
     */
    protected String _askForUserDetails(final SelectItemsToPurchaseProceedFormImpl form)
        throws Throwable
    {
        String forward = null;
        forward = "/my/onlinestore/purchase/enter-user-details.jsf";
        return forward;
    }

    /**
     * Retrieves the {@link SelectItemsToPurchaseBuyFormImpl} form instance 
     *
     * @return SelectItemsToPurchaseBuyFormImpl
     */
    protected SelectItemsToPurchaseBuyFormImpl getSelectItemsToPurchaseBuyForm()
    {
        return (SelectItemsToPurchaseBuyFormImpl)JsfUtils.resolveVariable("purchaseItemsSelectItemsToPurchaseBuyForm");
    }

    /**
     * <p>
     * TODO: Model Documentation for buy
     * </p>
     * This method is called when 'buy' is triggered in the view 'select items to purchase'.
     * It can be safely overridden in descendant classes.
     *
     * @param form the associated form
     */
    protected void _selectItemsToPurchase_buy(SelectItemsToPurchaseBuyFormImpl form)
    {
        //this method can be overridden
    }

    /**
     * Retrieves selectItemsToPurchaseBuy()
     *    
     * @return selectItemsToPurchaseBuy
     * @throws Throwable
     */
    public String selectItemsToPurchaseBuy()
        throws Throwable
    {
        this.setLastPostedFormClientId("purchaseItemsSelectItemsToPurchaseBuyForm");
        
        String forward=null;
        final SelectItemsToPurchaseBuyFormImpl form =
            this.getSelectItemsToPurchaseBuyForm();
            
        //trigger method execution
        _selectItemsToPurchase_buy(form);

        forward = _addItemsToBasket(form);
        populateActionFormsAndPageVariables("/my/onlinestore/purchase/select-items-to-purchase.jsf",forward,form);
        if(forward != null)
        {
            if("/my/onlinestore/purchase/select-items-to-purchase.jsf".equals(forward))
            {
                forward = null; //the destination form is the same, stay on the current view
            }
        }
        
        return forward;
    }

    /**
     * <p>
     * TODO: Model Documentation for add items to basket
     * </p>
     *
     * @param form the associated form
     * @return the forward view
     * @throws Throwable
     */
    protected String _addItemsToBasket(final SelectItemsToPurchaseBuyFormImpl form)
        throws Throwable
    {
        String forward = null;
        forward = _askForUserDetails(form);
        return forward;
    }

    /**
     * <p>
     * TODO: Model Documentation for ask for user details
     * </p>
     *
     * @param form the associated form
     * @return the forward view
     * @throws Throwable
     */
    protected String _askForUserDetails(final SelectItemsToPurchaseBuyFormImpl form)
        throws Throwable
    {
        String forward = null;
        forward = "/my/onlinestore/purchase/enter-user-details.jsf";
        return forward;
    }

    /**
     * Retrieves the {@link SelectItemsToPurchaseDetailsFormImpl} form instance 
     *
     * @return SelectItemsToPurchaseDetailsFormImpl
     */
    protected SelectItemsToPurchaseDetailsFormImpl getSelectItemsToPurchaseDetailsForm()
    {
        return (SelectItemsToPurchaseDetailsFormImpl)JsfUtils.resolveVariable("purchaseItemsSelectItemsToPurchaseDetailsForm");
    }

    /**
     * <p>
     * This action could bring you to the item details page (not to overcomplicate this example we
     * simply restart the use-case).
     * </p>
     * This method is called when 'details' is triggered in the view 'select items to purchase'.
     * It can be safely overridden in descendant classes.
     *
     * @param form the associated form
     */
    protected void _selectItemsToPurchase_details(SelectItemsToPurchaseDetailsFormImpl form)
    {
        //this method can be overridden
    }

    /**
     * Retrieves selectItemsToPurchaseDetails()
     *    
     * @return selectItemsToPurchaseDetails
     * @throws Throwable
     */
    public String selectItemsToPurchaseDetails()
        throws Throwable
    {
        this.setLastPostedFormClientId("purchaseItemsSelectItemsToPurchaseDetailsForm");
        
        String forward=null;
        this.getSelectItemsToPurchaseDetailsForm().copyTo(getUseCaseParameters());
    
        forward=((PurchaseController)JsfUtils.resolveVariable("purchaseController")).startUseCase();
        
        return forward;
    }

    /**
     * Retrieves the {@link SelectItemsToPurchaseGoFormImpl} form instance 
     *
     * @return SelectItemsToPurchaseGoFormImpl
     */
    protected SelectItemsToPurchaseGoFormImpl getSelectItemsToPurchaseGoForm()
    {
        return (SelectItemsToPurchaseGoFormImpl)JsfUtils.resolveVariable("purchaseItemsSelectItemsToPurchaseGoForm");
    }

    /**
     * <p>
     * This action could bring you to the page describing the publisher (not to overcomplicate this
     * example we simply restart the use-case).
     * </p>
     * This method is called when 'go' is triggered in the view 'select items to purchase'.
     * It can be safely overridden in descendant classes.
     *
     * @param form the associated form
     */
    protected void _selectItemsToPurchase_go(SelectItemsToPurchaseGoFormImpl form)
    {
        //this method can be overridden
    }

    /**
     * Retrieves selectItemsToPurchaseGo()
     *    
     * @return selectItemsToPurchaseGo
     * @throws Throwable
     */
    public String selectItemsToPurchaseGo()
        throws Throwable
    {
        this.setLastPostedFormClientId("purchaseItemsSelectItemsToPurchaseGoForm");
        
        String forward=null;
        this.getSelectItemsToPurchaseGoForm().copyTo(getUseCaseParameters());
    
        forward=((PurchaseController)JsfUtils.resolveVariable("purchaseController")).startUseCase();
        
        return forward;
    }

    /**
     * Retrieves the {@link SelectItemsToPurchaseRememberSelectionFormImpl} form instance 
     *
     * @return SelectItemsToPurchaseRememberSelectionFormImpl
     */
    protected SelectItemsToPurchaseRememberSelectionFormImpl getSelectItemsToPurchaseRememberSelectionForm()
    {
        return (SelectItemsToPurchaseRememberSelectionFormImpl)JsfUtils.resolveVariable("purchaseItemsSelectItemsToPurchaseRememberSelectionForm");
    }

    /**
     * <p>
     * This is a dummy event, just to show the usage of an action that operates on an entire table.
     * </p>
     * This method is called when 'remember selection' is triggered in the view 'select items to purchase'.
     * It can be safely overridden in descendant classes.
     *
     * @param form the associated form
     */
    protected void _selectItemsToPurchase_rememberSelection(SelectItemsToPurchaseRememberSelectionFormImpl form)
    {
        //this method can be overridden
    }

    /**
     * Retrieves selectItemsToPurchaseRememberSelection()
     *    
     * @return selectItemsToPurchaseRememberSelection
     * @throws Throwable
     */
    public String selectItemsToPurchaseRememberSelection()
        throws Throwable
    {
        this.setLastPostedFormClientId("purchaseItemsSelectItemsToPurchaseRememberSelectionForm");
        
        String forward=null;
        final SelectItemsToPurchaseRememberSelectionFormImpl form =
            this.getSelectItemsToPurchaseRememberSelectionForm();
            
        //trigger method execution
        _selectItemsToPurchase_rememberSelection(form);

        forward = _rememberSelection(form);
        populateActionFormsAndPageVariables("/my/onlinestore/purchase/select-items-to-purchase.jsf",forward,form);
        if(forward != null)
        {
            if("/my/onlinestore/purchase/select-items-to-purchase.jsf".equals(forward))
            {
                forward = null; //the destination form is the same, stay on the current view
            }
        }
        
        return forward;
    }

    /**
     * <p>
     * TODO: Model Documentation for remember selection
     * </p>
     *
     * @param form the associated form
     * @return the forward view
     * @throws Throwable
     */
    protected String _rememberSelection(final SelectItemsToPurchaseRememberSelectionFormImpl form)
        throws Throwable
    {
        String forward = null;
    
        rememberSelection(form);
        forward = _addItemsToBasket(form);
        return forward;
    }

    /**
     * <p>
     * TODO: Model Documentation for add items to basket
     * </p>
     *
     * @param form the associated form
     * @return the forward view
     * @throws Throwable
     */
    protected String _addItemsToBasket(final SelectItemsToPurchaseRememberSelectionFormImpl form)
        throws Throwable
    {
        String forward = null;
        forward = _askForUserDetails(form);
        return forward;
    }

    /**
     * <p>
     * TODO: Model Documentation for ask for user details
     * </p>
     *
     * @param form the associated form
     * @return the forward view
     * @throws Throwable
     */
    protected String _askForUserDetails(final SelectItemsToPurchaseRememberSelectionFormImpl form)
        throws Throwable
    {
        String forward = null;
        forward = "/my/onlinestore/purchase/enter-user-details.jsf";
        return forward;
    }

    /**
     * Retrieves the {@link EnterUserDetailsPurchaseFormImpl} form instance 
     *
     * @return EnterUserDetailsPurchaseFormImpl
     */
    protected EnterUserDetailsPurchaseFormImpl getEnterUserDetailsPurchaseForm()
    {
        return (EnterUserDetailsPurchaseFormImpl)JsfUtils.resolveVariable("purchaseItemsEnterUserDetailsPurchaseForm");
    }

    /**
     * <p>
     * TODO: Model Documentation for purchase
     * </p>
     * This method is called when 'purchase' is triggered in the view 'enter user details'.
     * It can be safely overridden in descendant classes.
     *
     * @param form the associated form
     */
    protected void _enterUserDetails_purchase(EnterUserDetailsPurchaseFormImpl form)
    {
        //this method can be overridden
    }

    /**
     * Retrieves enterUserDetailsPurchase()
     *    
     * @return enterUserDetailsPurchase
     * @throws Throwable
     */
    public String enterUserDetailsPurchase()
        throws Throwable
    {
        this.setLastPostedFormClientId("purchaseItemsEnterUserDetailsPurchaseForm");
        
        String forward=null;
        final EnterUserDetailsPurchaseFormImpl form =
            this.getEnterUserDetailsPurchaseForm();
            
        //trigger method execution
        _enterUserDetails_purchase(form);

        forward = _prepareItemsForShipping(form);
        populateActionFormsAndPageVariables("/my/onlinestore/purchase/enter-user-details.jsf",forward,form);
        if(forward != null)
        {
            if("/my/onlinestore/purchase/enter-user-details.jsf".equals(forward))
            {
                forward = null; //the destination form is the same, stay on the current view
            }
        }
        
        return forward;
    }

    /**
     * <p>
     * TODO: Model Documentation for prepare items for shipping
     * </p>
     *
     * @param form the associated form
     * @return the forward view
     * @throws Throwable
     */
    protected String _prepareItemsForShipping(final EnterUserDetailsPurchaseFormImpl form)
        throws Throwable
    {
        String forward = null;
    
        prepareForShipping();
        forward = _closeUserSession(form);
        return forward;
    }

    /**
     * <p>
     * TODO: Model Documentation for close user session
     * </p>
     *
     * @param form the associated form
     * @return the forward view
     * @throws Throwable
     */
    protected String _closeUserSession(final EnterUserDetailsPurchaseFormImpl form)
        throws Throwable
    {
        String forward = null;
    
        closeUserSession();
        forward = ((PurchaseController)JsfUtils.resolveVariable("purchaseController")).startUseCase();
        return forward;
    }

    /**
     * Retrieves the {@link PurchaseItemsFormImpl} form instance 
     *
     * @return PurchaseItemsFormImpl
     */
    protected PurchaseItemsFormImpl getPurchaseItemsForm()
    {
        return (PurchaseItemsFormImpl)JsfUtils.resolveVariable("purchaseItemsPurchaseItemsForm");
    }

    /**
     * This method is called when the use case 'Purchase Items' starts.
     * It can be safely overridden in descendant classes.
     *
     * @param form the associated form
     */
    protected void _purchaseItems_started(PurchaseItemsFormImpl form)
    {
        //this method can be overridden
    }

    /**
     * Retrieves the internal start use case
     *    
     * @return purchaseItems
     * @throws Throwable
     */
    protected String internalStartUseCase(Map<String,Object> useCaseParameters)
        throws Throwable
    {
        this.setLastPostedFormClientId("purchaseItemsPurchaseItemsForm");
        
        String forward=null;
        final PurchaseItemsFormImpl form =
            this.getPurchaseItemsForm();
            
        //copy parameters form caller use case
        form.copyFrom(useCaseParameters);
        
        //trigger method execution
        _purchaseItems_started(form);

        forward = _promptUserForNameAndPassword(form);
        populateActionFormsAndPageVariables(null,forward,form);
        return forward;
    }

    /**
     * <p>
     * TODO: Model Documentation for prompt user for name and password
     * </p>
     *
     * @param form the associated form
     * @return the forward view
     * @throws Throwable
     */
    protected String _promptUserForNameAndPassword(final PurchaseItemsFormImpl form)
        throws Throwable
    {
        String forward = null;
    
        loadLanguages(form);
        forward = "/my/onlinestore/purchase/enter-name-and-password.jsf";
        return forward;
    }



    /**
     * Returns the current Basket from the session found in the argument request.
     * <p/>
     * In case an object was found in the session but it was not of the correct type, this method
     * will return <code>null</code>.
     * <p/>
     * If there is no session, it will be created; if the session does not contain the session-object
     * the object will be instantiated and subsequently stored in the session.
     *
     * @return read description
     */
    protected final Basket getBasket()
    {
        Basket object = null;
        final HttpSession session = JsfUtils.getSession(true);

        Object attribute = session.getAttribute("basket");
        if (attribute instanceof Basket)
        {
            object = (Basket)attribute;
        }
        else if (attribute == null)
        {
            object = new Basket();
            setBasket(object);
        }
        return object;
    }

    /**
     * Set the argument org.andromda.cartridges.jsf2.metafacades.JSFSessionObjectLogicImpl[Basket] .name object in the session corresponding with the argument request.
     * If the session does not exist it will be created.
     *
     * @param object the object
     */
    protected final void setBasket(final Basket object)
    {
        this.setBasket(object, true);
    }

    /**
     * Set the argument Basket object in the session corresponding with the argument request.
     * Any existing object will be overwritten.
     *
     * @param object the object
     * @param createSession denotes whether or not the session should be created automatically in case it
     * would not yet exist
     */
    protected final void setBasket(Basket object, boolean createSession)
    {
        final HttpSession session = JsfUtils.getSession(createSession);
        if (session != null)
        {
            session.setAttribute("basket", object);
        }
    }

    /**
     * Removes the argument Basket object from the session corresponding with the argument request.
     * In any of the following cases this method will do nothing:
     * <ul>
     *   <li>No session corresponds to the argument request</li>
     *   <li>No Basket object could be found in the request</li>
     *   <li>The object is not of the correct type</li>
     * </ul>
     */
    protected final void removeBasket()
    {
        final HttpSession session = JsfUtils.getSession(false);
        if (session != null)
        {
            Object attribute = session.getAttribute("basket");
            if (attribute instanceof Basket)
            {
                session.removeAttribute("basket");
            }
        }
    }

}