Class ForeignKey
- java.lang.Object
-
- org.alfresco.util.schemacomp.model.AbstractDbObject
-
- org.alfresco.util.schemacomp.model.ForeignKey
-
- All Implemented Interfaces:
DbObject
public class ForeignKey extends AbstractDbObject
Represents a foreign key on a database table (localColumn) that referencestargetTable.targetColumn- Author:
- Matt Ward
-
-
Field Summary
-
Fields inherited from class org.alfresco.util.schemacomp.model.AbstractDbObject
comparisonUtils
-
-
Constructor Summary
Constructors Constructor Description ForeignKey(java.lang.String name)ForeignKey(Table table, java.lang.String fkName, java.lang.String localColumn, java.lang.String targetTable, java.lang.String targetColumn)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(DbObjectVisitor visitor)Allows a visitor to be invoked against this DbObject.protected voiddoDiff(DbObject right, DiffContext ctx)Override this method to provide subclass specific diffing logic.booleanequals(java.lang.Object obj)java.lang.StringgetLocalColumn()java.lang.StringgetTargetColumn()java.lang.StringgetTargetTable()java.lang.StringgetTypeName()Type name, e.g.inthashCode()booleansameAs(DbObject other)Are the twoDbObjects logically the same? For example two Index objects may have different names, but are the same index as they both index the same columns for the same table.voidsetLocalColumn(java.lang.String localColumn)voidsetTargetColumn(java.lang.String targetColumn)voidsetTargetTable(java.lang.String targetTable)-
Methods inherited from class org.alfresco.util.schemacomp.model.AbstractDbObject
diff, getName, getParent, getValidators, hasObjectLevelValidator, hasValidators, setComparisonUtils, setName, setParent, setValidators, toString
-
-
-
-
Constructor Detail
-
ForeignKey
public ForeignKey(java.lang.String name)
-
ForeignKey
public ForeignKey(Table table, java.lang.String fkName, java.lang.String localColumn, java.lang.String targetTable, java.lang.String targetColumn)
Constructor.- Parameters:
table- the parent tablefkName- StringlocalColumn- StringtargetTable- StringtargetColumn- String
-
-
Method Detail
-
getLocalColumn
public java.lang.String getLocalColumn()
- Returns:
- the localColumn
-
setLocalColumn
public void setLocalColumn(java.lang.String localColumn)
- Parameters:
localColumn- the localColumn to set
-
getTargetTable
public java.lang.String getTargetTable()
- Returns:
- the targetTable
-
setTargetTable
public void setTargetTable(java.lang.String targetTable)
- Parameters:
targetTable- the targetTable to set
-
getTargetColumn
public java.lang.String getTargetColumn()
- Returns:
- the targetColumn
-
setTargetColumn
public void setTargetColumn(java.lang.String targetColumn)
- Parameters:
targetColumn- the targetColumn to set
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractDbObject
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classAbstractDbObject
-
doDiff
protected void doDiff(DbObject right, DiffContext ctx)
Description copied from class:AbstractDbObjectOverride this method to provide subclass specific diffing logic.- Overrides:
doDiffin classAbstractDbObject- Parameters:
right- DbObjectctx- DiffContext
-
accept
public void accept(DbObjectVisitor visitor)
Description copied from interface:DbObjectAllows a visitor to be invoked against this DbObject. Implementations should ensure that child objects are visited first (by calling accept on them) before invoking the visitor on itself.- Parameters:
visitor- DbObjectVisitor
-
getTypeName
public java.lang.String getTypeName()
Description copied from interface:DbObjectType name, e.g. "column", "foreign key"- Specified by:
getTypeNamein interfaceDbObject- Overrides:
getTypeNamein classAbstractDbObject- Returns:
- String
-
sameAs
public boolean sameAs(DbObject other)
Description copied from interface:DbObjectAre the twoDbObjects logically the same? For example two Index objects may have different names, but are the same index as they both index the same columns for the same table.If two objects a and b have the same logical identity, it does not mean that
a.equals(b) == true. The two objects may well have differences and will be flagged as such by the schema comparison tool. Whena.sameAs(b) == trueit makes it easier to show the differences as related, i.e. a and b are different rather than, a is only in the 'left' tree and b is only in the 'right' tree.- Specified by:
sameAsin interfaceDbObject- Overrides:
sameAsin classAbstractDbObject- Parameters:
other- DbObject- Returns:
- boolean
-
-