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

How to retrieve the project area of a java file?

Hi all!

I have implemented it with Jazz 1.x version. But in 2.0 version some of the interfaces have been changed, my former code doesn't work now.

Here is my former code.

IProjectAreaHandle prjArea = null;
ISharingDescriptor shareDesc = shareable.getShare().getSharingDescriptor();

ITeamRepository repos = getTeamRepository(shareDesc);
IItemManager im = repos.itemManager();
IComponentHandle compRef = shareDesc.getComponent();
IComponent comp = (IComponent) im.fetchCompleteItem(compRef, IItemManager.DEFAULT, null);

// get owning team area & project area
IAuditableHandle compOwner = comp.getOwner();

if (compOwner instanceof ITeamAreaHandle) {
ITeamArea teamArea = (ITeamArea) im.fetchCompleteItem((ITeamAreaHandle)compOwner, IItemManager.DEFAULT, null);
prjArea = teamArea.getProjectArea();
}



IAuditableHandle compOwner = comp.getOwner();


In RTC 2.0, there is no getOwner() method. So, my plugin couldn't find out the project area of a java file.
Could anyone tell me how to modify the code to get the project area in RTC 2.0.

0 votes



11 answers

Permanent link
Ok, we got it:
IScmService scmService = (IScmService) ((IClientLibraryContext) repo).getServiceInterface(IScmService.class);
IComponentHandle componentH = cs.getComponent();
ComponentOwnerHandle componentOwnerH = scmService.getComponentOwnerRecord((ComponentHandle) componentH);
ComponentOwner componentOwner = (ComponentOwner) repo.itemManager().fetchCompleteItem(componentOwnerH, IItemManager.DEFAULT, null);
Cheers.

0 votes

1–15 items
page 2of 1 pagesof 2 pages

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
× 11,089

Question asked: Aug 31 '09, 3:14 a.m.

Question was seen: 19,985 times

Last updated: Aug 29 '12, 6:32 a.m.

Confirmation Cancel Confirm