Class ForeignKeyConstraint
- java.lang.Object
-
- org.linuxforhealth.fhir.database.utils.model.Constraint
-
- org.linuxforhealth.fhir.database.utils.model.ForeignKeyConstraint
-
public class ForeignKeyConstraint extends Constraint
Represents a FOREIGN KEY constraint referencing the primary key of a parent table
-
-
Constructor Summary
Constructors Constructor Description ForeignKeyConstraint(java.lang.String constraintName, boolean enforced, boolean self, java.lang.String targetSchema, java.lang.String targetTable, java.lang.String targetColumnName, java.lang.String... column)
ForeignKeyConstraint(java.lang.String constraintName, boolean enforced, java.lang.String targetSchema, java.lang.String targetTable, java.lang.String targetColumnName, java.lang.String... column)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
apply(java.lang.String schemaName, java.lang.String name, ISchemaAdapter target, DistributionType sourceDistributionType)
Apply the FK constraint to the given targetjava.util.List<java.lang.String>
getColumns()
Getter for the target schema namejava.lang.String
getQualifiedTargetName()
java.lang.String
getTargetColumnName()
returns the target column namejava.lang.String
getTargetSchema()
Getter for the target schema namejava.lang.String
getTargetTable()
Getter for the target table nameboolean
includesColumn(java.lang.String columnName)
Return true if the list of columns includes the column name, ignoring caseboolean
isEnforced()
Getter for the enforced boolean flagboolean
isSelf()
boolean
isTargetReference()
Is the target table distributed as a REFERENCE table (Citus)void
setTargetReference(boolean flag)
Set the flag to indicate if the target table is a reference type-
Methods inherited from class org.linuxforhealth.fhir.database.utils.model.Constraint
getConstraintName
-
-
-
-
Constructor Detail
-
ForeignKeyConstraint
public ForeignKeyConstraint(java.lang.String constraintName, boolean enforced, boolean self, java.lang.String targetSchema, java.lang.String targetTable, java.lang.String targetColumnName, java.lang.String... column)
- Parameters:
constraintName
-enforced
-self
-targetSchema
-targetTable
-targetColumName
-column
-
-
ForeignKeyConstraint
public ForeignKeyConstraint(java.lang.String constraintName, boolean enforced, java.lang.String targetSchema, java.lang.String targetTable, java.lang.String targetColumnName, java.lang.String... column)
-
-
Method Detail
-
getTargetColumnName
public java.lang.String getTargetColumnName()
returns the target column name- Returns:
-
isSelf
public boolean isSelf()
-
isTargetReference
public boolean isTargetReference()
Is the target table distributed as a REFERENCE table (Citus)- Returns:
-
setTargetReference
public void setTargetReference(boolean flag)
Set the flag to indicate if the target table is a reference type- Parameters:
flag
-
-
getTargetTable
public java.lang.String getTargetTable()
Getter for the target table name- Returns:
-
isEnforced
public boolean isEnforced()
Getter for the enforced boolean flag- Returns:
-
getTargetSchema
public java.lang.String getTargetSchema()
Getter for the target schema name- Returns:
-
getColumns
public java.util.List<java.lang.String> getColumns()
Getter for the target schema name- Returns:
-
getQualifiedTargetName
public java.lang.String getQualifiedTargetName()
-
apply
public void apply(java.lang.String schemaName, java.lang.String name, ISchemaAdapter target, DistributionType sourceDistributionType)
Apply the FK constraint to the given target- Parameters:
schemaName
-name
-target
-sourceDistributionType
-
-
includesColumn
public boolean includesColumn(java.lang.String columnName)
Return true if the list of columns includes the column name, ignoring case- Parameters:
distributionColumnName
-- Returns:
-
-