It's all about the answers!

Ask a question

How to fetch current iteration/sprint using plain java API?


Andrew Ciaz (59160) | asked Dec 04 '19, 2:09 a.m.

 Hi all, 


Please help me to find out the API to fetch current iteration/sprint from RTC using plain Java API

Accepted answer


permanent link
MooR Rathinasamy (413) | answered Dec 04 '19, 11:39 a.m.

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

Comments
Andrew Ciaz commented Dec 06 '19, 1:23 a.m.

 @MooR Rathinasamy thanks for your help

One other answer



permanent link
Ralph Schoon (63.1k33645) | 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? 


Ralph Schoon commented Dec 05 '19, 2:27 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

The provided link explains all that and also comes with downloadable code.

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.