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.
 Hello
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 

com.ibm.team.process.common.TeamAreaHierarchyException: Child team area is not part of this team area hierarchy
at com.ibm.team.process.internal.common.util.TeamAreaHierarchy.check(TeamAreaHierarchy.java:466)
at com.ibm.team.process.internal.common.util.TeamAreaHierarchy.getParent(TeamAreaHierarchy.java:142)

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.5k33646) | answered Oct 13 '14, 7:59 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Have you tried to use .getProjectArea() on the process Area?

Comments
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.