public class DbRelationship extends Relationship implements ConfigurationNode
| Modifier and Type | Field and Description |
|---|---|
protected List<DbJoin> |
joins |
protected boolean |
toDependentPK |
name, runtime, sourceEntity, targetEntityName, toMany| Constructor and Description |
|---|
DbRelationship() |
DbRelationship(String name) |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
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.
|
List<DbJoin> |
getJoins()
Returns a list of joins.
|
DbRelationship |
getReverseRelationship()
Returns DbRelationship that is the opposite of this DbRelationship.
|
Collection<DbAttribute> |
getSourceAttributes()
Returns a Collection of source attributes.
|
DbEntity |
getSourceEntity()
Returns relationship source entity.
|
String |
getSourceEntityName() |
Collection<DbAttribute> |
getTargetAttributes()
Returns a Collection of target attributes.
|
DbEntity |
getTargetEntity()
Returns a target of this relationship.
|
boolean |
isFromPK() |
boolean |
isMandatory()
Returns if relationship is mandatory
|
boolean |
isSourceIndependentFromTargetChange()
Returns a boolean indicating whether modifying a target of such
relationship in any way will not change the underlying table row of the
source.
|
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(Collection<DbJoin> newJoins) |
void |
setToDependentPK(boolean toDependentPK) |
void |
setToMany(boolean toMany)
Sets relationship multiplicity.
|
Map<String,Object> |
srcFkSnapshotWithTargetSnapshot(Map<String,Object> targetSnapshot)
Creates a snapshot of foreign key attributes of a source object of this
relationship based on a snapshot of a target.
|
Map<String,Object> |
srcPkSnapshotWithTargetSnapshot(Map<String,Object> targetSnapshot)
Creates a snapshot of primary key attributes of a source object of this
relationship based on a snapshot of a target.
|
Map<String,Object> |
targetPkSnapshotWithSrcSnapshot(Map<String,Object> srcSnapshot)
Creates a snapshot of primary key attributes of a target object of this
relationship based on a snapshot of a source.
|
String |
toString()
Overrides Object.toString() to return informative description.
|
getName, getParent, getTargetEntityName, isRuntime, isToMany, setName, setParent, setRuntime, setSourceEntity, setTargetEntityName, setTargetEntityNamepublic DbRelationship()
public DbRelationship(String name)
public DbEntity getSourceEntity()
RelationshipgetSourceEntity in class Relationshippublic <T> T acceptVisitor(ConfigurationNodeVisitor<T> visitor)
acceptVisitor in interface ConfigurationNodepublic void encodeAsXML(XMLEncoder encoder)
encodeAsXML in interface XMLSerializablepublic DbEntity getTargetEntity()
getTargetEntity in class Relationshippublic Collection<DbAttribute> getTargetAttributes()
public Collection<DbAttribute> getSourceAttributes()
public DbRelationship createReverseRelationship()
public DbRelationship getReverseRelationship()
getReverseRelationship in class Relationshippublic boolean isToPK()
public boolean isFromPK()
public boolean isToMasterPK()
true if a method isToDependentPK of
reverse relationship of this relationship returns true.public boolean isSourceIndependentFromTargetChange()
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 List<DbJoin> getJoins()
public void addJoin(DbJoin join)
public void removeJoin(DbJoin join)
public void removeAllJoins()
public void setJoins(Collection<DbJoin> newJoins)
public Map<String,Object> targetPkSnapshotWithSrcSnapshot(Map<String,Object> srcSnapshot)
public Map<String,Object> srcFkSnapshotWithTargetSnapshot(Map<String,Object> targetSnapshot)
public Map<String,Object> srcPkSnapshotWithTargetSnapshot(Map<String,Object> targetSnapshot)
public void setToMany(boolean toMany)
public boolean isMandatory()
RelationshipisMandatory in class Relationshippublic String toString()
RelationshiptoString in class Relationshippublic String getSourceEntityName()
Copyright © 2001–2023 Apache Cayenne. All rights reserved.