Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Data Persistence in ELIST - ECLIPSE MODELING FRAMEWORK(Data is getting deleted)
icon5.gif  Data Persistence in ELIST - ECLIPSE MODELING FRAMEWORK [message #1148267] Mon, 21 October 2013 11:36 Go to next message
Arshad Adavani is currently offline Arshad AdavaniFriend
Messages: 163
Registered: July 2013
Location: Bangalore
Senior Member
Hello all,
I have an Elist of Some objects.
Say Elist name is "eobjs" and it has 3 objects namely obj1, obj2, obj3.

Based on some condition I should copy the data present in this list some other java.Util List say "list1".

When I add obj1 from "eobjs" to "list1", No doubt it will be added to "list1" but it is getting deleted from "eobjs" which I don't want.

Can anyone suggest me some way ??

Thanks in advance Smile


Arshad
Re: Data Persistence in ELIST - ECLIPSE MODELING FRAMEWORK [message #1148286 is a reply to message #1148267] Mon, 21 October 2013 11:53 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Arshad,

Comments below.

On 21/10/2013 1:36 PM, Arshad Adavani wrote:
> Hello all,
> I have an Elist of Some objects.
> Say Elist name is "eobjs" and it has 3 objects namely obj1, obj2, obj3.
>
> Based on some condition I should copy the data present in this list
> some other java.Util List say "list1".
>
> When I add obj1 from "eobjs" to "list1", No doubt it will be added to
> "list1" but it is getting deleted from "eobjs" which I don't want.
So you've no doubt omitted some important details. Likely your eobjs
list is a containment list and likely your target list is as well. An
EObject can be in at most one containment list, so yes, adding it to the
target list will remove it from the source list. That's unavoidable. If
you really want to "copy" the objects, you should use EcoreUtil.copyAll
to copy the source objects and then add those copies to the target.
Then the source and target lists will contain what you want, without the
objects being removed from the source.
>
> Can anyone suggest me some way ??
I'm not sure if copying is appropriate for your situation, but it is the
only way if both lists are containment lists.
>
> Thanks in advance :)


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Data Persistence in ELIST - ECLIPSE MODELING FRAMEWORK [message #1148315 is a reply to message #1148286] Mon, 21 October 2013 12:18 Go to previous message
Arshad Adavani is currently offline Arshad AdavaniFriend
Messages: 163
Registered: July 2013
Location: Bangalore
Senior Member
Hello Ed,
Thanks a lot for your suggestion Smile


Arshad
Previous Topic:Creating instance if only the EObject interface is known
Next Topic:Missing reference within EAnnotation in generated code
Goto Forum:
  


Current Time: Thu Mar 28 18:29:34 GMT 2024

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

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

Back to the top