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

How to set iteration as current

 Hi,

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();
   @SuppressWarnings("unchecked")
List<IDevelopmentLine> devLines = itemManager.fetchCompleteItems(Arrays.asList(devLineHandles), IItemManager.DEFAULT, monitor);

   for (IDevelopmentLine devLine: devLines) {
    IIterationHandle[] iterationHandles = devLine.getIterations();
    @SuppressWarnings("unchecked")
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());
    service.save(new IProcessItem[]{workingDevLine, iterationCopy}, monitor);
    break;
    }
    }
    }
   
    }


   }
    } 

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?

0 votes


Be the first one to answer this question!

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
× 6,125

Question asked: Sep 25 '17, 9:51 a.m.

Question was seen: 948 times

Last updated: Sep 25 '17, 9:51 a.m.

Confirmation Cancel Confirm