DocContentDB.jcx Sample

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

Sample Location

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

BEA_HOME/weblogic81/samples/workshop/SamplesApp/WebApp/handlingData/binaryFlow/

Sample Source Code


001 package handlingData.binaryFlow;
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:///binaryDBtest" xmlns="java:///binaryDBtest" 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="DOCUMENT_CONTENTRowSet" wld:DefaultNamespace="java:///binaryDBtest" wld:RowSet="true" wld:WriteTable="WEBLOGIC.DOCUMENT_CONTENT">
014  *      <xsd:complexType>
015  *       <xsd:choice maxOccurs="unbounded">
016  *        <xsd:element name="DOCUMENT_CONTENTRow" wld:DatabaseProductName="PointBase">
017  *         <xsd:complexType>
018  *          <xsd:sequence>
019  *           <xsd:element name="ID" type="xsd:int" wld:JDBCType="INTEGER" minOccurs="0" wld:PrimaryKey="true" wld:ReadOnly="true" wld:TableName="WEBLOGIC.DOCUMENT_CONTENT" wld:EditMode="insert">
020  *           </xsd:element>
021  *           <xsd:element name="VERSIONED_OBJECT_ID" type="xsd:int" wld:JDBCType="INTEGER" minOccurs="0" wld:TableName="WEBLOGIC.DOCUMENT_CONTENT">
022  *           </xsd:element>
023  *           <xsd:element name="OBJECT_TYPE" type="xsd:string" wld:JDBCType="VARCHAR" minOccurs="0" wld:TableName="WEBLOGIC.DOCUMENT_CONTENT">
024  *           </xsd:element>
025  *           <xsd:element name="NAME" type="xsd:string" wld:JDBCType="VARCHAR" minOccurs="0" wld:TableName="WEBLOGIC.DOCUMENT_CONTENT">
026  *           </xsd:element>
027  *           <xsd:element name="CONTENT_TYPE" type="xsd:int" wld:JDBCType="INTEGER" minOccurs="0" wld:TableName="WEBLOGIC.DOCUMENT_CONTENT" nillable="true">
028  *           </xsd:element>
029  *           <xsd:element name="CONTAINMENT_OF_CONTENT" type="xsd:int" wld:JDBCType="INTEGER" minOccurs="0" wld:TableName="WEBLOGIC.DOCUMENT_CONTENT">
030  *           </xsd:element>
031  *           <xsd:element name="CONTENT" type="xsd:base64Binary" wld:JDBCType="LONGVARBINARY" minOccurs="0" wld:TableName="WEBLOGIC.DOCUMENT_CONTENT" nillable="true">
032  *           </xsd:element>
033  *           <xsd:element name="FILE_SIZE" type="xsd:decimal" wld:JDBCType="DECIMAL" minOccurs="0" wld:TableName="WEBLOGIC.DOCUMENT_CONTENT" nillable="true">
034  *           </xsd:element>
035  *           <xsd:element name="FILE_LAST_MODIFIED" type="xsd:dateTime" wld:JDBCType="TIMESTAMP" minOccurs="0" wld:TableName="WEBLOGIC.DOCUMENT_CONTENT" nillable="true">
036  *           </xsd:element>
037  *          </xsd:sequence>
038  *          <xsd:anyAttribute namespace="http://www.bea.com/2002/10/weblogicdata" processContents="skip">
039  *          </xsd:anyAttribute>
040  *         </xsd:complexType>
041  *        </xsd:element>
042  *       </xsd:choice>
043  *      </xsd:complexType>
044  *     </xsd:element>
045  *    </xsd:schema>::
046  
047  */
048 public interface docContentDB extends ControlExtension, DatabaseControl
049 {
050     /** Disable default Java serialization */
051     public final static long serialVersionUID = 1L;
052 
053     /**
054      * @jc:sql command-type="grid"
055      *   rowset-name="DOCUMENT_CONTENTRowSet"
056      *   max-rows="1000" 
057      *   statement::
058      *   SELECT ID,VERSIONED_OBJECT_ID,OBJECT_TYPE,NAME,CONTENT_TYPE,CONTAINMENT_OF_CONTENT,CONTENT,FILE_SIZE,FILE_LAST_MODIFIED FROM WEBLOGIC.DOCUMENT_CONTENT {sql: filter.getWhereClause ()} {sql: filter.getOrderByClause ()}
059      *   ::
060      */
061     public RowSet getAllDocumentContent(DatabaseFilter filter)
062         throws SQLException;
063 
064     /**
065      * @jc:sql command-type="detail"
066      *   rowset-name="DOCUMENT_CONTENTRowSet"
067      *   statement::
068      *   SELECT ID,VERSIONED_OBJECT_ID,OBJECT_TYPE,NAME,CONTENT_TYPE,CONTAINMENT_OF_CONTENT,CONTENT,FILE_SIZE,FILE_LAST_MODIFIED FROM WEBLOGIC.DOCUMENT_CONTENT WHERE ID = {x}
069      *   ::
070      */
071     public RowSet detailsDocumentContent(Integer x)
072         throws SQLException;
073 
074     /**
075      * @jc:sql 
076      * statement::
077      * SELECT CONTENT FROM WEBLOGIC.DOCUMENT_CONTENT WHERE ID = {x}
078      * ::
079      */
080     public java.sql.Blob getPHOTO(int x)
081         throws SQLException;
082     /**
083      * @jc:sql 
084      * statement::
085      * SELECT CONTENT FROM WEBLOGIC.DOCUMENT_CONTENT WHERE ID = {x}
086      * ::
087      */
088     public java.sql.Blob getPHOTOString(String x)
089         throws SQLException;
090     /**
091      * @jc:sql command-type="update"
092      *   rowset-name="DOCUMENT_CONTENTRowSet"
093      */
094     public RowSet updateDocumentContent(RowSet changedRs)
095         throws SQLException;
096 
097     /**
098      * @jc:sql command-type="delete"
099      *   rowset-name="DOCUMENT_CONTENTRowSet"
100      */
101     public void deleteDocumentContent(RowSet oldRs)
102         throws SQLException;
103 
104     /**
105      * @jc:sql command-type="templateRow"
106      *   rowset-name="DOCUMENT_CONTENTRowSet"
107      */
108     public RowSet detailsDocumentContentTemplate()
109         throws SQLException;
110 
111     /**
112      * @jc:sql command-type="insert"
113      *   rowset-name="DOCUMENT_CONTENTRowSet"
114      */
115     public RowSet insertDocumentContent(RowSet changedRs)
116         throws SQLException;
117 
118     /**
119      * @jc:sql command-type="insertedRow"
120      *   rowset-name="DOCUMENT_CONTENTRowSet"
121      *   statement::
122      *   SELECT ID,VERSIONED_OBJECT_ID,OBJECT_TYPE,NAME,CONTENT_TYPE,CONTAINMENT_OF_CONTENT,CONTENT,FILE_SIZE,FILE_LAST_MODIFIED FROM WEBLOGIC.DOCUMENT_CONTENT WHERE ID = ( Select Max ( ID ) From WEBLOGIC.DOCUMENT_CONTENT)
123      *   ::
124      */
125     public RowSet getInserted()
126         throws SQLException;
127         
128     /**
129      * @jc:sql command-type="newKey"
130      *   statement::
131      *   Select Max ( ID ) + 1 From WEBLOGIC.DOCUMENT_CONTENT
132      *   ::
133      */
134     public RowSet getNewKey()
135         throws SQLException;        
136 
137 }