Save EList [message #424852] |
Thu, 06 November 2008 21:13  |
Eclipse User |
|
|
|
Hello,
i have an Object with two multi-valued attributes. One of these
attributes is editable over a gmf editor. the other attribute is
effected programmatically. When i save the object, there is only the
first attribute saved. The second is not in the xmi representation. Why
is that?
Thanks for your help
Jörg Oelerink
|
|
|
|
|
Re: Save EList [message #424899 is a reply to message #424897] |
Mon, 10 November 2008 06:25   |
Eclipse User |
|
|
|
Jörg,
I see. Only an XMIResourceImpl will save multiple root objects, because
it serializes a "fake" XMI root elememt. An XMLResourceImpl will only
save a single root object, so you'd need to define a class whose
instances can hold multiple objects and use one of those as the root.
Jörg wrote:
> Hello,
>
> thanks a lot,but it depends on the containment feature. I add every
> single element on this way:
> resource.getContents().add((EObject) entry.getValue());
>
> is there a better way, so i can have containments, which are saved in
> the xmi representation?
>
> Greetings
>
> Ed Merks schrieb:
>> Jörg,
>>
>> Maybe it's marked with EStructuralFeature.transient being true? Of
>> maybe EObject.eIsSet(<feature>) returns false indicating the value is
>> not or or isn't different from the default.
>>
>>
>> Jörg wrote:
>>> Hello,
>>>
>>> i have an Object with two multi-valued attributes. One of these
>>> attributes is editable over a gmf editor. the other attribute is
>>> effected programmatically. When i save the object, there is only the
>>> first attribute saved. The second is not in the xmi representation.
>>> Why is that?
>>>
>>> Thanks for your help
>>> Jörg Oelerink
|
|
|
Re: Save EList [message #424936 is a reply to message #424899] |
Tue, 11 November 2008 04:36   |
Eclipse User |
|
|
|
Hello,
hmm multiple roots would be okay, i need the correct childrentree. but
in the xml representation he has now one root with no childs. The
rootelement has children in a contained elist. How can i get them into
the resource. the add method ignores now the none root elements.
Thanks
Jörg
Ed Merks schrieb:
> Jörg,
>
> I see. Only an XMIResourceImpl will save multiple root objects, because
> it serializes a "fake" XMI root elememt. An XMLResourceImpl will only
> save a single root object, so you'd need to define a class whose
> instances can hold multiple objects and use one of those as the root.
>
>
> Jörg wrote:
>> Hello,
>>
>> thanks a lot,but it depends on the containment feature. I add every
>> single element on this way:
>> resource.getContents().add((EObject) entry.getValue());
>>
>> is there a better way, so i can have containments, which are saved in
>> the xmi representation?
>>
>> Greetings
>>
>> Ed Merks schrieb:
>>> Jörg,
>>>
>>> Maybe it's marked with EStructuralFeature.transient being true? Of
>>> maybe EObject.eIsSet(<feature>) returns false indicating the value is
>>> not or or isn't different from the default.
>>>
>>>
>>> Jörg wrote:
>>>> Hello,
>>>>
>>>> i have an Object with two multi-valued attributes. One of these
>>>> attributes is editable over a gmf editor. the other attribute is
>>>> effected programmatically. When i save the object, there is only the
>>>> first attribute saved. The second is not in the xmi representation.
>>>> Why is that?
>>>>
>>>> Thanks for your help
>>>> Jörg Oelerink
|
|
|
Re: Save EList [message #424938 is a reply to message #424936] |
Tue, 11 November 2008 06:55   |
Eclipse User |
|
|
|
Jörg,
Keep in mind that generally adding a child to the contents of a resource
will remove it from the parent. So perhaps you need to be more careful
that if eContainer() != null and if eResource() != null that you don't
try to add that object to the root of a resource because it's already
indirectly contained by a resource.
Jörg wrote:
> Hello,
>
> hmm multiple roots would be okay, i need the correct childrentree. but
> in the xml representation he has now one root with no childs. The
> rootelement has children in a contained elist. How can i get them into
> the resource. the add method ignores now the none root elements.
> Thanks
>
> Jörg
>
> Ed Merks schrieb:
>> Jörg,
>>
>> I see. Only an XMIResourceImpl will save multiple root objects,
>> because it serializes a "fake" XMI root elememt. An XMLResourceImpl
>> will only save a single root object, so you'd need to define a class
>> whose instances can hold multiple objects and use one of those as the
>> root.
>>
>>
>> Jörg wrote:
>>> Hello,
>>>
>>> thanks a lot,but it depends on the containment feature. I add every
>>> single element on this way:
>>> resource.getContents().add((EObject) entry.getValue());
>>>
>>> is there a better way, so i can have containments, which are saved
>>> in the xmi representation?
>>>
>>> Greetings
>>>
>>> Ed Merks schrieb:
>>>> Jörg,
>>>>
>>>> Maybe it's marked with EStructuralFeature.transient being true? Of
>>>> maybe EObject.eIsSet(<feature>) returns false indicating the value
>>>> is not or or isn't different from the default.
>>>>
>>>>
>>>> Jörg wrote:
>>>>> Hello,
>>>>>
>>>>> i have an Object with two multi-valued attributes. One of these
>>>>> attributes is editable over a gmf editor. the other attribute is
>>>>> effected programmatically. When i save the object, there is only
>>>>> the first attribute saved. The second is not in the xmi
>>>>> representation. Why is that?
>>>>>
>>>>> Thanks for your help
>>>>> Jörg Oelerink
|
|
|
Re: Save EList [message #424951 is a reply to message #424938] |
Tue, 11 November 2008 10:22  |
Eclipse User |
|
|
|
Thanks a lot. Now i got it.
Ed Merks schrieb:
> Jörg,
>
> Keep in mind that generally adding a child to the contents of a resource
> will remove it from the parent. So perhaps you need to be more careful
> that if eContainer() != null and if eResource() != null that you don't
> try to add that object to the root of a resource because it's already
> indirectly contained by a resource.
>
>
> Jörg wrote:
>> Hello,
>>
>> hmm multiple roots would be okay, i need the correct childrentree. but
>> in the xml representation he has now one root with no childs. The
>> rootelement has children in a contained elist. How can i get them into
>> the resource. the add method ignores now the none root elements.
>> Thanks
>>
>> Jörg
>>
>> Ed Merks schrieb:
>>> Jörg,
>>>
>>> I see. Only an XMIResourceImpl will save multiple root objects,
>>> because it serializes a "fake" XMI root elememt. An XMLResourceImpl
>>> will only save a single root object, so you'd need to define a class
>>> whose instances can hold multiple objects and use one of those as the
>>> root.
>>>
>>>
>>> Jörg wrote:
>>>> Hello,
>>>>
>>>> thanks a lot,but it depends on the containment feature. I add every
>>>> single element on this way:
>>>> resource.getContents().add((EObject) entry.getValue());
>>>>
>>>> is there a better way, so i can have containments, which are saved
>>>> in the xmi representation?
>>>>
>>>> Greetings
>>>>
>>>> Ed Merks schrieb:
>>>>> Jörg,
>>>>>
>>>>> Maybe it's marked with EStructuralFeature.transient being true? Of
>>>>> maybe EObject.eIsSet(<feature>) returns false indicating the value
>>>>> is not or or isn't different from the default.
>>>>>
>>>>>
>>>>> Jörg wrote:
>>>>>> Hello,
>>>>>>
>>>>>> i have an Object with two multi-valued attributes. One of these
>>>>>> attributes is editable over a gmf editor. the other attribute is
>>>>>> effected programmatically. When i save the object, there is only
>>>>>> the first attribute saved. The second is not in the xmi
>>>>>> representation. Why is that?
>>>>>>
>>>>>> Thanks for your help
>>>>>> Jörg Oelerink
|
|
|
Powered by
FUDForum. Page generated in 0.05189 seconds