/**
 * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * Component of: Red Hat Application Server
 * 
 * Initial Developers: Aizaz Ahmed
 *                     Vivek Lakshmanan
 *                     Andrew Overholt
 *                     Matthew Wringe
 *
 */
package olstore.action;

import javax.servlet.http.*;
import org.apache.struts.action.*;


public class ItemDispatchActions extends DemoBaseDispatchActions {

    /**
     * This method forwards to the success page which should represent
     * an item for editing, if it already exists
     */
    public ActionForward view ( ActionMapping mapping,
                                ActionForm form,
                                HttpServletRequest request,
                                HttpServletResponse response
                              ) throws Exception {

        // Load up the item into the Dynamic Action form so that it
        // displays on the success page 
        return mapping.findForward ( "createItem" );

    }


    /**
     * This method is used to update or create an item with user
     * entered information
     */
    public ActionForward update ( ActionMapping mapping,
                                  ActionForm form,
                                  HttpServletRequest request,
                                  HttpServletResponse response
                                ) throws Exception {

        // Load data from form into dto, and pass to session bean to
        // either create or update the item (depending on if it has
        // an itemId already or not

        return mapping.findForward ( "createItem" );
    }

}
