|
WebObjects 5.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.webobjects.eocontrol.EOClassDescription | +--com.webobjects.eoaccess.EOEntityClassDescription
EOEntityClassDescription is a subclass of the control layer's EOClassDescription. The EOClassDescription class provides a mechanism for extending classes by giving them access to metadata not available in the runtime system. EOEntityClassDescription extends the behavior of Enterprise Objects by deriving information about them (such as NULL constraints and referential integrity rules) from an associated EOModel.
In the typical scenario in which an Enterprise Object has a
corresponding model file, the first time a particular operation is
performed on a class (such as validating a value), an
EOClassDescriptionNeeded
... notification is broadcast. This
may be either an EOClassDescriptionNeededForClassNotification
or an EOClassDescriptionNeededForEntityNameNotification
.
When an EOModel object receives this notification it registers the metadata
(class description) for the EOEntity on which the Enterprise Object is
based. This class description is used from that point on.
EOClassDescription
, Serialized FormInner classes inherited from class com.webobjects.eocontrol.EOClassDescription |
EOClassDescription.ClassDelegate |
Fields inherited from class com.webobjects.eocontrol.EOClassDescription |
ClassDescriptionNeededForClassNotification, ClassDescriptionNeededForEntityNameNotification, DeleteRuleCascade, DeleteRuleDeny, DeleteRuleNoAction, DeleteRuleNullify |
Constructor Summary | |
EOEntityClassDescription(EOEntity entity)
Creates and returns a new EOEntityClassDescription for entity . |
Method Summary | |
NSArray |
allAttributeKeys()
Returns an array of the names of all the attributes of the receiver's entity. |
NSArray |
allPropertyKeys()
Returns an array of the names of all the properties for the entity associated with the receiver. |
NSArray |
allToManyRelationshipKeys()
Returns an array of the names of all the to-many relationships of the receiver's entity. |
NSArray |
allToOneRelationshipKeys()
Returns an array of the names of all the to-one relationships of the receiver's entity. |
NSArray |
attributeKeys()
Returns an array of attribute keys for the entity associated with the receiver. |
void |
awakeObjectFromInsertion(EOEnterpriseObject object,
EOEditingContext ec)
Propagates inserts for the newly-inserted Enterprise Object object in the editing context ec . |
EOClassDescription |
classDescriptionForDestinationKey(String detailKey)
Returns the EOClassDescription for objects at the destination of the to-one relationship identified by detailKey . |
Class |
classForAttributeKey(String key)
|
NSArray |
clientAttributeKeys()
Returns an array containing the names of the attributes that are bound to the client-side class that corresponds to the receiver's entity. |
NSArray |
clientToManyRelationshipKeys()
Returns an array containing the names of the to-many relationships that are bound to the client-side class that corresponds to the receiver's entity. |
NSArray |
clientToOneRelationshipKeys()
Returns an array containing the names of the to-one relationships that are bound to the client-side class that corresponds to the receiver's entity. |
EOEnterpriseObject |
createInstanceWithEditingContext(EOEditingContext ec,
EOGlobalID gid)
Creates and returns an Enterprise Object in the editing context ec
by using the EOGlobalID gid to query the receiver's EOEntity for
the appropriate class of object to instantiate. |
Format |
defaultFormatterForKey(String key)
Returns the formatter to use when parsing values for assignment to key . |
int |
deleteRuleForRelationshipKey(String relationshipKey)
Returns a delete rule indicating how to treat the destination of the given relationship when the receiver's entity is deleted. |
EOEntity |
entity()
Returns the entity associated with the receiver. |
String |
entityName()
Returns the name of the entity associated with the receiver. |
EOFetchSpecification |
fetchSpecificationNamed(String name)
Returns the fetch specification with the specified name from the receiver's entity. |
String |
inverseForRelationshipKey(String relationshipKey)
Returns the name of the relationship pointing back to the receiver's entity from the destination of the relationship specified by relationshipKey . |
boolean |
ownsDestinationObjectsForRelationshipKey(String relationshipKey)
Returns true if the the objects at the destination of
the relationship specified by relationshipKey should be
deleted if they are removed from the relationship rather than transferred
to the corresponding relationship of another object. |
protected Object |
readResolve()
|
EOClassDescription |
superClassDescription()
Returns null . |
NSArray |
toManyRelationshipKeys()
Returns an array of keys for the to-many relationship properties of the receiver's entity. |
NSArray |
toOneRelationshipKeys()
Returns the keys for the to-one relationship properties of the receiver's entity. |
void |
validateObjectForDelete(EOEnterpriseObject object)
Determines whether it is permissible to delete object . |
Exception |
validateObjectForSave(Object object)
Returns null . |
Object |
validateValueForKey(Object valueP,
String key)
Validates the object valueP using the property named
key . |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public EOEntityClassDescription(EOEntity entity)
entity
.entity
- An EOEntity object.entity()
Method Detail |
public NSArray allAttributeKeys()
public NSArray allPropertyKeys()
public NSArray allToManyRelationshipKeys()
public NSArray allToOneRelationshipKeys()
public NSArray attributeKeys()
attributeKeys
in class EOClassDescription
EOEntity.attributes()
public void awakeObjectFromInsertion(EOEnterpriseObject object, EOEditingContext ec)
object
in the editing context ec
.
If object
has one or more relationships that
propagate the primary key and if no object yet exists at the destination
of those relationships, a new object is created at the destination.
Use this method to put default values in the new Enterprise Object.awakeObjectFromInsertion
in class EOClassDescription
object
- An Enterprise Object newly inserted into ec
.ec
- The editing context to which object
belongs.public EOClassDescription classDescriptionForDestinationKey(String detailKey)
detailKey
.
Throws a runtime exception if an error is encountered while
resolving the relationship or its destination entity; the error
text indicates the nature of the exception.classDescriptionForDestinationKey
in class EOClassDescription
detailKey
- The name of a to-one relationship of the receiver's entity.detailKey
.public Class classForAttributeKey(String key)
classForAttributeKey
in class EOClassDescription
public NSArray clientAttributeKeys()
clientAttributeKeys
in class EOClassDescription
public NSArray clientToManyRelationshipKeys()
clientToManyRelationshipKeys
in class EOClassDescription
public NSArray clientToOneRelationshipKeys()
clientToOneRelationshipKeys
in class EOClassDescription
public EOEnterpriseObject createInstanceWithEditingContext(EOEditingContext ec, EOGlobalID gid)
ec
by using the EOGlobalID gid
to query the receiver's EOEntity for
the appropriate class of object to instantiate. If the receiver's entity does
not have an Enterprise Object class name set, creates and returns an
EOGenericRecord object.
Throws an exception if the receiver's entity does have an Enterprise Object
class name set and the class for the Enterprise Object identified by
gid
does not have a publicly accessible constructor.
createInstanceWithEditingContext
in class EOClassDescription
ec
- The EOEditingContext into which to instantiate the new enterprise
object.gid
- The unique identifier of an Enterprise Object belonging to the
receiver's entity.IllegalArgumentException
- if unable to construct an object for
gid
.EOEditingContext
,
EOEntity.className()
,
EOEntity.setClassName(String name)
public Format defaultFormatterForKey(String key)
key
. The formatter is based on the Java value class specified
for key
in the associated model file. Returns null
if the value class is not matched.defaultFormatterForKey
in class EOClassDescription
key
- The name of an attribute to format.key
.public int deleteRuleForRelationshipKey(String relationshipKey)
DeleteRuleCascade
DeleteRuleDeny
DeleteRuleNullify
DeleteRuleNoAction
deleteRuleForRelationshipKey
in class EOClassDescription
relationshipKey
- The name of a relationship of the receiver's entity.EOModel
,
EORelationship
public EOEntity entity()
public String entityName()
entityName
in class EOClassDescription
public EOFetchSpecification fetchSpecificationNamed(String name)
fetchSpecificationNamed
in class EOClassDescription
name
- The name of the fetch specification to retrieve.name
.public String inverseForRelationshipKey(String relationshipKey)
relationshipKey
. Returns null
if
relationshipKey
can not be resolved to a valid relationship
in the entity's model, or if a valid inverse relationship can not be
found.
For example, suppose an Employee object has a relationship called
department
to a Department object,
and Department has a relationship called employees
back to Employee. Invoking inverseForRelationshipKey
on
an instance of Employee with the argument "department" will
return the string "employees".
inverseForRelationshipKey
in class EOClassDescription
relationshipKey
- The name of a relationship owned by the receiver's entity.relationshipKey
, or null
.public boolean ownsDestinationObjectsForRelationshipKey(String relationshipKey)
true
if the the objects at the destination of
the relationship specified by relationshipKey
should be
deleted if they are removed from the relationship rather than transferred
to the corresponding relationship of another object. Returns false
otherwise.
For example, an Invoice object owns its line items. If a LineItem object is removed from an Invoice, it should be deleted since it can not exist outside of an Invoice. In the common case, this behavior for an Enterprise Object is defined in its EOModel.
ownsDestinationObjectsForRelationshipKey
in class EOClassDescription
relationshipKey
- The name of a relationship of the receiver's entity.true
if destination objects should be deleted.protected Object readResolve() throws ObjectStreamException
public EOClassDescription superClassDescription()
null
.superClassDescription
in class EOClassDescription
null
.public NSArray toManyRelationshipKeys()
toManyRelationshipKeys
in class EOClassDescription
public NSArray toOneRelationshipKeys()
toOneRelationshipKeys
in class EOClassDescription
public void validateObjectForDelete(EOEnterpriseObject object) throws NSValidation.ValidationException
object
. If the
delete operation can proceed, this method returns normally. If the delete
operation should not proceed, an NSValidation.ValidationException is
thrown. Validation for deletion will fail if the delete rule for any
relationship owned by object
is DeleteRuleDeny
and
there are related destination objects.validateObjectForDelete
in class EOClassDescription
object
- An Enterprise Object to be deleted.NSValidation.ValidationException
- if the delete operation
should not proceed.public Exception validateObjectForSave(Object object)
null
.object
- An object to be validated.null
public Object validateValueForKey(Object valueP, String key) throws NSValidation.ValidationException
valueP
using the property named
key
. If key
can be resolved to an attribute
of the receiver's entity, that attribute will attempt to validate
valueP
. Otherwise, if key
can be resolved to a
relationship of the receiver's entity, that relationship will attempt to
validate valueP
. In either case, the validating property
will return valueP
unchanged if validation was successful and
no conversion was required or will return the coerced value if valueP
required some type of conversion and validation was successful.
If key
is not the name of a property of the receiver's entity,
valueP
is returned unchanged. Throws an exception if any error
occurs during validation.
validateValueForKey
in class EOClassDescription
valueP
- The value to be validated.key
- The name of an attribute or relationship of the receiver's entity.NSValidation.ValidationException
- if validation fails.EOAttribute.validateValue(Object valueP)
,
EORelationship.validateValue(Object valueP)
,
EOValidation
|
Last updated Fri Feb 21 13:15:00 PST 2003. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |