It's all about the answers!

Ask a question

How do I get the Project Area of an Iteration


Matthias Lückl (2325) | asked Dec 03 '12, 4:35 a.m.
Hello
My task is to create a method that can export all plans of a project to a textfile. After searching for a long time, I've finally found a method to get the plans programmatically:
https://jazz.net/wiki/bin/view/Main/InformalProjectCopy (under "Agile Planning")
List<IIterationPlanRecordHandle> handles= source.fetchAllIterationPlans(ItemProfile.createFullProfile(IIterationPlanRecord.ITEM_TYPE), monitor);
List<IIterationPlanRecord> plans= source.getItemManager().fetchCompleteItems(handles, IItemManager.DEFAULT, monitor);
However, this method gets me all plans of all project areas that I have access to, and I can't find a way to filter only the plans that are in the current project area. That's why I made a subfunction that whould check if the iteration lies within the current project area. The problem is, that I can't find an option to get the project area of an iteration, and looping the getParent command also doesn't work, because it only gets to the top level iteration, but not the Project Area itself.
I'd either need an option to only search through the current project area with the linked method, or a command to get the project area of an iteration. If anyone knows a way to do any of these, I'd much appreciate the help.

Thanks

Accepted answer


permanent link
sam detweiler (12.5k6195201) | answered Dec 03 '12, 6:43 a.m.
I don't think you can find the backlink,

so you have to get all the interations in a project (in their developmentlines),
and make a hash table or something to be able to go backwards.

ProjectArea->getDevelopmentLines()
IDevelopmentLineHandle[] getDevelopmentLines()
IDevelopmentLine->getIterations()

  IIterationHandle[] getIterations()

get their children

IIteration->getChildren()
  IIterationHandle[] getChildren()
Matthias Lückl selected this answer as the correct answer

Comments
Matthias Lückl commented Dec 03 '12, 7:20 a.m. | edited Dec 03 '12, 7:32 a.m.

Yes, that whould work. Thanks for the answer!

EDIT: I'm doing something similar. Just getting all iterations of a project whould not help in this case, since I only have to get the iterations that contain a plan. So when I do the check method, that searches through all levels of an Iteration, I get the top level iterations the way you described, and compare the IDs of them with the IDs of the top level iterations, which I got with the getParent-loop method.
Simply said, I go backwards and forwards from both sides, top and bottom level.

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.