Home » Modeling » EMF » [Teneo]E_CONTAINER_FEATUREID maintenance after model changing
| |
Re: [Teneo]E_CONTAINER_FEATUREID maintenance after model changing [message #427846 is a reply to message #427838] |
Mon, 02 March 2009 20:55 |
Ed Merks Messages: 33137 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------090107080405080108070903
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Alexey,
For InternalEObject it says:
/**
* The base value for negative, i.e., opposite-end,
eContainerFeatureID values.
*/
static final int EOPPOSITE_FEATURE_BASE = -1;
/**
* Returns the container feature ID.
* If the container isn't a navigable feature, this will be a
negative ID indicating the inverse of the containment feature's ID.
* @return the container feature ID.
* @see #eContainmentFeature()
* @see #EOPPOSITE_FEATURE_BASE
*/
int eContainerFeatureID();
So the ID is either >= 0 when its a container feature of the object,
i.e., if the containment reference of the container is explicitly
bidirectional, or < 0 when it's the container object's feature for ID
(EOPPOSITE_FEATURE_BASE - value). Generally you need to add features to
the end and only to leaf classes not to shift feature IDs.
koloale wrote:
> For example if I add feature to the base class, than all feature id in
> subclasses shift by 1 and there is no way to change subclasses feature
> id due to magic freeze method. So in db all E_CONTAINER_FEATUREID
> should be increased by 1, right? Is there any way to proceed working
> with DB without manually updating all rows?
>
> Alexey.
>
--------------090107080405080108070903
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">
Alexey,<br>
<br>
For InternalEObject it says:<br>
<blockquote> /**<br>
* The base value for negative, i.e., opposite-end,
eContainerFeatureID values.<br>
*/<br>
static final int EOPPOSITE_FEATURE_BASE = -1;<br>
<br>
/**<br>
* Returns the container feature ID.<br>
* If the container isn't a navigable feature, this will be a
negative ID indicating the inverse of the containment feature's ID.<br>
* @return the container feature ID.<br>
* @see #eContainmentFeature()<br>
* @see #EOPPOSITE_FEATURE_BASE<br>
*/<br>
int eContainerFeatureID();<br>
</blockquote>
So the ID is either >= 0 when its a container feature of the object,
i.e., if the containment reference of the container is explicitly
bidirectional, or < 0 when it's the container object's feature for
ID (EOPPOSITE_FEATURE_BASE - value). Generally you need to add
features to the end and only to leaf classes not to shift feature IDs.<br>
<br>
koloale wrote:
<blockquote cite="mid:goh9nb$ol4$1@build.eclipse.org" type="cite">For
example if I add feature to the base class, than all feature id in
subclasses shift by 1 and there is no way to change subclasses feature
id due to magic freeze method. So in db all E_CONTAINER_FEATUREID
should be increased by 1, right? Is there any way to proceed working
with DB without manually updating all rows?
<br>
<br>
Alexey.
<br>
<br>
</blockquote>
</body>
</html>
--------------090107080405080108070903--
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
| |
Re: [Teneo]E_CONTAINER_FEATUREID maintenance after model changing [message #427866 is a reply to message #427863] |
Tue, 03 March 2009 08:33 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Alexey,
On the short term (weeks) I am afraid that you need to update the econtainerfeatureid manually. Please enter a bugzilla
for a better solution. I think that I can make it so that the featureid is replaced by the featurename. I can make this
work transparently so that it will support a mix of featureid and featurename values in the db column. To support
current as well as new situations.
Then if you want to change the model while your db still contains featureids, the next thing is to write a small program
which runs through all tables and replaces the featureid with featurename. We can discuss how to do this in the bugzilla.
gr. Martin
koloale wrote:
> So I can't add a new feature to a base class? But it is very
> inconvenient and prevents superclasses for extension. Is it designed
> restriction?
>
> Ed Merks wrote:
>> Alexey,
>>
>> For InternalEObject it says:
>>
>> /**
>> * The base value for negative, i.e., opposite-end,
>> eContainerFeatureID values.
>> */
>> static final int EOPPOSITE_FEATURE_BASE = -1;
>>
>> /**
>> * Returns the container feature ID.
>> * If the container isn't a navigable feature, this will be a
>> negative ID indicating the inverse of the containment feature's ID.
>> * @return the container feature ID.
>> * @see #eContainmentFeature()
>> * @see #EOPPOSITE_FEATURE_BASE
>> */
>> int eContainerFeatureID();
>>
>> So the ID is either >= 0 when its a container feature of the object,
>> i.e., if the containment reference of the container is explicitly
>> bidirectional, or < 0 when it's the container object's feature for ID
>> (EOPPOSITE_FEATURE_BASE - value). Generally you need to add features
>> to the end and only to leaf classes not to shift feature IDs.
>>
--
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: [Teneo]E_CONTAINER_FEATUREID maintenance after model changing [message #427875 is a reply to message #427866] |
Tue, 03 March 2009 12:06 |
Ed Merks Messages: 33137 Registered: July 2009 |
Senior Member |
|
|
Martin,
Yes, I was going to suggest that these feature IDs are nice to use
dynamically at runtime, but they are not an appropriate long term
persistence mechanism. The combination of package nsURI, class name,
and feature name are far more appropriate, and of course if the first
two are implicit, then just the name will do. Probably it makes sense
to always use the name of the containment feature of the container...
Martin Taal wrote:
> Hi Alexey,
> On the short term (weeks) I am afraid that you need to update the
> econtainerfeatureid manually. Please enter a bugzilla for a better
> solution. I think that I can make it so that the featureid is replaced
> by the featurename. I can make this work transparently so that it will
> support a mix of featureid and featurename values in the db column. To
> support current as well as new situations.
> Then if you want to change the model while your db still contains
> featureids, the next thing is to write a small program which runs
> through all tables and replaces the featureid with featurename. We can
> discuss how to do this in the bugzilla.
>
> gr. Martin
>
> koloale wrote:
>> So I can't add a new feature to a base class? But it is very
>> inconvenient and prevents superclasses for extension. Is it designed
>> restriction?
>>
>> Ed Merks wrote:
>>> Alexey,
>>>
>>> For InternalEObject it says:
>>>
>>> /**
>>> * The base value for negative, i.e., opposite-end,
>>> eContainerFeatureID values.
>>> */
>>> static final int EOPPOSITE_FEATURE_BASE = -1;
>>>
>>> /**
>>> * Returns the container feature ID.
>>> * If the container isn't a navigable feature, this will be a
>>> negative ID indicating the inverse of the containment feature's ID.
>>> * @return the container feature ID.
>>> * @see #eContainmentFeature()
>>> * @see #EOPPOSITE_FEATURE_BASE
>>> */
>>> int eContainerFeatureID();
>>>
>>> So the ID is either >= 0 when its a container feature of the object,
>>> i.e., if the containment reference of the container is explicitly
>>> bidirectional, or < 0 when it's the container object's feature for
>>> ID (EOPPOSITE_FEATURE_BASE - value). Generally you need to add
>>> features to the end and only to leaf classes not to shift feature IDs.
>>>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Goto Forum:
Current Time: Fri Apr 19 06:38:55 GMT 2024
Powered by FUDForum. Page generated in 0.02044 seconds
|