|
Re: [EMF] resolve of a reference [message #705224 is a reply to message #705154] |
Fri, 29 July 2011 15:18 |
Ed Merks Messages: 33217 Registered: July 2009 |
Senior Member |
|
|
Comments below.
On 29/07/2011 6:59 AM, Rimvydas Vaidelis wrote:
> Hi,
>
> I have model:
>
> EClass Folder
> EReference subfolders (type: Folder, containment = true, eOpposite =
> parent)
> EReference parent (type: Folder, eOpposite = subfolders)
>
> Object folderA of type Folder is added into XMIResource resourceA
> contents. Object folderB of type Folder is added into XMIResource
> resourceB contents. folderA.eContents().contains(folderB).
So I assume you have proxy resolving containment here. Not sure if
parent is transient or not...
> Both resources are saved.
>
> Case 1:
>
> resourceB.unload();
> remove parent reference from the resource file (file modification)
> folderA.eContents().get(0).eContainer(); // returns folderA
>
> Case 2:
>
> resourceA.unload();
> remove subfolders reference from the resource file (file modification)
> folderB.eContainer().eContents().contains(folderB) - returns false
>
>
> Question: Why resolving of contents fixes the container but resolving
> of container does not add the object into contents of container ?
Because container features are not necessarily (and often aren't)
serialized. For other types of bidirectional reference, both ends need
to be serialized (if they can span documents), and proxy resolution only
affects one side. We didn't impose that restriction on containment
references to make them a little more flexible, which is possible in
this case because the reference must refer to the root object of a resource.
>
> Thanks in advance for an answer.
>
> Regards,
> Rimvydas Vaidelis
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03001 seconds