Package com.wisecoders.dbs.schema
Class ForeignKey
java.lang.Object
com.wisecoders.dbs.diagram.model.AbstractUnit
com.wisecoders.dbs.schema.ForeignKey
- All Implemented Interfaces:
Relation<AbstractTable>
,TreeUnit
,Unit
,DbUnit
,Comparable<AbstractUnit>
- Direct Known Subclasses:
ForeignKeyCollector.InternalFk
Class representing a Foreign Key between two tables.
-
Field Summary
FieldsFields inherited from interface com.wisecoders.dbs.diagram.model.Relation
MANY_TO_MANY, SOURCE_MANDATORY, TARGET_MANDATORY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addColumns
(Column sourceAttribute, Column destAttribute) void
Remove all columnsstatic boolean
compareLists
(List<?> source, List<?> target) getColumnAt
(int index, boolean atSource) int
getDbId()
Returns the parent entity.int
int
int
com.wisecoders.dbs.sys.fx.glyph.Glyph
getTargetColumnFor
(Column sourceColumn) boolean
hasFlag
(int flag) boolean
boolean
boolean
static String
listAttributes
(List<? extends Attribute> sourceAttributes, String arrow, List<? extends Attribute> destAttributes) void
refresh()
void
resetFlag
(int flag) void
void
boolean
sameAs
(AbstractUnit unit, boolean considerRenaming) Special comparatorvoid
setDeduced
(boolean deduced) void
setDeleteAction
(ForeignKeyAction deleteAction) void
setFlag
(int flag) void
setLogical
(int logical) void
setLogicalMandatory
(boolean isLogical) void
setLogicalRangeFrom
(int rangeFrom) void
setLogicalRangeTo
(int rangeTo) void
setOptions
(String options) void
setRelationCardinality
(RelationCardinality relationCardinality) void
setRelationType
(RelationType relationType) void
setTargetEntity
(AbstractTable targetEntity) void
setTargetEntity
(AbstractTable targetEntity, boolean addToImportedRelations) The target entity is the table or view referred by this foreign key.void
setUpdateAction
(ForeignKeyAction updateAction) boolean
Compare the source and target column namesMethods inherited from class com.wisecoders.dbs.diagram.model.AbstractUnit
compareTo, fixNull, getByName, getByName, getChildAt, getChildrenCount, getComment, getCommentNotNull, getCommentTag, getCommentTags, getDefaultKey, getDisplayName, getKey, getName, getPlainName, getPropertyAddOnFolder, getString, getSyncFolders, getTickId, getTouchId, getUnitProperty, has, is, is, isMarkedForDeletion, isVirtual, markForDeletion, matches, ref, removeUnitProperty, rename, sameAs, setComment, setCommentTag, setCommentTags, setTouchId, setUnitProperty, setVirtual, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.wisecoders.dbs.diagram.model.Unit
getComment, getCommentTag, getCommentTags, getDisplayName, is, isMarkedForDeletion, markForDeletion, ref, setComment, setCommentTag, setCommentTags
-
Field Details
-
FOREIGN_KEY_ICON
- See Also:
-
-
Constructor Details
-
ForeignKey
Protected constructor- Parameters:
table
- owner table of the foreign key ( referrencing )name
- of the fk
-
-
Method Details
-
getSymbolicName
- Specified by:
getSymbolicName
in interfaceUnit
- Specified by:
getSymbolicName
in classAbstractUnit
-
getSymbolicIcon
- Specified by:
getSymbolicIcon
in classAbstractUnit
-
getSymbolicGlyph
public com.wisecoders.dbs.sys.fx.glyph.Glyph getSymbolicGlyph()- Specified by:
getSymbolicGlyph
in classAbstractUnit
-
getColumnAt
- Specified by:
getColumnAt
in interfaceRelation<AbstractTable>
-
clearAllAttributes
public void clearAllAttributes()Remove all columns -
getDeleteAction
-
getParent
- Specified by:
getParent
in interfaceTreeUnit
- Specified by:
getParent
in classAbstractUnit
-
setDeleteAction
-
getUpdateAction
-
setUpdateAction
-
setFlag
public void setFlag(int flag) - Specified by:
setFlag
in interfaceRelation<AbstractTable>
-
resetFlag
public void resetFlag(int flag) - Specified by:
resetFlag
in interfaceRelation<AbstractTable>
-
hasFlag
public boolean hasFlag(int flag) - Specified by:
hasFlag
in interfaceRelation<AbstractTable>
-
refresh
public void refresh()- Specified by:
refresh
in classAbstractUnit
-
setTargetEntity
-
setTargetEntity
The target entity is the table or view referred by this foreign key.- Parameters:
targetEntity
- it is referredaddToImportedRelations
- if true will added as imported relations of the source entity
-
getEntity
Returns the parent entity.- Specified by:
getEntity
in interfaceRelation<AbstractTable>
- Specified by:
getEntity
in interfaceUnit
- Returns:
- the entity on which is defined
-
getTargetEntity
- Specified by:
getTargetEntity
in interfaceRelation<AbstractTable>
- Returns:
- the destination entity.
-
addColumns
-
getTargetAttributes
- Specified by:
getTargetAttributes
in interfaceRelation<AbstractTable>
-
getSourceAttributes
- Specified by:
getSourceAttributes
in interfaceRelation<AbstractTable>
-
sameAs
Special comparator- Overrides:
sameAs
in classAbstractUnit
- Parameters:
unit
- other BasicUnit- Returns:
- true if they act on the same tables, same columns
-
usesSameColumns
Compare the source and target column names- Parameters:
fk
- to compare- Returns:
- true if they are the same
-
compareLists
-
getColumnCount
public int getColumnCount()- Specified by:
getColumnCount
in interfaceRelation<AbstractTable>
-
listAttributes
-
getLastSourceAttribute
- Specified by:
getLastSourceAttribute
in interfaceRelation<AbstractTable>
-
getLastTargetAttribute
- Specified by:
getLastTargetAttribute
in interfaceRelation<AbstractTable>
-
isAutoReference
public boolean isAutoReference()- Specified by:
isAutoReference
in interfaceRelation<AbstractTable>
-
getColumnsName
- Specified by:
getColumnsName
in interfaceRelation<AbstractTable>
-
getCascadeText
- Specified by:
getCascadeText
in interfaceRelation<AbstractTable>
-
getParentEntity
- Specified by:
getParentEntity
in interfaceUnit
- Overrides:
getParentEntity
in classAbstractUnit
-
getDbId
-
getSchema
-
setOptions
-
getOptions
-
getLogical
public int getLogical() -
setLogical
public void setLogical(int logical) -
setLogicalMandatory
public void setLogicalMandatory(boolean isLogical) -
isLogicalMandatory
public boolean isLogicalMandatory() -
setRelationType
-
getRelationType
- Specified by:
getRelationType
in interfaceRelation<AbstractTable>
-
setRelationCardinality
-
getRelationCardinality
- Specified by:
getRelationCardinality
in interfaceRelation<AbstractTable>
-
setLogicalRangeFrom
public void setLogicalRangeFrom(int rangeFrom) -
getLogicalRangeFrom
public int getLogicalRangeFrom() -
setLogicalRangeTo
public void setLogicalRangeTo(int rangeTo) -
getLogicalRangeTo
public int getLogicalRangeTo() -
getTargetColumnFor
-
resolveLogical
public void resolveLogical() -
resolveManyToMany
public void resolveManyToMany() -
setDeduced
public void setDeduced(boolean deduced) -
isDeduced
public boolean isDeduced()- Specified by:
isDeduced
in interfaceRelation<AbstractTable>
-