[cvs] expresso commit by lhamel: make program listings have EOLs
again
JCorporate Ltd
jcorp at jcorp2.servlets.net
Fri Oct 15 02:31:22 PDT 2004
Log Message:
-----------
make program listings have EOLs again
Modified Files:
--------------
expresso/expresso-web/expresso/doc/edg:
components.xml
configuration.xml
contrib.xml
controllers.xml
dbmaint.xml
dbobject-types.xml
dbobjects.xml
Revision Data
-------------
Index: controllers.xml
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/expresso/doc/edg/controllers.xml,v
retrieving revision 1.29
retrieving revision 1.30
diff -Lexpresso-web/expresso/doc/edg/controllers.xml -Lexpresso-web/expresso/doc/edg/controllers.xml -u -r1.29 -r1.30
--- expresso-web/expresso/doc/edg/controllers.xml
+++ expresso-web/expresso/doc/edg/controllers.xml
@@ -912,12 +912,12 @@
even jobs. But what if you wanted to use servlet specific features? In
older versions of Expresso you would have the following code in your internal
state handler:
- <programlisting><![CDATA[1. ControllerResponse
- runPromptState(ControllerRequest request, ControllerResponse response)
- throws ControllerException { 2. ServletControllerRequest scr =
- (ServletControllerRequest)request; 3. /** Get HttpServlet Request through:
- scr.getHttpServletRequest() **/ ..... 4 } /*
- runPromptState(ControllerRequest, ControllerResponse);]]></programlisting>
+ <programlisting><![CDATA[
+1. ControllerResponse runPromptState(ControllerRequest request, ControllerResponse response)
+ throws ControllerException {
+2. ServletControllerRequest scr = (ServletControllerRequest)request;
+3. /** Get HttpServlet Request through: scr.getHttpServletRequest() **/ .....
+4 } ]]></programlisting>
</para>
<para>
@@ -964,12 +964,19 @@
When using "external" state objects, the declaration of the Controller
is a bit different:
</para>
- <programlisting><![CDATA[1. public Upload() { 2. PromptBrowser browser = new
+ <programlisting><![CDATA[
+1. public Upload() {
+2. PromptBrowser browser = new
PromptBrowser("browser", "Prompt for Upload from Browser");
- 3. browser.addParameter("resource", false); 4. addState(browser); 5.
- 6. DoBrowser dobrowser = new DoBrowser("dobrowser", "Process
- Upload from Browser"); 7. dobrowser.addParameter("action"); 9.
- addState(dobrowser); 10. 11. } /* Upload() */]]></programlisting>
+ 3. browser.addParameter("resource", false);
+ 4. addState(browser);
+ 5.
+ 6. DoBrowser dobrowser = new DoBrowser("dobrowser", "Process Upload from Browser");
+ 7. dobrowser.addParameter("action");
+ 9.
+ addState(dobrowser);
+ 10.
+ 11. } /* Upload() */]]></programlisting>
<para>
In the listing above, PromptBrowser and DoBrowser are objects defined external
to the Controller class that extend the State object. For example, PromptBrowser
Index: dbobject-types.xml
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/expresso/doc/edg/dbobject-types.xml,v
retrieving revision 1.19
retrieving revision 1.20
diff -Lexpresso-web/expresso/doc/edg/dbobject-types.xml -Lexpresso-web/expresso/doc/edg/dbobject-types.xml -u -r1.19 -r1.20
--- expresso-web/expresso/doc/edg/dbobject-types.xml
+++ expresso-web/expresso/doc/edg/dbobject-types.xml
@@ -69,7 +69,8 @@
directly instantiate MultiDBObject objects, rather than having to subclass.
For example:
</para>
- <programlisting><![CDATA[1. MultiDBObject myMulti = new MultiDBObject();
+ <programlisting><![CDATA[
+1. MultiDBObject myMulti = new MultiDBObject();
2. myMulti.setDataContext(getDataContext());
3. myMulti.addDBObj(
"com.jcorporate.expresso.services.dbobj.UserDBObj");
@@ -220,7 +221,8 @@
So let's show a JoinedDataObject that joins DownloadLog and DownloadFiles
tables based upon the file number in Download Log.
- <programlisting><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+ <programlisting><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dataobject-join PUBLIC "-//Jcorporate Ltd//DTD Expresso DataObject Join 5.1//EN"
"http://www.jcorporate.com/dtds/jdbc-join_5_1.dtd">
<dataobject-join description="Download Log View">
@@ -295,7 +297,8 @@
and conform to the API. So JoinedDataObjects expect field names to be specially
formatted. They go by the format [alias].[fieldName] . So, for example,
to refer to the file number in DownloadLog, you would type in code:
- <programlisting><![CDATA[setField("DownloadLog.FileNumber",4");]]></programlisting>
+ <programlisting><![CDATA[
+ setField("DownloadLog.FileNumber",4");]]></programlisting>
Although JoinedDataObject parses the string, to all external clients, it
looks like a single data object, with weird field names.
@@ -315,7 +318,8 @@
of String value for the object to configure itself with. For AutoDBObject,
for example, you set the table name to attach to. JoinedDataObjects take
the path (in classpath) to the definition file. So let's use a sample:
- <programlisting><![CDATA[import com.jcorporate.expresso.core.dataobjects.jdbc.JoinedDataObject;
+ <programlisting><![CDATA[
+import com.jcorporate.expresso.core.dataobjects.jdbc.JoinedDataObject;
import com.jcorporate.expresso.core.dataobjects.Securable;
//...
@@ -332,7 +336,8 @@
Expresso 5.1 now has a DataObject factory that considers all the construction
order of various dataobjects including Securable and Definable. Instead
of the sample above, you can instead write the code:
- <programlisting><![CDATA[import com.jcorporate.expresso.core.dataobjects.DataObjectFactory;
+ <programlisting><![CDATA[
+import com.jcorporate.expresso.core.dataobjects.DataObjectFactory;
import com.jcorporate.expresso.core.dataobjects.jdbc.JoinedDataObject;
import com.jcorporate.expresso.core.dataobjects.Securable;
@@ -356,19 +361,22 @@
<listitem>
<para>
Getting a field string value:
- <programlisting><![CDATA[String myValue = myjoin.getDataField("alias1.field1").asString();]]></programlisting>
+ <programlisting><![CDATA[
+String myValue = myjoin.getDataField("alias1.field1").asString();]]></programlisting>
</para>
</listitem>
<listitem>
<para>
Setting a field value:
- <programlisting><![CDATA[myjoin.setFieldValue("alias1.field2","abcdefg");]]></programlisting>
+ <programlisting><![CDATA[
+myjoin.setFieldValue("alias1.field2","abcdefg");]]></programlisting>
</para>
</listitem>
<listitem>
<para>
Retrieving search results:
- <programlisting><![CDATA[myJoin.setFieldValue("alias1.field3", "ab%");
+ <programlisting><![CDATA[
+myJoin.setFieldValue("alias1.field3", "ab%");
myJoin.setFieldValue("alias2.field2", "e%");
java.util.ArrayList results = myJoin.searchAndRetrieveList("alias1.field1")']]></programlisting>
@@ -403,7 +411,8 @@
The definition parameter is identical to that of what you set earlier when
instantiating it by memory. So to list all records of the join, enter (all
in one line)
- <programlisting><![CDATA[/DBMaint.do?dbobj=com.jcorporate.expresso.core.dataobjects.jdbc.JoinedDataObject&definition=
+ <programlisting><![CDATA[
+/DBMaint.do?dbobj=com.jcorporate.expresso.core.dataobjects.jdbc.JoinedDataObject&definition=
/org/example/myapp/dbobj/myjoin.xml&state=List]]></programlisting>
</para>
</sect2>
@@ -426,7 +435,8 @@
a feature to allow you to turn off the create/read/update/delete capabilities
in an override fashion. To do this, you add a new element to your join
definition file called 'permissions'. An example is like so:
- <programlisting><![CDATA[<dataobject-join description="Download Log View">
+ <programlisting><![CDATA[
+<dataobject-join description="Download Log View">
<dataobject className="com.jcorporate.expresso.ext.dbobj.DownloadLog" alias="DownloadLog"/>
<dataobject className="com.jcorporate.expresso.ext.dbobj.DownloadFiles" alias="DownloadFiles"/>
<dataobject className="com.jcorporate.expresso.services.dbobj.MimeTypes" alias="MimeTypes"/>
@@ -547,8 +557,8 @@
</para>
<para>
A concrete example:
- <programlisting><![CDATA[public void setupFields()
- throws DBException {
+ <programlisting><![CDATA[
+public void setupFields() throws DBException {
setTargetTable("TESTMEDIA");
setDescription("Blob Storage Test");
setCharset("ISO-8859-1");
@@ -595,7 +605,8 @@
<para>
You can save your BLOB fields in the following example code:
- <programlisting><![CDATA[// Open the file, get its length
+ <programlisting><![CDATA[
+// Open the file, get its length
File f = new File(importFile);
InputStream is = new FileInputStream(f);
int fileSize = (int) f.length();
@@ -613,7 +624,8 @@
</para>
<para>
The code to retrieve the BLOB is similar:
- <programlisting><![CDATA[// Open the file, get its length
+ <programlisting><![CDATA[
+// Open the file, get its length
File f = new File(exportFile);
OutputStream os = new FileOutputStream(f);
@@ -656,7 +668,8 @@
</para>
<para>
If you use the URL with something like:
- <programlisting><![CDATA[http://localhost:8080/DBMaint.do?state=Add&dbobj=org.example.dbobj.MyMediaDBObject]]></programlisting>
+ <programlisting><![CDATA[
+http://localhost:8080/DBMaint.do?state=Add&dbobj=org.example.dbobj.MyMediaDBObject]]></programlisting>
You will notice that there is a 'File Upload' field where you added the
BLOB field. You can use this to upload any file to the database and DBMaint
@@ -713,8 +726,8 @@
access a table without any coding at all! The DBMaint servlet has a special
parameter to allow an AutoDBObject to be used:
</para>
- <programlisting><![CDATA[1. /DBMaint.do?dbobj=com.jcorporate.expresso.core.dbobj.AutoDBObject&definition=SCHEMALIST&
-state=List]]></programlisting>
+ <programlisting><![CDATA[
+1. /DBMaint.do?dbobj=com.jcorporate.expresso.core.dbobj.AutoDBObject&definition=SCHEMALIST&state=List]]></programlisting>
<para>
This command will list (and enable editing) on the SCHEMALIST table on
the current database. No coding at all is required but the user must have
@@ -759,7 +772,8 @@
<title>SynchronizedDataObject example</title>
<para>
- <programlisting><![CDATA[DataObject sharedObject = SynchronizedDataObject.newInstance(mydbobj);]]></programlisting>
+ <programlisting><![CDATA[
+DataObject sharedObject = SynchronizedDataObject.newInstance(mydbobj);]]></programlisting>
</para>
<para>
Index: dbmaint.xml
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/expresso/doc/edg/dbmaint.xml,v
retrieving revision 1.18
retrieving revision 1.19
diff -Lexpresso-web/expresso/doc/edg/dbmaint.xml -Lexpresso-web/expresso/doc/edg/dbmaint.xml -u -r1.18 -r1.19
--- expresso-web/expresso/doc/edg/dbmaint.xml
+++ expresso-web/expresso/doc/edg/dbmaint.xml
@@ -180,7 +180,8 @@
The servlet works on any SecuredDBObject, specified as a parameter, and
can perform any of a number of different commands. For example:
</para>
- <programlisting><![CDATA[1. /DBMaint.do?dbobj=com.yourcompany.dbobj.Customer&state=List]]></programlisting>
+ <programlisting><![CDATA[
+1. /DBMaint.do?dbobj=com.yourcompany.dbobj.Customer&state=List]]></programlisting>
<para>
will list all records (subject to a page size specified in Expresso and
discussed later) in the table corresponding to the Customer DBObject. (Assuming
Index: configuration.xml
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/expresso/doc/edg/configuration.xml,v
retrieving revision 1.31
retrieving revision 1.32
diff -Lexpresso-web/expresso/doc/edg/configuration.xml -Lexpresso-web/expresso/doc/edg/configuration.xml -u -r1.31 -r1.32
--- expresso-web/expresso/doc/edg/configuration.xml
+++ expresso-web/expresso/doc/edg/configuration.xml
@@ -126,7 +126,8 @@
</para>
<para>
Specifying an alternate implementation:
- <programlisting><![CDATA[<class-handlers>
+ <programlisting><![CDATA[
+<class-handlers>
<class-handler name="userInfo" classHandler="com.jcorporate.expresso.services.dbobj.DefaultUserInfo"/>
</class-handlers>]]></programlisting>
</para>
@@ -340,12 +341,14 @@
downloads, and example of this is already created. To do this, add the
expresso.logDir macro to wherever you would normally put the logging directory
name.
- <programlisting><![CDATA[<appender name="expressoLog" class="org.apache.log4j.FileAppender">
+
+<programlisting><![CDATA[
+<appender name="expressoLog" class="org.apache.log4j.FileAppender">
<param name="File" value="${expresso.logDir}/expresso.log"/>
- <param name="Append" value="true"/>
+ <param name="Append" value="true"/>
<layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%l) - %m\n"/>
- </layout>
+ <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%l) - %m\n"/>
+ </layout>
</appender>]]></programlisting>
</para>
<para>
@@ -402,7 +405,8 @@
can be used inside the log4j file by enclosing the system property with
${}. So, for example, under Tomcat installations you could write your log
file to the catalina log directory by having:
- <programlisting><![CDATA[<appender name="expressoLog" class="org.apache.log4j.FileAppender">
+ <programlisting><![CDATA[
+<appender name="expressoLog" class="org.apache.log4j.FileAppender">
<param name="File" value="${catalina.home}/logs/expresso.log"/>
<param name="Append" value="true"/>
<layout class="org.apache.log4j.PatternLayout">
@@ -829,7 +833,8 @@
JobHandler's thread can be turned on at startup by having the following
line in expresso-config.xml:
- <programlisting><![CDATA[<startJobHandler>y</startJobHandler>]]></programlisting>
+ <programlisting><![CDATA[
+<startJobHandler>y</startJobHandler>]]></programlisting>
</para>
</sect2>
<sect2>
@@ -950,18 +955,19 @@
From the top directory where this source download was expanded (e.g., "expressosrc"),
and referring to the directory where the "complete" download was expanded
(e.g., "expressocomplete"), the commands would be something like
- <programlisting><![CDATA[# copy appropriate db config, expresso-config.xml, into directory
-# where src package has been expanded
-cp downloads/expresso-config.xml expressosrc/expresso-web/WEB-INF/config/
-# set env var for where to find tomcat (used to find servlet.jar)
-export CATALINA_HOME=/home/me/expressocomplete
-# go to topmost directory where you unpacked src zip file,
-# where (topmost) build.xml is found
-cd expressosrc
-# execute ant command; assumes ant is installed per instructions,
-# with (ant-distrib)/bin in path
-ant generatefromdb
-# list java files created in this directory
+ <programlisting><![CDATA[
+# copy appropriate db config, expresso-config.xml, into directory
+# where src package has been expanded
+cp downloads/expresso-config.xml expressosrc/expresso-web/WEB-INF/config/
+# set env var for where to find tomcat (used to find servlet.jar)
+export CATALINA_HOME=/home/me/expressocomplete
+# go to topmost directory where you unpacked src zip file,
+# where (topmost) build.xml is found
+cd expressosrc
+# execute ant command; assumes ant is installed per instructions,
+# with (ant-distrib)/bin in path
+ant generatefromdb
+# list java files created in this directory
ls *.java]]></programlisting>
In order to know if the Java files have been created, look in the directory.
Index: components.xml
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/expresso/doc/edg/components.xml,v
retrieving revision 1.10
retrieving revision 1.11
diff -Lexpresso-web/expresso/doc/edg/components.xml -Lexpresso-web/expresso/doc/edg/components.xml -u -r1.10 -r1.11
--- expresso-web/expresso/doc/edg/components.xml
+++ expresso-web/expresso/doc/edg/components.xml
@@ -966,7 +966,8 @@
<title>Implement Lifecycle interface if you want to receive configuration and lifecycle events.</title>
<para>
The Configuration Interface's rules are simple:
- <programlisting><![CDATA[Boolean booleanProperty = (Boolean)newConfig.get("myBooleanProperty");]]></programlisting>
+<programlisting><![CDATA[
+ Boolean booleanProperty = (Boolean)newConfig.get("myBooleanProperty");]]></programlisting>
Since the component knows about what it requires type-wise, as per its
metadata, then it knows how to case the property that it is getting.
Index: dbobjects.xml
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/expresso/doc/edg/dbobjects.xml,v
retrieving revision 1.32
retrieving revision 1.33
diff -Lexpresso-web/expresso/doc/edg/dbobjects.xml -Lexpresso-web/expresso/doc/edg/dbobjects.xml -u -r1.32 -r1.33
--- expresso-web/expresso/doc/edg/dbobjects.xml
+++ expresso-web/expresso/doc/edg/dbobjects.xml
@@ -595,9 +595,10 @@
an implementation of javax.sql.DataSource to use for grabbing new database
connections. Expresso 5.3 now has code to allow you to retrieve a "dumb"
datasource from the DBConnectionPool. Example code to do this is:
- <programlisting><![CDATA[javax.sql.DataSource dataSource = DBConnectionPool.getDataSource("default");
+ <programlisting><![CDATA[
+javax.sql.DataSource dataSource = DBConnectionPool.getDataSource("default");
java.sql.Connection connection = dataSource.getConnection();
-//... Use the connection here
+//... Use the connection here
connection.close();]]></programlisting>
</para>
</sect2>
@@ -1003,7 +1004,8 @@
<primary>Database Objects</primary>
<secondary>Example of</secondary>
</indexterm>
- <programlisting><![CDATA[1. public void setupFields() throws DBException {
+ <programlisting><![CDATA[
+1. public void setupFields() throws DBException {
2. setTargetTable ("Customer");
3. addField("CustomerID", "auto-inc", 0, false, "Customer Identifier");
4. addField("CustomerName", "varchar", 80, false, "Customer Name");
@@ -1148,7 +1150,8 @@
to be retrieved with a "getDataContext()" call - Controller objects, for
example, do this. So a DBObject being used within a Controller simply says:
</para>
- <programlisting><![CDATA[1. custList.setDataContext(getDataContext());]]></programlisting>
+ <programlisting><![CDATA[
+1. custList.setDataContext(getDataContext());]]></programlisting>
<para>
to specify that it should use the Database/Context of the Controller -
this makes the whole Controller object portable across databases.
@@ -1209,7 +1212,8 @@
<para>
In order to do this we extend the usual getField(String) method:
</para>
- <programlisting><![CDATA[1. public String getField(String fieldName) throws DBException {
+ <programlisting><![CDATA[
+1. public String getField(String fieldName) throws DBException {
2. if (fieldName.equals("CustomerName")) {
3. Customer ourCustomer = newCustomer();
4. ourCustomer.setDataContext(getDataContext());
@@ -1255,7 +1259,8 @@
are Y or N. In order to make this restriction, we call the setMultiValued
method in setupFields():
</para>
- <programlisting><![CDATA[1. setMultiValued("AccountOpen");]]></programlisting>
+ <programlisting><![CDATA[
+1. setMultiValued("AccountOpen");]]></programlisting>
<para>
Once you've specified that a field is multi-valued, you must enumerate
the possible values by one of two methods.
@@ -1265,8 +1270,8 @@
values available for the field. This is most appropriate for static values,
such as in our example above:
</para>
- <programlisting><![CDATA[1. public Vector getValidValues(String fieldName)
- throws DBException {
+ <programlisting><![CDATA[
+1. public Vector getValidValues(String fieldName) throws DBException {
2.
3. if (fieldName.equals("AccountOpen")) {
4. Vector myValues = newVector();
@@ -1281,7 +1286,8 @@
"lookup object" for the field. This is appropriate if the values for the
field come from another DBObject, such as a code lookup table. For example:
</para>
- <programlisting><![CDATA[1. setMultiValued("CustomerType");
+ <programlisting><![CDATA[
+1. setMultiValued("CustomerType");
2. setLookupObject("CustomerType", "com.yourcompany.dbobj.CustomerType");]]></programlisting>
<para>
If you choose the second option then you are allowing the <emphasis>framework</emphasis>
@@ -1305,7 +1311,8 @@
An example will make this clearer. Suppose we have an EMPLOYEE and DEPARTMENT
database tables, and they have the following schemas.
</para>
- <programlisting><![CDATA[CREATE TABLE IF NOT EXISTS EMPLOYEE (
+ <programlisting><![CDATA[
+CREATE TABLE IF NOT EXISTS EMPLOYEE (
INT Employee_Id,
VARCHAR(25) First_Names,
VARCHAR(25) Last_Names,
@@ -1326,24 +1333,25 @@
to return a vector of valid values according to the right field and also
set up the lookup meta data accordingly.
</para>
- <programlisting><![CDATA[package org.fooey.testapp.dbobj;
+ <programlisting><![CDATA[
+package org.fooey.testapp.dbobj;
public class Employee extends DBObject {
-
- // ...
+
+ // ...
public void setupFields() {
- // ...
+ // ...
setMultiValued("Sex");
setMultiValued("Dept_Id");
setLookupObject("Dept_Id", "com.fooey.testapp.dbobj.Department" );
- }
+ }
- public Vector getValidValues(String fieldName)
+ public Vector getValidValues(String fieldName)
throws DBException {
-
+
if (fieldName.equals("Sex")) {
Vector myValues = new Vector();
myValues.addElement(new ValidValue("M", "Male"));
@@ -1352,8 +1360,8 @@
}
return super.getValidValues(fieldName);
}
-
- // ...
+
+ // ...
}]]></programlisting>
<para>
So we have an Employee database object with the attribute "Sex" that handles
@@ -1362,18 +1370,19 @@
object. In order to handle this automatically we override the <emphasis>getValues()</emphasis>
method.
</para>
- <programlisting><![CDATA[package org.fooey.testapp.dbobj;
+ <programlisting><![CDATA[
+package org.fooey.testapp.dbobj;
public class Department extends DBObject {
-
- // ...
+
+ // ...
public Vector getValues() throws DBException {
- Vector myValue = this.getValuesDefault( "Dept_Id", "Dept_Name" );
+ Vector myValue = this.getValuesDefault( "Dept_Id", "Dept_Name" );
return myValues;
}
-
- // ...
+
+ // ...
}]]></programlisting>
<para>
The method <emphasis>getValuesDefault()</emphasis> in the base class <emphasis>DBObject</emphasis>
@@ -1390,7 +1399,8 @@
"Dept_Name" )' automatically retrieve the data from the database as if
it is stored like this:
</para>
- <programlisting><![CDATA[DEPT_ID DEPT_NAME
+ <programlisting><![CDATA[
+DEPT_ID DEPT_NAME
========================================
100 PAYROLL
200 SALES
@@ -1440,7 +1450,8 @@
is expected to refer to a <emphasis>DataObject</emphasis> which implements
the <emphasis>LookupInterface</emphasis>.
</para>
- <programlisting><![CDATA[package com.jcorporate.expresso.core.dbobj;
+ <programlisting><![CDATA[
+package com.jcorporate.expresso.core.dbobj;
public interface LookupInterface {
public Vector getValues() throws DBException;
@@ -1456,31 +1467,33 @@
a EMPLOYEE data object, then has a look-up values in another data object
ACCOUNT such as
</para>
- <programlisting><![CDATA[package org.fooey.testapp.dbobj;
+ <programlisting><![CDATA[
+package org.fooey.testapp.dbobj;
public class Employee extends DBObject {
- // ...
+ // ...
public void setupFields() {
- // ...
+ // ...
setLookupObject("Account_Id", "com.fooey.testapp.dbobj.Account" );
- }
+ }
}]]></programlisting>
<para>
The account object is rather simply written as the following code. Notice
that it uses the convenience <emphasis>getDefaultValues()</emphasis> method
to retrieve valid values and cache them simultaneously.
</para>
- <programlisting><![CDATA[package org.fooey.testapp.dbobj;
+ <programlisting><![CDATA[
+package org.fooey.testapp.dbobj;
public class Account extends DBObject {
-
- // ...
+
+ // ...
public Vector getValues() {
- return this.getValuesDefault( "Account_Id", "Account_Description" );
- }
+ return this.getValuesDefault( "Account_Id", "Account_Description" );
+ }
}]]></programlisting>
<para>
@@ -1570,10 +1583,11 @@
A more specific way of validating fields is to extend the actual setField
method, like this:
</para>
- <programlisting><![CDATA[1. public void setField(String fieldName, String fieldValue)
+ <programlisting><![CDATA[
+1. public void setField(String fieldName, String fieldValue)
throws DBException {
2. if (fieldName.equals("Priority")) {
-3. if(!(fieldValue.equals("A") ||
+3. if(!(fieldValue.equals("A") ||
fieldValue.equals("B") ||
fieldValue.equals("C"))) {
4. throw new DBException ("Priority must be A, B or C");
@@ -1830,7 +1844,8 @@
In order to retrieve a specified DBObject corresponding to a particular
row in the database, you must first initialize the object in your program:
</para>
- <programlisting><![CDATA[import com.yourcompany.dbobj.Customer;
+ <programlisting><![CDATA[
+import com.yourcompany.dbobj.Customer;
.
.
.
@@ -1840,7 +1855,8 @@
a specific customer, we must specify a value for the key field (or fields
if there were more than one key field).
</para>
- <programlisting><![CDATA[oneCustomer.setField("CustomerID", "1");]]></programlisting>
+ <programlisting><![CDATA[
+ oneCustomer.setField("CustomerID", "1");]]></programlisting>
<para>
This specifies a value for the Customer ID field as "1". Note that we specify
the value as a string - there are also setField methods for other types
@@ -1871,7 +1887,8 @@
Other methods for retrieval exist for when the key retrieved is not suitable.
For example:
</para>
- <programlisting><![CDATA[/* Erase any current values in fields */
+ <programlisting><![CDATA[
+/* Erase any current values in fields */
oneCustomer.clear();
oneCustomer setField("CustomerName", "Jones");
@@ -1897,11 +1914,12 @@
one at a time. For example, lets say we want to perform some processing
on all customers of type "AB" in our database. We can use code like this:
</para>
- <programlisting><![CDATA[import java.util.*;
+ <programlisting><![CDATA[
+import java.util.*;
1. Customer custList = newCustomer();
2. Customer oneCustomer = null;
3. custList.setField("CustomerType", "AB");
-4. for (Iterator e = custList.searchAndRetrieveList().iterator();
+4. for (Iterator e = custList.searchAndRetrieveList().iterator();
e.hasNext(); ) {
5. oneCustomer = (Customer) e.next();
6. /* do whatever we need to do to oneCustomer */
@@ -1928,7 +1946,8 @@
the "searchAndRetrieveList()" method from custList. We could write each
step of this line separately like this:
</para>
- <programlisting><![CDATA[1. java.util.Iterator i = custList.searchAndRetrieveList();
+ <programlisting><![CDATA[
+1. java.util.Iterator i = custList.searchAndRetrieveList();
2. while (i.hasNext()) {
3. oneCustomer = (Customer) e.next();
4. }]]></programlisting>
Index: contrib.xml
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/expresso/doc/edg/contrib.xml,v
retrieving revision 1.11
retrieving revision 1.12
diff -Lexpresso-web/expresso/doc/edg/contrib.xml -Lexpresso-web/expresso/doc/edg/contrib.xml -u -r1.11 -r1.12
--- expresso-web/expresso/doc/edg/contrib.xml
+++ expresso-web/expresso/doc/edg/contrib.xml
@@ -111,7 +111,8 @@
home directory at `/home/blairt/proj/expresso'. So we change to the EDG
directory.
</para>
- <programlisting><![CDATA[% cd /home/blairt/proj/expresso/expresso-web/expresso/doc/edg]]></programlisting>
+ <programlisting><![CDATA[
+% cd /home/blairt/proj/expresso/expresso-web/expresso/doc/edg]]></programlisting>
<para>
Use a XML Stylesheet Langauge Template (XSLT) engine to transform the DocBook
XML to a well formed HTML document `edg.html'. In this example we will
More information about the cvs
mailing list