It's all about the answers!

Ask a question

Attributes of type Tags


Emi Liano (135) | asked Jul 20 '18, 4:52 a.m.

 Hello everyone and thank you in advance. A question maybe simple but I could not find anything about it. Using Java api how should the tags type be treated? That is, for any type of attribute I use the getValue (attribute) but I do not know if it can also be used for this type and especially the return then the chaste with the object that serves me, but in this case it can be multiple, so I thought get me back a list of strings, is that correct? Or is there a type of object to use and then I take it to what I need? Thank you so much again.

</pre>

3 answers



permanent link
Ralph Schoon (63.3k33646) | answered Jul 20 '18, 5:25 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Comments
Emi Liano commented Jul 20 '18, 6:33 a.m. | edited Jul 20 '18, 8:16 a.m.

Thank you very much, but I have a small problem, in your example the library "com.ibm.js.team.workitem.commandline.framework.ParameterValue" is used and is treated as a parameter. This is because it is not an attribute, but how can I recover it? Because in the example you build it, but I have the need to retrieve the value from a workItem that continue the attribute of type tags, I tried taking a cue from the example to use the .findAttribute but I come back null :( then I saw that uses it as a list of strings so I figured well, I only have the recovery of the attribute itself :( Thanks again.


permanent link
Ralph Schoon (63.3k33646) | answered Jul 20 '18, 8:20 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER


See https://rsjazz.wordpress.com/2013/01/02/working-with-work-item-attributes/ and the related posts for how to find attributes. IWorlkItem also has utility methods for the built in tag attribute. A custom tag attribute would still work with a value of List<string> <string>

        @Override
        protected void execute(WorkItemWorkingCopy workingCopy,
                IProgressMonitor monitor) throws TeamRepositoryException {
            IWorkItem workItem = workingCopy.getWorkItem();
            workItem.setHTMLSummary(XMLString.createFromPlainText(fSummary));
            workItem.setHTMLDescription(XMLString.createFromPlainText(fSummary));
            workItem.setCategory(fCategory);

        List<string>&lt;string&gt; tags = workItem.getTags2();
        tags.add("NewTag");
        workItem.setTags2(tags);
    }

</string>

</string>


permanent link
Emi Liano (135) | answered Jul 20 '18, 9:42 a.m.
edited Jul 20 '18, 9:45 a.m.

Here it is, thank you very kind I had just found it but recovered from a higher level (it is not deprecated the getTags and the getTags2 uses the attribute to recover only those of that tag). So now I'm trying both solutions, ie the one I found and the one you posted to me, thank you very much.Can I ask you only a very small detail?So once I have the list I work and ok, I do not have to put anything in luck, I just have to verify that there is a certain tag, but I still have a very strong doubt that is: how do I retrieve the tag attribute in question? Because the tags that I found I want it in input (workItemServer.findTags2 (attribute, monitor), but I can not understand how to pass the attribute as the method I use that is: workItemServer.findAttribute (projectArea, "idAttribute", monitor ); I return null :( Thank you very much for the support anyway.
And I almost forgot :( I had already seen the url you indicated to me but I did not find where it referred to the tags, sorry.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.