How to fetch the all work flow states based on the every Work Item Type in IBM RTC using Java API?
2 answers
starting from
IWorkItemHandle wiHandle;you need to resolve this to a full work item:
IAuditableCommon auditableCommon = (IAuditableCommon) teamRepository.getClientLibrary(IAuditableCommon.class);
IWorkItem workItem = auditableCommon.resolveAuditable(wiHandle, IWorkItem.SMALL_PROFILE, null);Then obtain a workItemClient and use it to get an IWorkflowInfo object then use its .getAllStateIds method:
IWorkItemClient workItemClient = (IWorkItemClient) teamRepository
.getClientLibrary(IWorkItemClient.class);
IWorkflowInfo workflowInfo = workItemClient.findWorkflowInfo(workItem, monitor);
List< IState> allStates = workflowInfo.getAllStateIds();If you want the names of the states, loop over the list and use
workflowInfo.getStateName();
If this is helpful please mark the answer as accepted.
- Arne
Comments
HI Arne,
Ramesh,
please work through https://jazz.net/library/article/1000 to be up to par with terminology.
Then please describe where you are starting from. Are you using a client plugin, a server side extension or are you e.g. writing a java script against Plain Java API?
In either case at one point you need to query for a work item by name, by id or some other mechanism. Please cp. the excellent article from Ralph Schoon on work item querying: https://rsjazz.wordpress.com/2012/11/19/using-expressions-for-automation/
Using any such technique will leave you with either a valid IWorkItemHandle or possibly already a full IWorkItem.
Once you log in (basic exercise in workshop or the snippets shipped with Plain Java SDK) from the session you can obtain the necessary ITeamRepository object.
Then you should be all set.
gg,
Arne