Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.objectstyle.cayenne.map
Class ObjRelationship  view ObjRelationship download ObjRelationship.java

java.lang.Object
  extended byorg.objectstyle.cayenne.map.MapObject
      extended byorg.objectstyle.cayenne.map.Relationship
          extended byorg.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.


Field Summary
private  java.util.List dbRelationships
           
private  java.util.List dbRelationshipsRef
           
private  int deleteRule
           
private  boolean isFlattened
           
private  boolean isReadOnly
           
 
Fields inherited from class org.objectstyle.cayenne.map.Relationship
targetEntityName, toMany
 
Fields inherited from class org.objectstyle.cayenne.map.MapObject
objName, objParent
 
Constructor Summary
ObjRelationship()
           
ObjRelationship(ObjEntity source, ObjEntity target, boolean toMany)
           
ObjRelationship(java.lang.String name)
           
 
Method Summary
 void addDbRelationship(DbRelationship dbRel)
          Appends a DbRelationship to the existing list of DbRelationships.
private  void calculateReadOnlyValue()
           
private  void calculateToManyValue()
           
 void clearDbRelationships()
           
 void dbRelationshipDidChange(org.objectstyle.cayenne.map.event.RelationshipEvent event)
           
 java.util.List getDbRelationships()
          Returns a list of underlying DbRelationships.
 int getDeleteRule()
          Returns the deleteRule.
 ObjRelationship getReverseRelationship()
          Returns ObjRelationship that is the opposite of this ObjRelationship.
 Entity getTargetEntity()
          Returns relationship target entity.
 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 Otherwise, it returns false.
 boolean isToDependentEntity()
          Returns true if underlying DbRelationships point to dependent entity.
 void removeDbRelationship(DbRelationship dbRel)
          Removes the relationship dbRel from the list of relationships.
 void setDeleteRule(int value)
          Sets the deleteRule.
 
Methods inherited from class org.objectstyle.cayenne.map.Relationship
getSourceEntity, getTargetEntityName, isToMany, setSourceEntity, setTargetEntity, setTargetEntityName, toString
 
Methods inherited from class org.objectstyle.cayenne.map.MapObject
getName, getParent, setName, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

deleteRule

private int deleteRule

isFlattened

private boolean isFlattened

isReadOnly

private boolean isReadOnly

dbRelationships

private java.util.List dbRelationships

dbRelationshipsRef

private java.util.List dbRelationshipsRef
Constructor Detail

ObjRelationship

public ObjRelationship()

ObjRelationship

public ObjRelationship(java.lang.String name)

ObjRelationship

public ObjRelationship(ObjEntity source,
                       ObjEntity target,
                       boolean toMany)
Method Detail

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)