Essentials Overview Features License Installation FAQ Sample Sites Resources Todo Changes Download Binaries Source Code Supporting Projects Community Portlets Documentation Configuration Guide Javadocs Development Jetspeed Tutorial Portlet Catalog Components Registry Security Syndication WAP Customization Cache PSML Forwards Translated Japanese (Web) Get Involved Contributors CVS Repository View CVS CVS Branches Coding Spec Bug Database |
Database Browser Portlet Class Name : org.apache.jetspeed.portal.portlets.browser.DatabaseBrowserPortlet Class Name : org.apache.jetspeed.modules.actions.portlets.browser.DatabaseBrowserAction
Description
> Presents the result set of a database query in a grid with columns representing selected columns, and rows representing each selected row of data. The SQL query string is configurable in portlet configuration mode.
> Supported Media Types
> Description of Media Types. html
Element: parameter
> Parameter that control the how the web page is converted into a portlet. This element is optional. Parameters common to many portlets.
> Parameter Name | Description
> --- | ---
> sql | The SQL String. Can be any valid SQL Query for your configured database. However it is required that the query returns at least one column. All selected columns of are represented as columns in the grid.
> windowSize | The number of rows presented in the grid at one time.
> template | The Velocity template to layout the database grid HTML in view mode. For many cases the default template is sufficient.
> customizeTemplate | The Velocity templated to layout the database grid HTML in customize mode. For many cases the default template is sufficient.
> poolName | To use a different Torque database connection pool than the default Torque pool. See the Jakarta Torque project documentation for more information on database connection pools.
> row-link-ids | The row-link-ids parameter is a comma separated list of localised string ids. These ids are looked up in the resource bundle, and displayed as hyperlinks.
> row-link-types | The row-link-types determine the type of link. They are also comma separated. Valid values are: pane, psml. The 'pane' link type will go to another pane in your current PSML resource, where you can place an edit form for entering the values of the selected record. The 'psml' link type specifies the name of a local PSML page.
> row-link-targets | The table-link-targets specifies the name of the resource(s). With a pane link type, it identifies the name of the pane. The pane name can also be a portlet. When used with the psml link type, it specifies the name of a PSML resource.
> table-link-ids | The table-link-ids parameter is a comma separated list of localised string ids. These ids are looked up in the resource bundle, and displayed as hyperlinks.
> table-link-types | The table-link-types determine the type of link. They are also comma separated. Valid values are: pane, psml. The 'pane' link type will go to another pane in your current PSML resource, where you can place an edit form for entering the values of the selected record. The 'psml' link type specifies the name of a local PSML page.
> table-link-targets | The table-link-targets specifies the name of the resource(s). With a pane link type, it identifies the name of the pane. The pane name can also be a portlet. When used with the psml link type, it specifies the name of a PSML resource.
> user-object-names | A 'user object' can be automatically created and attached to each row of the Database Browser result set. User object can be any Java object. The name is arbitrary, and is to access your user object from Java your action. This property can contain one or more user object names, separated in a list by commas.
> user-object-types | A 'user object' can be automatically created and attached to each row of the Database Browser result set. The user object can be any Java object. The type of the object is declared here as a full Java path. For example: com.xyz.project.MyUserObject, com.xyz.project.YourUserObject. This property can contain one or more user object types, separated in a list by commas.
> sqlparam[1..n] | A parametrized query may be specified for the browser (for example: 'select * from coffees where coffee_id=?'). To provide static parameter values, use the sqlparam[index] prefix when naming your parameters. For example, sqlparam1 may be used to specify the first parameter, sqlparam2 for the second one and so on. The parameter index must be consecutive and must start with one. As of 1.4-b5.
Example of Registry Entry
>         <portlet-entry name="DatabaseBrowserTest" hidden="false" type="ref"
>             parent="DatabaseBrowserPortlet" application="false">
>             <meta-info>
>                 <title>DatabaseBrowserTest</title>
>                 <description>Simple Test Database Browser Portlet Example</description>
>             </meta-info>
>             <parameter name="template" value="database-browser-portlet" hidden="false"/>
>             <parameter name="customizeTemplate" value="database-browser-customize" hidden="false"/>
>             <parameter name="action" value="portlets.browser.DatabaseBrowserAction" hidden="false"/>
>             <parameter name="sql" value="select * from coffees" hidden="false"/>
>             <!-- to use an alternate torque pool, set this parameter -->
>             <!-- parameter name="poolname" value="otherpool" hidden="false"/-->
>             <parameter name="user-object-types" value="com.xyz.app.UserItem"/>
>             <parameter name="user-object-names" value="userObject"/>
>             <parameter name="row-link-ids" value="EDIT,DELETE" hidden="true"/>
>             <parameter name="row-link-types" value="pane,pane" hidden="true"/>
>             <parameter name="row-link-targets" value="CoffeesForm,CoffeesForm" hidden="true"/>
>             <parameter name="table-link-ids" value="ADD" hidden="true"/>
>             <parameter name="table-link-types" value="pane" hidden="true"/>
>             <parameter name="table-link-targets" value="CoffeesForm" hidden="true"/>
>             <parameter name="windowSize" value="5" hidden="false"/>
>             <media-type ref="html"/>
>         </portlet-entry>
>     	<portlet-entry name="DatabaseBrowserWithParms" hidden="false" type="ref"
>             parent="DatabaseBrowserPortlet" application="false">
>     		<parameter name="template" value="database-browser-portlet" hidden="true"/>
>     		<parameter name="customizeTemplate" value="database-browser-customize" hidden="true"/>
>     		<parameter name="action" value="portlets.browser.DatabaseBrowserAction" hidden="true"/>
>     		<parameter name="sqlparam1" value="1" hidden="false">
>     			<meta-info>
>     				<title>Coffee Id</title>
>     				<description>Only coffee with the id specified will be displayed</description>
>     			</meta-info>
>     		</parameter>
>     		<parameter name="sql" value="select * from coffees where coffee_id=?" type="style" hidden="false">
>     			<security-ref parent="admin-only"/>
>     			<meta-info>
>     				<title>SQL Query</title>
>     			</meta-info>
>     		</parameter>
>     		<parameter name="sql.style" value="TextArea" hidden="true"/>
>     		<parameter name="windowSize" value="5" hidden="false">
>     			<meta-info>
>     				<title>Window Size</title>
>     				<description>Number of rows per page to display</description>
>     			</meta-info>
>     		</parameter>
>     		<media-type ref="html"/>
>     	</portlet-entry>
Examples of use in Portal
>             <portlet-entry id="P-ef1547a162-10018" parent="DatabaseBrowserTest">
>                 <parameter name="sql" value="select * from coffees"/>
>                 <parameter name="windowSize" value="10"/>
>             </portlet-entry>
Issues
Warning: this version of the portlet only supports array-based result sets. This means that all rows from the result set are loaded into memory. Future releases will support a 'virtual' database browser, which will not load the entire result set into memory.
Copyright © 1999-2003, Apache Software Foundation