ItemsDBControl.jcx Sample

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

Sample Location

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

BEA_HOME/weblogic81/samples/workshop/SamplesApp/WebApp/tagSamples/netui_databinding/choice/

Sample Source Code


01 package tagSamples.netui_databinding.choice;
02 
03 import java.sql.SQLException;
04 import javax.sql.RowSet;
05 import com.bea.control.DatabaseControl;
06 import com.bea.control.DatabaseFilter;
07 
08 /**
09   *@jc:connection data-source-jndi-name="cgSampleDataSource"
10   *@common:schema file="#rowset-schemas" inline="true"
11   *@common:define name="rowset-schemas" value::
12   *  <xsd:schema targetNamespace="http://www.tempuri.org"  xmlns="http://www.tempuri.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wld="http://www.bea.com/2002/10/weblogicdata" elementFormDefault="qualified" attributeFormDefault="qualified" id="ITEMSRowSet" >
13   *   <xsd:element wld:DefaultNamespace="http://www.tempuri.org" name="ITEMSRowSet" wld:RowSet="true" writeTable="ITEMS" >
14   *    <xsd:complexType>
15   *     <xsd:choice maxOccurs="unbounded" >
16   *      <xsd:element name="ITEMSRow" >
17   *       <xsd:complexType>
18   *        <xsd:sequence>
19   *         <xsd:element name="ITEMNUMBER" wld:AutoIncrement="true" type="xsd:int" wld:readOnly="true"  wld:PrimaryKey="true" wld:JDBCType="INTEGER" minOccurs="0" wld:TableName="ITEMS" />
20   *         <xsd:element name="ITEMNAME" wld:AutoIncrement="false" type="xsd:string" wld:readOnly="false"  wld:PrimaryKey="false" wld:JDBCType="VARCHAR" minOccurs="0" wld:TableName="ITEMS" />
21   *         <xsd:element name="QUANTITYAVAILABLE" wld:AutoIncrement="false" type="xsd:int" wld:readOnly="false"  wld:PrimaryKey="false" wld:JDBCType="INTEGER" minOccurs="0" wld:TableName="ITEMS" />
22   *         <xsd:element name="PRICE" wld:AutoIncrement="false" type="xsd:double" wld:readOnly="false"  wld:PrimaryKey="false" wld:JDBCType="DOUBLE" minOccurs="0" wld:TableName="ITEMS" />
23   *        </xsd:sequence>
24   *       <xsd:anyAttribute namespace="http://www.bea.com/2202/10/weblogicdata" processContents="skip" />
25   *       </xsd:complexType>
26   *      </xsd:element>
27   *     </xsd:choice>
28   *    </xsd:complexType>
29   *   </xsd:element>
30   *  </xsd:schema>::
31   */
32 public interface ItemsDBControl extends com.bea.control.ControlExtension, DatabaseControl
33 {
34     /**
35       * @jc:sql command-type="grid"
36       *    rowset-name="ITEMSRowSet"
37       *    statement::
38       *      SELECT ITEMNUMBER,ITEMNAME,QUANTITYAVAILABLE,PRICE FROM ITEMS
39       *      {sql: filter.getWhereClause ()}
40       *      {sql: filter.getOrderByClause ()}
41       *    ::
42       */
43     public RowSet getAllItems DatabaseFilter filter )
44       throws SQLException;
45 
46     /**
47       * @jc:sql command-type="detail"
48       *    rowset-name="ITEMSRowSet"
49       *    statement::
50       *      SELECT ITEMNUMBER,ITEMNAME,QUANTITYAVAILABLE,PRICE FROM ITEMS WHERE ITEMNUMBER = {x}
51       *    ::
52       */
53     public RowSet getItems Integer x )
54       throws SQLException;
55 
56     /**
57       * @jc:sql command-type="update"
58       *    rowset-name="ITEMSRowSet"
59       */
60     public RowSet updateItems RowSet changedRs )
61       throws SQLException;
62 
63     /**
64       * @jc:sql command-type="delete"
65       *    rowset-name="ITEMSRowSet"
66       */
67     public void deleteItems RowSet oldRs )
68       throws SQLException;
69 
70     /**
71       * @jc:sql command-type="insert"
72       *    rowset-name="ITEMSRowSet"
73       */
74     public void insertItems RowSet changedRs )
75       throws SQLException;
76 
77     /**
78       * @jc:sql command-type="templateRow"
79       *    rowset-name="ITEMSRowSet"
80       */
81     public RowSet getItemsTemplate ()
82       throws SQLException;
83 
84     /**
85       * @jc:sql command-type="insertedRow"
86       *    rowset-name="ITEMSRowSet"
87       *    statement::
88       *      SELECT ITEMNUMBER,ITEMNAME,QUANTITYAVAILABLE,PRICE FROM ITEMS WHERE ITEMNUMBER = ( Select Max ( ITEMNUMBER ) From ITEMS)
89       *    ::
90       */
91     public RowSet getInsertedItems ()
92       throws SQLException;
93 
94 
95 }