Not able to persist Enum types [message #416677] |
Tue, 12 February 2008 13:15 |
Eclipse User |
|
|
|
Originally posted by: rmishra.tibco.com
Hi ,
Default XMI serializer is not able to persist Enum types present in model
.... I can see its literal value present in model but not getting persisted
when i persist it in a conventional way ---
In the example below ResourceType is an Enum Type -- is this a bug or EMF or
i need to do some thing extra to persist it ..
please help me out --
DecisionTable dt = DtmodelFactory.eINSTANCE.createDecisionTable();
Argument arg = DtmodelFactory.eINSTANCE.createArgument();
ArgumentProperty argProperty =
DtmodelFactory.eINSTANCE.createArgumentProperty();
argProperty.setResourceType(ResourceType.get("CONCEPT"));
arg.setProperty(argProperty);
dt.getArgument().add(arg);
ResourceSet rs = new ResourceSetImpl();
URI fileURI = URI.createFileURI((new
File("E:/tibco/decisionTable/sampleDT.dt")).getAbsolutePath());
Resource resource = rs.createResource(fileURI);
resource.getContents().add(dt);
try {
resource.save(null);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
|
|
|
Re: Not able to persist Enum types [message #416679 is a reply to message #416677] |
Tue, 12 February 2008 13:52 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Raju,
Does "CONCEPT" happen to be the default value of the enumeration type? (the
default-default is the first declared literal)
Note that EMF does not normally serialize default values of EAttributes,
although you can use the XMLResource.OPTION_KEEP_DEFAULT_CONTENT save
option to force the serialization of default values.
HTH,
Christian
Raju Mishra wrote:
> Hi ,
> Default XMI serializer is not able to persist Enum types present in model
> ... I can see its literal value present in model but not getting persisted
> when i persist it in a conventional way ---
>
> In the example below ResourceType is an Enum Type -- is this a bug or EMF
> or i need to do some thing extra to persist it ..
> please help me out --
> DecisionTable dt = DtmodelFactory.eINSTANCE.createDecisionTable();
>
> Argument arg = DtmodelFactory.eINSTANCE.createArgument();
>
> ArgumentProperty argProperty =
> DtmodelFactory.eINSTANCE.createArgumentProperty();
>
> argProperty.setResourceType(ResourceType.get("CONCEPT"));
>
> arg.setProperty(argProperty);
>
> dt.getArgument().add(arg);
>
>
> ResourceSet rs = new ResourceSetImpl();
>
> URI fileURI = URI.createFileURI((new
> File("E:/tibco/decisionTable/sampleDT.dt")).getAbsolutePath());
>
> Resource resource = rs.createResource(fileURI);
>
> resource.getContents().add(dt);
>
> try {
>
> resource.save(null);
>
> } catch (IOException e) {
>
> // TODO Auto-generated catch block
>
> e.printStackTrace();
>
> }
|
|
|
Re: Not able to persist Enum types [message #416680 is a reply to message #416679] |
Tue, 12 February 2008 14:06 |
Eclipse User |
|
|
|
Originally posted by: rmishra.tibco.com
Thanks alot for helping--i set "CONCEPT" as default value and was trying to
persist that ----I didn't know that it doesn't persist default value --
"Christian W. Damus" <cdamus@ca.ibm.com> wrote in message
news:fos8au$eb6$1@build.eclipse.org...
> Hi, Raju,
>
> Does "CONCEPT" happen to be the default value of the enumeration type?
> (the
> default-default is the first declared literal)
>
> Note that EMF does not normally serialize default values of EAttributes,
> although you can use the XMLResource.OPTION_KEEP_DEFAULT_CONTENT save
> option to force the serialization of default values.
>
> HTH,
>
> Christian
>
> Raju Mishra wrote:
>
>> Hi ,
>> Default XMI serializer is not able to persist Enum types present in model
>> ... I can see its literal value present in model but not getting
>> persisted
>> when i persist it in a conventional way ---
>>
>> In the example below ResourceType is an Enum Type -- is this a bug or EMF
>> or i need to do some thing extra to persist it ..
>> please help me out --
>> DecisionTable dt = DtmodelFactory.eINSTANCE.createDecisionTable();
>>
>> Argument arg = DtmodelFactory.eINSTANCE.createArgument();
>>
>> ArgumentProperty argProperty =
>> DtmodelFactory.eINSTANCE.createArgumentProperty();
>>
>> argProperty.setResourceType(ResourceType.get("CONCEPT"));
>>
>> arg.setProperty(argProperty);
>>
>> dt.getArgument().add(arg);
>>
>>
>> ResourceSet rs = new ResourceSetImpl();
>>
>> URI fileURI = URI.createFileURI((new
>> File("E:/tibco/decisionTable/sampleDT.dt")).getAbsolutePath());
>>
>> Resource resource = rs.createResource(fileURI);
>>
>> resource.getContents().add(dt);
>>
>> try {
>>
>> resource.save(null);
>>
>> } catch (IOException e) {
>>
>> // TODO Auto-generated catch block
>>
>> e.printStackTrace();
>>
>> }
>
|
|
|
Powered by
FUDForum. Page generated in 0.02501 seconds