⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 retailhelper.java

📁 ORACLE AQ sample 演示的如何出列
💻 JAVA
字号:
package oracle.otnsamples.AQ.Helper;

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

// Util Imports
import java.util.Vector;

// Other files
import oracle.otnsamples.AQ.DataBase.DBConnect;

/**
 * This Class is called by the Retail Administrator. It has a method which generates
 * the query for getting information about the various orders placed.
 */
public class RetailHelper{

  /**
   * Empty Constructor
   */
  public RetailHelper(){
  }

  /**
   * This method , as the name implies, displays the orders. It creates a query
   * and passes it to DBConnect.java which in turn executes the query in the
   * DataBase. It gets a Vector with all the orders which is returned further.
   *
   * @param p_user Type of User
   * @exception Exception In case of some unreported Exception
   * @return Contains information about the orders placed by the customer
   * @see DBConnect.java
   */
  public static Vector displayOrders(String p_user) throws Exception {

    // Make DB Query
    StringBuffer query = new StringBuffer();
    query.append("select om.order_id, INITCAP(cm.customer_name), om.order_date, om.order_total, ");
    query.append("INITCAP(os.order_desc), cc.currency_desc from order_master om, order_status os, ");
    query.append("customer_master cm , currency_conversion cc where om.customer_id=cm.customer_id ");
    query.append("and om.order_id=os.order_id and cm.country=cc.country order by om.order_date ");

    // Get instance and execute Query
    DBConnect dbInstance = DBConnect.getInstance();
    Vector orders = dbInstance.executeQuery(query.toString(), p_user);

    return orders;
  }

  /**
   * This method is called by the Retail Administrator. If the admin wants to
   * see the details of an order, then this method serves the purpose. It takes
   * the OrderID as an input and retrives the various details about the products
   * in that particular order.
   *
   * @param p_user Type of User
   * @param p_orderID Order ID
   * @exception Exception In case of some unreported Exception
   * @return Contains information about the products for the particular order
   * @see DBConnect.java
   */
  public static Vector displayProduct(String p_user, String p_orderID) throws Exception{

    // Make DB Query
    StringBuffer query = new StringBuffer();
    query.append("select oi.product_id, INITCAP(pm.product_name), INITCAP(mm.manufacturer_name), ");
    query.append("pm.price, oi.quantity_ordered  from product_master pm, ");
    query.append("manufacturer_master mm, order_items oi where oi.order_id=" + p_orderID);
    query.append(" and oi.product_id=pm.product_id and oi.manufacturer_id=mm.manufacturer_id");

    // Get Instance and execute Query
    DBConnect dbInstance = DBConnect.getInstance();
    Vector products = dbInstance.executeQuery(query.toString(), p_user);

    return products;
  }
}

⌨️ 快捷键说明

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