|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javatools.db.DbConstraint | +--javatools.db.DbDynamicConstraint
It is a class representing a "dynamic" constraint, i.e. a constraint that changes references dynamically.
Field Summary |
Constructor Summary | |
DbDynamicConstraint(DbAbstractTable tbl)
Creates new DbDynamicConstraint |
Method Summary | |
void |
addFatherTable(DbAbstractTable fatherTable,
DbColumn[] fatherColumns,
DbColumn[] pRefColumns,
int updateOperation,
int deleteOperation)
Adds a new father table. |
void |
addSonTable(DbAbstractTable sonTable,
int fatherIndex)
Adds a son table. |
void |
build()
Builds all static lists. |
void |
check(int operation)
Performs checking in the table, after setting all dynamic and "static" data. |
protected void |
checkFathers()
Checks the fathers. |
protected void |
checkThis(int operation)
Performs base checking. |
java.lang.Object[] |
getDefaultValues(int index)
Returns the default values of referenced father table whose index is specified. |
int |
getDeleteOperation(int index)
Returns the delete operation that should be done for the father table whose index is specified. |
DbColumn[] |
getFatherColumns(int index)
The referenced columns of father table whose index is specified. |
DbAbstractTable |
getFatherTable(int index)
Returns a father table whose index is specified. |
int |
getFatherTablesCount()
Returns the number of referenced father tables. |
DbColumn[] |
getRefColumns(int index)
Returns the referencing columns of THIS table to the father table whose index is specified. |
int |
getSonFatherIndex(int index)
Returns the index that a son table uses to reference this table. |
DbAbstractTable |
getSonTable(int index)
Returns a son table whose index is specified. |
int |
getSonTablesCount()
Returns the number of son tables. |
int |
getUpdateOperation(int index)
Returns the update operation that should be done for the father table whose index is specified. |
void |
setAutomaticBuild(boolean value)
Tells this object to build (or not) automatically all lists at all times. |
int |
update(int operation)
Performs actual update in the table and, eventually, cascades. |
Methods inherited from class javatools.db.DbConstraint |
checkChildren, clear, clone, getAutomaticChecking, getConstraintEmulation, getTable, initLists, initStaticLists, setAutomaticChecking, setConstraintEmulation, setSelector, setValueLists, setWhere, updateThis |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DbDynamicConstraint(DbAbstractTable tbl)
tbl
- The table to be referenced.Method Detail |
public void check(int operation) throws DbException
check
in class DbConstraint
operation
- The kind of operation (INSERT, UPDATE etc.) that should be done.
DbException
- If something goes wrong.public int update(int operation) throws DbException
update
in class DbConstraint
operation
- The kind of operation (INSERT, UPDATE etc.) that should be done.
DbException
- If something goes wrong.public void addFatherTable(DbAbstractTable fatherTable, DbColumn[] fatherColumns, DbColumn[] pRefColumns, int updateOperation, int deleteOperation)
fatherTable
- The father table to be referenced.fatherColumns
- The father columns to use as father keys.pRefColumns
- The columns to be used as son keys.updateOperation
- What kind of operation should I do in case of an update?deleteOperation
- What kind of operation should I do in case of a deletion?public void addSonTable(DbAbstractTable sonTable, int fatherIndex)
sonTable
- The table to be added as a son table.fatherIndex
- The index that the new son table uses to reference THIS table.public int getFatherTablesCount()
getFatherTablesCount
in class DbConstraint
public int getSonTablesCount()
getSonTablesCount
in class DbConstraint
public DbAbstractTable getFatherTable(int index) throws DbException
getFatherTable
in class DbConstraint
index
- The index of the requested father table.
DbException
- If something goes wrong.public DbAbstractTable getSonTable(int index) throws DbException
getSonTable
in class DbConstraint
index
- The index of the requested son table.
DbException
- If something goes wrong.public int getSonFatherIndex(int index) throws DbException
getSonFatherIndex
in class DbConstraint
index
- The index of the requested son table.
DbException
- If something goes wrong.public int getUpdateOperation(int index) throws DbException
getUpdateOperation
in class DbConstraint
index
- The index of the requested father table.
DbException
- If something goes wrong.public int getDeleteOperation(int index) throws DbException
getDeleteOperation
in class DbConstraint
index
- The index of the requested father table.
DbException
- If something goes wrong.public DbColumn[] getFatherColumns(int index) throws DbException
getFatherColumns
in class DbConstraint
index
- The index of requested father table.
DbException
- If something goes wrong.public DbColumn[] getRefColumns(int index) throws DbException
getRefColumns
in class DbConstraint
index
- The index of requested father table.
DbException
- If something goes wrong.public void setAutomaticBuild(boolean value)
value
- true
: automatic build will be done;
false
: it won't be done.public void build() throws DbException
build
in class DbConstraint
DbException
- If something goes wrong.protected void checkThis(int operation) throws DbException
checkThis
in class DbConstraint
operation
- The operation that should be done.
DbException
- If something goes wrong.protected void checkFathers() throws DbException
checkFathers
in class DbConstraint
DbException
- If something goes wrong.public java.lang.Object[] getDefaultValues(int index) throws DbException
getDefaultValues
in class DbConstraint
index
- The index of requested father table.
DbException
- If something goes wrong.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |