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
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.
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
Oct 07 '14, 1:19 a.m.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.