It's all about the answers!

Ask a question

moving or Deleting an iteration


Andy Berner (61127) | asked Jul 26 '11, 4:41 p.m.
Can someone confirm how to (a) move an iteration from one timeline to another and (b) delete an iteration outright, and (c) tell me the code to archive an iteration?

This is what I found experimentally, but I don't know all the rules, so please correct anything that's wrong:

a) To move iterationI from devLineA to devLineB:

IIteration iterationCopy =
(IIteration)processItemService.getMutableCopy(iterationI);
iterationCopy.setDevelopmentLine(devLineB);

IDevelopmentLine devLineBCopy =
(IDevelopmentLine)processItemService.getMutableCopy(devLineB);
devLineBCopy.addIteration(iterationI);

IDDevelopmentLine devLineACopy =
(IDevelopmentLine)processItemService.getMutableCopy(devLineA);
devLineACopy.removeIteration(iterationI);

IProcessItem[] itemsToSave =
new IProcessItem[]{devLineACopy, devLineBCopy, iterationCopy};
IProcessItem[] savedItems =
processItemService.save(itemsToSave, new NullProgressMonitor());

The important thing is to set the iteration to point to the new development line before deleting it from the original dev line.

If you don't delete the iteration from the list of owned iterations of devLineA, you cannot save devLineA, because it thinks it has an iteration that doesn't actually point to it.




b) To delete iterationI:

IDevelopmentLineHandle iterDevLine = iterationI.getDevelopmentLine();
//convert handle to a development line however you choose
IDevelopmentLine dl =
(IDevelopmentLine) (itemManager.getSharedItemIfKnown(iterDevLine));
IDDevelopmentLine devLineCopy =
(IDevelopmentLine)processItemService.getMutableCopy(dl);
devLineCopy.removeIteration(iterationI);
IProcessItem[] itemsToSave = new IProcessItem[]{devLineCopy};
IProcessItem[] savedItems = processItemService.save(itemsToSave, new NullProgressMonitor());

If I'm right, then IDevelopmentLine::removeIteration(IIteration iter) behaves differently depending on whether iter.getDevelopmentLine is the dev line you're deleting the iteration from. If it is, it deletes the iteration itself. If it isn't, it just deletes the iteration from the list of children the dev line thinks it has, as in the "move" code.

c) How do you archive an iteration without deleting it? There's a boolean to check if it's archived, but how do you set that?

One answer



permanent link
Parker Dunton (4064) | answered Jul 27 '11, 1:05 p.m.
JAZZ DEVELOPER
Hi Andy,

In answer to c), IProcessItemService has a archiveProcessItem method that you can use.

Parker Dunton
Jazz Foundation | Process team

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.