org.apache.ws.jaxme.js.pattern
public class VersionGenerator extends Object
The VersionGenerator is able to clone a version of a row in a database. That is nothing special. A simple INSERT does the same.
The difference is that the VersionGenerator is able to clone rows in other tables referencing the cloned table as well, updating the references, and clone and update rows referencing these cloned and updated rows, and so on.
In other words: The VersionGenerator derives a new version of a complex object stored in the database.
The VersionGenerator operates on a list of tables. This list must not contain forward or self references. In other words: Under no circumstances may a table in the list contain a foreign key referencing another table, which follows later.
Nested Class Summary | |
---|---|
interface | VersionGenerator.ColumnUpdater The ColumnUpdater is able to update one or more columns in a table. |
static class | VersionGenerator.TableInfo This class is used internally to maintain the informations on the tables being cloned. |
Method Summary | |
---|---|
void | addTable(Table pTable, VersionGenerator.ColumnUpdater pUpdater) Adds a new table to the list of tables. |
protected void | getApplyCacheData(JavaMethod pMethod, VersionGenerator.TableInfo pTableInfo, ColumnSet pColumnSet, DirectAccessible pRow, DirectAccessible pData) Updates a row by reading the values from an instance of the inner class CacheData. |
protected JavaInnerClass | getCacheDataClass(JavaSource pSource) Generates the innner class CacheData. |
protected LocalJavaField | getCacheDataClassInstance(JavaMethod pMethod, VersionGenerator.TableInfo pTableInfo, ColumnSet pColumnSet, DirectAccessible pValues) Creates an instance of the inner class CacheData by reading the key from the given row. |
protected JavaQName | getCacheDataClassName(JavaQName pQName) Returns the name of the inner class CacheData. |
JavaMethod | getCloneMethod(JavaSource pSource) Creates a method for updating one row in the head table. |
protected JavaMethod | getInnerInsertRowMethod(JavaSource pSource, VersionGenerator.TableInfo pTableInfo) Creates a method for cloning one row from the given table. |
protected JavaMethod | getInsertRowMethod(JavaSource pSource, VersionGenerator.TableInfo pTableInfo) Creates a method for cloning one row from the given table. |
protected String | getInsertRowMethodName(VersionGenerator.TableInfo pTableInfo) Returns the name of the method for cloning one row from the given table. |
protected JavaMethod | getPublicCloneMethod(JavaSource pSource) Actually creates the public "clone" method. |
protected void | getSelectRowsCode(JavaMethod pMethod, VersionGenerator.TableInfo pTableInfo, ColumnSet pColumnSet, DirectAccessible pConn, DirectAccessible pMap, DirectAccessible pValues, boolean pReturnValue) Generates code for reading all rows matching the given key. |
protected void | initLogging(JavaSource pSource) Creates the code for initialization of the logging framework. |
boolean | isGeneratingLogging() Returns whether the generator is creating logging statements. |
protected void | logEntering(JavaMethod pMethod, Object pValues) Creates code for logging the entrance into a method with fine level. Note: The method should consider the isGeneratingLogging value. |
protected void | logExiting(JavaMethod pMethod, Object pValues) Creates code for logging the exit from a method with fine level. Note: The method should consider the isGeneratingLogging value. |
protected void | logFinest(JavaMethod pMethod, Object pMsg, Object pValues) Creates code for logging a message with finest level. Note: The method should consider the isGeneratingLogging value. |
protected void | logFinestEntering(JavaMethod pMethod, Object pValues) Creates code for logging the entrance into a method with finest level. Note: The method should consider the isGeneratingLogging value. Implementation note: The default implementation is
equivalent to |
protected void | logFinestExiting(JavaMethod pMethod, Object pValues) Creates code for logging the exit from a method with fine level. Note: The method should consider the isGeneratingLogging value. Implementation note: The default implementation is
equivalent to |
void | setGeneratingLogging(boolean pGeneratingLogging) Sets whether the generator is creating logging statements. |
protected void | setPreparedStatementValue(JavaMethod pMethod, Column pColumn, Object pStmt, Object pParamNum, Object pValue) Generates code for setting a PreparedStatement's parameter. |
protected void | setResultSetValue(JavaMethod pMethod, Column pColumn, DirectAccessible pResultSet, int pColumnNum, Object pTarget) Generates code for reading a ResultSet's column. |
Parameters: pTable The table being cloned pUpdater The column updater to use for changing the updated columns.
Updates a row by reading the values from an instance of the inner class CacheData.
Generates the innner class CacheData.
Creates an instance of the inner class CacheData by reading the key from the given row.
Returns the name of the inner class CacheData.
Creates a method for updating one row in the head table.
Creates a method for cloning one row from the given table.
Creates a method for cloning one row from the given table.
Returns the name of the method for cloning one row from the given table.
Actually creates the public "clone" method.
Generates code for reading all rows matching the given key.
Creates the code for initialization of the logging framework. The default implementation generates code creating an instance of Logger.
Returns whether the generator is creating logging statements. By default no logging statements are created.
The default implementation creates logging statements suitable for the JaxMe logging package. To change this, create a subclass and overwrite the following methods: VersionGenerator, VersionGenerator, VersionGenerator, VersionGenerator, and VersionGenerator.
See Also: VersionGenerator
Creates code for logging the entrance into a method with fine level.
Note: The method should consider the isGeneratingLogging value.
Parameters: pMethod The method in which a logging statement should be inserted pValues An array of additional values, possibly null
Creates code for logging the exit from a method with fine level.
Note: The method should consider the isGeneratingLogging value.
Parameters: pMethod The method in which a logging statement should be inserted pValues An array of additional values, possibly null
Creates code for logging a message with finest level.
Note: The method should consider the isGeneratingLogging value.
Parameters: pMethod The method in which a logging statement should be inserted pMsg The message being logged pValues An array of additional values, possibly null
Creates code for logging the entrance into a method with finest level.
Note: The method should consider the isGeneratingLogging value.
Implementation note: The default implementation is
equivalent to logFinest(pMethod, "->", pValues)
.
Parameters: pMethod The method in which a logging statement should be inserted pValues An array of additional values, possibly null
Creates code for logging the exit from a method with fine level.
Note: The method should consider the isGeneratingLogging value.
Implementation note: The default implementation is
equivalent to logFinest(pMethod, "<-", pValues)
.
Parameters: pMethod The method in which a logging statement should be inserted pValues An array of additional values, possibly null
Sets whether the generator is creating logging statements. By default no logging statements are created.
The default implementation creates logging statements suitable for the JaxMe logging package. To change this, create a subclass and overwrite the following methods: VersionGenerator, VersionGenerator, VersionGenerator, VersionGenerator, and VersionGenerator.
See Also: isGeneratingLogging
Generates code for setting a PreparedStatement's parameter.
Generates code for reading a ResultSet's column.