|
||||||||||
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.ObjRelationship
public class ObjRelationship
Describes an association between two Java classes mapped as source and target ObjEntity. Maps to a path of DbRelationships.
Field Summary | |
---|---|
protected java.lang.String |
collectionType
Stores the type of collection mapped by a to-many relationship. |
protected java.util.List<DbRelationship> |
dbRelationships
|
static java.lang.String |
DEFAULT_COLLECTION_TYPE
Denotes a default type of to-many relationship collection which is a Java List. |
protected int |
deleteRule
|
protected java.lang.String |
mapKey
Stores a property name of a target entity used to create a relationship map. |
protected boolean |
usedForLocking
|
Fields inherited from class org.apache.cayenne.map.Relationship |
---|
name, runtime, sourceEntity, targetEntityName, toMany |
Constructor Summary | |
---|---|
ObjRelationship()
|
|
ObjRelationship(java.lang.String name)
|
Method Summary | ||
---|---|---|
|
acceptVisitor(ConfigurationNodeVisitor<T> visitor)
|
|
void |
addDbRelationship(DbRelationship dbRel)
Appends a DbRelationship to the existing list of DbRelationships. |
|
void |
clearDbRelationships()
|
|
ObjRelationship |
createReverseRelationship()
Creates a complimentary reverse relationship from target entity to the source entity. |
|
void |
encodeAsXML(XMLEncoder encoder)
Prints itself as XML to the provided XMLEncoder. |
|
ObjRelationship |
getClientRelationship()
Returns an ObjAttribute stripped of any server-side information, such as DbAttribute mapping. |
|
java.lang.String |
getCollectionType()
Returns the interface of collection mapped by a to-many relationship. |
|
java.lang.String |
getDbRelationshipPath()
Returns a dot-separated path over mapped DbRelationships. |
|
java.util.List<DbRelationship> |
getDbRelationships()
Returns an immutable list of underlying DbRelationships. |
|
int |
getDeleteRule()
Returns the deleteRule. |
|
java.lang.String |
getMapKey()
Returns a property name of a target entity used to create a relationship map. |
|
java.lang.String |
getReverseDbRelationshipPath()
Returns a reversed dbRelationship path. |
|
ObjRelationship |
getReverseRelationship()
Returns a "complimentary" ObjRelationship going in the opposite direction. |
|
java.lang.String |
getReverseRelationshipName()
Returns the name of a complimentary relationship going in the opposite direction or null if it doesn't exist. |
|
Entity |
getTargetEntity()
Returns a target ObjEntity of this relationship. |
|
boolean |
isFlattened()
Returns true if the relationship is a "flattened" relationship. |
|
boolean |
isMandatory()
Returns if relationship is mandatory |
|
boolean |
isOptional()
Returns a boolean indicating whether the presence of a non-null source key(s) will not guarantee a presence of a target record. |
|
boolean |
isReadOnly()
Returns true if the relationship is flattened, but is not of the single case that can have automatic write support. |
|
boolean |
isSourceDefiningTargetPrecenseAndType(EntityResolver entityResolver)
Returns true if the relationship is non-optional and target has no subclasses. |
|
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 |
isToDependentEntity()
Returns true if underlying DbRelationships point to dependent entity. |
|
boolean |
isToMany()
Returns a boolean value that determines relationship multiplicity. |
|
boolean |
isToPK()
Returns true if the underlying DbRelationships point to a at least one of the columns of the target entity. |
|
boolean |
isUsedForLocking()
Returns whether this attribute should be used for locking. |
|
void |
recalculateReadOnlyValue()
Recalculates a new readonly value based on the underlying DbRelationships. |
|
void |
recalculateToManyValue()
Recalculates whether a relationship is toMany or toOne, based on the underlying db relationships. |
|
void |
removeDbRelationship(DbRelationship dbRel)
Removes the relationship dbRel from the list of relationships. |
|
void |
setCollectionType(java.lang.String collectionType)
|
|
void |
setDbRelationshipPath(java.lang.String relationshipPath)
Sets mapped DbRelationships as a dot-separated path. |
|
void |
setDeleteRule(int value)
Sets the delete rule of the relationship. |
|
void |
setMapKey(java.lang.String mapKey)
|
|
void |
setUsedForLocking(boolean usedForLocking)
Sets whether this attribute should be used for locking. |
|
java.lang.String |
toString()
Overrides Object.toString() to return informative description. |
Methods inherited from class org.apache.cayenne.map.Relationship |
---|
getName, getParent, getSourceEntity, getTargetEntityName, isRuntime, setName, setParent, setRuntime, setSourceEntity, setTargetEntity, setTargetEntityName |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DEFAULT_COLLECTION_TYPE
protected int deleteRule
protected boolean usedForLocking
protected java.util.List<DbRelationship> dbRelationships
protected java.lang.String collectionType
protected java.lang.String mapKey
Constructor Detail |
---|
public ObjRelationship()
public ObjRelationship(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.lang.String getReverseRelationshipName()
public ObjRelationship getReverseRelationship()
getReverseRelationship
in class Relationship
public ObjRelationship createReverseRelationship()
CayenneRuntimeException
if reverse DbRelationship is not mapped.
public java.util.List<DbRelationship> getDbRelationships()
public void addDbRelationship(DbRelationship dbRel)
public void removeDbRelationship(DbRelationship dbRel)
dbRel
from the list of relationships.
public void clearDbRelationships()
public boolean isOptional()
public boolean isSourceDefiningTargetPrecenseAndType(EntityResolver entityResolver)
public boolean isSourceIndependentFromTargetChange()
public boolean isToDependentEntity()
public boolean isToPK()
public boolean isFlattened()
isReadOnly()
public boolean isReadOnly()
public boolean isToMany()
Relationship
isToMany
in class Relationship
public int getDeleteRule()
setDeleteRule(int)
public void setDeleteRule(int value)
value
- New delete rule. Must be one of the constants defined in DeleteRule
class.
java.lang.IllegalArgumentException
- if the value is not a valid delete rule.DeleteRule
public boolean isUsedForLocking()
public void setUsedForLocking(boolean usedForLocking)
public java.lang.String getDbRelationshipPath()
public java.lang.String getReverseDbRelationshipPath() throws ExpressionException
ExpressionException
public void setDbRelationshipPath(java.lang.String relationshipPath)
public void recalculateToManyValue()
public void recalculateReadOnlyValue()
public java.lang.String toString()
Relationship
toString
in class Relationship
public ObjRelationship getClientRelationship()
public java.lang.String getCollectionType()
public void setCollectionType(java.lang.String collectionType)
public java.lang.String getMapKey()
null
if the default
(PK) is used as the map key.public void setMapKey(java.lang.String mapKey)
public boolean isMandatory()
Relationship
isMandatory
in class Relationship
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |