Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Manipulating and Changing Objects

The methods in this section manipulate enterprise objects and editing contexts.

EOCustomObject: addObjectToBothSidesOfRelationshipWithKey(EORelationshipManipulationobject, Stringkey)

Use this method to add the enterprise object specified by object as the destination of the relationship specified by key. See “Manipulating Relationships” for more information.

EOEditingContext: deleteObject(EOEnterpriseObjectenterpriseObject)

Use this method to delete an enterprise object from an editing context. If your application connects to a relational database, this method usually results in the removal of a row or rows of data.

EOEditingContext: lock()

Obtains a lock on the receiver. To ensure the integrity of an editing context in multithreaded environments, you must lock an editing context before you invoke operations on it and unlock it afterwards. In a WebObjects application, if you use Session’s defaultEditingContext, you do not need to lock and unlock it; it performs those operations internally.

EOEditingContext: redo()

Reapplies the last set of operations performed on enterprise objects in an editing context that were undone by the undo method. See “Undoing Changes” for more information. You do not usually invoke this method explicitly. Rather, it is usually used only in a desktop application as the invocation target of the Edit menu’s Redo item.

EOEditingContext: revert()

Use this method to restore an editing context to a stable state. See “Discarding Changes.”

EOCustomObject: removeObjectFromBothSidesOfRelationshipWithKey(EORelationshipManipulationobject, Stringkey)

Use this method to remove from the destination of the relationship specified by key the enterprise object specified by object. See “Manipulating Relationships” for more information.

EOEditingContext: saveChanges()

Commits the changes made in an editing context to the data source. See “Flow of Data During a Save” for detailed information on what occurs when this method is invoked.

EOCustomObject: takeValueForKey(Objectvalue, Stringkey)

This method sets the value of an enterprise object’s property identified by key to value. This method is part of the key-value coding infrastructure of Enterprise Objects, in which an object’s properties are accessed by key rather than directly as fields or through accessor methods. This is discussed in more detail in “Accessing an Enterprise Object’s Data.”

EOCustomObject: takeValueForKeyPath(Objectvalue, StringkeyPath)

This method sets the value of a property in an enterprise object that is the destination of an enterprise object’s relationship. keyPath is a String of the form “relationship.property”, in which “relationship” is the name of a relationship in the enterprise object on which this method is invoked and in which value mutates the property identified by the “property” portion of keyPath. This is discussed in more detail in “Accessing an Enterprise Object’s Data.”

EOEditingContext: undo()

Reverses the last set of operations performed on enterprise objects in an editing context. See “Undoing Changes” for more information.

EOEditingContext: unlock()

Releases a lock on the receiver. To ensure the integrity of an editing context in multithreaded environments, you must lock an editing context before you invoke operations on itm, and you must unlock it afterwards. In a WebObjects application, if you use Session’s defaultEditingContext, you do not need to lock and unlock it; it performs those operations internally.

EOCustomObject: validateKey(Objectvalue, Stringkey)

This method is defined in EOCustomObject as validateValueForKey. You never directly invoke that method. Rather, you implement methods of the form validateKey in custom enterprise object classes to validate certain properties. Those methods are then automatically invoked by validateValueForKey.

An implementation that validates the value of a bathrooms property of a Listing enterprise object would have the signature publicObjectvalidateBedrooms(Objectvalue, Stringkey). See “Adding Validation” for more information.



< Previous PageNext Page > Hide TOC


Last updated: 2007-07-11




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice