|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cayenne.map.Relationship
org.apache.cayenne.map.DbRelationship
public class DbRelationship
A DbRelationship is a descriptor of a database inter-table relationship based on one or more primary key/foreign key pairs.
Field Summary | |
---|---|
protected java.util.List<DbJoin> |
joins
|
protected boolean |
toDependentPK
|
Fields inherited from class org.apache.cayenne.map.Relationship |
---|
name, runtime, sourceEntity, targetEntityName, toMany |
Constructor Summary | |
---|---|
DbRelationship()
|
|
DbRelationship(java.lang.String name)
|
Method Summary | ||
---|---|---|
|
acceptVisitor(ConfigurationNodeVisitor<T> visitor)
|
|
void |
addJoin(DbJoin join)
Adds a join. |
|
DbRelationship |
createReverseRelationship()
Creates a new relationship with the same set of joins, but going in the opposite direction. |
|
void |
encodeAsXML(XMLEncoder encoder)
Prints itself as XML to the provided XMLEncoder. |
|
java.util.List<DbJoin> |
getJoins()
Returns a list of joins. |
|
DbRelationship |
getReverseRelationship()
Returns DbRelationship that is the opposite of this DbRelationship. |
|
java.util.Collection<DbAttribute> |
getSourceAttributes()
Returns a Collection of source attributes. |
|
java.util.Collection<DbAttribute> |
getTargetAttributes()
Returns a Collection of target attributes. |
|
Entity |
getTargetEntity()
Returns a target of this relationship. |
|
boolean |
isFromPK()
|
|
boolean |
isMandatory()
Returns if relationship is mandatory |
|
boolean |
isToDependentPK()
Returns true if relationship from source to target points to dependent
primary key. |
|
boolean |
isToMasterPK()
Returns true if a method isToDependentPK of reverse
relationship of this relationship returns true . |
|
boolean |
isToPK()
Returns true if the relationship points to at least one of the PK columns of the target entity. |
|
boolean |
isValidForDepPk()
|
|
void |
removeAllJoins()
|
|
void |
removeJoin(DbJoin join)
|
|
void |
setJoins(java.util.Collection<DbJoin> newJoins)
|
|
void |
setToDependentPK(boolean toDependentPK)
|
|
void |
setToMany(boolean toMany)
Sets relationship multiplicity. |
|
java.util.Map<java.lang.String,java.lang.Object> |
srcFkSnapshotWithTargetSnapshot(java.util.Map<java.lang.String,java.lang.Object> targetSnapshot)
Creates a snapshot of foreign key attributes of a source object of this relationship based on a snapshot of a target. |
|
java.util.Map<java.lang.String,java.lang.Object> |
srcPkSnapshotWithTargetSnapshot(java.util.Map<java.lang.String,java.lang.Object> targetSnapshot)
Creates a snapshot of primary key attributes of a source object of this relationship based on a snapshot of a target. |
|
java.util.Map<java.lang.String,java.lang.Object> |
targetPkSnapshotWithSrcSnapshot(java.util.Map<java.lang.String,java.lang.Object> srcSnapshot)
Creates a snapshot of primary key attributes of a target object of this relationship based on a snapshot of a source. |
Methods inherited from class org.apache.cayenne.map.Relationship |
---|
getName, getParent, getSourceEntity, getTargetEntityName, isRuntime, isToMany, setName, setParent, setRuntime, setSourceEntity, setTargetEntity, setTargetEntityName, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.util.List<DbJoin> joins
protected boolean toDependentPK
Constructor Detail |
---|
public DbRelationship()
public DbRelationship(java.lang.String name)
Method Detail |
---|
public <T> T acceptVisitor(ConfigurationNodeVisitor<T> visitor)
acceptVisitor
in interface ConfigurationNode
public void encodeAsXML(XMLEncoder encoder)
encodeAsXML
in interface XMLSerializable
public Entity getTargetEntity()
getTargetEntity
in class Relationship
public java.util.Collection<DbAttribute> getTargetAttributes()
public java.util.Collection<DbAttribute> getSourceAttributes()
public DbRelationship createReverseRelationship()
public DbRelationship getReverseRelationship()
getReverseRelationship
in class Relationship
public boolean isToPK()
public boolean isFromPK()
public boolean isToMasterPK()
true
if a method isToDependentPK
of reverse
relationship of this relationship returns true
.
public boolean isToDependentPK()
true
if relationship from source to target points to dependent
primary key. Dependent PK is a primary key column of the destination table that is
also a FK to the source column.
public void setToDependentPK(boolean toDependentPK)
public boolean isValidForDepPk()
public java.util.List<DbJoin> getJoins()
public void addJoin(DbJoin join)
public void removeJoin(DbJoin join)
public void removeAllJoins()
public void setJoins(java.util.Collection<DbJoin> newJoins)
public java.util.Map<java.lang.String,java.lang.Object> targetPkSnapshotWithSrcSnapshot(java.util.Map<java.lang.String,java.lang.Object> srcSnapshot)
public java.util.Map<java.lang.String,java.lang.Object> srcFkSnapshotWithTargetSnapshot(java.util.Map<java.lang.String,java.lang.Object> targetSnapshot)
public java.util.Map<java.lang.String,java.lang.Object> srcPkSnapshotWithTargetSnapshot(java.util.Map<java.lang.String,java.lang.Object> targetSnapshot)
public void setToMany(boolean toMany)
public boolean isMandatory()
Relationship
isMandatory
in class Relationship
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |