• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Detecting a deleted object
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Detecting a deleted object


  • Subject: Re: Detecting a deleted object
  • From: Francis Labrie <email@hidden>
  • Date: Sun, 19 Feb 2006 09:56:41 -0500

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Detecting a deleted object
      • From: Kieran Kelleher <email@hidden>
References: 
 >Detecting a deleted object (From: Miguel Arroz <email@hidden>)
 >Re: Detecting a deleted object (From: Kieran Kelleher <email@hidden>)

  • Prev by Date: Re: Detecting a deleted object
  • Next by Date: Stress testing
  • Previous by thread: Re: Detecting a deleted object
  • Next by thread: Re: Detecting a deleted object
  • Index(es):
    • Date
    • Thread