WebObjects 5.2.3

com.webobjects.eodistribution.client
Class EORelationship

java.lang.Object
  extended bycom.webobjects.eodistribution.client.EORelationship
All Implemented Interfaces:
NSCoding

public class EORelationship
extends Object
implements NSCoding

An EORelationship describes an association between two entities. The two entities can be in the same model or two different models as long as they are in the same model group. The assocation can be to-one or to-many, and is directional: no inverse is implied, however an inverse relationship may exist.

A relationship belongs to the 'source' entity, and is in many ways like an attribute (of the source object), its value being the related EOEnterpriseObject (or null) in the case of a to-one relationship, and an NSArray of EOEnterpriseObjects (possibly empty) in the case of a to-many relationship.


Nested Class Summary
 
Nested classes inherited from class com.webobjects.foundation.NSCoding
NSCoding.Support
 
Constructor Summary
EORelationship()
          The constructor for EORelationship.
 
Method Summary
 Class classForCoder()
          Returns the class that will be used by NSCoders to later re-create this object.
static Object decodeObject(NSCoder coder)
          Re-creates (decodes) an object of this class from the values stored in a NSCoder.
 int deleteRule()
          Returns an integer constant specifiying the delete rule.
 String destinationName()
          Returns the name of destination entity.
 void encodeWithCoder(NSCoder coder)
          Encodes this object (its defining values) into the specified NSCoder.
 String inverseName()
          Returns the name of the inverse relationship.
 boolean isMandatory()
          Returns whether this relationship is mandatory, meaning there has to be (at least) one destination object, it cannot be null.
 boolean isToMany()
          Returns whether this relationship is to-many, meaning its value is a (possibly empty) array of enterprise objects.
 String name()
          Returns the name of this relationship.
 boolean ownsDestination()
          Returns whether the related object(s) is (are) owned by the source object of this relationship.
 boolean propagatesPrimaryKey()
          Returns whether the primary key of the source object is propagated to the destination object(s) of this relationship, so that these will have the same primary key.
 String toString()
          Returns a readable String representation off this relationship's definitions.
 Object validateValue(Object value)
          Validates value by performing several checks to see whether value would be an acceptable value for the relationship.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EORelationship

public EORelationship()
The constructor for EORelationship.

Method Detail

classForCoder

public Class classForCoder()
Returns the class that will be used by NSCoders to later re-create this object.

Specified by:
classForCoder in interface NSCoding
Returns:
the class that will be used by NSCoders to later re-create this object

decodeObject

public static Object decodeObject(NSCoder coder)
Re-creates (decodes) an object of this class from the values stored in a NSCoder.

Parameters:
coder - the coder with the encoded defining values

deleteRule

public int deleteRule()
Returns an integer constant specifiying the delete rule. The delete rule specifies what will happen when the related object(s) is (are) about to be deleted. The constants EOClassDescription (in com.webobjects.eocontrol) defines are DeleteRuleNullify, DeleteRuleCascade, DeleteRuleDeny and DeleteRuleNoAction.

Returns:
the delete rule (as an integer constant, defined in EOClassDescription)
See Also:
EOClassDescription

destinationName

public String destinationName()
Returns the name of destination entity.

Returns:
the destination entity's name

encodeWithCoder

public void encodeWithCoder(NSCoder coder)
Encodes this object (its defining values) into the specified NSCoder.

Specified by:
encodeWithCoder in interface NSCoding
Parameters:
coder - the coder used to store the encoded definitions
See Also:
NSCoder

inverseName

public String inverseName()
Returns the name of the inverse relationship.

Returns:
the inverse relationship's name

isMandatory

public boolean isMandatory()
Returns whether this relationship is mandatory, meaning there has to be (at least) one destination object, it cannot be null.

Returns:
true if the relationship is mandatory; falseotherwise

isToMany

public boolean isToMany()
Returns whether this relationship is to-many, meaning its value is a (possibly empty) array of enterprise objects. Otherwise it is a to-one relationship, and its value either a direct pointer to a single enterprise object, or null.

Returns:
true if the relationship is to-many; falseotherwise

name

public String name()
Returns the name of this relationship.

Returns:
the name

ownsDestination

public boolean ownsDestination()
Returns whether the related object(s) is (are) owned by the source object of this relationship.

Returns:
true if the source object 'owns' the destination object(s); falseotherwise

propagatesPrimaryKey

public boolean propagatesPrimaryKey()
Returns whether the primary key of the source object is propagated to the destination object(s) of this relationship, so that these will have the same primary key.

Returns:
true if the primary key is propagated to the destination object(s); falseotherwise

toString

public String toString()
Returns a readable String representation off this relationship's definitions.

Returns:
the String representation

validateValue

public Object validateValue(Object value)
                     throws NSValidation.ValidationException
Validates value by performing several checks to see whether value would be an acceptable value for the relationship. However, it currently will only check the 'mandatory' requirement, if set, to verify that value contains one object (or an array with at least one e lement)

Parameters:
value - the object to be validated
Returns:
value, the converted value, or null
Throws:
NSValidation.ValidationException - if validation fails

Last updated Thu Oct 21 15:04:16 PDT 2004.

Copyright © 2004 Apple Computer, Inc.