Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Facing issue with EMF Enum persistence and loading using WST Translator
Facing issue with EMF Enum persistence and loading using WST Translator [message #501689] Thu, 03 December 2009 13:48
Nidhi  is currently offline Nidhi
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:50]

Report message to a moderator

Previous Topic:Problem deploying facelets projekt
Next Topic:Non-Internalization of WST APIs for EMF persistence, loading and synchronization
Goto Forum:
  


Current Time: Mon Oct 20 09:47:49 GMT 2014

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

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