retailmanager.java

来自「ORACLE AQ sample 演示的如何出列」· Java 代码 · 共 80 行

JAVA
80
字号
package oracle.otnsamples.AQ.Manager;

/**
 * @author  Rajat Gupta
 * @version 1.0
 *
 * Name of the Application        :  RetailManager.java
 * Development Environment        :  Oracle 9i JDeveloper
 * Creation/Modification History  :
 *
 *    Rajat Gupta       15-Jan-2001      Created
 *
 */

// Servlet Imports
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

// Util Imports
import java.util.Vector;


// Other Files
import oracle.otnsamples.AQ.Helper.RetailHelper;

/**
 * This class is invoked when the request comes from the Retail Admin.
 * It has a method which displays all the orders made in this Shopping
 * site. It also displays other related information about the order.
 *
 * @see Manager.java
 */
public class RetailManager implements Manager{
  /**
   * Empty Constructor
   */
  public RetailManager(){
  }

  /**
   * This is the main method which displays all the orders made by the customer.
   * It gets the required attributes from the session and request objects and
   * passes them to the helper classes.
   *
   * @param p_request HttpServlet Request Object
   * @exception Exception In case an unreported exception is thrown
   * @see RetailHelper.java
   */
  public void displayOrders(HttpServletRequest p_request) throws Exception{
    HttpSession session = p_request.getSession(false);
    if (session == null){
      throw new Exception("AQ-1018");
    }

    String user = (String)session.getAttribute("User");
    Vector orders = RetailHelper.displayOrders(user);

    p_request.setAttribute("Orders", orders);

    return;
  }

  public void displayProduct(HttpServletRequest p_request) throws Exception{
    HttpSession session = p_request.getSession(false);
    if (session == null){
      throw new Exception("AQ-1018");
    }

    String user = (String)session.getAttribute("User");
    String orderID = p_request.getParameter("ShowProducts");

    Vector products = RetailHelper.displayProduct(user, orderID);

    p_request.setAttribute("Products", products);

    return;
  }

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?