|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.zentense.step2.model.ResultSetModel
com.zentense.step2.model.ResultSetI18NModel
public class ResultSetI18NModel
This class implements an internationalized resultset model. I18N texts are
stored in a separated table while in the model, for each I18N text a
reference to the i18n table is stored. This model extends ResultSetModel
by managing this I18N columns and translating automatically the
references in model by texts in current language. Current language
is encoded using ISO codes.
The i18n table must have this form:
CREATE TABLE i18n ( i18n_id INT NOT NULL, i18n_lang CHAR(2) NOT NULL, i18n_text TEXT, primary key (i18n_id, i18n_lang) );
| Field Summary | |
|---|---|
protected java.lang.String[] |
I18NCols
I18N column names |
protected java.lang.String |
lang
Language used to retrieve I18N texts |
| Fields inherited from class com.zentense.step2.model.ResultSetModel |
|---|
idName, logLevel, prepared, preparedTableId, RSConcur, RSType, table |
| Constructor Summary | |
|---|---|
ResultSetI18NModel()
|
|
ResultSetI18NModel(java.lang.String tableName,
java.lang.String idName)
Constructor |
|
| Method Summary | |
|---|---|
void |
delete(java.lang.Object id)
Deletes a row, and also deletes any associated text from i18n pool. |
void |
deleteI18N(int id,
java.lang.String lang)
|
void |
deleteI18N(View v)
Deletes all i18n texts (all languages) of any I18N column on current row from given view. |
View |
doLegacyQuery(java.lang.String sql)
Executes a SQL query but returns a ResultSetView instead of an I18nView so that I18N columns are not translated. |
View |
doPrepared(java.lang.String name,
java.lang.Object[] obj)
Executes a prepared statement. |
View |
doQuery(java.lang.String sql)
Executes a SQL query using JDBC. |
java.lang.String[] |
getI18NCols()
Returns array of I18N columns |
java.lang.String |
getLang()
Gets current language |
int |
getLastI18NId()
Returns the last i18n_id from i18n table |
boolean |
insertI18N(int id,
java.lang.String txt,
java.lang.String lang)
Inserts a text into I18N table |
int |
insertI18N(java.lang.String txt,
java.lang.String lang)
Inserts a text into I18N table. |
boolean |
isEmptyEntriesAllowed()
|
boolean |
isI18NCol(java.lang.String col)
Returns true if column is internationalized |
boolean |
modifyI18N(int id,
java.lang.String txt,
java.lang.String lang)
If text with given id exists, text is updated on i18n table. |
void |
setEmptyEntriesAllowed(boolean emptyEntriesAllowed)
|
void |
setI18NCols(java.lang.String[] cols)
Sets I18N columns |
void |
setLang(java.lang.String lang)
Sets language manually. |
boolean |
textExists(int id,
java.lang.String lang)
Exists a text in current language? |
boolean |
updateI18N(int id,
java.lang.String txt,
java.lang.String lang)
Updates a internationalized text in i18n texts table |
| Methods inherited from class com.zentense.step2.model.ResultSetModel |
|---|
addPrepared, clearPrepared, deleteAll, deleteBy, doUpdate, exists, find, find, findById, genSQL, genSQL, genSQL, getAll, getAllOrderedBy, getConnection, getCount, getMaxId, getPK, getPrepared, getTableName, insertMode, insertMode, loopMode, prepare, prepareStatements, rowMode, update, updateMode |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String[] I18NCols
protected java.lang.String lang
| Constructor Detail |
|---|
public ResultSetI18NModel()
public ResultSetI18NModel(java.lang.String tableName,
java.lang.String idName)
| Method Detail |
|---|
public boolean isI18NCol(java.lang.String col)
public final java.lang.String[] getI18NCols()
public final void setI18NCols(java.lang.String[] cols)
public final java.lang.String getLang()
public final void setLang(java.lang.String lang)
New - languagepublic final View doQuery(java.lang.String sql)
ResultSetModel
doQuery in class ResultSetModelsql - SQL statement to execute
public final View doLegacyQuery(java.lang.String sql)
public final View doPrepared(java.lang.String name,
java.lang.Object[] obj)
ResultSetModel
doPrepared in class ResultSetModelname - Name of prepared statement previosly crated with addPreparedobj - Array of objects to be set in statement. Use ResultSetView.NULL
for setting a null value into the statement.
public final int getLastI18NId()
throws java.lang.Exception
vm - A RequestRuntime instance
java.lang.Exception
public final boolean textExists(int id,
java.lang.String lang)
throws java.lang.Exception
id - Identifier of internationalized text
java.lang.Exception - If something goes wrong
public final boolean insertI18N(int id,
java.lang.String txt,
java.lang.String lang)
id - Identifier for this texttxt - The textlang - Language described as ISO code
public final int insertI18N(java.lang.String txt,
java.lang.String lang)
throws java.lang.Exception
txt - The textlang - Language described as ISO code
java.lang.Exception
public final boolean updateI18N(int id,
java.lang.String txt,
java.lang.String lang)
id - Identifier for this texttxt - The new textlang - Language described as ISO code
public final boolean modifyI18N(int id,
java.lang.String txt,
java.lang.String lang)
throws java.lang.Exception
id - Identifier for this texttxt - The new textlang - Language described as ISO code
java.lang.Exceptionpublic void delete(java.lang.Object id)
delete in class ResultSetModelid - Identifier value of the row to be deleted
public final void deleteI18N(int id,
java.lang.String lang)
public final void deleteI18N(View v)
public void setEmptyEntriesAllowed(boolean emptyEntriesAllowed)
public boolean isEmptyEntriesAllowed()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||