Class RelationshipInfo


  • public final class RelationshipInfo
    extends java.lang.Object
    Represents the relationship info for a table relationship. A relationship consists of two and only two tables, each having one of these roles in the relationship:
    • Origin table, sometimes referred to as the source table or original table.
    • Destination table.

    One table must have one of these roles and the other table must have the other role. A table can participate in more than one relationship and may be an origin table in one relationship and also a destination table in another relationship.

    The relationship's cardinality describes whether features in a table are related to only one feature in the other table, or whether a feature may be related to multiple features. The relationship can also be simple or composite isComposite(). In a simple relationship, the features in the participating tables can exist without the other. For example, a transformer and an electric pole may be related but one's existence does not depend on the other. Deleting the origin features will simply disassociate the destination features from the origin features. In a composite relationship, the destination features cannot exist without the origin features. When the origin feature is deleted, the related destination feature is deleted as well. This is called a cascade delete. This dependency also means that each destination feature must be linked to a counterpart origin feature.

    Since:
    100.1.0
    • Method Detail

      • getId

        public long getId()
        Gets the ID of this relationship, this is shared between the origin and destination tables.
        Returns:
        the ID
        Since:
        100.1.0
      • getName

        public java.lang.String getName()
        Gets the name of the relationship.
        Returns:
        the relationship name
        Since:
        100.1.0
      • getRelatedTableId

        public long getRelatedTableId()
        Gets the ID of the related table.
        Returns:
        the related table's ID
        Since:
        100.1.0
      • getRelationshipTableId

        public long getRelationshipTableId()
        Gets the ID of the relationship table. The default value is -1, indicating that no table exists.

        The relationship table is used in many-to-many and attributed relationships.

        Returns:
        the ID of the relationship table. The default value is -1, indicating that no table exists.
        Since:
        100.12.0
      • getKeyField

        public java.lang.String getKeyField()
        Gets the key field, the field that links the origin and destination tables of this relationship.
        Returns:
        the key field
        Since:
        100.1.0
      • getKeyFieldInRelationshipTable

        public java.lang.String getKeyFieldInRelationshipTable()
        Gets the key field in the relationship table.

        Used in many-to-many and attributed relationships. Values in this field will match values stored in the getKeyField() of features participating in the relationship.

        Returns:
        the key field in the relationship table
        Since:
        100.12.0
      • isComposite

        public boolean isComposite()
        Gets whether or not the relationship is composite.

        In a composite relationship, a feature in the destination table must always be associated with an origin feature. Orphan features in the destination tables are not permitted. Therefore, destination table features will be deleted when their associated origin table features are deleted. This is called a cascade delete.

        Returns:
        true if the relationship is composite, false otherwise
        Since:
        100.1.0