Utility to obtain model root [message #508624] |
Tue, 19 January 2010 16:27 |
Pierre Francis Roy Messages: 12 Registered: July 2009 |
Junior Member |
|
|
Hi,
My application have two models that are persisted using Teneo. Each model have its own root which are contained in a resourceSet loaded from my database.
Here's my model root aggregates (using containment).
Application
Workspaces
Services
Database
Products
Samples
Results
Analysis
I'm searching an effective way to get a reference to Application and Database object from the resource object instead of doing something like this:
Resource resource = editingDomain.getResourceSet().getResource(resourceURI, true);
Application app = (Application) resource.get(0);
Database data = (Database) resource.get(1);
And having to guess that Application will be at index 0 and Database at index 1 (or vice-versa). I saw an article where the examples was using a utility function to easily get the root object, but can't find it back. Can you please give me hints about this subject?
Pierre
|
|
|
Re: Utility to obtain model root [message #508632 is a reply to message #508624] |
Tue, 19 January 2010 11:44 |
Ed Merks Messages: 33137 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------020105090708070809010301
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Pierre,
See EcoreUtil.getObjectByType*.*
Pierre Francis Roy wrote:
> Hi,
>
> My application have two models that are persisted using Teneo. Each
> model have its own root which are contained in a resourceSet loaded
> from my database.
>
> Here's my model root aggregates (using containment).
>
> Application
> Workspaces
> Services
> Database
> Products
> Samples
> Results
> Analysis
>
> I'm searching an effective way to get a reference to Application and
> Database object from the resource object instead of doing something
> like this:
>
> Resource resource =
> editingDomain.getResourceSet().getResource(resourceURI, true);
> Application app = (Application) resource.get(0);
> Database data = (Database) resource.get(1);
>
> And having to guess that Application will be at index 0 and Database
> at index 1 (or vice-versa). I saw an article where the examples was
> using a utility function to easily get the root object, but can't find
> it back. Can you please give me hints about this subject?
>
> Pierre
--------------020105090708070809010301
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Pierre,<br>
<br>
See EcoreUtil.getObjectByType<b>.</b><br>
<br>
<br>
Pierre Francis Roy wrote:
<blockquote cite="mid:hj4mh5$tc3$1@build.eclipse.org" type="cite">Hi,
<br>
<br>
My application have two models that are persisted using Teneo. Each
model have its own root which are contained in a resourceSet loaded
from my database.
<br>
<br>
Here's my model root aggregates (using containment).
<br>
<br>
Application
<br>
Workspaces
<br>
Services
<br>
Database
<br>
Products
<br>
Samples
<br>
Results
<br>
Analysis
<br>
<br>
I'm searching an effective way to get a reference to Application and
Database object from the resource object instead of doing something
like this:
<br>
<br>
Resource resource =
editingDomain.getResourceSet().getResource(resourceURI, true);
<br>
Application app = (Application) resource.get(0);
<br>
Database data = (Database) resource.get(1);
<br>
<br>
And having to guess that Application will be at index 0 and Database at
index 1 (or vice-versa). I saw an article where the examples was using
a utility function to easily get the root object, but can't find it
back. Can you please give me hints about this subject?
<br>
<br>
Pierre
<br>
</blockquote>
</body>
</html>
--------------020105090708070809010301--
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02808 seconds