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

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

0 votes


Accepted answer

Permanent link

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

0 votes

Comments

 @MooR Rathinasamy thanks for your help


One other answer

Permanent link
com.ibm.team.process.common.IDevelopmentLine.getCurrentIteration()

0 votes

Comments

@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

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,936
× 1,700

Question asked: Dec 04 '19, 2:09 a.m.

Question was seen: 1,759 times

Last updated: Dec 06 '19, 1:23 a.m.

Confirmation Cancel Confirm