How to fetch the all work flow states based on the every Work Item Type in IBM RTC using Java API?
Hi All,
I want to display the All the Work flow states based on the selected Work Item Type. Please help me on this.
Regards,
Ramesh M
|
2 answers
Arne Bister (2.6k●1●28●32)
| answered Sep 07 '15, 5:36 p.m.
JAZZ DEVELOPER edited Sep 07 '15, 5:38 p.m.
Ramesh,
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
ramesh m
commented Sep 08 '15, 8:34 a.m.
HI Arne,
Thanks for the clear explanation. bu i am getting null pointer exception on below.
Please assist on below.
IAuditableCommon auditableCommon = (IAuditableCommon) repository.getClientLibrary(IAuditableCommon.class);
how to initialize the IWorkItemHandle wiHandle;
Regards,
Ramesh
Ramesh,
|
Hi All ,
I found the solutions to retrive the all the states based on the work item type. Please find code from below.
First Step1 :
ITeamRepository iTeamRepository ; Login in to RTC
IWorkItemCommon workItemCommon = (IWorkItemCommon) iTeamRepository.getClientLibrary(IWorkItemCommon.class);
Step2 : use Work Item Common get the Work item types:
List<IWorkItemType> workItemTypes = null;
workItemTypes = workItemCommon.findWorkItemTypes(projectArea, monitor);
Step3:
IWorkItemClient workItemClient = (IWorkItemClient) iTeamRepository.getClientLibrary(IWorkItemClient.class);
Step4:
IWorkItemWorkingCopyManager workingManager = workItemClient.getWorkItemWorkingCopyManager();
Step5:
Iterate the work item types to get states:
List status = new ArrayList();
for (IWorkItemType iworkItemType : workItemTypes) {
wc = workingManager.getWorkingCopy(workingManager.connectNew(iworkItemType, monitor));
workFlowInfo = workItemCommon.findWorkflowInfo(wc.getWorkItem(), monitor);
states = workFlowInfo.getAllStateIds();
for (Identifier<IState> identifier : states) {
sysout(workFlowInfo.getStateName(identifier))
status.add(workFlowInfo.getStateName(identifier));
}
}
|
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.