How to get ITeamRepository and IWorkItemClient (in RTC follow-up action)?
Hello everybody!
I'm trying to extend an RTC with follow-up action plug-in. It works well but untill I try to get workitem attributes. How to do it, I found a lot of excellent articles including this one: http://rsjazz.wordpress.com/2013/01/02/working-with-work-item-attributes/ But I stumble at the step when I need get ITeamRepository and IWorkItemClient objects. For example, I used such code: IProcessArea procarea = operation.getProcessArea(); ITeamRepository teamRepository1 = (ITeamRepository) procarea.getOrigin(); IWorkItemClient workItemClient1 = (IWorkItemClient) teamRepository1.getClientLibrary(IWorkItemClient.class); and another one: IProjectAreaHandle projhndl = newState.getProjectArea(); ITeamRepository teamRepository2 = (ITeamRepository) projhndl.getOrigin(); IWorkItemClient workItemClient2 = (IWorkItemClient) teamRepository2.getClientLibrary(IWorkItemClient.class); But every time, I have null for the teamRepository object! Can somebody say what is wrong? As far as I understand, follow-up action is called by RTC under a user which is already connected to the repository. Can I get an existing reference to this data from within RTC extention plug-in? Thank you very much in advance for any advices! |
Accepted answer
because your code is a subclass of abstractService you have access to methods to load libraries
from another plugin
fWorkItemServer = getService(IWorkItemServer.class);
fAuditableCommon = getService(IAuditableCommon.class);
fcontributorService = getService(IContributorService.class);
fProcessServerService = getService(IProcessServerService.class);
fQueryService = getService(IQueryService.class);
fItemService = getService(IRepositoryItemService.class);
note that you must declare the need to access these other services in your plugin.xml
<extensionService
componentId="com.sd.tools.workitem.createapproval.participant.component"
implementationClass="com.sd.tools.CreateApprovalParticipant">
<prerequisites>
<requiredService interface="com.ibm.team.repository.common.service.IContributorService"/>
<requiredService interface="com.ibm.team.workitem.common.IAuditableCommon"/>
<requiredService interface="com.ibm.team.process.service.IProcessServerService"/>
<requiredService interface="com.ibm.team.workitem.service.IWorkItemServer"/>
<requiredService interface="com.ibm.team.repository.common.service.IQueryService"/>
<requiredService interface="com.ibm.team.repository.service.IRepositoryItemService"/>
</prerequisites>
</extensionService>
also all attributes, see here
https://jazz.net/forum/questions/94776/assertionfailedexception-problem-with-getting-the-values-of-attributes
routine
private static void printResolved(IQueryClient queryClient,
Dmitry A. Lesin selected this answer as the correct answer
Comments Thank you very much!
sam detweiler
commented Mar 26 '14, 2:19 p.m.
thank you for posting your usage for others!! |
One other answer
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.