|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.actuate.ExternalText.TextEntryList
This is the main interface to retrieving externalized text fields from a database through JDBC. The general calling sequence is:
TextEntryList() constructor
connectDB() to specify the JDBC connection parameters
setAttribute() to specify anything that will be substituted into the SQL string placeholders later on (locale, reportname, etc)
addList() to specify all of the text keys to lookup in one shot
addStringKey() alternatively to specify a single lookup key that is character based
addIntKey alternatively to specify a single lookup key that is a number
translate() to specify the generic SQL query and cause a lookup of whatever keys have been added so far
next() to iterate through the retruned resultset rows
getString() and getInt() to get the specific returned fields on the current row
disconnectDB to close the DBconnection
Constructor Summary | |
TextEntryList()
Creates a new instance of TextEntryList. |
Method Summary | |
void |
addIntKey(int intKeyName)
Adds a single integer (label) key. |
void |
addList(java.lang.String MultipleKeyNames)
Adds an entire list of keys. |
void |
addStringKey(java.lang.String textKeyName)
Adds a single text (label) key. |
void |
connectDB()
Establishes a JDBC connection to the database. |
void |
disconnectDB()
Closes the current DB resultset, statement, and disconnects from the database. |
int |
getInt(java.lang.String colName)
Gets a specific integer value back from the current resultset row. |
java.lang.String |
getString(java.lang.String colName)
Gets a specific string value back from the current resultset row. |
boolean |
next()
Allows iterating through the resultset rows of translated labels. |
void |
setAttribute(java.lang.String attributeName,
java.lang.String attributeValue)
Sets an attribute for later substitution into the SQL string. |
void |
translate()
Provides the generic SQL string with attribute placeholders, and executes the translation SQL query. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TextEntryList() throws java.io.FileNotFoundException, java.io.IOException
This also causes the reading in of important properties from a properties file; ActuateI18NText.properties
The properties that need to be in this file are:
actuate.externText.JDBCDriverName
actuate.externText.JDBCConnectionURL
actuate.externText.username
actuate.externText.password
actuate.externText.SQLString - This is the generic version of the SQL that is used to lookup the external text. When specifying this input SQL string, there should be placeholder for each attribute that you set using setAttribute, and a special placeholder of ":_TextList:" to be the placeholder for the list of textkeys that was formed by calls to addStringKey, addIntKey, or addList.
Method Detail |
public void connectDB() throws java.sql.SQLException, java.lang.ClassNotFoundException
java.sql.SQLException
java.lang.ClassNotFoundException
public void disconnectDB() throws java.sql.SQLException
java.sql.SQLException
public void addStringKey(java.lang.String textKeyName)
A label key should be a unique identifier for the text of a label to be translated. Sometimes this database table key field will be stored in a character (like varchar) format, and sometimes it will be an integer. use this particular method if it stored in character format. Further processing will automatically put quotes around each string key that is submitted, and comma delimit them in order to form the final SQL.
Example: addStringKey( "Work Order") will ultimately look up the one label called "Work Order" in the translation table for the appropriate locale.
textKeyName
- A string field to be used as a key in the SQL lookup for translation.
public void addIntKey(int intKeyName)
A label key should be a unique identifier for the text of a label to be translated. Sometimes this database table key field will be stored in a character (like varchar) format, and sometimes it will be an integer. use this particular method if it stored in integer format. Further processing will automatically put these together in order to form the final SQL.
Example: addIntKey( 1231 ) will ultimately look up the one label called with key 1231 in the translation table for the appropriate locale.
intKeyName
- An integer field to be used as a key in the SQL lookup for translation.
public void addList(java.lang.String MultipleKeyNames)
A label key should be a unique identifier for the text of a label to be translated.
Example: addList( "1231,1232,1233,1234") will ultimately look up these four integer-keyed labels. in the translation table for the appropriate locale.
Example: addList( "\'Work Order\',\'Due Date\',\'Authorized By\'") will ultimately look up these three test-keyed labels. The single quote is mandatory for SQL and the backslash escape syntax shown is Java-specific. Actuate Basic can drop the backslashes.
MultipleKeyNames
- A String list of keys to be used as is in the SQL lookup for translation.
public void setAttribute(java.lang.String attributeName, java.lang.String attributeValue)
This method is generally called repetitively to specify attributes such as Locale or Language, ReportName, etc. When specifying the SQL string as a parameter to the translate method, the attribute names should appear within colons. For example: ":Locale:".
attributeName
- The name for this attribute, eg. "Locale"attributeValue
- The value for this attribute, eg. "de_DE"
public void translate() throws java.sql.SQLException
This method is called once to execute the translation SQL.
java.sql.SQLException
public boolean next() throws java.sql.SQLException
This method is called in a loop to increment the internal cursor that is kept on the resulting rows of translated labels and returns true while there are still rows to process. For each of these method executions, you should use getString() and getInt() methods to get the specific fields from the query.
java.sql.SQLException
public java.lang.String getString(java.lang.String colName) throws java.sql.SQLException
This method is generally called repetitively (and with getInt) to get the individual fields back from the resultset row. An example call might be: getString("TranslatedLabel"); or getString("FontFaceName");
colName
- The name of the column to get from this resultset row.
This must correspond exactly (case insensitive) with a column that is
being returned by the SQL statement.
java.sql.SQLException
public int getInt(java.lang.String colName) throws java.sql.SQLException
This method is generally called repetitively (and with getString) to get the individual fields back from the resultset row. An example call might be: getInt("FieldWidth"); or getInt("FontSize");
colName
- The name of the column to get from this resultset row.
This must correspond exactly (case insensitive) with a column that is
being returned by the SQL statement.
java.sql.SQLException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |