<%-- 
/**
  * 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
  *
  */
--%>
<%@ page contentType="text/html"
         import="olstore.entity.*"
	 import="olstore.framework.EJBHomeFactory"
         import="java.util.Collection"
         import="java.util.Iterator"
         %>


    <% request.setAttribute ( "page_title", "View All Items" ); %>
    <jsp:include page="../nav/Header.jsp" />

    <!-- Content begins here -->
    <div id="form" >

<%-- Get the home Type --%>
<%
    EJBHomeFactory factory=EJBHomeFactory.getInstance();
    ItemLocalHome home = (ItemLocalHome)factory.getLocalHome (EJBHomeFactory.USER);
%>


<p> <div class="formHeader"> Items your friends picked </div>
<%
    try {
        Collection allItems = home.findAll();
        Iterator it = allItems.iterator();
        while ( it.hasNext() ) {
            ItemLocal item = (ItemLocal) it.next();
           request.setAttribute ( "itemToDisplay", item ) ;
%> <jsp:include page="../views/ItemDetailedView.jsp" /> <%
        }
    }  catch ( Exception e ) {
        out.println ( "Could not list all items: " + e.getMessage() );
    }
%>


<p> <div class="formHeader"> Items on special offer</div>
<%
    try {
        Collection allItems = home.findAll();
        Iterator it = allItems.iterator();
        while ( it.hasNext() ) {
            ItemLocal item = (ItemLocal) it.next();
           request.setAttribute ( "itemToDisplay", item ) ;
%> <jsp:include page="../views/ItemThumbView.jsp" /> <%
        }
    }  catch ( Exception e ) {
        out.println ( "Could not list all items: " + e.getMessage() );
    }
%>


<p> <div class="formHeader"> Available Items </div>
<%
    try {
        Collection allItems = home.findAll();
        Iterator it = allItems.iterator();
        while ( it.hasNext() ) {
            ItemLocal item = (ItemLocal) it.next();
           request.setAttribute ( "itemToDisplay", item ) ;
%> <jsp:include page="../views/ItemListView.jsp" /> <%
        }
    }  catch ( Exception e ) {
        out.println ( "Could not list all items: " + e.getMessage() );
    }
%>

<div class="spacer" ></div>
<br style="clear:both" />
</div>

    <jsp:include page="../nav/Footer.jsp" />
