It's all about the answers!

Ask a question

about project area and process template


yaoben lu (56181) | asked Dec 21 '09, 1:49 a.m.
Hi all,
My code tries to retrieve project area of a sharable object (such as a shared java file). When the process template of the project area is openup, it works just fine. But when the process template is simple team process template, it just couldn't find the project area.

Below is my code.

IProjectAreaHandle prjArea = null;

ISharingDescriptor shareDesc = shareable.getShare(null)
.getSharingDescriptor();
IWorkspaceHandle workspaceHandle = (IWorkspaceHandle)shareDesc.getConnectionHandle();


ITeamRepository repos = getTeamRepository(shareDesc);
IItemManager im = repos.itemManager();

IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(repos);
IWorkspaceConnection workspaceConnection = workspaceManager.getWorkspaceConnection(workspaceHandle, null);

IFlowEntry currentFlowEntry = workspaceConnection.getFlowTable().getCurrentDeliverFlow();
if (currentFlowEntry != null) {

IWorkspaceHandle targetHandle = (IWorkspaceHandle) currentFlowEntry.getFlowNode();
IWorkspaceConnection targetConnection = workspaceManager.getWorkspaceConnection(targetHandle, null);
if (targetConnection.isStream()) {
IAuditableHandle ownerHandle = targetConnection.getOwner();
ITeamArea teamArea = (ITeamArea) im.fetchCompleteItem((ITeamAreaHandle)ownerHandle, IItemManager.DEFAULT, null);
prjArea = teamArea.getProjectArea();

}
}


So, what is the problem of this? I hope the code works in any template.

2 answers



permanent link
Sridevi Sangaiah (59179) | answered Dec 21 '09, 11:31 p.m.
JAZZ DEVELOPER
Hi all,
My code tries to retrieve project area of a sharable object (such as a shared java file). When the process template of the project area is openup, it works just fine. But when the process template is simple team process template, it just couldn't find the project area.

Below is my code.

IProjectAreaHandle prjArea = null;

ISharingDescriptor shareDesc = shareable.getShare(null)
.getSharingDescriptor();
IWorkspaceHandle workspaceHandle = (IWorkspaceHandle)shareDesc.getConnectionHandle();


ITeamRepository repos = getTeamRepository(shareDesc);
IItemManager im = repos.itemManager();

IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(repos);
IWorkspaceConnection workspaceConnection = workspaceManager.getWorkspaceConnection(workspaceHandle, null);

IFlowEntry currentFlowEntry = workspaceConnection.getFlowTable().getCurrentDeliverFlow();
if (currentFlowEntry != null) {

IWorkspaceHandle targetHandle = (IWorkspaceHandle) currentFlowEntry.getFlowNode();
IWorkspaceConnection targetConnection = workspaceManager.getWorkspaceConnection(targetHandle, null);
if (targetConnection.isStream()) {
IAuditableHandle ownerHandle = targetConnection.getOwner();
ITeamArea teamArea = (ITeamArea) im.fetchCompleteItem((ITeamAreaHandle)ownerHandle, IItemManager.DEFAULT, null);
prjArea = teamArea.getProjectArea();

}
}


So, what is the problem of this? I hope the code works in any template.


Hi,

Can you please provide more details on where exactly your code fails?

Thanks
Sridevi
Jazz Process Team.

permanent link
Jared Burns (4.5k29) | answered Jan 04 '10, 10:23 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
On Mon, 21 Dec 2009 06:52:51 +0000, luyaoben wrote:

Hi all,
My code tries to retrieve project area of a sharable object (such as a
shared java file). When the process template of the project area is
openup, it works just fine. But when the process template is simple team
process template, it just couldn't find the project area.

Below is my code.

IProjectAreaHandle prjArea = null;

ISharingDescriptor shareDesc = shareable.getShare
(null)
.getSharingDescriptor();
IWorkspaceHandle workspaceHandle =
(IWorkspaceHandle)shareDesc.getConnectionHandle();


ITeamRepository repos = getTeamRepository
(shareDesc); IItemManager im
= repos.itemManager();

IWorkspaceManager workspaceManager =
SCMPlatform.getWorkspaceManager(repos);
IWorkspaceConnection workspaceConnection =
workspaceManager.getWorkspaceConnection(workspaceHandle, null);

IFlowEntry currentFlowEntry =
workspaceConnection.getFlowTable().getCurrentDeliverFlow();

if (currentFlowEntry != null) {

IWorkspaceHandle targetHandle = (IWorkspaceHandle)
currentFlowEntry.getFlowNode();
IWorkspaceConnection targetConnection =
workspaceManager.getWorkspaceConnection(targetHandle, null);
if (targetConnection.isStream()) {
IAuditableHandle ownerHandle =
targetConnection.getOwner();
ITeamArea teamArea = (ITeamArea)
im.fetchCompleteItem((ITeamAreaHandle)ownerHandle, IItemManager.DEFAULT,
null);
prjArea = teamArea.getProjectArea();

}
}


So, what is the problem of this? I hope the code works in any template.

Looks like your code is casting the "ownerHandle" to an ITeamAreaHandle.
I believe SCM allows the stream owner to be either a team area or a
project area. Your code is probably failing because the new Scrum
template creates a stream that is owned by a project area.

Change your code to cast the ownerHandle to IProcessArea instead. Might
want to throw in an instanceof check for good measure, since I think the
owner can also be an IContributor.

--
Jared Burns
Jazz Process Team

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.