It's all about the answers!

Ask a question

How to get the Workitem type properties ?


vinitha dsouza (1191157) | asked Jun 26 '15, 10:45 a.m.
Hello Team
I am working on RTC API extensions.

I want to know how can i get the properties of WI programmatically?


I get WI as Story but i am not able to get the Filed Against property of Story programmatically ?



Please help :(

Accepted answer


permanent link
Ralph Schoon (58.5k23642) | answered Jun 26 '15, 10:54 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Jun 26 '15, 10:59 a.m.
You want to train yourself on using the API. Start here:  https://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/
related is https://rsjazz.wordpress.com/2013/01/02/working-with-work-item-attributes/

You need to get the IAttribute for IWorkItem.CATEGORY_PROPERTY

IAttribute category = workItemCommon.findAttribute(projectArea, IWorkItem.CATEGORY_PROPERTY, monitor);
Then you can  the value and cast it.
if(workItem.hasAttribute(category )){
Object value = workItem.getValue(category )
}

Please read the post above to get an idea how the API works.
vinitha dsouza selected this answer as the correct answer

Comments
vinitha dsouza commented Jun 29 '15, 11:54 a.m.

Thank you so much for the ans .

The result is displayed in Object format
How do i get the same  result in a string format ?

I tried casting as String it throws me an class cast exception


Ralph Schoon commented Jun 29 '15, 2:11 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Consider reading the links I provided above for an answer. Thanks.


vinitha dsouza commented Jun 30 '15, 12:01 p.m.

Hi Ralph

I used the code provided by the link :
https://rsjazz.wordpress.com/2012/08/20/manipulationg-work-item-enumeration-values/...

But whenever i tried to access it throws me an exception :

 java.lang.ClassCastException: com.ibm.team.workitem.common.internal.model.impl.CategoryHandleImpl cannot be cast to com.ibm.team.workitem.common.model.Identifier

Please need an help :(



Ralph Schoon commented Jun 30 '15, 3:28 p.m. | edited Jun 30 '15, 3:29 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

The post also says:

If you are just starting with extending Rational Team Concert, start reading this and the linked posts to get some guidance on how to set up your environment.

And I also provided you with the first links in the first answer. An ICategory is not an Enumeration literal. Again, read those posts above carefully.

Your answer


Register or to post your answer.