Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] CDOID changes when CDOObject is moved - bug or not?
[CDO] CDOID changes when CDOObject is moved - bug or not? [message #431640] Mon, 20 July 2009 05:20 Go to next message
Caspar D. is currently offline Caspar D.Friend
Messages: 35
Registered: July 2009
Member
When a CDOObject is moved from one place in the graph to another, by means
of an either an EMF DragAndDropCommand, or, equivalently, a RemoveCommand
followed by an AddCommand, it gets assigned a new CDOID.

This is obviously a consequence of the state changes that are brought
about by this remove-then-add-back approach: the removal cycles the
object's state from CLEAN to TRANSIENT, and then the adding back cycles it
from TRANSIENT to NEW, which results in a new CDOID.

Not removing the object first, but just adding it elsewhere, avoids this
problem, but causes other problems: the RemoveCommand indeed serves a
definite purpose, as was recently pointed out to me by Ed in
http://bugs.eclipse.org/283527

So it seems that it's currently impossible to move a CDOObject around in
the graph, without changing its CDOID... does this make sense?
Re: [CDO] CDOID changes when CDOObject is moved - bug or not? [message #431641 is a reply to message #431640] Mon, 20 July 2009 06:21 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6457
Registered: July 2009
Senior Member
Caspar,

As you figured out there is an essential difference in CDO between

1) moving an object within a persistent (attached) object graph
2) detach/reattach an object

Whenever an object is detached from the graph it looses all its
CDO-specific properties: id, state, view and revision.

Can you please explain why a conceptual move in your and Ed's opinion
must go through a remove?

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper




Caspar De Groot schrieb:
> When a CDOObject is moved from one place in the graph to another, by
> means of an either an EMF DragAndDropCommand, or, equivalently, a
> RemoveCommand followed by an AddCommand, it gets assigned a new CDOID.
>
> This is obviously a consequence of the state changes that are brought
> about by this remove-then-add-back approach: the removal cycles the
> object's state from CLEAN to TRANSIENT, and then the adding back
> cycles it from TRANSIENT to NEW, which results in a new CDOID.
>
> Not removing the object first, but just adding it elsewhere, avoids
> this problem, but causes other problems: the RemoveCommand indeed
> serves a definite purpose, as was recently pointed out to me by Ed in
> http://bugs.eclipse.org/283527
>
> So it seems that it's currently impossible to move a CDOObject around
> in the graph, without changing its CDOID... does this make sense?
>


Re: [CDO] CDOID changes when CDOObject is moved - bug or not? [message #431644 is a reply to message #431641] Mon, 20 July 2009 09:43 Go to previous messageGo to next message
Caspar D. is currently offline Caspar D.Friend
Messages: 35
Registered: July 2009
Member
Eike,

An AddCommand, by itself, is not adequate for *moving* objects, because it
doesn't take responsibility for properly restoring eOpposites when its
#undo method is called. In other words, the AddCommand is only meant for
adding *unattached* objects to a parent.

A move operation, such as effected by EMF's DragAndDropCommand, is
therefore synthesized from a RemoveCommand (which takes care of restoring
eOpposites in case of an undo) and an AddCommand.
Re: [CDO] CDOID changes when CDOObject is moved - bug or not? [message #431645 is a reply to message #431641] Mon, 20 July 2009 10:03 Go to previous message
Caspar D. is currently offline Caspar D.Friend
Messages: 35
Registered: July 2009
Member
Open Bugzilla 283985, as agreed.
Previous Topic:[CDO] Thread race condition with two transactions.
Next Topic:Storing xml commets in emf object
Goto Forum:
  


Current Time: Tue Dec 10 00:44:21 GMT 2019

Powered by FUDForum. Page generated in 0.01793 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top