Re: Accessing Deleted Object
Re: Accessing Deleted Object
- Subject: Re: Accessing Deleted Object
- From: Chuck Hill <email@hidden>
- Date: Thu, 15 Jan 2004 09:52:11 -0800
One sort of reliable test is:
public boolean hasObjectBeenDeleted() {
return anObject().editingContext() == null;
}
It will also return true for an object that has not yet been inserted into
an EC, but you should not be playing with those anyway. Then you could
implement takeValues to be
...
if ( ! hasObjectBeenDeleted()) super.takeValues...
And probably the same for invokeAction, then handle the error in
appendToResponse.
The other thing to do is to listen to the
EditingContextDidSaveChangesNotification and take action if your object is
in the deleted list.
Chuck
At 03:23 PM 14/01/2004 -0500, Lon Baker wrote:
>Hello,
>
>I am trying to track down a solution for an error I am seeing.
>
>User A - Views an object
>User B - Views an object
>
>User A - Deletes the object
>User B - Takes action on the object, triggering an error.
>
>I currently am overriding invokeAction and appendToResponse to try and
>catch these objects by making sure they are valid and in worst case
>catch the exception and send them back to the previous page.
>
>The error that I am not able to catch is when the page awakes
>sporadically it throws an error due to the use of WOConditional on the
>page to show certain content.
>
>Does anyone know a solution? One solution which I am considering
>implementing that has been recommended is not allowing the immediate
>deletion of objects. Instead mark it for deletion to be handle in
>batches later.
>
>Any ideas or comments are appreciated.
>
>Thanks,
>Lon Baker
>_______________________________________________
>webobjects-dev mailing list | email@hidden
>Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
>Do not post admin requests to the list. They will be ignored.
>
--
Chuck Hill email@hidden
Global Village Consulting Inc. http://www.global-village.net
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.