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 TypeMethodDescriptionvoidaddColumns(Column sourceAttribute, Column destAttribute) voidRemove all columnsstatic booleancompareLists(List<?> source, List<?> target) getColumnAt(int index, boolean atSource) intgetDbId()Returns the parent entity.intintintcom.wisecoders.dbs.sys.fx.glyph.GlyphgetTargetColumnFor(Column sourceColumn) booleanhasFlag(int flag) booleanbooleanbooleanstatic StringlistAttributes(List<? extends Attribute> sourceAttributes, String arrow, List<? extends Attribute> destAttributes) voidrefresh()voidresetFlag(int flag) voidvoidbooleansameAs(AbstractUnit unit, boolean considerRenaming) Special comparatorvoidsetDeduced(boolean deduced) voidsetDeleteAction(ForeignKeyAction deleteAction) voidsetFlag(int flag) voidsetLogical(int logical) voidsetLogicalMandatory(boolean isLogical) voidsetLogicalRangeFrom(int rangeFrom) voidsetLogicalRangeTo(int rangeTo) voidsetOptions(String options) voidsetRelationCardinality(RelationCardinality relationCardinality) voidsetRelationType(RelationType relationType) voidsetTargetEntity(AbstractTable targetEntity) voidsetTargetEntity(AbstractTable targetEntity, boolean addToImportedRelations) The target entity is the table or view referred by this foreign key.voidsetUpdateAction(ForeignKeyAction updateAction) booleanCompare 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:
getSymbolicNamein interfaceUnit- Specified by:
getSymbolicNamein classAbstractUnit
-
getSymbolicIcon
- Specified by:
getSymbolicIconin classAbstractUnit
-
getSymbolicGlyph
public com.wisecoders.dbs.sys.fx.glyph.Glyph getSymbolicGlyph()- Specified by:
getSymbolicGlyphin classAbstractUnit
-
getColumnAt
- Specified by:
getColumnAtin interfaceRelation<AbstractTable>
-
clearAllAttributes
public void clearAllAttributes()Remove all columns -
getDeleteAction
-
getParent
- Specified by:
getParentin interfaceTreeUnit- Specified by:
getParentin classAbstractUnit
-
setDeleteAction
-
getUpdateAction
-
setUpdateAction
-
setFlag
public void setFlag(int flag) - Specified by:
setFlagin interfaceRelation<AbstractTable>
-
resetFlag
public void resetFlag(int flag) - Specified by:
resetFlagin interfaceRelation<AbstractTable>
-
hasFlag
public boolean hasFlag(int flag) - Specified by:
hasFlagin interfaceRelation<AbstractTable>
-
refresh
public void refresh()- Specified by:
refreshin 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:
getEntityin interfaceRelation<AbstractTable>- Specified by:
getEntityin interfaceUnit- Returns:
- the entity on which is defined
-
getTargetEntity
- Specified by:
getTargetEntityin interfaceRelation<AbstractTable>- Returns:
- the destination entity.
-
addColumns
-
getTargetAttributes
- Specified by:
getTargetAttributesin interfaceRelation<AbstractTable>
-
getSourceAttributes
- Specified by:
getSourceAttributesin interfaceRelation<AbstractTable>
-
sameAs
Special comparator- Overrides:
sameAsin 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:
getColumnCountin interfaceRelation<AbstractTable>
-
listAttributes
-
getLastSourceAttribute
- Specified by:
getLastSourceAttributein interfaceRelation<AbstractTable>
-
getLastTargetAttribute
- Specified by:
getLastTargetAttributein interfaceRelation<AbstractTable>
-
isAutoReference
public boolean isAutoReference()- Specified by:
isAutoReferencein interfaceRelation<AbstractTable>
-
getColumnsName
- Specified by:
getColumnsNamein interfaceRelation<AbstractTable>
-
getCascadeText
- Specified by:
getCascadeTextin interfaceRelation<AbstractTable>
-
getParentEntity
- Specified by:
getParentEntityin interfaceUnit- Overrides:
getParentEntityin 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:
getRelationTypein interfaceRelation<AbstractTable>
-
setRelationCardinality
-
getRelationCardinality
- Specified by:
getRelationCardinalityin 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:
isDeducedin interfaceRelation<AbstractTable>
-