Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO Teneo] Does CDOENumStringType.nullSafeGet require identical name and literal for EEnum?
[CDO Teneo] Does CDOENumStringType.nullSafeGet require identical name and literal for EEnum? [message #509851] Mon, 25 January 2010 15:33 Go to next message
Bjoern Sundin is currently offline Bjoern SundinFriend
Messages: 47
Registered: July 2009
Member
I hope I'm not too nagging for you, but while I'm testing CDO 3.0 using a Hibernate Datastore I do get some unexpected issues.

In my application I define several EEnums in the ecore file. On initiating the model I get following exception:

[QUOTE]
The enum value string is not valid for enumerator: DataType
java.lang.IllegalStateException: The enum value string is not valid for enumerator: DataType
at org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOEN umStringType.nullSafeGet(CDOENumStringType.java:150)
[UNQUOTE]

As it seems the value 'string' is not recognized in the enum 'DataType' which I declare in the ecore as follows:
<eClassifiers xsi:type="ecore:EEnum" name="DataType">
<eLiterals name="boolean" literal="Boolean"/>
<eLiterals name="integer" value="1" literal="Integer"/>
<eLiterals name="float" value="2" literal="Float"/>
<eLiterals name="string" value="3" literal="String"/>
<eLiterals name="complex" value="4" literal="Complex"/>
</eClassifiers>

If I debug I find that the method CDOENumStringType.nullSafeGet on line 147 is calling getEEnumLiteralByLiteral passing the enum
name as parameter.

System outs from the method shows following:
name: 'string' // The name variable
getEEnum().getEEnumLiteralByLiteral(name.trim()): 'null' // That's why an exception is thrown
getEEnum().getEEnumLiteral(name.trim()): 'String' // The literal returned giving the name as parameter

If I modify the ecore declaration so that name and literal are identical and regenerate the model the code works well.

I do not really see why one has to set the name and the literal identical. I actually planned to use the literal for i18n purposes.

Can someone help me sorting this out?

Cheers
Bjoern
Re: [CDO Teneo] Does CDOENumStringType.nullSafeGet require identical name and literal for EEnum? [message #509864 is a reply to message #509851] Mon, 25 January 2010 11:04 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Bjoern,
Yes this seems wrong, afaik know now the literal should be used, the error is in the nullSafeSet method and the names of
the variables should be changed to literal.
Can you enter a bugzilla for this and assign it to me?

Below you say that you want to use the literal for i18n, but you mean the name maybe?

gr. Martin

Bjoern Sundin wrote:
> I hope I'm not too nagging for you, but while I'm testing CDO 3.0 using a Hibernate Datastore I do get some unexpected issues.
>
> In my application I define several EEnums in the ecore file. On initiating the model I get following exception:
>
> [QUOTE]
> The enum value string is not valid for enumerator: DataType
> java.lang.IllegalStateException: The enum value string is not valid for enumerator: DataType
> at org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOEN umStringType.nullSafeGet(CDOENumStringType.java:150)
> [UNQUOTE]
>
> As it seems the value 'string' is not recognized in the enum 'DataType' which I declare in the ecore as follows:
> <eClassifiers xsi:type="ecore:EEnum" name="DataType">
> <eLiterals name="boolean" literal="Boolean"/>
> <eLiterals name="integer" value="1" literal="Integer"/>
> <eLiterals name="float" value="2" literal="Float"/>
> <eLiterals name="string" value="3" literal="String"/>
> <eLiterals name="complex" value="4" literal="Complex"/>
> </eClassifiers>
>
> If I debug I find that the method CDOENumStringType.nullSafeGet on line 147 is calling getEEnumLiteralByLiteral passing the enum
> name as parameter.
>
> System outs from the method shows following:
> name: 'string' // The name variable
> getEEnum().getEEnumLiteralByLiteral(name.trim()): 'null' // That's why an exception is thrown
> getEEnum().getEEnumLiteral(name.trim()): 'String' // The literal returned giving the name as parameter
>
> If I modify the ecore declaration so that name and literal are identical and regenerate the model the code works well.
>
> I do not really see why one has to set the name and the literal identical. I actually planned to use the literal for i18n purposes.
>
> Can someone help me sorting this out?
>
> Cheers
> Bjoern
>
>


--

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: [CDO Teneo] Does CDOENumStringType.nullSafeGet require identical name and literal for EEnum? [message #509867 is a reply to message #509864] Mon, 25 January 2010 16:04 Go to previous messageGo to next message
Bjoern Sundin is currently offline Bjoern SundinFriend
Messages: 47
Registered: July 2009
Member
Hi Martin,

It's entered in Bugzilla, Bug 300695. I could not assign it to anyone, though...

Re: literal for i18n. I'm not sure about this, but in generated EMF editors gui I thought to have seen the literal values.

Cheers
Bjoern

"Martin Taal" <mtaal@elver.org> schrieb im Newsbeitrag news:hjkeck$e6l$1@build.eclipse.org...
> Hi Bjoern,
> Yes this seems wrong, afaik know now the literal should be used, the error is in the nullSafeSet method and the names of the
> variables should be changed to literal.
> Can you enter a bugzilla for this and assign it to me?
>
> Below you say that you want to use the literal for i18n, but you mean the name maybe?
>
> gr. Martin
>
> Bjoern Sundin wrote:
>> I hope I'm not too nagging for you, but while I'm testing CDO 3.0 using a Hibernate Datastore I do get some unexpected issues.
>>
>> In my application I define several EEnums in the ecore file. On initiating the model I get following exception:
>>
>> [QUOTE]
>> The enum value string is not valid for enumerator: DataType
>> java.lang.IllegalStateException: The enum value string is not valid for enumerator: DataType
>> at org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOEN umStringType.nullSafeGet(CDOENumStringType.java:150)
>> [UNQUOTE]
>>
>> As it seems the value 'string' is not recognized in the enum 'DataType' which I declare in the ecore as follows:
>> <eClassifiers xsi:type="ecore:EEnum" name="DataType">
>> <eLiterals name="boolean" literal="Boolean"/>
>> <eLiterals name="integer" value="1" literal="Integer"/>
>> <eLiterals name="float" value="2" literal="Float"/>
>> <eLiterals name="string" value="3" literal="String"/>
>> <eLiterals name="complex" value="4" literal="Complex"/>
>> </eClassifiers>
>>
>> If I debug I find that the method CDOENumStringType.nullSafeGet on line 147 is calling getEEnumLiteralByLiteral passing the enum
>> name as parameter.
>>
>> System outs from the method shows following:
>> name: 'string' // The name variable
>> getEEnum().getEEnumLiteralByLiteral(name.trim()): 'null' // That's why an exception is thrown
>> getEEnum().getEEnumLiteral(name.trim()): 'String' // The literal returned giving the name as parameter
>>
>> If I modify the ecore declaration so that name and literal are identical and regenerate the model the code works well.
>>
>> I do not really see why one has to set the name and the literal identical. I actually planned to use the literal for i18n
>> purposes.
>>
>> Can someone help me sorting this out?
>>
>> Cheers
>> Bjoern
>>
>>
>
>
> --
>
> 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: [CDO Teneo] Does CDOENumStringType.nullSafeGet require identical name and literal for EEnum? [message #509875 is a reply to message #509867] Mon, 25 January 2010 16:16 Go to previous messageGo to next message
Bjoern Sundin is currently offline Bjoern SundinFriend
Messages: 47
Registered: July 2009
Member
Re: literal for i18n.On the other hand, when I look in an XMI export the literals have been used, not the name.

/Bj
Re: [CDO Teneo] Does CDOENumStringType.nullSafeGet require identical name and literal for EEnum? [message #509886 is a reply to message #509875] Mon, 25 January 2010 16:35 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Yes, that's why the enum string type should use the literal and not the name (so it is a real bug :-).

gr. Martin

Bjoern Sundin wrote:
> Re: literal for i18n.On the other hand, when I look in an XMI export the literals have been used, not the name.
>
> /Bj├Ârn
>
> "Bjoern Sundin" <bsu@bergauer.ch> schrieb im Newsbeitrag news:hjkfdj$814$1@build.eclipse.org...
>> Hi Martin,
>>
>> It's entered in Bugzilla, Bug 300695. I could not assign it to anyone, though...
>>
>> Re: literal for i18n. I'm not sure about this, but in generated EMF editors gui I thought to have seen the literal values.
>>
>> Cheers
>> Bjoern
>>
>> "Martin Taal" <mtaal@elver.org> schrieb im Newsbeitrag news:hjkeck$e6l$1@build.eclipse.org...
>>> Hi Bjoern,
>>> Yes this seems wrong, afaik know now the literal should be used, the error is in the nullSafeSet method and the names of the
>>> variables should be changed to literal.
>>> Can you enter a bugzilla for this and assign it to me?
>>>
>>> Below you say that you want to use the literal for i18n, but you mean the name maybe?
>>>
>>> gr. Martin
>>>
>>> Bjoern Sundin wrote:
>>>> I hope I'm not too nagging for you, but while I'm testing CDO 3.0 using a Hibernate Datastore I do get some unexpected issues.
>>>>
>>>> In my application I define several EEnums in the ecore file. On initiating the model I get following exception:
>>>>
>>>> [QUOTE]
>>>> The enum value string is not valid for enumerator: DataType
>>>> java.lang.IllegalStateException: The enum value string is not valid for enumerator: DataType
>>>> at org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOEN umStringType.nullSafeGet(CDOENumStringType.java:150)
>>>> [UNQUOTE]
>>>>
>>>> As it seems the value 'string' is not recognized in the enum 'DataType' which I declare in the ecore as follows:
>>>> <eClassifiers xsi:type="ecore:EEnum" name="DataType">
>>>> <eLiterals name="boolean" literal="Boolean"/>
>>>> <eLiterals name="integer" value="1" literal="Integer"/>
>>>> <eLiterals name="float" value="2" literal="Float"/>
>>>> <eLiterals name="string" value="3" literal="String"/>
>>>> <eLiterals name="complex" value="4" literal="Complex"/>
>>>> </eClassifiers>
>>>>
>>>> If I debug I find that the method CDOENumStringType.nullSafeGet on line 147 is calling getEEnumLiteralByLiteral passing the enum
>>>> name as parameter.
>>>>
>>>> System outs from the method shows following:
>>>> name: 'string' // The name variable
>>>> getEEnum().getEEnumLiteralByLiteral(name.trim()): 'null' // That's why an exception is thrown
>>>> getEEnum().getEEnumLiteral(name.trim()): 'String' // The literal returned giving the name as parameter
>>>>
>>>> If I modify the ecore declaration so that name and literal are identical and regenerate the model the code works well.
>>>>
>>>> I do not really see why one has to set the name and the literal identical. I actually planned to use the literal for i18n
>>>> purposes.
>>>>
>>>> Can someone help me sorting this out?
>>>>
>>>> Cheers
>>>> Bjoern
>>>>
>>>>
>>>
>>> --
>>>
>>> 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: [CDO Teneo] Does CDOENumStringType.nullSafeGet require identical name and literal for EEnum? [message #509895 is a reply to message #509886] Mon, 25 January 2010 16:51 Go to previous message
Bjoern Sundin is currently offline Bjoern SundinFriend
Messages: 47
Registered: July 2009
Member
This is confusing me. I do see that the literal is used as an "enum id" both in the XMI export and in the hibernate tuplizer. For me
the name was the id and the literal the "spoken out" value. Is this specified somewhere in the EMF dokumentation?

/Bj
Previous Topic:Containament reference upper bound
Next Topic:EMF's OSGI Configuration
Goto Forum:
  


Current Time: Fri Nov 22 03:21:24 GMT 2019

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

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

Back to the top