It's all about the answers!

Ask a question

How to get a project area from a WorkItem


Sam Smith (2142) | asked Jun 02 '10, 6:57 a.m.
Hi there,

Can anyone point me towards any docs about how to get a hold of the project area that a particular WorkItem has come from programmatically please?

Many thanks.

3 answers



permanent link
Sam Smith (2142) | answered Jun 03 '10, 6:25 a.m.
Hi there,

Can anyone point me towards any docs about how to get a hold of the project area that a particular WorkItem has come from programmatically please?

Many thanks.


I'm getting there slowly with this by doing the following:


ITeamRepository repository = (ITeamRepository) handle.getOrigin();
if (repository != null) {
IWorkItemClient workItemClient = (IWorkItemClient) repository.getClientLibrary(IWorkItemClient.class);
try {
IProcessAreaHandle pah = workItemClient.findProcessArea(workItemHandle, monitor);
}
catch (TeamRepositoryException e) {
....
}



However, doing this causes me the following exception:

11:22:21,125 ERROR com.ibm.team.repository.client.util.ThreadCheck - Long-running operations prohibited on this thread
java.lang.IllegalStateException: Long-running operations prohibited on this thread
at com.ibm.team.repository.client.util.ThreadCheck.checkLongOpsAllowed(ThreadCheck.java:117)
at com.ibm.team.repository.client.internal.ServiceInterfaceProxy.invoke(ServiceInterfaceProxy.java:81)
at $Proxy0.fetchOrRefreshItems(Unknown Source)
at com.ibm.team.repository.client.internal.ItemManager$3.run(ItemManager.java:1561)
at com.ibm.team.repository.client.internal.ItemManager$3.run(ItemManager.java:1)
at com.ibm.team.repository.client.internal.TeamRepository$3.run(TeamRepository.java:1169)
at com.ibm.team.repository.common.transport.CancelableCaller.call(CancelableCaller.java:79)
at com.ibm.team.repository.client.internal.TeamRepository.callCancelableService(TeamRepository.java:1162)
at com.ibm.team.repository.client.internal.TeamPlatformObject.callCancelableService(TeamPlatformObject.java:41)
at com.ibm.team.repository.client.internal.ItemManager.internalFetchItem(ItemManager.java:1556)
at com.ibm.team.repository.client.internal.ItemManager.access$0(ItemManager.java:1538)
at com.ibm.team.repository.client.internal.ItemManager$AbstractStore.retrieveItem(ItemManager.java:186)
at com.ibm.team.repository.client.internal.ItemManager$CurrentStore.fetchItem(ItemManager.java:311)
at com.ibm.team.repository.client.internal.ItemManager.fetchPartialItem(ItemManager.java:1059)
at com.ibm.team.workitem.client.internal.AuditableClient.resolveAuditable(AuditableClient.java:131)
at com.ibm.team.workitem.common.internal.WorkItemCommon.findProcessArea(WorkItemCommon.java:760)
......


Any advice/doc on how I should be doing this to avoid getting this exception please?

Thanks,

permanent link
Jared Burns (4.5k29) | answered Jun 04 '10, 10:44 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
On Thu, 03 Jun 2010 10:38:03 +0000, smithsj wrote:

11:22:21,125 ERROR
com.ibm.team.repository.client.util.ThreadCheck - Long-running
operations prohibited on this thread
java.lang.IllegalStateException: Long-running operations prohibited on
this thread

What you're seeing here is code which prevents you from performing
network operations in the UI thread. We require that all network requests
are made in background threads in order to keep the UI responsive.

The most common way to get code into background threads is to use a Job
(org.eclipse.core.runtime.jobs.Job).

- Jared

permanent link
Patrick Streule (4.9k21) | answered Jun 11 '10, 9:36 a.m.
JAZZ DEVELOPER
Hi there,

Can anyone point me towards any docs about how to get a hold of the
project area that a particular WorkItem has come from
programmatically please?

Many thanks.

com.ibm.team.workitem.common.model.IWorkItem.getProjectArea()

--
Regards,
Patrick
Jazz Work Item 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.