Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] CDOObject containment problems
[CDO] CDOObject containment problems [message #425915] Thu, 11 December 2008 17:11 Go to next message
David Bonneau is currently offline David BonneauFriend
Messages: 28
Registered: July 2009
Junior Member
Hi all,

I have a problem with resources in CDO. I have the following EMF model :
Data
name : String
Folder -> Datas
contents : 0..* Datas (containment = true)
File -> Data

The model is composed of Datas, a Data can be a Folder or a File. A
Folder can contains Datas, i.e. Files and Folders

I have a first resource : resource1 wich contains a instance of a File :
myFile

I have a second resource : resource2 which contains a instance of a
Folder : myFolder.

When I add myFile (of resource1) in myFolder (of resource2) it is
automatically removed from resource1. It is done in eBasicSetContainer
method of CDOObjectImpl class.

It seems that it works with pure EMF Resources. How can I manage this
kind of containment with CDO ?


David
Re: [CDO] CDOObject containment problems [message #425918 is a reply to message #425915] Thu, 11 December 2008 20:10 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6481
Registered: July 2009
Senior Member
David,

I think you're asking for "containment proxy" support, i.e. the ability
of an object to be directly contained in both a Resource and another
EObject, right?

In CDO 2.0 this should be supported:

246705: Support containment proxies
https://bugs.eclipse.org/bugs/show_bug.cgi?id=246705

But not in CDO 1.0.x!

Personally I never used this feature of EMF but isn't it done via
eSetDirectResource() or so?

Cheers
/Eike

----
http://thegordian.blogspot.com




David Bonneau schrieb:
> Hi all,
>
> I have a problem with resources in CDO. I have the following EMF model :
> Data
> name : String
> Folder -> Datas
> contents : 0..* Datas (containment = true)
> File -> Data
>
> The model is composed of Datas, a Data can be a Folder or a File. A
> Folder can contains Datas, i.e. Files and Folders
>
> I have a first resource : resource1 wich contains a instance of a File
> : myFile
>
> I have a second resource : resource2 which contains a instance of a
> Folder : myFolder.
>
> When I add myFile (of resource1) in myFolder (of resource2) it is
> automatically removed from resource1. It is done in eBasicSetContainer
> method of CDOObjectImpl class.
>
> It seems that it works with pure EMF Resources. How can I manage this
> kind of containment with CDO ?
>
>
> David
>


Re: [CDO] CDOObject containment problems [message #425919 is a reply to message #425918] Thu, 11 December 2008 20:47 Go to previous messageGo to next message
Simon Mc Duff is currently offline Simon Mc DuffFriend
Messages: 596
Registered: July 2009
Senior Member
Based on the work I've done you don't need to do anything special..

Here an example:


resource.getContent().add(objectA);
container.getElements().add(objectA);

if containment proxy is turned on... objectsA will not be removed from
resource when you add it to container....

(if I remember correctly).

Simon


Eike Stepper wrote:
> David,
>
> I think you're asking for "containment proxy" support, i.e. the ability
> of an object to be directly contained in both a Resource and another
> EObject, right?
>
> In CDO 2.0 this should be supported:
>
> 246705: Support containment proxies
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=246705
>
> But not in CDO 1.0.x!
>
> Personally I never used this feature of EMF but isn't it done via
> eSetDirectResource() or so?
>
> Cheers
> /Eike
>
> ----
> http://thegordian.blogspot.com
>
>
>
>
> David Bonneau schrieb:
>> Hi all,
>>
>> I have a problem with resources in CDO. I have the following EMF model :
>> Data
>> name : String
>> Folder -> Datas
>> contents : 0..* Datas (containment = true)
>> File -> Data
>>
>> The model is composed of Datas, a Data can be a Folder or a File. A
>> Folder can contains Datas, i.e. Files and Folders
>>
>> I have a first resource : resource1 wich contains a instance of a File
>> : myFile
>>
>> I have a second resource : resource2 which contains a instance of a
>> Folder : myFolder.
>>
>> When I add myFile (of resource1) in myFolder (of resource2) it is
>> automatically removed from resource1. It is done in eBasicSetContainer
>> method of CDOObjectImpl class.
>>
>> It seems that it works with pure EMF Resources. How can I manage this
>> kind of containment with CDO ?
>>
>>
>> David
>>
Re: [CDO] CDOObject containment problems [message #425920 is a reply to message #425915] Thu, 11 December 2008 20:54 Go to previous messageGo to next message
Simon Mc Duff is currently offline Simon Mc DuffFriend
Messages: 596
Registered: July 2009
Senior Member
It should be supported:

In your genmodel be sure you have the following set:

..genmodel

containment proxies = true

..ecore (under your relation)

resolve proxy should be true
containment = true

(maybe some of them doesn't need to be set... )

Let me know if it is working.

Simon



David Bonneau wrote:
> Hi all,
>
> I have a problem with resources in CDO. I have the following EMF model :
> Data
> name : String
> Folder -> Datas
> contents : 0..* Datas (containment = true)
> File -> Data
>
> The model is composed of Datas, a Data can be a Folder or a File. A
> Folder can contains Datas, i.e. Files and Folders
>
> I have a first resource : resource1 wich contains a instance of a File :
> myFile
>
> I have a second resource : resource2 which contains a instance of a
> Folder : myFolder.
>
> When I add myFile (of resource1) in myFolder (of resource2) it is
> automatically removed from resource1. It is done in eBasicSetContainer
> method of CDOObjectImpl class.
>
> It seems that it works with pure EMF Resources. How can I manage this
> kind of containment with CDO ?
>
>
> David
>
Re: [CDO] CDOObject containment problems [message #425931 is a reply to message #425920] Fri, 12 December 2008 10:21 Go to previous messageGo to next message
David Bonneau is currently offline David BonneauFriend
Messages: 28
Registered: July 2009
Junior Member
Simon, Eike, thanks for your help !

In my genmodel Containment Proxies property was false. I set it to true
and now it works :)

Now I have an exception : Unable to provideCDOID. I think it's me, I'm
doing things wrong.

I have on transaction where I create
- a Folder : myFolder
- a Resource : fileResource
- a File : myFile
- I add myFile in fileResource : fileResource -> myFile
- commit : OK
- I add myFile in myFolder : fileResource -> myFile <- myFolder
- commit : ! OK : unable to provideCDOID: fr.exemple.FolderImpl

I think, I understand why I have an exception : the CDOObject myFolder
doesn't belong to a Resource, if I do it, it works.

Is it a bug ?

David
Re: [CDO] CDOObject containment problems [message #425932 is a reply to message #425931] Fri, 12 December 2008 12:33 Go to previous messageGo to next message
Simon Mc Duff is currently offline Simon Mc DuffFriend
Messages: 596
Registered: July 2009
Senior Member
hi David,

Does containment = true is set for the relationship: myFolder->myFile ?

Simon


David Bonneau wrote:
> Simon, Eike, thanks for your help !
>
> In my genmodel Containment Proxies property was false. I set it to true
> and now it works :)
>
> Now I have an exception : Unable to provideCDOID. I think it's me, I'm
> doing things wrong.
>
> I have on transaction where I create
> - a Folder : myFolder
> - a Resource : fileResource
> - a File : myFile
> - I add myFile in fileResource : fileResource -> myFile
> - commit : OK
> - I add myFile in myFolder : fileResource -> myFile <- myFolder
> - commit : ! OK : unable to provideCDOID: fr.exemple.FolderImpl
>
> I think, I understand why I have an exception : the CDOObject myFolder
> doesn't belong to a Resource, if I do it, it works.
>
> Is it a bug ?
>
> David
>
>
Re: [CDO] CDOObject containment problems [message #425934 is a reply to message #425932] Fri, 12 December 2008 13:38 Go to previous messageGo to next message
David Bonneau is currently offline David BonneauFriend
Messages: 28
Registered: July 2009
Junior Member
Simon McDuff a écrit :
> hi David,
>
> Does containment = true is set for the relationship: myFolder->myFile ?

Yes

>
> Simon
>
>
> David Bonneau wrote:
>> Simon, Eike, thanks for your help !
>>
>> In my genmodel Containment Proxies property was false. I set it to
>> true and now it works :)
>>
>> Now I have an exception : Unable to provideCDOID. I think it's me, I'm
>> doing things wrong.
>>
>> I have on transaction where I create
>> - a Folder : myFolder
>> - a Resource : fileResource
>> - a File : myFile
>> - I add myFile in fileResource : fileResource -> myFile
>> - commit : OK
>> - I add myFile in myFolder : fileResource -> myFile <- myFolder
>> - commit : ! OK : unable to provideCDOID: fr.exemple.FolderImpl
>>
>> I think, I understand why I have an exception : the CDOObject myFolder
>> doesn't belong to a Resource, if I do it, it works.
>>
>> Is it a bug ?
>>
>> David
>>
>>
Re: [CDO] CDOObject containment problems [message #425936 is a reply to message #425934] Fri, 12 December 2008 14:08 Go to previous messageGo to next message
Simon Mc Duff is currently offline Simon Mc DuffFriend
Messages: 596
Registered: July 2009
Senior Member
I've created a testcases and it worked... so I don't know what is
missing... Could you send me your .ecore and .genmodel ? (or the all
project) (you can open a buzilla :-))

Can you tell me which version of CDO you are using ?

Simon

David Bonneau wrote:
> Simon McDuff a écrit :
>> hi David,
>>
>> Does containment = true is set for the relationship: myFolder->myFile ?
>
> Yes
>
>>
>> Simon
>>
>>
>> David Bonneau wrote:
>>> Simon, Eike, thanks for your help !
>>>
>>> In my genmodel Containment Proxies property was false. I set it to
>>> true and now it works :)
>>>
>>> Now I have an exception : Unable to provideCDOID. I think it's me,
>>> I'm doing things wrong.
>>>
>>> I have on transaction where I create
>>> - a Folder : myFolder
>>> - a Resource : fileResource
>>> - a File : myFile
>>> - I add myFile in fileResource : fileResource -> myFile
>>> - commit : OK
>>> - I add myFile in myFolder : fileResource -> myFile <- myFolder
>>> - commit : ! OK : unable to provideCDOID: fr.exemple.FolderImpl
>>>
>>> I think, I understand why I have an exception : the CDOObject
>>> myFolder doesn't belong to a Resource, if I do it, it works.
>>>
>>> Is it a bug ?
>>>
>>> David
>>>
>>>
Re: [CDO] CDOObject containment problems [message #425977 is a reply to message #425936] Mon, 15 December 2008 08:25 Go to previous message
David Bonneau is currently offline David BonneauFriend
Messages: 28
Registered: July 2009
Junior Member
I created a bugzilla with a Junit Test Case :
https://bugs.eclipse.org/bugs/show_bug.cgi?id=258780

David

Simon McDuff a écrit :
> I've created a testcases and it worked... so I don't know what is
> missing... Could you send me your .ecore and .genmodel ? (or the all
> project) (you can open a buzilla :-))
>
> Can you tell me which version of CDO you are using ?
>
> Simon
>
> David Bonneau wrote:
>> Simon McDuff a écrit :
>>> hi David,
>>>
>>> Does containment = true is set for the relationship: myFolder->myFile ?
>>
>> Yes
>>
>>>
>>> Simon
>>>
>>>
>>> David Bonneau wrote:
>>>> Simon, Eike, thanks for your help !
>>>>
>>>> In my genmodel Containment Proxies property was false. I set it to
>>>> true and now it works :)
>>>>
>>>> Now I have an exception : Unable to provideCDOID. I think it's me,
>>>> I'm doing things wrong.
>>>>
>>>> I have on transaction where I create
>>>> - a Folder : myFolder
>>>> - a Resource : fileResource
>>>> - a File : myFile
>>>> - I add myFile in fileResource : fileResource -> myFile
>>>> - commit : OK
>>>> - I add myFile in myFolder : fileResource -> myFile <- myFolder
>>>> - commit : ! OK : unable to provideCDOID: fr.exemple.FolderImpl
>>>>
>>>> I think, I understand why I have an exception : the CDOObject
>>>> myFolder doesn't belong to a Resource, if I do it, it works.
>>>>
>>>> Is it a bug ?
>>>>
>>>> David
>>>>
>>>>
Previous Topic:Auto-create node's children
Next Topic:Creating EMap Entries
Goto Forum:
  


Current Time: Fri Feb 21 10:39:41 GMT 2020

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

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

Back to the top