Tagged value

Hello,
When I add/edit a tagged value programatically, like this:

 
IRequirement req = ...
if(req.getTaggedValues()!=null && req.getTaggedValues().getTaggedValueByName("Body")!=null){
     ITaggedValue tvBody = req.getTaggedValues().getTaggedValueByName("Body");
     tvBody.setValue(...); 

it works only if I display Tagged Values tab in specification window before. Is it something wrong in my code?

Regards,
anita

Hi Anita,

Thanks for your post. We’re sorry that our engineers cannot repeat the problem. Our engineers prepared 3 kinds of Requirement as attached image,
<> is the original requirement with Text, ID, etc… properties
<> is a new requirement with body property.
<> is a new requirement without any property.

They tried to call the IRequirement.getTaggedValues() first, <> and <> must can return ITaggedValueContainer, <> must return null since it really has no property (taggedValue).
Secondly, they tried to get “Body” from the ITaggedValueContainer, <> and <> also return null, since there really no “Body” property.

May I know is “Body” a property you defined in your own requirement?
If no, please manually add your own requirements via Tool > Configure Requirements. More details can be found at the following link:

If there is any further inquiry, please do not hesitate to contact me.

Best regards,
Lilian Wong

prepared_requirements.png

Hi,
“Body” is a property I defined in my own requirement (via Tool > Configure Requirements).
I tried to call the IRequirement.getTaggedValues() - return ITaggedValueContainer, when I tried to get “Body” from the ITaggedValueContainer - return null, since there really is “Body” property.
It works if I display Tagged Values tab in specification window (Requirement specification -> Attributes) and than
call req.getTaggedValues().getTaggedValueByName(“Body”).

Regards,
anita

Hi Anita,

Thanks for replying. May I know was your requirement created by plugin or diagram toolbar?

Best regards,
Lilian Wong

Hi,

May I know was your requirement created by plugin or diagram toolbar?
by plugin.
It works OK if I create by diagram toolbar.

Best regards,
Anita

Hi Anita,

Thanks for replying. May I know did you add the requirement stereotype into IRequirement?

Would you mind sending me your plugin and project file for investigation? Thanks in advance!

*If you do not want the files to be accessed by public, please send to lilian@visual-paradigm.com

Best regards,
Lilian Wong