Java API extending - Work Item Attribute data type to accept Java List
Hi,
I'm using RTC 4.0.3. Is there a work item attribute data type that is compatible with List<String>? I am working with a custom attribute with data type declared as Large HTML. The following code generates the exception: java.util.ArrayList incompatible with java.lang.String
List<String> tmp = new ArrayList<String>();
// assign values to strings and add to tmp List
workItemCopy.setValue(iAttribute, tmp);
Would the attribute "String list" data type handle List<String>?
TIA
Peter
|
2 answers
Ralph Schoon (63.5k●3●36●46)
| answered Oct 07 '14, 3:04 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Oct 07 '14, 3:07 a.m.
Large HTML is of course incompatible with String List. It is just an attribute maintaining a single object.
I am not completely sure which collection class is used to wrap the strings in the StringList type, I would suggest to read the value of such an attribute and have a look at the types involved in the debugger. That always helps to understand what you get and have to provide. With respect to where data goes, I think you got things wrong. Data does not go to any tab at all. The data goes into an attribute. You have to configure a presentation that shows the attribute in the editor presentation section. Although for simple custom attributes, in the Eclipse client (and only there) a custom attribute tab is automatically maintained, this may only show simple attributes in the way you want them by default. I would therefore suggest to create an editor presentation for the string list attribute and see if it is displayed as you want it to. Comments
Peter Moraza
commented Oct 07 '14, 9:45 p.m.
Thanks as always RS for your very helpful comments and suggestions. I definitely did misspeak with regard to data "to a tab".
I am still researching this. For my requirement, I may pass a String to setValue targeting a Large HTML attribute after all.
Peter
|
Hello,
I would try:
String[] _stringValues= new String[] { "String 1", "String 2" };
_listValue= new ArrayList<String>(_stringValues);
workItemCopy.setValue(iAttribute, _listValue);
Eric
Comments
Peter Moraza
commented Oct 07 '14, 6:27 p.m.
Hi Eric,
That is very similar to what I am doing to generate the List. Thanks!
Peter
Hello Peter,
well - this how our tests for String List Attributes are implemented.
So it should work.
Eric
|
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.
Comments
The "String list" type does allow setValue with List<String> data, but the update is written to the History tab of the work item, not to the custom attribute tab I am directing the update to. Worst case scenario for me is to plain String data to the custom attribute tab, but I will do that if that is the only option.