It's all about the answers!

Ask a question

How to set iteration as current

sara chason (2711) | asked Sep 25 '17, 9:51 a.m.


I'm trying to set the current iteration as current grammatically.

this is my function: 
    public static void IterateOverIterations(IProjectArea projectArea, IProgressMonitor monitor) throws TeamRepositoryException{
    IItemManager itemManager = teamRepository.itemManager();
    Date today = new Date();
    IProcessItemService service = (IProcessItemService) teamRepository.getClientLibrary(IProcessClientService.class);

IDevelopmentLineHandle[] devLineHandles = ((IProjectArea)projectArea).getDevelopmentLines();
List<IDevelopmentLine> devLines = itemManager.fetchCompleteItems(Arrays.asList(devLineHandles), IItemManager.DEFAULT, monitor);

   for (IDevelopmentLine devLine: devLines) {
    IIterationHandle[] iterationHandles = devLine.getIterations();
List<IIteration> iterations = itemManager.fetchCompleteItems(Arrays.asList(iterationHandles), IItemManager.DEFAULT, monitor);
    for (IIteration iteration: iterations) {
    List<IIteration> iterationNodes = getAllIterationNodes(iteration, projectArea, monitor);
    for (IIteration iterationNode: iterationNodes){
    System.out.println("iteration name: " + iterationNode.getName());
    Date start = iterationNode.getStartDate();
    Date end = iterationNode.getEndDate();
    if(start != null){
    System.out.println("iteration start date: " + start.toString());
    System.out.println("iteration end date: " + end.toString());
    if (today.after(start) && today.before(end)){
    System.out.println("We are in " + iterationNode.getName() + " Iteration!, making it active");
    IDevelopmentLine workingDevLine  = (IDevelopmentLine)devLine.getWorkingCopy();
    IIteration iterationCopy = (IIteration)iteration.getWorkingCopy();
    workingDevLine.setCurrentIteration((IIterationHandle)iterationCopy.getItemHandle()); IProcessItem[]{workingDevLine, iterationCopy}, monitor);


the code passes with no errors, but in RTC I don't see any changes. I just see the old current iteration without the current icon.

can someone help me and tell me what's wrong with this code?

Be the first one to answer this question!

Register or to post your answer.