|
||||||||||
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 String |
collectionType
Stores the type of collection mapped by a to-many relationship. |
protected String |
dbRelationshipPath
|
protected List<DbRelationship> |
dbRelationships
|
static String |
DEFAULT_COLLECTION_TYPE
Denotes a default type of to-many relationship collection which is a Java List. |
protected int |
deleteRule
|
protected 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(String name)
|
Method Summary | |
---|---|
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 |
dbRelationshipDidChange(RelationshipEvent event)
|
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. |
String |
getCollectionType()
Returns the interface of collection mapped by a to-many relationship. |
String |
getDbRelationshipPath()
Returns a dot-separated path over mapped DbRelationships. |
List<DbRelationship> |
getDbRelationships()
Returns an immutable list of underlying DbRelationships. |
int |
getDeleteRule()
Returns the deleteRule. |
String |
getMapKey()
Returns a property name of a target entity used to create a relationship map. |
String |
getReverseDbRelationshipPath()
Returns a reversed dbRelationship path. |
ObjRelationship |
getReverseRelationship()
Returns a "complimentary" ObjRelationship going in the opposite direction. |
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 |
isReadOnly()
Returns true if the relationship is flattened, but is not of the single case that can have automatic write support. |
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 |
removeDbRelationship(DbRelationship dbRel)
Removes the relationship dbRel from the list of relationships. |
void |
setCollectionType(String collectionType)
|
void |
setDbRelationshipPath(String relationshipPath)
Sets mapped DbRelationships as a dot-separated path. |
void |
setDeleteRule(int value)
Sets the delete rule of the relationship. |
void |
setMapKey(String mapKey)
|
void |
setUsedForLocking(boolean usedForLocking)
Sets whether this attribute should be used for locking. |
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 String DEFAULT_COLLECTION_TYPE
protected int deleteRule
protected boolean usedForLocking
protected String dbRelationshipPath
protected List<DbRelationship> dbRelationships
protected String collectionType
protected String mapKey
Constructor Detail |
---|
public ObjRelationship()
public ObjRelationship(String name)
Method Detail |
---|
public void encodeAsXML(XMLEncoder encoder)
encodeAsXML
in interface XMLSerializable
public Entity getTargetEntity()
getTargetEntity
in class Relationship
public String getReverseRelationshipName()
public ObjRelationship getReverseRelationship()
public ObjRelationship createReverseRelationship()
CayenneRuntimeException
if reverse DbRelationship is not mapped.
public List<DbRelationship> getDbRelationships()
public void addDbRelationship(DbRelationship dbRel)
public void removeDbRelationship(DbRelationship dbRel)
dbRel
from the list of relationships.
public void clearDbRelationships()
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.
IllegalArgumentException
- if the value is not a valid delete rule.DeleteRule
public void dbRelationshipDidChange(RelationshipEvent event)
public boolean isUsedForLocking()
public void setUsedForLocking(boolean usedForLocking)
public String getDbRelationshipPath()
public String getReverseDbRelationshipPath() throws ExpressionException
ExpressionException
public void setDbRelationshipPath(String relationshipPath)
public String toString()
Relationship
toString
in class Relationship
public ObjRelationship getClientRelationship()
public String getCollectionType()
public void setCollectionType(String collectionType)
public String getMapKey()
null
if the
default (PK) is used as the map key.public void setMapKey(String mapKey)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |