Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to get Team Area of a WorkItem [using multiple timelines] in Plain Java API

I need to export work item information. I am able to export everything of a workitem except the calculated team area. I tried to calculate the teamarea by myself, but I stuck with the implementation of it.

Is there anyone who did this before or who can point me out how to do this?
Any tip is highly appreciated. 

EDIT:
I was successful getting all team areas of a category. But I don't know how to get further on as I have multiple timelines where another team area is associated to the same category
As you see in the example below, the Category "Test Category" is associated to the Project Area by default on the "Main Development" Timeline. As soon as I switch the timeline to "Timeline 1", the category is associated to the team "Team 1", the same for "Timeline 2" with "Team 2"



My current source:
// get the workitem's associated category
ICategoryHandle cat = myCurrentWorkItem.getCategory();
ICategory category = (ICategory) teamRepository.itemManager().fetchCompleteItem(cat, IItemManager.REFRESH, monitor);
logger.info("category name: " +category.getName());
// get all team areas associated to the above category
List<ITeamAreaHandle> tAreas = category.getAssociatedTeamAreas();
for(ITeamAreaHandle tArea : tAreas) {
ITeamArea teamArea = (ITeamArea) teamRepository.itemManager().fetchCompleteItem(tArea, IItemManager.REFRESH, monitor);
logger.info("team area: " + teamArea.getName());
}
// check whether default team area is useful
ITeamAreaHandle teamAreaHandle = category.getDefaultTeamArea();
ITeamArea defaultTeamArea = (ITeamArea) teamRepository.itemManager().fetchCompleteItem(teamAreaHandle, IItemManager.REFRESH, monitor);
logger.info("default team area: " + defaultTeamArea.getName());

1

1 vote



2 answers

Permanent link
 I have finally managed to find this out by myself. Here's the solution:

IWorkItem myWorkItem = ...;
IWorkItemCommon workItemCommon = (IWorkItemCommon) teamRepository.getClientLibrary(IWorkItemCommon.class);
IProcessAreaHandle processAreaHandle = workItemCommon.findProcessArea(myWorkItem, null);
IProcessArea processArea = (IProcessArea) teamRepository.itemManager().fetchCompleteItem(processAreaHandle, IItemManager.REFRESH, monitor);
String teamAreaName = processArea.getName();

1 vote


Permanent link
You can get the information from the work item category.   For example, given a connection the list of categories can be had:

            List<ICategory> findCategories = service.findCategories(
                    projectArea, ICategory.FULL_PROFILE,
                    jazzServer.getMonitor());

You can get the category attribute from a IWorkItem workItem.getCategory().  Given the category you can use the getDefaultTeamArea() or getAssociatedTeamAreas().  However the workItem.getCategory() return might have to be cast or otherwise retrieved.


0 votes

Comments

 I have tried a similar approach as you (see my edited question above). But I have troubles if I have multiple timelines where the team area is different between the timelines

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,948
× 411
× 169

Question asked: Feb 04 '14, 4:58 a.m.

Question was seen: 7,844 times

Last updated: Feb 07 '14, 3:55 a.m.

Confirmation Cancel Confirm