ItemsDatabase.jcx Sample

This topic inludes the source code for the ItemsDatabase.jcx Sample.

Sample Location

This sample is located in the following directory in your WebLogic Workshop installation:

BEA_HOME/weblogic81/samples/workshop/SamplesApp/WebServices/localControls/nestedControls/

Sample Source Code


01 package localControls.nestedControls; 
02 
03 import com.bea.control.*; 
04 import java.sql.SQLException; 
05 
06 /** 
07  * A Database control to support the VerifyFunds sample control. Provides access
08  * to a database for purchase order requests.
09  
10  * @jc:connection data-source-jndi-name="cgSampleDataSource" 
11  */ 
12 public interface ItemsDatabase 
13     extends DatabaseControl, com.bea.control.ControlExtension
14 
15     /**
16      * Select item price based on item number.
17      
18      * @jc:sql statement="SELECT price FROM items WHERE itemnumber = {itemNumber}"
19      */
20     double selectItemPrice(int itemNumber);
21     
22     /**
23      * Insert purchase and customer information into a table that correlates the two.
24      
25      * @jc:sql statement="INSERT INTO po_customers (orderid, customerid) VALUES ({poNumber}, {customerID})"
26      */
27     void insertItemCustomer(int poNumber, int customerID);
28 
29     /**
30      * Insert purchase order and item information into a table that correlates the two.
31      
32      * @jc:sql statement="INSERT INTO po_items (orderid, itemnumber, quantity) VALUES ({poNumber}, {itemNumber}, {quantity})"
33      */
34     void insertPOItem(int poNumber, int itemNumber, int quantity);
35 
36     /**
37      * Select the number of items available based on item number.
38      
39      * @jc:sql statement="SELECT quantityAvailable FROM items WHERE itemNumber = {itemNumber}"
40      */
41     int checkInventory(int itemNumber);
42 
43     /**
44      * Update the item inventory.
45      
46      * @jc:sql statement="UPDATE items SET quantityAvailable = {newQuantityAvailable} WHERE itemnumber={itemNumber}"
47      */
48     int updateInventory(int itemNumber, int newQuantityAvailable);
49 }