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 voiddelete()Deletes the foreign key.booleanequals(Object obj)Map<String,Column<?>>getColumns()Unmodified list of columns for the foreign key.StringgetConstraintName()Returns the name of FK constraint (or generates it if it's not provided).FKRulegetDeleteRule()Returns rule for deletion.BasicTablegetParentTable()Table that the foreign key is part of.BasicTablegetReferencedTable()Table that is being referenced by the foreign key.FKRulegetUpdateRule()Returns rule for update.inthashCode()voidsetConstraintName(String constraintName)Sets name for FK constraint.voidsetDeleteRule(FKRule deleteBehaviour)Sets rule for deletion.voidsetUpdateRule(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 ParseExceptionDeletes the foreign key.- Throws:
ParseException- When trying to modify the system grain.
-
-