Package ru.curs.celesta.score
Class ForeignKey
- java.lang.Object
-
- ru.curs.celesta.score.ForeignKey
-
public final class ForeignKey extends Object
Foreign key class.
-
-
Constructor Summary
Constructors Constructor Description ForeignKey(BasicTable parentTable, BasicTable referencedTable, String[] columnNames)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete()
Deletes the foreign key.boolean
equals(Object obj)
Map<String,Column<?>>
getColumns()
Unmodified list of columns for the foreign key.String
getConstraintName()
Returns the name of FK constraint (or generates it if it's not provided).FKRule
getDeleteRule()
Returns rule for deletion.BasicTable
getParentTable()
Table that the foreign key is part of.BasicTable
getReferencedTable()
Table that is being referenced by the foreign key.FKRule
getUpdateRule()
Returns rule for update.int
hashCode()
void
setConstraintName(String constraintName)
Sets name for FK constraint.void
setDeleteRule(FKRule deleteBehaviour)
Sets rule for deletion.void
setUpdateRule(FKRule updateBehaviour)
Sets rule for update.
-
-
-
Constructor Detail
-
ForeignKey
public ForeignKey(BasicTable parentTable, BasicTable referencedTable, String[] columnNames) throws ParseException
- Throws:
ParseException
-
-
Method Detail
-
setDeleteRule
public void setDeleteRule(FKRule deleteBehaviour) throws ParseException
Sets rule for deletion.- Parameters:
deleteBehaviour
- rule for deletion.- Throws:
ParseException
- When trying to modify the system grain.
-
setUpdateRule
public void setUpdateRule(FKRule updateBehaviour) throws ParseException
Sets rule for update.- Parameters:
updateBehaviour
- rule for update.- Throws:
ParseException
- When trying to modify the system grain.
-
getColumns
public Map<String,Column<?>> getColumns()
Unmodified list of columns for the foreign key.- Returns:
-
getParentTable
public BasicTable getParentTable()
Table that the foreign key is part of.- Returns:
-
getReferencedTable
public BasicTable getReferencedTable()
Table that is being referenced by the foreign key.- Returns:
-
getDeleteRule
public FKRule getDeleteRule()
Returns rule for deletion.- Returns:
-
getUpdateRule
public FKRule getUpdateRule()
Returns rule for update.- Returns:
-
getConstraintName
public String getConstraintName()
Returns the name of FK constraint (or generates it if it's not provided).- Returns:
-
setConstraintName
public void setConstraintName(String constraintName) throws ParseException
Sets name for FK constraint.- Parameters:
constraintName
- new name of constraint- Throws:
ParseException
- incorrect name of constraint
-
delete
public void delete() throws ParseException
Deletes the foreign key.- Throws:
ParseException
- When trying to modify the system grain.
-
-