It's all about the answers!

Ask a question

How to fetch Team Hierarchy for a new Team Area in an OperationAdvisor for saveTeamArea

Martin Wassermann (13864144) | asked Oct 13 '14, 7:44 a.m.
I'm working at an OperationAdvisor for saveTeamArea. In this precondition I need the parent team of this new team. But I don't know how to get this information.

As far as I know I can use the method ".getParent" on the ITeamHIerarchy object for getting the parent team. But the problem is, that I need the project area object itself to get the ITeamHierarchy. And there is the problem. If I try to fetch the Project area with following code

IProjectArea projectArea = (IProjectArea) repositoryService.fetchItem(
processArea.getProjectArea(), null);
                ITeamAreaHierarchy hierarchy = projectArea.getTeamAreaHierarchy();
ITeamAreaHandle parentTeam = hierarchy
.getParent((ITeamAreaHandle) teamArea.getItemHandle());

I receive the exception Child team area is not part of this team area hierarchy

I understand also the reason for the exception. I have a new team area that is not saved and that is handled by my OperationAdvisor. With the operation "fetchItem" I got the actual state from the repository WITHOUT my new team (because the save is still not completed). Therefore I can't identify the parent team.

Did anybody know a solution how to identify the parent team in the OperationAdvisor?

One answer

permanent link
Ralph Schoon (63.2k33646) | answered Oct 13 '14, 7:59 a.m.
Have you tried to use .getProjectArea() on the process Area?

Martin Wassermann commented Oct 13 '14, 8:04 a.m.
Yes, I have.

 processArea.getProjectArea() returns an IProjectAreaHandle. If I now use the method fetchItem I get the ProjectArea before the save. And that leads to the Exception I have mentioned.

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.