|0.5 -> 0.6 migration problem [message #1022847]
||Fri, 22 March 2013 16:27
| Jan Rohner
Registered: March 2013
I'm writing my own Eclipse Plugin and for that I use the functionality of ProR. After updating ProR to version 0.6.1 I have noticed the following problem:
First I'm creating a new specObject.
ed = specificationEditor.getEditingDomain();
SpecHierarchy newSpecHierarchy = ReqIF10Factory.eINSTANCE.createSpecHierarchy();
SpecObject newSpecObject = ReqIF10Factory.eINSTANCE.createSpecObject();
cmd.append(SetCommand.create(ed, newSpecObject,ReqIF10Package.Literals.SPEC_OBJECT__TYPE, type));
In the next step I want to set the values into the defined table structure (columns). Normally I get the corresponding attributeValues by the following code:
EList<AttributeValue> list = newSpecObject.getValues();
Before updating ProR I got the column names and depending on I could set the desired values. But now the EList is empty and I can't set the values. How can I solve this problem?
|Re: 0.5 -> 0.6 migration problem [message #1023859 is a reply to message #1022847]
||Mon, 25 March 2013 10:22
|| Michael Jastram
Registered: April 2010
Location: Düsseldorf, Germany
From 0.5.0 to 0.6.0, we did some significant refactoring. The way we handled AttributeValues in 0.5.0 was not conform to the ReqIF spec. We fixed that in 0.6.0, and the result is what you observe. Let me elaborate:
In 0.5.0, we created AttributeValues for SpecElements, as soon as the SpecElement had a SpecType. However, the actual value of all those AttributeValues was null. But writing out such a model would result in invalid ReqIF (for instance, an AttributeValueDate with a null value violates the Schema). The right way of handling this is to omit all those AttributeValues that have a null value. And this is what you are experiencing.
There are two ways for you to get the information you need:
(1) You can consult the SpecType.getSpecAttributes(). I would recommend this only if you do not have access to ItemProviders.
(2) Retrieve the SpecElement's ItemProvider (i.e. ProrUtil.getItemProvider()). You can then get the PropertyDescriptors, with each having an AttributeValue instance. Be careful: These AttributeValues are not connected to the model. If you use them, you need to add them to the SpecObject with your command as well.
I hope this helps!
Powered by FUDForum
. Page generated in 0.02308 seconds