Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

0 votes

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.




2 answers

Permanent link
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.

0 votes

Comments

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
 


Permanent link
 Hello,
I would try:
String[] _stringValues= new String[] { "String 1", "String 2" };
_listValue= new ArrayList<String>(_stringValues);
workItemCopy.setValue(iAttribute, _listValue);

Eric

0 votes

Comments

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

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,927

Question asked: Oct 06 '14, 8:44 p.m.

Question was seen: 4,047 times

Last updated: Oct 08 '14, 2:08 a.m.

Confirmation Cancel Confirm