Get teamAreaList attribute with RTC Java API
![]()
Hi All,
I would like to extract custom field type; "teamAreaList", using RTC Java API.
Team Area List:
"Affected Team Area" is a custom field; "com.test.issue.attribute.affectedTeam", type;"teamAreaList"
I am able to extract the Team Area Hierarchy, nevertheless I do not know how to obtain expected data from that customized field.
To extract the Team Area Hierarchy, I do the following:
IProjectArea projectArea = getProjectArea(repo, "Sandbox");Thanks in advance.
Regards.
|
Accepted answer
![]()
Ralph Schoon (62.3k●3●36●43)
| answered Apr 03 '13, 2:36 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Gustavo,
I would suggest to setup your development environment to be able to debug. This makes it so much easier to look at objects and to understand what they are. Please consider to read the following http://rsjazz.wordpress.com/2013/02/28/setting-up-rational-team-concert-for-api-development/ and the liked posts to set up PlainJava. Code I have used looks like below. It casts the ItemList attribute value to a collection and then iterates the enclosed handles. private String convertItemListAttributeType(IWorkItem workItem, IAttribute iAttribute, Object value) { String displayValue = "ITEM LIST: " + iAttribute.getAttributeType(); if (null != value && value instanceof Collection) { Collection values = (Collection) value; for (Iterator iterator = values.iterator(); iterator.hasNext();) { Object object = (Object) iterator.next(); if (null != object && object instanceof IItemHandle) { IItemHandle itemHandle = (IItemHandle) object; // do something // for example resolve the item and identify it as a teamArea. return itemHandle.toString(); } else if (null != object && object instanceof IItemHandle) { IItem item = (IItem) object; return item.toString(); } displayValue += " " + object.toString(); } } return displayValue + " Item List Not yet implemented"; } Gustavo Leyva selected this answer as the correct answer
Comments Hi Ralph,
I implemented the code you mentioned and it works!
Thank you so much! Have an excellent day.
|
2 other answers
![]()
Ralph Schoon (62.3k●3●36●43)
| answered Apr 02 '13, 3:57 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Last time I tried, I casted it to List and then accessed the element and casted that to the desired Object.
Comments Hi Ralp,
Thank you for comment.
I did not mentioned "listTeams" is a list "List<iteamareahandle> listTeams=null;"
Can you please add more details to your comment? I did not get which element did you cast.
Thanks in advance.
|