Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Issue with persisting and loading of EMF Enum entities(Issue with Enum persistence and loading)
Issue with persisting and loading of EMF Enum entities [message #501686] Thu, 03 December 2009 13:20 Go to next message
Nidhi  is currently offline Nidhi Friend
Messages: 92
Registered: December 2009
Member

Hi,

I am struggling with a problem which initially looked trivial but aparently is not the case:

My Ecore model contains an EMF enum called Cardinality:

<eClassifiers xsi:type="ecore:EEnum" name="Cardinality">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="Cardinality"/>
</eAnnotations>
<eLiterals name="_01" literal="0..1"/>
<eLiterals name="_0N" value="1" literal="0..n"/>
</eClassifiers>

I am using WST Translator to persist and load EMF entities. When I persist the same, it gets persisted by its literal and not name:

<... cardinality="0..1">

Which is the desired way of persisting.

However, when I try to load it, it tries to match the dom attribute value of cardinality "0..1" to the name of the cardinality "_0N" and hence throws the following exception:


aused by: org.eclipse.wst.common.internal.emf.utilities.FeatureValueCo nversionException: IWAE0014E Failed to convert 0..1 to Enumeration.
at org.eclipse.wst.common.internal.emf.utilities.DefaultFeature ValueConverter.failedToConvert(DefaultFeatureValueConverter. java:352)
at org.eclipse.wst.common.internal.emf.utilities.DefaultFeature ValueConverter.convertToEnum(DefaultFeatureValueConverter.ja va:112)
at org.eclipse.wst.common.internal.emf.utilities.DefaultFeature ValueConverter.convertValue(DefaultFeatureValueConverter.jav a:228)
at org.eclipse.wst.common.internal.emf.utilities.DefaultFeature ValueConverter.convertValue(DefaultFeatureValueConverter.jav a:307)
at org.eclipse.wst.common.internal.emf.resource.Translator.conv ertStringToValue(Translator.java:520)
at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI mpl.primUpdateMOFFeature(EMF2DOMAdapterImpl.java:1376)
at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI mpl.updateMOFFeature(EMF2DOMAdapterImpl.java:1775)
at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI mpl.primUpdateMOF(EMF2DOMAdapterImpl.java:935)
at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI mpl.updateMOF(EMF2DOMAdapterImpl.java:915)
at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI mpl.primUpdateMOFMultiFeature(EMF2DOMAdapterImpl.java:464)
at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI mpl.primUpdateMOFMultiFeature(EMF2DOMAdapterImpl.java:1488)
at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI mpl.updateMOFMultiFeature(EMF2DOMAdapterImpl.java:1702)
at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI mpl.updateMOFFeature(EMF2DOMAdapterImpl.java:1757)
at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI mpl.primUpdateMOF(EMF2DOMAdapterImpl.java:935)
at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI mpl.updateMOF(EMF2DOMAdapterImpl.java:915)
at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI mpl.primUpdateMOFMultiFeature(EMF2DOMAdapterImpl.java:464)
at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI mpl.updateMOFRootFeature(EMF2DOMAdapterImpl.java:956)
at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI mpl.primUpdateMOF(EMF2DOMAdapterImpl.java:931)
at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI mpl.updateMOF(EMF2DOMAdapterImpl.java:915)
at org.eclipse.wst.common.internal.emf.resource.EMF2DOMRenderer .doLoad(EMF2DOMRenderer.java:64)
at org.eclipse.wst.common.internal.emf.resource.TranslatorResou rceImpl.basicDoLoad(TranslatorResourceImpl.java:144)
at org.eclipse.wst.common.internal.emf.resource.CompatibilityXM IResourceImpl.doLoad(CompatibilityXMIResourceImpl.java:175)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1494)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1282)
at org.eclipse.wst.common.internal.emf.resource.CompatibilityXM IResourceImpl.load(CompatibilityXMIResourceImpl.java:261)
at org.eclipse.wst.common.internal.emf.resource.TranslatorResou rceImpl.load(TranslatorResourceImpl.java:389)
... 44 more


Can anyone please help me how to fix this issue. I tried replacing the name for the Cardinality enum to "0..n", however, the genmodel gives an error.
Also I dont want to change the generated Java Class for the cardinality.

Thanks a lot,
Best Regards,
Nidhi

[Updated on: Wed, 09 December 2009 05:52]

Report message to a moderator

