Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Dynamic attributes value of EMF generated models in GMF editor
Dynamic attributes value of EMF generated models in GMF editor [message #500870] Sun, 29 November 2009 23:11 Go to next message
Syed Imran is currently offline Syed ImranFriend
Messages: 25
Registered: October 2009
Location: Ireland
Junior Member
Hi,



Is it possible to have the Attribute value (Integer) of EMF ecore model be
taken from the database which changes dynamically.



Actually I am making a business model of calculation objects. The values of
these generated EMF objects/models changes according to the business logic.
For example model A and model B attribute value (integer) effects model C
attribute value. Further model C and model D value would affect the value of
model E. So if one manually changes the attribute value of model A it would
ultimately will affect the value of model E.



By using the GMF editor one can calculate the values of different models and
their impact on other models. Can anyone give me a hint on how to do this.



kindly

Syed Imran

[Updated on: Sun, 29 November 2009 23:18]

Report message to a moderator

Re: Dynamic attributes value of EMF generated models in GMF editor [message #500886 is a reply to message #500870] Mon, 30 November 2009 06:00 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Syed,
This can either be implemented in the setter of model A/B or in a service like class which changes/recomputes A, B and C
together.
Assume that model A and B know which C to adapt then they can query for C and recompute C. If model A/B use the
(hibernate) session from their own (hibernate) resource (to query and load C in the same resource) then C will be
committed to the database together with A/B (when the resource is saved).

The main thing is that A/B are loaded through the same hibernate session as C, then A/B will load the correct C and if C
queries for A/B then A/B will be the ones being changed initially.

gr. Martin

Syed Imran wrote:
> Hi,
>
>
>
> Is it possible to have the Attribute value (Integer) of EMF ecore model be
> taken from the database which changes dynamically.
>
>
>
> Actually I am making a business model of calculation objects. The values of
> these generated EMF objects/models changes according to the business logic.
> For example model A and model B attribute value (integer) effects model C
> attribute value. Further model C and model D value would affect the value of
> model E. So if one manually changes the attribute value of model A it would
> ultimately will affect the value of model E.
>
>
>
> By using the GMF editor on can calculate the values of different models and
> their impact on other models. Can anyone give me a hint on how to do this.
>
>
>
> kindly
>
> Syed Imran
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: Dynamic attributes value of EMF generated models in GMF editor [message #500903 is a reply to message #500886] Mon, 30 November 2009 09:13 Go to previous messageGo to next message
Syed Imran is currently offline Syed ImranFriend
Messages: 25
Registered: October 2009
Location: Ireland
Junior Member
Hi Martin,



Thanks for your informative reply, can you me an idea or reference how it
can be implemented in the setter of ecore model A/B.

Following your tutorials in Elver.org, should I be following Dynamic EMF
tutorial and compute the value of attributes and use it in the instance of
efactory.createEAttribute().



Kindly,



Syed Imran







"Martin Taal" <mtaal@elver.org> wrote in message
news:hevn10$p5e$1@build.eclipse.org...
> Hi Syed,
> This can either be implemented in the setter of model A/B or in a service
> like class which changes/recomputes A, B and C together.
> Assume that model A and B know which C to adapt then they can query for C
> and recompute C. If model A/B use the (hibernate) session from their own
> (hibernate) resource (to query and load C in the same resource) then C
> will be committed to the database together with A/B (when the resource is
> saved).
>
> The main thing is that A/B are loaded through the same hibernate session
> as C, then A/B will load the correct C and if C queries for A/B then A/B
> will be the ones being changed initially.
>
> gr. Martin
>
> Syed Imran wrote:
>> Hi,
>>
>>
>>
>> Is it possible to have the Attribute value (Integer) of EMF ecore model
>> be taken from the database which changes dynamically.
>>
>>
>>
>> Actually I am making a business model of calculation objects. The values
>> of these generated EMF objects/models changes according to the business
>> logic. For example model A and model B attribute value (integer) effects
>> model C attribute value. Further model C and model D value would affect
>> the value of model E. So if one manually changes the attribute value of
>> model A it would ultimately will affect the value of model E.
>>
>>
>>
>> By using the GMF editor on can calculate the values of different models
>> and their impact on other models. Can anyone give me a hint on how to do
>> this.
>>
>>
>>
>> kindly
>>
>> Syed Imran
>>
>>
>
>
> --
>
> With Regards, Martin Taal
>
> Springsite/Elver.org
> Office: Hardwareweg 4, 3821 BV Amersfoort
> Postal: Nassaulaan 7, 3941 EC Doorn
> The Netherlands
> Cell: +31 (0)6 288 48 943
> Tel: +31 (0)84 420 2397
> Fax: +31 (0)84 225 9307
> Mail: mtaal@springsite.com - mtaal@elver.org
> Web: www.springsite.com - www.elver.org
Re: Dynamic attributes value of EMF generated models in GMF editor [message #500911 is a reply to message #500903] Mon, 30 November 2009 09:39 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Syed,
Are you talking about setting a value of an eattribute or are you talking about creating new eattributes?

For example the code for the setter in A would be like this:

public void setAValue(Object newValue) {
HibernateResource resource = (HibernateResource)eResource();
Object[] objects = resource.listByQuery(myHqlQueryforE, false);
for (Object o : objects) {
E e = (E)o;
e.setTheOtherValue(....);
}
}
myHqlQueryForE is a HQL query which retrieves the E object(s) which should be changed after a change in A.

The code in B would be similar.

Dynamic EMF is useful for when the model itself changes (so not the values/instances in/of the model).

gr. Martin

Syed Imran wrote:
> Hi Martin,
>
>
>
> Thanks for your informative reply, can you me an idea or reference how it
> can be implemented in the setter of ecore model A/B.
>
> Following your tutorials in Elver.org, should I be following Dynamic EMF
> tutorial and compute the value of attributes and use it in the instance of
> efactory.createEAttribute().
>
>
>
> Kindly,
>
>
>
> Syed Imran
>
>
>
>
>
>
>
> "Martin Taal" <mtaal@elver.org> wrote in message
> news:hevn10$p5e$1@build.eclipse.org...
>> Hi Syed,
>> This can either be implemented in the setter of model A/B or in a service
>> like class which changes/recomputes A, B and C together.
>> Assume that model A and B know which C to adapt then they can query for C
>> and recompute C. If model A/B use the (hibernate) session from their own
>> (hibernate) resource (to query and load C in the same resource) then C
>> will be committed to the database together with A/B (when the resource is
>> saved).
>>
>> The main thing is that A/B are loaded through the same hibernate session
>> as C, then A/B will load the correct C and if C queries for A/B then A/B
>> will be the ones being changed initially.
>>
>> gr. Martin
>>
>> Syed Imran wrote:
>>> Hi,
>>>
>>>
>>>
>>> Is it possible to have the Attribute value (Integer) of EMF ecore model
>>> be taken from the database which changes dynamically.
>>>
>>>
>>>
>>> Actually I am making a business model of calculation objects. The values
>>> of these generated EMF objects/models changes according to the business
>>> logic. For example model A and model B attribute value (integer) effects
>>> model C attribute value. Further model C and model D value would affect
>>> the value of model E. So if one manually changes the attribute value of
>>> model A it would ultimately will affect the value of model E.
>>>
>>>
>>>
>>> By using the GMF editor on can calculate the values of different models
>>> and their impact on other models. Can anyone give me a hint on how to do
>>> this.
>>>
>>>
>>>
>>> kindly
>>>
>>> Syed Imran
>>>
>>>
>>
>> --
>>
>> With Regards, Martin Taal
>>
>> Springsite/Elver.org
>> Office: Hardwareweg 4, 3821 BV Amersfoort
>> Postal: Nassaulaan 7, 3941 EC Doorn
>> The Netherlands
>> Cell: +31 (0)6 288 48 943
>> Tel: +31 (0)84 420 2397
>> Fax: +31 (0)84 225 9307
>> Mail: mtaal@springsite.com - mtaal@elver.org
>> Web: www.springsite.com - www.elver.org
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: Dynamic attributes value of EMF generated models in GMF editor [message #500921 is a reply to message #500911] Mon, 30 November 2009 10:14 Go to previous message
Syed Imran is currently offline Syed ImranFriend
Messages: 25
Registered: October 2009
Location: Ireland
Junior Member
Hi Martin,

It is clear to me now, Thanks a million.

kindly,
Syed Imran


"Martin Taal" <mtaal@elver.org> wrote in message
news:hf03th$1p9$1@build.eclipse.org...
> Hi Syed,
> Are you talking about setting a value of an eattribute or are you talking
> about creating new eattributes?
>
> For example the code for the setter in A would be like this:
>
> public void setAValue(Object newValue) {
> HibernateResource resource = (HibernateResource)eResource();
> Object[] objects = resource.listByQuery(myHqlQueryforE, false);
> for (Object o : objects) {
> E e = (E)o;
> e.setTheOtherValue(....);
> }
> }
> myHqlQueryForE is a HQL query which retrieves the E object(s) which should
> be changed after a change in A.
>
> The code in B would be similar.
>
> Dynamic EMF is useful for when the model itself changes (so not the
> values/instances in/of the model).
>
> gr. Martin
>
> Syed Imran wrote:
>> Hi Martin,
>>
>>
>>
>> Thanks for your informative reply, can you me an idea or reference how it
>> can be implemented in the setter of ecore model A/B.
>>
>> Following your tutorials in Elver.org, should I be following Dynamic EMF
>> tutorial and compute the value of attributes and use it in the instance
>> of efactory.createEAttribute().
>>
>>
>>
>> Kindly,
>>
>>
>>
>> Syed Imran
>>
>>
>>
>>
>>
>>
>>
>> "Martin Taal" <mtaal@elver.org> wrote in message
>> news:hevn10$p5e$1@build.eclipse.org...
>>> Hi Syed,
>>> This can either be implemented in the setter of model A/B or in a
>>> service like class which changes/recomputes A, B and C together.
>>> Assume that model A and B know which C to adapt then they can query for
>>> C and recompute C. If model A/B use the (hibernate) session from their
>>> own (hibernate) resource (to query and load C in the same resource) then
>>> C will be committed to the database together with A/B (when the resource
>>> is saved).
>>>
>>> The main thing is that A/B are loaded through the same hibernate session
>>> as C, then A/B will load the correct C and if C queries for A/B then A/B
>>> will be the ones being changed initially.
>>>
>>> gr. Martin
>>>
>>> Syed Imran wrote:
>>>> Hi,
>>>>
>>>>
>>>>
>>>> Is it possible to have the Attribute value (Integer) of EMF ecore model
>>>> be taken from the database which changes dynamically.
>>>>
>>>>
>>>>
>>>> Actually I am making a business model of calculation objects. The
>>>> values of these generated EMF objects/models changes according to the
>>>> business logic. For example model A and model B attribute value
>>>> (integer) effects model C attribute value. Further model C and model D
>>>> value would affect the value of model E. So if one manually changes the
>>>> attribute value of model A it would ultimately will affect the value of
>>>> model E.
>>>>
>>>>
>>>>
>>>> By using the GMF editor on can calculate the values of different models
>>>> and their impact on other models. Can anyone give me a hint on how to
>>>> do this.
>>>>
>>>>
>>>>
>>>> kindly
>>>>
>>>> Syed Imran
>>>>
>>>>
>>>
>>> --
>>>
>>> With Regards, Martin Taal
>>>
>>> Springsite/Elver.org
>>> Office: Hardwareweg 4, 3821 BV Amersfoort
>>> Postal: Nassaulaan 7, 3941 EC Doorn
>>> The Netherlands
>>> Cell: +31 (0)6 288 48 943
>>> Tel: +31 (0)84 420 2397
>>> Fax: +31 (0)84 225 9307
>>> Mail: mtaal@springsite.com - mtaal@elver.org
>>> Web: www.springsite.com - www.elver.org
>>
>>
>
>
> --
>
> With Regards, Martin Taal
>
> Springsite/Elver.org
> Office: Hardwareweg 4, 3821 BV Amersfoort
> Postal: Nassaulaan 7, 3941 EC Doorn
> The Netherlands
> Cell: +31 (0)6 288 48 943
> Tel: +31 (0)84 420 2397
> Fax: +31 (0)84 225 9307
> Mail: mtaal@springsite.com - mtaal@elver.org
> Web: www.springsite.com - www.elver.org
Previous Topic:[CDO] scalability of to-many references
Next Topic:Decorating a tree
Goto Forum:
  


Current Time: Wed Nov 13 09:51:52 GMT 2019

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

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

Back to the top