Class TdbIntegrityRule
java.lang.Object
com.tietoenator.trip.jxp.database.TdbIntegrityRule
Container and logic related to referential integrity rules between two
databases, a master and a slave.
The slave database defines an integrity rule, creating a foreign key field that reflects values stored in the master database. When values are updated in the master database, referential integrity projections ensure that records holding those values in the slave database are updated accordingly (or ensure that values cannot be updated or deleted from the master database, depending on the type of rule).
The slave database defines an integrity rule, creating a foreign key field that reflects values stored in the master database. When values are updated in the master database, referential integrity projections ensure that records holding those values in the slave database are updated accordingly (or ensure that values cannot be updated or deleted from the master database, depending on the type of rule).
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor, creates a blank ruleCopy constructor -
Method Summary
Modifier and TypeMethodDescriptionboolean
Test a rule for equality with another.getKey()
Retrieve the name of the field that holds the foreign keyRetrieve the name of the target database for the linkRetrieve the name of the field in the target database that holds the key for which this rule is a foreign reference.Retrieve the action to be taken in the current database if a record in the target database is deleted.Retrieve the action to be taken in the current database if a record in the target database is updated.boolean
Check if this rule is outgoing (i.e.void
Establish the name of the field that holds the foreign keyvoid
setLinkDatabase
(String database) Establish the name of the target database for the linkvoid
setLinkField
(String field) Establish the name of the field in the target database that holds the key for which this rule is a foreign reference.void
setOnDelete
(TdbIntegrityType action) Establish the action to be taken in the current database if a record in the target database is deleted.void
setOnUpdate
(TdbIntegrityType action) Establish the action to be taken in the current database if a record in the target database is updated.void
setOutgoing
(boolean mode) Establish whether this rule is outgoing (i.e.
-
Constructor Details
-
TdbIntegrityRule
public TdbIntegrityRule()Constructor, creates a blank rule -
TdbIntegrityRule
Copy constructor- Parameters:
src
- Source from which to copy
-
-
Method Details
-
getKey
Retrieve the name of the field that holds the foreign key- Returns:
- Foreign key field
-
setKey
Establish the name of the field that holds the foreign key- Parameters:
key
- Foreign key field
-
getLinkDatabase
Retrieve the name of the target database for the link- Returns:
- Target database name
-
setLinkDatabase
Establish the name of the target database for the link- Parameters:
database
- Target database name
-
getLinkField
Retrieve the name of the field in the target database that holds the key for which this rule is a foreign reference.- Returns:
- Target field name
-
setLinkField
Establish the name of the field in the target database that holds the key for which this rule is a foreign reference.- Parameters:
field
- Target field name
-
getOnDelete
Retrieve the action to be taken in the current database if a record in the target database is deleted.- Returns:
- The "on delete" action
-
setOnDelete
Establish the action to be taken in the current database if a record in the target database is deleted.- Parameters:
action
- The "on delete" action
-
getOnUpdate
Retrieve the action to be taken in the current database if a record in the target database is updated.- Returns:
- The "on update" action
-
setOnUpdate
Establish the action to be taken in the current database if a record in the target database is updated.- Parameters:
action
- The "on update" action
-
isOutgoing
public boolean isOutgoing()Check if this rule is outgoing (i.e. the current database is the master) or incoming (i.e. the current database is the slave). Referential integrity mappings are projected from the master database (outgoing) onto the slave database (incoming).- Returns:
- true if this database is the master in the foreign key relationship
-
setOutgoing
public void setOutgoing(boolean mode) Establish whether this rule is outgoing (i.e. the current database is the master) or incoming (i.e. the current database is the slave). Referential integrity mappings are projected from the master database (outgoing) onto the slave database (incoming).- Parameters:
mode
- true if this database is the master in the foreign key relationship
-
equals
Test a rule for equality with another. The test is performed on the Outgoing and Key properties only.
-