Class TdbIntegrityRule


  • public class TdbIntegrityRule
    extends java.lang.Object
    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).
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)
      Test a rule for equality with another.
      java.lang.String getKey()
      Retrieve the name of the field that holds the foreign key
      java.lang.String getLinkDatabase()
      Retrieve the name of the target database for the link
      java.lang.String getLinkField()
      Retrieve the name of the field in the target database that holds the key for which this rule is a foreign reference.
      TdbIntegrityType getOnDelete()
      Retrieve the action to be taken in the current database if a record in the target database is deleted.
      TdbIntegrityType getOnUpdate()
      Retrieve the action to be taken in the current database if a record in the target database is updated.
      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).
      void setKey​(java.lang.String key)
      Establish the name of the field that holds the foreign key
      void setLinkDatabase​(java.lang.String database)
      Establish the name of the target database for the link
      void setLinkField​(java.lang.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. the current database is the master) or incoming (i.e. the current database is the slave).
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TdbIntegrityRule

        public TdbIntegrityRule()
        Constructor, creates a blank rule
      • TdbIntegrityRule

        public TdbIntegrityRule​(TdbIntegrityRule src)
        Copy constructor
        Parameters:
        src - Source from which to copy
    • Method Detail

      • getKey

        public java.lang.String getKey()
        Retrieve the name of the field that holds the foreign key
        Returns:
        Foreign key field
      • setKey

        public void setKey​(java.lang.String key)
        Establish the name of the field that holds the foreign key
        Parameters:
        key - Foreign key field
      • getLinkDatabase

        public java.lang.String getLinkDatabase()
        Retrieve the name of the target database for the link
        Returns:
        Target database name
      • setLinkDatabase

        public void setLinkDatabase​(java.lang.String database)
        Establish the name of the target database for the link
        Parameters:
        database - Target database name
      • getLinkField

        public java.lang.String 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

        public void setLinkField​(java.lang.String field)
        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

        public TdbIntegrityType 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

        public void setOnDelete​(TdbIntegrityType action)
        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

        public TdbIntegrityType 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

        public void setOnUpdate​(TdbIntegrityType action)
        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

        public boolean equals​(java.lang.Object obj)
        Test a rule for equality with another. The test is performed on the Outgoing and Key properties only.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - Object to test for equality
        Returns:
        true iff the Outgoing and Key properties are equal