It's all about the answers!

Ask a question

How to get values of attributes of workitem using Plain Java API ?


shweta ranaware (3711053) | asked Nov 09 '15, 6:17 a.m.
 Hi All ,
          I want to access all  values of attribute type team area,Enumeration,Project area,Timestamp ,duration etc ..  depending upon user choice .
 Means if user want  to access the 3 attributes value of particular WI for example  created date, created by ,tags  
 then values of these attributes should be displayed on console.
           so My problem is how to access that attributes values depending on User Choice. I have code for  accessing the values of all attributes which are in WI . but i want to fetch the attribute value of user choice not all .

Comments
Ralph Schoon commented Nov 09 '15, 11:30 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I am basically not sure what the use case is. The explanation does not really help. You might want to enhance your question.


shweta ranaware commented Nov 10 '15, 2:24 a.m.

 Hi Ralph,

  I want to develop command Line Application. In this Command Line application I have take input from the User as Attribute Id and Depending upon user selected ID, i have to access the values of attribute and Display it. 
   I am able to get the values of String ,Contributor, category,string Types but problem occur when i am trying to access the values of Tags ,Timestamp , teamarea, subscribers, because ID's i am getting From Eclipse Client are not correct.
I also tried with Web UI Attribute Id , it Works for some attributes but not for all. so how can get the values of all the attributes ? 


Ralph Schoon commented Nov 10 '15, 2:33 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

You can get the values as described in several posts on my blog. Start here https://rsjazz.wordpress.com/2015/09/30/learning-to-fly-getting-started-with-the-rtc-java-apis/ see here: https://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/ search my blog. This can read and write all attributes (I am aware of) as well and has code attached https://rsjazz.wordpress.com/2015/11/03/a-rtc-workitem-command-line-version-3-0/ .

Accepted answer


permanent link
sam detweiler (12.5k6195201) | answered Nov 09 '15, 11:39 a.m.
well, you would have to make some cross reference table, that identified a user readable attribute name and the actual attribute name behind it.   your code would look up the user selected type to get the actual field attribute id, and use that to get its value.

I don't know what 'console' means, but from commandline it would be pretty easy.
shweta ranaware selected this answer as the correct answer

Comments
shweta ranaware commented Nov 10 '15, 2:15 a.m.

 Hi  sam, 

Thanks for your reply,
  I am working on Command Line and GUI based Application In which i want to take some attributes Id from user and have to check whether that attributes are present in the Work item or not if Present then get the value of that particular Attribute.
     As per my Knowledge i am able to access the values of String Data Types,Contributor ,Category ,Project Area but how can get the values of Team area, tags,subscribers,Item,E-signature,Enumeration List,Iteration,time Line,wiki etc datatypes Present in the RTC.


shweta ranaware commented Nov 10 '15, 2:17 a.m.

 It is Giving Problem when attributes ID of Attributes are different in Web UI and RTC Eclipse client .


Ralph Schoon commented Nov 10 '15, 2:25 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Please see https://rsjazz.wordpress.com/2015/11/03/a-rtc-workitem-command-line-version-3-0/ and the code attached which basically can access all attribute and non attribute types I am aware of.

Most interesting classes in com.ibm.js.team.workitem.commandline.helper and com.ibm.js.team.workitem.commandline.utils or search the blog for keywords.


Ralph Schoon commented Nov 10 '15, 2:30 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

With respect to the ID's use the ones displayed in the Web UI. See https://jazz.net/forum/questions/210676/problem-in-accessing-enumeration-in-work-item-using-client-java-api for what we found.

One other answer



permanent link
sam detweiler (12.5k6195201) | answered Nov 10 '15, 7:27 a.m.
the accepted answer here, https://jazz.net/forum/questions/94776/assertionfailedexception-problem-with-getting-the-values-of-attributes will print out all the attributes of a workitem, including its ID.




Your answer


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