General question about copyAll() method [message #665251] |
Wed, 13 April 2011 21:21 |
Vinny Messages: 20 Registered: July 2009 |
Junior Member |
|
|
I have an eObject that I'm copying via the ECoreUtil.copyAll() method. The XMI files below are of the source and the copy.
Also, 'subflow' below is a non-containment reference of 'myThing'.
//This is the source XMI of the copy (the correct version):
<?xml version="1.0" encoding="ASCII"?>
<com.blah.myThing xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" identity="a1d8662a-7700-4c75-aa04-8f4f2a8c8791" name="The name of myThing">
<subflow href=" ../SomeDir/c38435b4-9c59-4a61-8979-8bcc9da03400.testflow#c38 435b4-9c59-4a61-8979-8bcc9da03400 "/>
</com.blah.myThing>
//This is the destination XMI of the copy (the messed up version):
<?xml version="1.0" encoding="ASCII"?>
<com.blah.myThing xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" identity="a1d8662a-7700-4c75-aa04-8f4f2a8c8791" name="The name of myThing" subflow="c38435b4-9c59-4a61-8979-8bcc9da03400">
</com.blah.myThing>
My Question, is there a general issue that anyone sees that would make the copyAll() method create my "subflow" reference as an "attribute" not as an "href", as in my source? I see this in a few different places so I know I'm doing something consistently wrong.
[Updated on: Wed, 13 April 2011 21:22] Report message to a moderator
|
|
|
Re: General question about copyAll() method [message #665268 is a reply to message #665251] |
Wed, 13 April 2011 23:55 |
Eclipse User |
|
|
|
Originally posted by: jonas.helming.googlemail.com
Hi Vinny,
the copyAll method creates a self-contained version of the eObject,
therefore it will cut all references. Otherwise they would be dangling
in the copy. Maybe you can solve this based on your domain model. The
problem with a generic solution is that you never know where to stop
including references in the copy. That could copy the whole model.
Cheers
Jonas
Am 13.04.2011 23:21, schrieb Vinny:
> I have an eObject that I'm copying vie the ECoreUtil.copyAll() method.
> The XMI files below are of the source and the copy:
>
> 'subflow' below is a non-containment reference of 'myThing'.
>
>
> //This is the source XMI of the copy (the correct version):
>
> <?xml version="1.0" encoding="ASCII"?>
> <com.blah.myThing xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> identity="a1d8662a-7700-4c75-aa04-8f4f2a8c8791" name="Do Something">
> <subflow href="
> ../SomeDir/c38435b4-9c59-4a61-8979-8bcc9da03400.testflow#c38
> 435b4-9c59-4a61-8979-8bcc9da03400 "/>
> </com.blah.myThing>
>
>
> //This is the destination XMI of the copy (the messed up version):
>
> <?xml version="1.0" encoding="ASCII"?>
> <com.blah.myThing xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> identity="a1d8662a-7700-4c75-aa04-8f4f2a8c8791" name="Do Something"
> subflow="c38435b4-9c59-4a61-8979-8bcc9da03400">
> </com.blah.myThing>
>
>
> My Question, is there a general issue that anyone sees that would make
> the copyAll() method create my "subflow" reference as an "attribute" not
> as an "href", as in my source? I see this in a few different places so I
> know I'm doing something consistently wrong.
|
|
|
Re: General question about copyAll() method [message #665270 is a reply to message #665251] |
Thu, 14 April 2011 00:39 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Vinny,
It sounds like you might be copying the referenced subflow as part of
the copyAll but you're not putting it in a new resource so it's a
dangling reference as Jonas suggests, but because it has an intrinsic
ID, the serializer doesn't end up barfing.
Note that in general, if all references are in the same document, XMI
will serialize them as an attribute that lists all the space-separated IDs.
Vinny wrote:
> I have an eObject that I'm copying vie the ECoreUtil.copyAll()
> method. The XMI files below are of the source and the copy:
>
> 'subflow' below is a non-containment reference of 'myThing'.
>
>
> //This is the source XMI of the copy (the correct version):
>
> <?xml version="1.0" encoding="ASCII"?>
> <com.blah.myThing xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> identity="a1d8662a-7700-4c75-aa04-8f4f2a8c8791" name="Do Something">
> <subflow href="
> ../SomeDir/c38435b4-9c59-4a61-8979-8bcc9da03400.testflow#c38
> 435b4-9c59-4a61-8979-8bcc9da03400 "/>
> </com.blah.myThing>
>
>
> //This is the destination XMI of the copy (the messed up version):
>
> <?xml version="1.0" encoding="ASCII"?>
> <com.blah.myThing xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> identity="a1d8662a-7700-4c75-aa04-8f4f2a8c8791" name="Do Something"
> subflow="c38435b4-9c59-4a61-8979-8bcc9da03400">
> </com.blah.myThing>
>
>
> My Question, is there a general issue that anyone sees that would make
> the copyAll() method create my "subflow" reference as an "attribute"
> not as an "href", as in my source? I see this in a few different
> places so I know I'm doing something consistently wrong.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03958 seconds