about project area and process template
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.
So, what is the problem of this? I hope the code works in any template.
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
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.
On Mon, 21 Dec 2009 06:52:51 +0000, luyaoben wrote:
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
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