Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 312186

Summary: Support post event handling for CDOTransactionHandler
Product: [Modeling] EMF Reporter: Martin Fluegge <martin.fluegge>
Component: cdo.coreAssignee: Eike Stepper <stepper>
Status: CLOSED FIXED QA Contact: Eike Stepper <stepper>
Severity: enhancement    
Priority: P3    
Version: 4.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Patch v1
none
Test v1 none

Description Martin Fluegge CLA 2010-05-09 13:39:57 EDT
The CDO TransactionHandler currently handles the pre-events for modifying, attaching and detaching objects. It should also support the execution of operations after the object was manipulated.
Comment 1 Eike Stepper CLA 2010-06-29 04:54:34 EDT
Rebasing all outstanding 3.0 problem reports to version 3.0.1
Comment 2 Eike Stepper CLA 2010-07-04 07:59:05 EDT
Note that this is not possible in 3.0 maintenance!
Comment 3 Martin Fluegge CLA 2010-07-04 09:59:59 EDT
Sorry, forgot to set flag. Good that nothing slips your attention ;)
Comment 4 Martin Fluegge CLA 2010-07-08 06:02:08 EDT
Created attachment 173756 [details]
Patch v1

A first step. Not yet perfect.
Comment 5 Martin Fluegge CLA 2010-07-08 06:03:14 EDT
Created attachment 173757 [details]
Test v1

And here the test. Also not yet perfect ;)
Comment 6 Eike Stepper CLA 2011-06-23 03:59:16 EDT
Moving all open enhancement requests to 4.1
Comment 7 Eike Stepper CLA 2011-07-16 11:35:58 EDT
Martin, do you still want this fix? It looks good to me. 2 issues, though:

1) Are you sure you want to implement CDOTransactionHandler? Or is the newer and reduced CDOTransactionHandler1 more adequate?
2) The test case fails. Please investigate.
Comment 8 Martin Fluegge CLA 2011-07-16 12:24:18 EDT
Honestly, I can't remember why I wanted to implement this. Whatever it was I must have workarounded it in Dawn. But having the flexibilty to react after the transaction handler has finished could be interesting for other.

So yes, I think to look at this issue again would be worth the effort. 

Don't know the CDOTransactionHandler1 interface yet, but I'll check whether it would be better to use this interface.

I'll have a look at this topic soon...
Comment 9 Martin Fluegge CLA 2011-07-22 12:47:58 EDT
This does not seem to be that easy. :(

The problem come from the notification. Take the following scenario: you want to add an object to its container.

From CDO site of view two operation are executed: 
1.) the container is modified (modifying)
2.) that contained element is attached to the container (attaching)

What happens now with the postEventHandler adapter is the following:

First, the container is modified. This adds a MODIFIED_ADAPTER to the container and also (when CDO fires attaching on the transaction handler) a ATTACHED_ADAPTER to the contained child Then all adapters are fired on the object as for any eObject and the post adapter will be notified and removed afterwards. Until this point everything is ok. But when the inverseAdd operation is called for the child, no notification is send on this object, and the ATTACHED_ADAPTER remains inactive until the next operation on the object is performed.

Not sure how to solve this or even really what causes this ;(
Comment 10 Eike Stepper CLA 2012-01-26 02:07:30 EST
commit 54f072db40982a486d25b1099872489b47371756
Comment 11 Eike Stepper CLA 2012-09-21 07:18:43 EDT
Closing.