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

How to get value of State attribute?

Hi,

i am using plain java client for fetching all work items and its values.


But i am unable to get the value of State attribute.


Please also check my previous post.

https://jazz.net/forums/viewtopic.php?t=24762&highlight=

Please suggest any solution.

0 votes



2 answers

Permanent link
Hi Paulo Cavoto,

Thank for your response.

Now i have fetched the state value.

I am using plain java client. check my code below.

ITeamRepository repository = RepositoryManager.getInstance().getCurrentRepository();
IWorkItemClient workItemService = (IWorkItemClient) repository.getClientLibrary(IWorkItemClient.class);
IWorkflowInfo wfi = null;
try {
wfi = workItemService.findWorkflowInfo(workitem, null);
} catch (TeamRepositoryException e) {
e.printStackTrace();
}
String statename = wfi.getStateName(workitem.getState2());

1 vote


Permanent link
Hi,

i am using plain java client for fetching all work items and its values.


But i am unable to get the value of State attribute.


Please also check my previous post.

https://jazz.net/forums/viewtopic.php?t=24762&highlight=

Please suggest any solution.


By reading you other topic, I assume you are only listing the custom attributes of a WorkItem, there are some attributes that you can get directly from the WI itself , the following example is from the server side, but it shouldn't be much different on the client.
To get the state use getState2() , it will return the ID of the state but not its name. To get the name, use the WorkflowInfo


IWorkItemServer workItemService = getService(IWorkItemServer.class);

IWorkflowInfo wfi = workItemService.findWorkflowInfo(workItem, monitor);
String statename = wfi.getStateName(workItem.getState2());

0 votes

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,952

Question asked: May 14 '12, 12:44 a.m.

Question was seen: 5,208 times

Last updated: May 14 '12, 12:44 a.m.

Related questions
Confirmation Cancel Confirm