|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object velosurf.sql.ReverseEngineer
public class ReverseEngineer
Class used to reverse engine a database.
Field Summary | |
---|---|
private Database |
db
Database. |
static int |
DEFAULT_REVERSE_MODE
Default reverse engineering mode. |
private DriverInfo |
driverInfo
Driver infos. |
private java.util.Map<java.lang.String,java.lang.String> |
entityByTableName
map table->entity, valid only between readConfigFile and readMetaData. |
static int |
REVERSE_FULL
Full reverse engineering mode. |
static int |
REVERSE_NONE
No reverse engineering mode. |
static int |
REVERSE_PARTIAL
Partial reverse engineering mode. |
static int |
REVERSE_TABLES
Tables reverse engineering mode. |
private int |
reverseMode
Reverse mode. |
static java.lang.String[] |
reverseModeName
Reverse engineering mode names. |
Constructor Summary | |
---|---|
ReverseEngineer(Database database)
constructor. |
Method Summary | |
---|---|
private java.lang.String |
adaptCase(java.lang.String name)
adapt case |
private void |
addExportedKey(Entity entity,
java.lang.String fkSchema,
java.lang.String fkTable,
java.util.List<java.lang.String> fkCols,
java.util.List<java.lang.String> pkCols)
Add a new exported key. |
private void |
addImportedKey(Entity entity,
java.lang.String pkSchema,
java.lang.String pkTable,
java.util.List<java.lang.String> pkCols,
java.util.List<java.lang.String> fkCols)
Add a new imported key. |
protected void |
addTableMatching(java.lang.String tableName,
Entity entity)
add a table <-> entity matching. |
private java.lang.String |
getEntityByTable(java.lang.String schema,
java.lang.String table)
Get an entity by its table name. |
private java.lang.String |
getExportedKeyName(java.lang.String name)
rough plural calculation. |
private void |
readForeignKeys(java.sql.DatabaseMetaData meta,
Entity entity,
java.lang.String tableName)
Read foreign keys. |
protected void |
readMetaData()
read the meta data from the database. |
private void |
readTableMetaData(java.sql.DatabaseMetaData meta,
Entity entity,
java.lang.String tableName)
Read table meta data. |
protected void |
setDriverInfo(DriverInfo di)
Driver infos setter. |
protected void |
setReverseMode(int reverseMethod)
Set reverse mode. |
private java.util.List<java.lang.String> |
sortColumns(java.util.List<java.lang.String> ordered,
java.util.List<java.lang.String> unordered,
java.util.List<java.lang.String> target)
Sort columns in target the same way unordered would have to
be sorted to be like ordered . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.Map<java.lang.String,java.lang.String> entityByTableName
private Database db
private DriverInfo driverInfo
private int reverseMode
public static final int REVERSE_NONE
public static final int REVERSE_PARTIAL
public static final int REVERSE_TABLES
public static final int REVERSE_FULL
public static final int DEFAULT_REVERSE_MODE
public static java.lang.String[] reverseModeName
Constructor Detail |
---|
public ReverseEngineer(Database database)
database
- databaseMethod Detail |
---|
protected void setDriverInfo(DriverInfo di)
di
- driver infosprotected void setReverseMode(int reverseMethod)
reverseMethod
- reverse modeprotected void addTableMatching(java.lang.String tableName, Entity entity)
tableName
- entity
- protected void readMetaData() throws java.sql.SQLException
java.sql.SQLException
- thrown by the database engineprivate void readTableMetaData(java.sql.DatabaseMetaData meta, Entity entity, java.lang.String tableName) throws java.sql.SQLException
meta
- database meta dataentity
- corresponding entitytableName
- table name
java.sql.SQLException
private void readForeignKeys(java.sql.DatabaseMetaData meta, Entity entity, java.lang.String tableName) throws java.sql.SQLException
meta
- database meta dataentity
- entitytableName
- table name
java.sql.SQLException
private void addExportedKey(Entity entity, java.lang.String fkSchema, java.lang.String fkTable, java.util.List<java.lang.String> fkCols, java.util.List<java.lang.String> pkCols)
entity
- target entityfkSchema
- foreign key schemafkTable
- foreign key tablefkCols
- foreign key columnspkCols
- primary key columnsprivate void addImportedKey(Entity entity, java.lang.String pkSchema, java.lang.String pkTable, java.util.List<java.lang.String> pkCols, java.util.List<java.lang.String> fkCols)
entity
- target entitypkSchema
- primary key schemapkTable
- primary key tablepkCols
- primary key columnsfkCols
- foreign key columnsprivate java.lang.String getEntityByTable(java.lang.String schema, java.lang.String table)
schema
- schema nametable
- table name
private java.util.List<java.lang.String> sortColumns(java.util.List<java.lang.String> ordered, java.util.List<java.lang.String> unordered, java.util.List<java.lang.String> target)
target
the same way unordered
would have to
be sorted to be like ordered
.
ordered
- ordered list referenceunordered
- unordered list referencetarget
- target list
private java.lang.String adaptCase(java.lang.String name)
name
- name to adapt
private java.lang.String getExportedKeyName(java.lang.String name)
name
- singular
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |