delete iterations using Java-API
Dear all,
after the creation of iteration works fine for me I now want to delete not needed iterations. I basically refer to the blog entry moving or deleting an iteration.
Unfortunately it did not work for me. I always got the error:
Iteration 'MyIteration' has no parent, but timeline 'MyTimeline' doesn't consider it a root.
So for me it looks that with devLineCopy.removeIteration(MyIteration) I only remove the iteration from MyTimeline but not delete it in total.
Could you give me a hint what went wrong?
One answer
That is not a blog, that is a question from someone who tries to figure the API out.
- Did you read the answer to that question?
- Did you try to delete an iteration in the UI?
If you did 2, you probably found out that you can not delete iterations in the UI. You can archive them. This is what the answer to the "blog" also suggests.
For all I know you can not delete iterations, you have to archive them.
The method you refer to has this documentation:
/
* Removes the iteration identified by the given handle from the list of
* iterations. If the iteration does not belong to this development line,
* this method does not have any effect. In order to ensure the consistency
* of the bi-directional relationship, the caller has also to remove the
* development line from the iteration.
* @param iteration a handle to the iteration
/
void removeIteration(IIterationHandle iteration);
I do not know what it does. I would archive the iteration. If you want to be able to see the code and comments like that, see https://jazz.net/library/article/1000 especially the last chapter of Lab 1 and then run Lab 1 to set up the environment.
PS: I looked for references to that call and found it in some unit tests:
IIteration iteration1 = (IIteration) IIteration.ITEM_TYPE.createItem();
IIteration iteration2 = (IIteration) IIteration.ITEM_TYPE.createItem();
timeline1.setCurrentIteration(iteration1);
timeline2.setCurrentIteration(iteration2);
assertFalse(ProcessItemComparisonUtil.equalTimeline(timeline1, timeline2));
timeline2.setCurrentIteration(iteration1);
assertTrue(ProcessItemComparisonUtil.equalTimeline(timeline1, timeline2));
timeline1.addIteration(iteration1);
assertFalse(ProcessItemComparisonUtil.equalTimeline(timeline1, timeline2));
timeline2.addIteration(iteration2);
assertFalse(ProcessItemComparisonUtil.equalTimeline(timeline1, timeline2));
timeline2.removeIteration(iteration2);
timeline2.addIteration(iteration1);
assertTrue(ProcessItemComparisonUtil.equalTimeline(timeline1, timeline2));
I am unsure if it is meant to be used in production on data in the database. The reason why I am unsure is, that the unit test code never saves any of these changes.