• 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: Testing if an EO would be deletable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Testing if an EO would be deletable


  • Subject: Re: Testing if an EO would be deletable
  • From: Chuck Hill <email@hidden>
  • Date: Tue, 19 Jan 2010 10:46:54 -0800


On Jan 19, 2010, at 1:47 AM, Paul Hoadley wrote:

Hello,

I was just reading Johan Henselmans's thread entitled "validating deleting an object with relationship", and it reminded me of a similar question I had recently: is there a convenient way to ask EOF if a particular EO _would be_ deletable if I tried to delete it?

No. The stock validateForDelete() does not follow the the relationships and call validateForDelete() on the to-many with a Cascade delete rule. This does not happen until saveChanges().



I have a component where I list some EOs, and I want to offer a "Delete" hyperlink next to only those which would be deletable given the model's delete rules. Is the easiest way to do this to call validateForDelete() and see if it throws a ValidationException? I assume that would answer the question, it just seems a bit clumsy.


That will answer it for that one object directly, but the delete may be thwarted by a related object's validateForDelete(). I'd add a custom method like public boolean canBeDeleted() and then also use that in validateForDelete().

Chuck


-- Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects








_______________________________________________
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: Testing if an EO would be deletable
      • From: Paul Hoadley <email@hidden>
References: 
 >Testing if an EO would be deletable (From: Paul Hoadley <email@hidden>)

  • Prev by Date: Re: Testing if an EO would be deletable
  • Next by Date: Re: AjaxUtils.redirectTo() and IE7
  • Previous by thread: Re: Testing if an EO would be deletable
  • Next by thread: Re: Testing if an EO would be deletable
  • Index(es):
    • Date
    • Thread