How to fetch current iteration/sprint using plain java API?
Hi all,
Please help me to find out the API to fetch current iteration/sprint from RTC using plain Java API
|
Accepted answer
Get IDevelopmentLineHandle and run a recursive method to get all sub iterations.
IDevelopmentLineHandle[] developmentLineHandles = projectArea.getDevelopmentLines();
for (IDevelopmentLineHandle developmentLineHandle : developmentLineHandles)
{
developmentLine = null;
try
{
developmentLine = (IDevelopmentLine) itemManager.fetchCompleteItem(developmentLineHandle, IItemManager.DEFAULT, monitor);
}
catch (TeamRepositoryException e)
{
// Handle the exception
}
if(null != developmentLine)
{
iterationHandles = developmentLine.getIterations();
if(null != iterationHandles)
{
for(IIterationHandle iterationHandle : iterationHandles)
{
fetchIterations(iterationHandle, itemManager, monitor);
}
}
}
}
void fetchIterations(IIterationHandle iterationHandle, IItemManager itemManager, IProgressMonitor monitor)
{
IIteration iteration = null;
try
{
iteration = (IIteration) itemManager.fetchCompleteItem(iterationHandle, IItemManager.DEFAULT, monitor);
}
catch (TeamRepositoryException e)
{
// Handle it
}
if(null != iteration)
{
// Scan Child iterations
IIterationHandle[] iterationHandles = iteration.getChildren();
if(null != iterationHandles)
{
for(IIterationHandle subIterationHandle : iterationHandles)
{
fetchIterations(subIterationHandle, itemManager, monitor);
}
}
}
}
Andrew Ciaz selected this answer as the correct answer
|
One other answer
Ralph Schoon (63.3k●3●36●46)
| answered Dec 04 '19, 6:20 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
com.ibm.team.process.common.IDevelopmentLine.getCurrentIteration()
Comments
Andrew Ciaz
commented Dec 04 '19, 7:30 a.m.
@Ralph Schoon, Thanks for your answer, I go through your code but how can I get IDevelopmentLine object? The provided link explains all that and also comes with downloadable code.
|
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.