ItemsRowSetControl.jcx Sample

This topic inludes the source code for the ItemsRowSetControl.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/grid/itemsrowsetcontrol/

Sample Source Code


001 package tagSamples.netui_databinding.grid.itemsrowsetcontrol;
002 import java.sql.SQLException;
003 import javax.sql.RowSet;
004 import com.bea.control.DatabaseControl;
005 import com.bea.control.DatabaseFilter;
006 import com.bea.control.ControlExtension;
007 
008 /**
009  * @jc:connection data-source-jndi-name="cgDataSource"
010  * @common:schema file="#rowset-schemas" inline="true"
011  * @common:define name="rowset-schemas" value::
012  *    <xsd:schema targetNamespace="java:///itemsrowsetcontrol" xmlns="java:///itemsrowsetcontrol" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wld="http://www.bea.com/2002/10/weblogicdata" elementFormDefault="qualified" attributeFormDefault="unqualified">
013  *     <xsd:element name="ITEMSRowSet" wld:DefaultNamespace="java:///itemsrowsetcontrol" wld:RowSet="true" wld:WriteTable="WEBLOGIC.ITEMS">
014  *      <xsd:complexType>
015  *       <xsd:choice maxOccurs="unbounded">
016  *        <xsd:element name="ITEMSRow" wld:DatabaseProductName="PointBase">
017  *         <xsd:complexType>
018  *          <xsd:sequence>
019  *           <xsd:element name="ITEMNUMBER" type="xsd:int" wld:JDBCType="INTEGER" minOccurs="0" wld:AutoIncrement="true" wld:PrimaryKey="true" wld:ReadOnly="true" wld:TableName="WEBLOGIC.ITEMS">
020  *           </xsd:element>
021  *           <xsd:element name="ITEMNAME" type="xsd:string" wld:JDBCType="VARCHAR" minOccurs="0" wld:TableName="WEBLOGIC.ITEMS" nillable="true">
022  *           </xsd:element>
023  *           <xsd:element name="QUANTITYAVAILABLE" type="xsd:int" wld:JDBCType="INTEGER" minOccurs="0" wld:TableName="WEBLOGIC.ITEMS" nillable="true">
024  *           </xsd:element>
025  *           <xsd:element name="PRICE" type="xsd:double" wld:JDBCType="DOUBLE" minOccurs="0" wld:TableName="WEBLOGIC.ITEMS" nillable="true">
026  *           </xsd:element>
027  *          </xsd:sequence>
028  *          <xsd:anyAttribute namespace="http://www.bea.com/2002/10/weblogicdata" processContents="skip">
029  *          </xsd:anyAttribute>
030  *         </xsd:complexType>
031  *        </xsd:element>
032  *       </xsd:choice>
033  *      </xsd:complexType>
034  *     </xsd:element>
035  *    </xsd:schema>::
036  
037  */
038 public interface ItemsRowSetControl extends ControlExtension, DatabaseControl
039 {
040     /** Disable default Java serialization */
041     public final static long serialVersionUID = 1L;
042 
043     /**
044      * @jc:sql command-type="grid"
045      *   rowset-name="ITEMSRowSet"
046      *   max-rows="1000" 
047      *   statement::
048      *   SELECT ITEMNUMBER,ITEMNAME,QUANTITYAVAILABLE,PRICE FROM WEBLOGIC.ITEMS {sql: filter.getWhereClause ()} {sql: filter.getOrderByClause ()}
049      *   ::
050      */
051     public RowSet getAllItems(DatabaseFilter filter)
052         throws SQLException;
053 
054     /**
055      * @jc:sql command-type="detail"
056      *   rowset-name="ITEMSRowSet"
057      *   statement::
058      *   SELECT ITEMNUMBER,ITEMNAME,QUANTITYAVAILABLE,PRICE FROM WEBLOGIC.ITEMS WHERE ITEMNUMBER = {x}
059      *   ::
060      */
061     public RowSet detailsItems(Integer x)
062         throws SQLException;
063 
064     /**
065      * @jc:sql command-type="update"
066      *   rowset-name="ITEMSRowSet"
067      */
068     public RowSet updateItems(RowSet changedRs)
069         throws SQLException;
070 
071     /**
072      * @jc:sql command-type="delete"
073      *   rowset-name="ITEMSRowSet"
074      */
075     public void deleteItems(RowSet oldRs)
076         throws SQLException;
077 
078     /**
079      * @jc:sql command-type="templateRow"
080      *   rowset-name="ITEMSRowSet"
081      */
082     public RowSet detailsItemsTemplate()
083         throws SQLException;
084 
085     /**
086      * @jc:sql command-type="insert"
087      *   rowset-name="ITEMSRowSet"
088      */
089     public RowSet insertItems(RowSet changedRs)
090         throws SQLException;
091 
092     /**
093      * @jc:sql command-type="insertedRow"
094      *   rowset-name="ITEMSRowSet"
095      *   statement::
096      *   SELECT ITEMNUMBER,ITEMNAME,QUANTITYAVAILABLE,PRICE FROM WEBLOGIC.ITEMS WHERE ITEMNUMBER = ( Select Max ( ITEMNUMBER ) From WEBLOGIC.ITEMS)
097      *   ::
098      */
099     public RowSet getInserted()
100         throws SQLException;
101 
102 }