java.lang.Object
org.objectstyle.cayenne.map.MapObject
org.objectstyle.cayenne.map.Relationship
org.objectstyle.cayenne.map.ObjRelationship
- All Implemented Interfaces:
- org.objectstyle.cayenne.util.CayenneMapEntry, java.util.EventListener
- public class ObjRelationship
- extends Relationship
- implements java.util.EventListener
Metadata for the navigational association between the data objects. For
example, if class "Employee" you may need to get to the department entity by
calling "employee.getDepartment()". In this case you navigate from data
object class Employee to Department. In this case Employee is source and
Department is target. The navigation from Department to the list of
employees would be expressed by another instance of ObjRelationship.
ObjRelationship class also stores the navigation information in terms of the
database entity relationships. The ObjRelationship objects are stored in the
ObjEntities.
deleteRule
private int deleteRule
isFlattened
private boolean isFlattened
isReadOnly
private boolean isReadOnly
dbRelationships
private java.util.List dbRelationships
dbRelationshipsRef
private java.util.List dbRelationshipsRef
ObjRelationship
public ObjRelationship()
ObjRelationship
public ObjRelationship(java.lang.String name)
ObjRelationship
public ObjRelationship(ObjEntity source,
ObjEntity target,
boolean toMany)
getTargetEntity
public Entity getTargetEntity()
- Description copied from class:
Relationship
- Returns relationship target entity.
- Specified by:
getTargetEntity in class Relationship
isToDependentEntity
public boolean isToDependentEntity()
- Returns true if underlying DbRelationships point to dependent entity.
getReverseRelationship
public ObjRelationship getReverseRelationship()
- Returns ObjRelationship that is the opposite of this ObjRelationship.
returns null if no such relationship exists.
getDbRelationships
public java.util.List getDbRelationships()
- Returns a list of underlying DbRelationships.
addDbRelationship
public void addDbRelationship(DbRelationship dbRel)
- Appends a DbRelationship to the existing list of DbRelationships.
removeDbRelationship
public void removeDbRelationship(DbRelationship dbRel)
- Removes the relationship
dbRel from the list of relationships.
clearDbRelationships
public void clearDbRelationships()
calculateToManyValue
private void calculateToManyValue()
calculateReadOnlyValue
private void calculateReadOnlyValue()
isFlattened
public boolean isFlattened()
- Returns true if the relationship is a "flattened" relationship.
This means that the ObjRelationship represents a series of DbRelationships (a relationship path)
transparently. All flattened relationships are "readable", but only those formed across a many-many link table
(with no custom attributes other than foreign keys) can be automatically written. isReadOnly handles that
isReadOnly
public boolean isReadOnly()
- Returns true if the relationship is flattened, but is not of the single case that can have automatic write support
Otherwise, it returns false.
getDeleteRule
public int getDeleteRule()
- Returns the deleteRule.
The delete rule is a constant from the DeleteRule class, and specifies
what should happen to the destination object when the source object is
deleted.
setDeleteRule
public void setDeleteRule(int value)
- Sets the deleteRule.
dbRelationshipDidChange
public void dbRelationshipDidChange(org.objectstyle.cayenne.map.event.RelationshipEvent event)