Re: Detecting a deleted object
Re: Detecting a deleted object
- Subject: Re: Detecting a deleted object
- From: Kieran Kelleher <email@hidden>
- Date: Mon, 20 Feb 2006 08:30:05 -0500
Actually, I spoke too soon .... too early in the morning! You can
follow the discussion on the Project Wonder list regarding the
intricacies of detecting a deleted object.
http://sourceforge.net/mailarchive/forum.php?
thread_id=9762338&forum_id=8222
Regards, Kieran
On Feb 20, 2006, at 7:46 AM, Kieran Kelleher wrote:
Hi,
Jonathon Leffert has just checked in a fix to Project Wonder for this,
so latest CVS source is correct. Thanks for highlighting it.
Regards, Kieran
On Feb 19, 2006, at 9:56 AM, Francis Labrie wrote:
Hi,
Kieran Kelleher wrote:
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);
}
Well, there is a bug in this method, because if the editing context
is null, it still return false, unlike said in the JavaDoc... And the
result of the multiple "editingContext()" can even change...
The code would better be like this:
public boolean isDeletedEO() {
EOEditingContext editingContext;
editingContext = editingContext();
if(log.isDebugEnabled()) {
log.debug("editingContext = " + editingContext + " this
object: " + this);
}
return((editingContext == null) ||
editingContext.deletedObjects().containsObject(this));
}
Kind regards,
--
Francis Labrie
Saint-Bruno-de-Montarville, Québec, Canada
_______________________________________________
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:
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