It's all about the answers!

Ask a question

How to retrieve the project area of a java file?


yaoben lu (56181) | asked Aug 31 '09, 3:14 a.m.
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.

11 answers



permanent link
Nick Edgar (6.5k711) | answered Sep 09 '09, 3:19 p.m.
JAZZ DEVELOPER
The owner of a component wasn't necessarily the workspace in any case in 1.0 (e.g. it could have been the stream, or some other workspace).

ISharingDescriptor has:
public IContextHandle getConnectionHandle()
the result of which can be cast down to IWorkspaceHandle.

IBaselineHandle also extends IContextHandle, but we don't currently allow loading directly from a baseline or baseline set (aka snapshot).

This still doesn't give you the project area though. Workspaces aren't necessarily tied to a particular project area -- they're owned by individuals, and may load components from various streams. Streams are typically scoped to a project or team area, though. A workspace may flow to/from multiple streams, though, possibly in different project areas. A workspace may also have no flow targets.

It would help to know more about what you're trying to do.

Regards,
Nick Edgar
RTC Build component lead

Your answer


Register or to post your answer.