com.fenalco.servlets.shopkeeper
Class SuperOfferPurchaser

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.fenalco.servlets.shopkeeper.SuperOfferPurchaser
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class SuperOfferPurchaser
extends javax.servlet.http.HttpServlet

Este servlet es el encargado de generar la compra de una superoferta. Para tal efecto recibe los parámetros quantity , store, id de versuperoferta que son la cantidad, establecimiento destino e id de la superoferta respectivamente.

Author:
Mario Linares Vásquez
See Also:
Serialized Form

Constructor Summary
SuperOfferPurchaser()
           
 
Method Summary
 boolean buildOrder(int superOfferId, int storeId, int communityId, int quantity)
          Esete método construye una orden de compra con la superoferta seleccionada y la cantidad de compra definida, para tal efecto debe crear una instancia de la clase SuperOffer con el parámetro superOfferId y luego invocar la función submit de la superoferta con los parámetros storeId y quantity tomados del request
 void destroy()
          Destructor de el servlet.
protected  void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Procesa el método HTTP GET.
protected  void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Procesa el método POST method.
 java.lang.String getServletInfo()
          Retorna una breve descripción de el servlet.
 void init(javax.servlet.ServletConfig config)
          Inicializa el servlet.
protected  void processRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Procesa solicitudes para los metodos HTTP GET y POST.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SuperOfferPurchaser

public SuperOfferPurchaser()
Method Detail

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Inicializa el servlet.

Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class javax.servlet.GenericServlet
Parameters:
config -
Throws:
javax.servlet.ServletException

destroy

public void destroy()
Destructor de el servlet.

Specified by:
destroy in interface javax.servlet.Servlet
Overrides:
destroy in class javax.servlet.GenericServlet

processRequest

protected void processRequest(javax.servlet.http.HttpServletRequest request,
                              javax.servlet.http.HttpServletResponse response)
                       throws javax.servlet.ServletException,
                              java.io.IOException
Procesa solicitudes para los metodos HTTP GET y POST. Este método toma los parámetros storeId, quantity e id del request e invoca a la función miembro buildOrder para generar una orden de compra con la superoferta seleccionada. Como el resultado se muestra en una ventana popup al final del proceso se debe mostrar un mensaje resultado.

Parameters:
request - servlet request
response - servlet response
Throws:
javax.servlet.ServletException
java.io.IOException

doGet

protected void doGet(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response)
              throws javax.servlet.ServletException,
                     java.io.IOException
Procesa el método HTTP GET.

Overrides:
doGet in class javax.servlet.http.HttpServlet
Parameters:
request - servlet request
response - servlet response
Throws:
javax.servlet.ServletException
java.io.IOException

doPost

protected void doPost(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)
               throws javax.servlet.ServletException,
                      java.io.IOException
Procesa el método POST method.

Overrides:
doPost in class javax.servlet.http.HttpServlet
Parameters:
request - servlet request
response - servlet response
Throws:
javax.servlet.ServletException
java.io.IOException

getServletInfo

public java.lang.String getServletInfo()
Retorna una breve descripción de el servlet.

Specified by:
getServletInfo in interface javax.servlet.Servlet
Overrides:
getServletInfo in class javax.servlet.GenericServlet
Returns:

buildOrder

public boolean buildOrder(int superOfferId,
                          int storeId,
                          int communityId,
                          int quantity)
Esete método construye una orden de compra con la superoferta seleccionada y la cantidad de compra definida, para tal efecto debe crear una instancia de la clase SuperOffer con el parámetro superOfferId y luego invocar la función submit de la superoferta con los parámetros storeId y quantity tomados del request

Parameters:
superOfferId - id de la superoferta seleccionada
storeId - id del establecimiento destino de la compra
quantity - cantidad
Returns:
boolean que representa el exito del proces