Package com.im.ijc.df.impl.db
Class DBRelationshipExistingNTO
- java.lang.Object
-
- com.chemaxon.dif.db.api.item.newtype.AbstractNTOImpl
-
- com.chemaxon.dif.db.api.item.newtype.SingleDFItemNTO
-
- com.im.ijc.df.impl.db.DBRelationshipExistingNTO
-
- All Implemented Interfaces:
com.im.df.api.support.DFNewTypeOptions
,com.im.df.api.support.DFNewTypeWellKnownOptions.ExistingRelationship
,com.im.df.api.support.DFNewTypeWellKnownOptions.SingleDFItem
public final class DBRelationshipExistingNTO extends com.chemaxon.dif.db.api.item.newtype.SingleDFItemNTO implements com.im.df.api.support.DFNewTypeWellKnownOptions.ExistingRelationship
This NTO supports 2 modes: Constraint driven ----------- The FK is provided, which derives the source and destination entities/fields. If both FK and PK map to a field, the NTO is valid, and the relationship can be created. If FK or PK does not form a field, the NTO is invalid. Join table can be specified, together with the "right" FK name. Field driven ------------- Fields are set by the caller. If there is a FK, which binds those fields, the NTO is valid. Otherwise, a join table must be specified. The mode is set implicitly: - by setting the FK - by setting one of the fields isFKNameSet() returns true, if operating in the 'constraint driven' mode.- Author:
- svata
-
-
Field Summary
-
Fields inherited from interface com.im.df.api.support.DFNewTypeOptions
PROP_ERROR_MESSAGE, PROP_VALID
-
-
Constructor Summary
Constructors Constructor Description DBRelationshipExistingNTO(com.im.df.api.ddl.DFContainer parentContainer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.im.df.api.ddl.DFField
getDestField()
com.im.commons.db.util.SchemaQualifiedName
getFkName()
com.im.commons.db.ddl.DBForeignKeyInfo
getImpliedFK()
com.im.commons.db.util.SchemaQualifiedName
getImpliedFKName()
com.im.commons.db.ddl.DBForeignKeyInfo
getImpliedRightFK()
com.im.commons.db.util.SchemaQualifiedName
getJoinTableName()
com.im.df.api.ddl.DFRelationship.Type
getRelType()
com.im.commons.db.util.SchemaQualifiedName
getRightFkName()
com.chemaxon.dif.db.api.schema.DBSchemaImpl
getSchema()
com.im.df.api.ddl.DFField
getSourceField()
boolean
isFkNameSet()
boolean
isUniqueConstraint(com.im.df.api.ddl.DFField field)
protected com.im.df.api.ddl.DFEntity
resolveDestEntity()
protected com.im.df.api.ddl.DFEntity
resolveSourceEntity()
void
setDestField(com.im.df.api.ddl.DFField destField)
void
setFkName(com.im.commons.db.util.SchemaQualifiedName fkName)
void
setJoinTableName(com.im.commons.db.util.SchemaQualifiedName joinTableName)
void
setRelType(com.im.df.api.ddl.DFRelationship.Type relType)
void
setRightFkName(com.im.commons.db.util.SchemaQualifiedName sqn)
void
setSourceField(com.im.df.api.ddl.DFField sourceField)
void
updateStatus()
Check that the FK Name is not used by any other Relationship in the schema.-
Methods inherited from class com.chemaxon.dif.db.api.item.newtype.SingleDFItemNTO
getDescription, getNewDFItemName, getParentContainer, normalizeDFItemName, notifyNewDFItemNameChanged, setDescription, setNewDFItemName, setNewDFItemNameSafe
-
Methods inherited from class com.chemaxon.dif.db.api.item.newtype.AbstractNTOImpl
addPropertyChangeListener, firePropertyChange, getErrorMessage, isValid, removePropertyChangeListener, setErrorMessage, setValid
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Method Detail
-
getFkName
public com.im.commons.db.util.SchemaQualifiedName getFkName()
- Specified by:
getFkName
in interfacecom.im.df.api.support.DFNewTypeWellKnownOptions.ExistingRelationship
-
setFkName
public void setFkName(com.im.commons.db.util.SchemaQualifiedName fkName)
- Specified by:
setFkName
in interfacecom.im.df.api.support.DFNewTypeWellKnownOptions.ExistingRelationship
-
getJoinTableName
public com.im.commons.db.util.SchemaQualifiedName getJoinTableName()
- Specified by:
getJoinTableName
in interfacecom.im.df.api.support.DFNewTypeWellKnownOptions.ExistingRelationship
-
getImpliedFKName
public com.im.commons.db.util.SchemaQualifiedName getImpliedFKName()
-
setJoinTableName
public void setJoinTableName(com.im.commons.db.util.SchemaQualifiedName joinTableName)
- Specified by:
setJoinTableName
in interfacecom.im.df.api.support.DFNewTypeWellKnownOptions.ExistingRelationship
-
isFkNameSet
public boolean isFkNameSet()
- Specified by:
isFkNameSet
in interfacecom.im.df.api.support.DFNewTypeWellKnownOptions.ExistingRelationship
-
getImpliedFK
public com.im.commons.db.ddl.DBForeignKeyInfo getImpliedFK()
- Specified by:
getImpliedFK
in interfacecom.im.df.api.support.DFNewTypeWellKnownOptions.ExistingRelationship
-
getImpliedRightFK
public com.im.commons.db.ddl.DBForeignKeyInfo getImpliedRightFK()
- Specified by:
getImpliedRightFK
in interfacecom.im.df.api.support.DFNewTypeWellKnownOptions.ExistingRelationship
-
getRightFkName
public com.im.commons.db.util.SchemaQualifiedName getRightFkName()
- Specified by:
getRightFkName
in interfacecom.im.df.api.support.DFNewTypeWellKnownOptions.ExistingRelationship
-
setRightFkName
public void setRightFkName(com.im.commons.db.util.SchemaQualifiedName sqn)
- Specified by:
setRightFkName
in interfacecom.im.df.api.support.DFNewTypeWellKnownOptions.ExistingRelationship
-
resolveSourceEntity
protected com.im.df.api.ddl.DFEntity resolveSourceEntity()
-
resolveDestEntity
protected com.im.df.api.ddl.DFEntity resolveDestEntity()
-
isUniqueConstraint
public boolean isUniqueConstraint(com.im.df.api.ddl.DFField field)
-
getDestField
public com.im.df.api.ddl.DFField getDestField()
- Specified by:
getDestField
in interfacecom.im.df.api.support.DFNewTypeWellKnownOptions.ExistingRelationship
-
setDestField
public void setDestField(com.im.df.api.ddl.DFField destField)
- Specified by:
setDestField
in interfacecom.im.df.api.support.DFNewTypeWellKnownOptions.ExistingRelationship
-
getSourceField
public com.im.df.api.ddl.DFField getSourceField()
- Specified by:
getSourceField
in interfacecom.im.df.api.support.DFNewTypeWellKnownOptions.ExistingRelationship
-
setSourceField
public void setSourceField(com.im.df.api.ddl.DFField sourceField)
- Specified by:
setSourceField
in interfacecom.im.df.api.support.DFNewTypeWellKnownOptions.ExistingRelationship
-
getRelType
public com.im.df.api.ddl.DFRelationship.Type getRelType()
-
setRelType
public void setRelType(com.im.df.api.ddl.DFRelationship.Type relType)
-
getSchema
public com.chemaxon.dif.db.api.schema.DBSchemaImpl getSchema()
-
updateStatus
public void updateStatus()
Check that the FK Name is not used by any other Relationship in the schema. First check the FK name bound to the relationship, then check correspondence of fields relationships without a linked FK- Overrides:
updateStatus
in classcom.chemaxon.dif.db.api.item.newtype.SingleDFItemNTO
-
-