/*
 * Copyright (c) 2004, 2005, ADAPT project partners (IST-2001-37126).
 * 
 * IndexServlet.java
 */

package org.eu.adapt.demonstrator.web.demo;

import java.io.*;

import javax.servlet.*;
import javax.servlet.http.*;
import org.eu.adapt.demonstrator.web.ADAPTLookAndFeel;
import org.eu.adapt.demonstrator.web.Navigation;

public class IndexServlet extends HttpServlet
{
    public void init()
        throws ServletException
    {
    }

    public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException 
    {
        response.setContentType("text/html");
        response.setHeader("Cache-Control", "no-cache");

        PrintWriter writer = response.getWriter();

        ADAPTLookAndFeel.generatePageHeader("..", writer);
        Navigation.generateNavigationHeader("..", writer);

        ADAPTLookAndFeel.generateTableHeader("Customer Operations", null, writer);
        ADAPTLookAndFeel.generateTableEntry("<I>Submit Purchase Order</I>", "SubmitRetailerPurchaseOrder.html", writer);
        ADAPTLookAndFeel.generateTableFooter(writer);

        ADAPTLookAndFeel.generateTableHeader("Retailer Operations", null, writer);
        ADAPTLookAndFeel.generateTableEntry("<I>Replenish Stock</I>", "SubmitManufacturerPurchaseOrder.html", "Sensors", getInitParameter("RetailerSensorsURL"), writer);
        ADAPTLookAndFeel.generateTableFooter(writer);

        ADAPTLookAndFeel.generateTableHeader("Manufacturer A Operations", null, writer);
        ADAPTLookAndFeel.generateTableEntry("Produce Finished Goods", "Restock_A.html", "<I>Purchase Order Check</I>", "CheckStock_A.html", "Sensors", getInitParameter("ManufacturerASensorsURL"), writer);
        ADAPTLookAndFeel.generateTableFooter(writer);

        ADAPTLookAndFeel.generateTableHeader("Manufacturer B Operations", null, writer);
        ADAPTLookAndFeel.generateTableEntry("Produce Finished Goods", "Restock_B.html", "<I>Purchase Order Check</I>", "CheckStock_B.html", "Sensors", getInitParameter("ManufacturerBSensorsURL"), writer);
        ADAPTLookAndFeel.generateTableFooter(writer);

        ADAPTLookAndFeel.generateTableHeader("Manufacturer C Operations", null, writer);
        ADAPTLookAndFeel.generateTableEntry("Produce Finished Goods", "Restock_C.html", "<I>Purchase Order Check</I>", "CheckStock_C.html", "Sensors", getInitParameter("ManufacturerCSensorsURL"), writer);
        ADAPTLookAndFeel.generateTableFooter(writer);

        ADAPTLookAndFeel.generateTableHeader("Global Operations", null, writer);
        ADAPTLookAndFeel.generateTableEntry("Setup Databases", "SetupDatabases.html", "Setup Sensors", "SetupSensors.html", writer);
        ADAPTLookAndFeel.generateTableFooter(writer);

        Navigation.generateNavigationFooter(writer);
        ADAPTLookAndFeel.generatePageFooter(writer);
    }
}
