Re: Detecting a deleted object
Re: Detecting a deleted object
- Subject: Re: Detecting a deleted object
- From: Kieran Kelleher <email@hidden>
- Date: Sun, 19 Feb 2006 07:39:12 -0500
The source code in er.extensions.ERXGenericRecord.isDeletedEO() in
Project Wonder looks like this ....
/**
* Determines if this object is a deleted object by
* checking to see if it is included in the deletedObjects
* array of the editing context or if it's editing context
* is null.<br/>
* <br/>
* Note: An object that has just been created will also not
* have an editing context and by this method would test
* positive for being a deleted object.
* @return if the object is a deleted object
*/
// CHECKME: Might be able to tell better by checking EOGlobalIDs
public boolean isDeletedEO() {
if (log.isDebugEnabled())
log.debug("editingContext() = " + editingContext() + " this
object: " + this);
return editingContext() != null &&
editingContext().deletedObjects().containsObject(this);
}
HTH,
Kieran
On Feb 18, 2006, at 4:26 PM, Miguel Arroz wrote:
Hi!
Imagine the following code (I'm writing this directly on the email,
it's possible that it contains errors):
EOEditingContext myContext = getMyContexy();
MyClass myObject =
giveMeSomeObjectOfMyClassSotredOnTheDataStorage(myContext);
myContext.deleteObject(myObject);
myContext.saveChanges();
Right after this, what exactly is myObject? Is there a way to know
that it references a previously deleted object? The only way I can
find is calling myObject.editingContext() and catch a
NullPointerException, but that method is very very dirty... is there a
better way?
Yours
Miguel Arroz
"We have no sympathy for the lost souls
We've chosen the path of disgrace
We give this life to our children
And teach them to hate this place" -- Apocalyptica, Life Burns!
Miguel Arroz
http://www.ipragma.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden