How to get value from Custom Attribute?
Hello,
I am using number of Custom Attributes in my code. I am using following types of Custom Attributes, String, Contributor, Category and Boolean I am able to get values from Custom Attribute whose type is String and Boolean, but for others I am getting objects. Can anyone please help me? Here is the code, //here Custom Attribute(owner) is of type Contributor myattr = workItemCommon.findAttribute(workItem.getProjectArea(), "owner", monitor); owner = (ContributorHandleImpl) workItem.getValue(myattr); //here Custom Attribute(groupOwner) is of type Category myattr = workItemCommon.findAttribute(workItem.getProjectArea(), "groupOwner", monitor); groupOwner = (CategoryHandleImpl) workItem.getValue(myattr); How can I get value from owner and groupOwner? |
Accepted answer
Ralph Schoon (63.5k●3●36●46)
| answered Jul 23 '15, 7:54 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Jul 24 '15, 3:10 a.m.
You have to cast them to the correct object. See https://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/ .
You can guess the type you have to cast to or you use the debugger to see it. This is also explained above together with https://rsjazz.wordpress.com/2013/02/28/setting-up-rational-team-concert-for-api-development/ . You can also use the search field in the blog to search for things like Contributor. You will get an object that you have to cast to, an IContributorHandle for owner attributes you have to cast to and the resolve it, an ICathegoryHandle for type Category and a Boolean (not boolean). Avinash Bamane selected this answer as the correct answer
Comments
Avinash Bamane
commented Jul 24 '15, 1:36 a.m.
Hello Ralph,
Read the answer above again.
|
One other answer
Hello All,
I was trying to develop server API, and I got answer from Ralph for this question here, https://jazz.net/forum/questions/203295/crjzs0383e-the-rtc_sample-bundle-could-not-be-resolved Thanks Ralph! |
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.