Re: Issue with persisting and loading of EMF Enum entities [message #501694 is a reply to message #501686] Thu, 03 December 2009 14:04 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30620
Registered: July 2009
Senior Member
Nidhi,

I see you posted the same question to the WTP newsgroup. That's the
place to ask about WST...


Nidhi wrote:
> Hi,
>
> I am struggling with a problem which initially looked trivial but
> aparently is not the case:
>
> My Ecore model contains an EMF enum called Cardinality:
>
> <eClassifiers xsi:type="ecore:EEnum" name="Cardinality">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="name" value="Cardinality"/>
> </eAnnotations>
> <eLiterals name="_01" literal="0..1"/>
> <eLiterals name="_0N" value="1" literal="0..n"/>
> </eClassifiers>
>
> I am using WST Translator to persist and load EMF entities. When I
> persist the same, it gets persisted by its literal and not name:
>
> <... cardinality="0..1">
>
> Which is the desired way of persisting.
>
> However, when I try to load it, it tries to match the dom attribute
> value of cardinality "0..1" to the name of the cardinality "_0N" and
> hence throws the following exception:
>
>
> aused by:
> org.eclipse.wst.common.internal.emf.utilities.FeatureValueCo
> nversionException: IWAE0014E Failed to convert 0..1 to Enumeration.
> at org.eclipse.wst.common.internal.emf.utilities.DefaultFeature
> ValueConverter.failedToConvert(DefaultFeatureValueConverter. java:352)
> at org.eclipse.wst.common.internal.emf.utilities.DefaultFeature
> ValueConverter.convertToEnum(DefaultFeatureValueConverter.ja va:112)
> at org.eclipse.wst.common.internal.emf.utilities.DefaultFeature
> ValueConverter.convertValue(DefaultFeatureValueConverter.jav a:228)
> at org.eclipse.wst.common.internal.emf.utilities.DefaultFeature
> ValueConverter.convertValue(DefaultFeatureValueConverter.jav a:307)
> at org.eclipse.wst.common.internal.emf.resource.Translator.conv
> ertStringToValue(Translator.java:520)
> at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI
> mpl.primUpdateMOFFeature(EMF2DOMAdapterImpl.java:1376)
> at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI
> mpl.updateMOFFeature(EMF2DOMAdapterImpl.java:1775)
> at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI
> mpl.primUpdateMOF(EMF2DOMAdapterImpl.java:935)
> at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI
> mpl.updateMOF(EMF2DOMAdapterImpl.java:915)
> at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI
> mpl.primUpdateMOFMultiFeature(EMF2DOMAdapterImpl.java:464)
> at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI
> mpl.primUpdateMOFMultiFeature(EMF2DOMAdapterImpl.java:1488)
> at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI
> mpl.updateMOFMultiFeature(EMF2DOMAdapterImpl.java:1702)
> at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI
> mpl.updateMOFFeature(EMF2DOMAdapterImpl.java:1757)
> at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI
> mpl.primUpdateMOF(EMF2DOMAdapterImpl.java:935)
> at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI
> mpl.updateMOF(EMF2DOMAdapterImpl.java:915)
> at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI
> mpl.primUpdateMOFMultiFeature(EMF2DOMAdapterImpl.java:464)
> at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI
> mpl.updateMOFRootFeature(EMF2DOMAdapterImpl.java:956)
> at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI
> mpl.primUpdateMOF(EMF2DOMAdapterImpl.java:931)
> at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterI
> mpl.updateMOF(EMF2DOMAdapterImpl.java:915)
> at org.eclipse.wst.common.internal.emf.resource.EMF2DOMRenderer
> .doLoad(EMF2DOMRenderer.java:64)
> at org.eclipse.wst.common.internal.emf.resource.TranslatorResou
> rceImpl.basicDoLoad(TranslatorResourceImpl.java:144)
> at org.eclipse.wst.common.internal.emf.resource.CompatibilityXM
> IResourceImpl.doLoad(CompatibilityXMIResourceImpl.java:175)
> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour
> ceImpl.java:1494)
> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour
> ceImpl.java:1282)
> at org.eclipse.wst.common.internal.emf.resource.CompatibilityXM
> IResourceImpl.load(CompatibilityXMIResourceImpl.java:261)
> at org.eclipse.wst.common.internal.emf.resource.TranslatorResou
> rceImpl.load(TranslatorResourceImpl.java:389)
> at com.sap.ide.phoenix.metamodel.library.util.LibraryResourceIm
> pl.load(LibraryResourceImpl.java:88)
> at com.sap.ide.phoenix.services.mm.PhoenixMetamodelCache.loadRe
> source(PhoenixMetamodelCache.java:123)
> ... 44 more
>
>
> Can anyone please help me how to fix this issue. I tried replacing the
> name for the Cardinality enum to "0..n", however, the genmodel gives
> an error.
> Also I dont want to change the generated Java Class for the cardinality.
>
> Thanks a lot,
> Best Regards,
> Nidhi
>
Re: Issue with persisting and loading of EMF Enum entities [message #501715 is a reply to message #501694] Thu, 03 December 2009 15:15 Go to previous message
Nidhi  is currently offline Nidhi Friend
Messages: 92
Registered: December 2009
Member

Hi Ed,

I realized my mistake immediately after posting this topic
that it's not really an issue with the way EMF serializes but might be an issue with the way Translator loads the serialized Enum.

Since I am new in this forum, I dont really if it's possbile to delete a post?

Thanks anyways for pointing to the right group.
Nidhi
Previous Topic:How to select particular elements, based on current state of element in edit part
Next Topic:Prevent EMF "Generate model code" from screwing up classpath
Goto Forum:
  


Current Time: Tue Nov 12 08:11:01 GMT 2019

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

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

Back to the top