Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Utility to copy CDOObject data only(Utility to copy CDOObject data only)
Utility to copy CDOObject data only [message #1006582] Thu, 31 January 2013 22:08 Go to next message
Andrew Whelan is currently offline Andrew WhelanFriend
Messages: 71
Registered: October 2012
Location: Syracuse NY
Member
Lets say I have 2 CDObjects, object1 and object2.

Is there a CDOUtility

copy(object2, object1)

that will allow me to copy only the data elements of object1 into object2 but yet wont effect any of the CDO plumbing of object2(CDOID, CDOView, etc)? I'd like to keep the CDOTransaction and CDOSession of object2 intact. I just want to update its data with that of object1. I was wondering if this is something I need to write myself.

 object2 = EcoreUtil.copy(object1)


Will obviously hose all of the CDO plumbing.
Thanks
-Andrew
Re: Utility to copy CDOObject data only [message #1006609 is a reply to message #1006582] Fri, 01 February 2013 07:17 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 31.01.2013 23:08, schrieb Andrew Whelan:
> Lets say I have 2 CDObjects, object1 and object2.
>
> Is there a CDOUtility
>
> copy(object2, object1)
>
> that will allow me to copy only the data elements of object1 into object2 but yet wont effect any of the CDO plumbing
> of object2(CDOID, CDOView, etc)?
No, the copy of an object is always detached from the graph, which in CDO implies that it's TRANSIENT (i.e., view==null,
id==null).

> I'd like to keep the CDOTransaction and CDOSession of object2 intact. I just want to update its data with that of
> object1.
That's not possible, because the container reference is implicitely bidirectional and leaving it intact would imply to
add the object to the containment reference of its container.

> I was wondering if this is something I need to write myself.
Yes, only you can decide where to attach/add the copied object.

>
> object2 = EcoreUtil.copy(object1)
>
>
> Will obviously hose all of the CDO plumbing.
Yes, and the EMF plumbing (the container reference), too.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Previous Topic:[CDO] CDOTransaction.close
Next Topic:[CDO] Installation of CDO 4.2 failed
Goto Forum:
  


Current Time: Fri Apr 19 00:33:24 GMT 2024

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

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

Back to the top