IContributor from IContributorHandle
I am using the following code sample to try to retrieve IContributor from IContributorHandle in a advisor, which I had noticed on another forum post:
IContributorHandle owner = workItem.getOwner();
IRepositoryItemService itemService = getService(IRepositoryItemService.class);
IContributor user = (IContributor) itemService.fetchItem(owner, null);
I don't see any compilation errors in the project.
However, when the advisor runs, I get the following error:
Problem
An unhandled exception occurred during "Check Owner Advisor".
The service 'com.pb.CheckOwnerAdvisor@35f835f8' failed to find the required service 'interface com.ibm.team.repository.service.IRepositoryItemService'. Check <prerequisites> in plugin.xml.
I would deeply appreciate feedback on the issue.
Thanks.
IContributorHandle owner = workItem.getOwner();
IRepositoryItemService itemService = getService(IRepositoryItemService.class);
IContributor user = (IContributor) itemService.fetchItem(owner, null);
I don't see any compilation errors in the project.
However, when the advisor runs, I get the following error:
Problem
An unhandled exception occurred during "Check Owner Advisor".
The service 'com.pb.CheckOwnerAdvisor@35f835f8' failed to find the required service 'interface com.ibm.team.repository.service.IRepositoryItemService'. Check <prerequisites> in plugin.xml.
I would deeply appreciate feedback on the issue.
Thanks.
Accepted answer
Check the particpants plugin.xml, there is a <prerequisites> block.
You'll need to be sure you have
<prerequisites>
<requiredService interface="com.ibm.team.repository.service.IRepositoryItemService"/>
.
.
</prerequisites>
You'll need to be sure you have
<prerequisites>
<requiredService interface="com.ibm.team.repository.service.IRepositoryItemService"/>
.
.
</prerequisites>
Comments
3 other answers
if you have the manifest file open in the eclipse editor, you may want to look at the dependencies tab.
You must have an entry here for com.ibm.team.repository.service.
If you dont find it, please revisit your Target Platform to add the required library to it and add the dependency in the plugin configuration.
hope this helps.
You must have an entry here for com.ibm.team.repository.service.
If you dont find it, please revisit your Target Platform to add the required library to it and add the dependency in the plugin configuration.
hope this helps.
Comments
the prereq block is optional.. here is part of a plugin.xml for one of my plugins
you can get to it from the plugin.xml editor UI as well.. right click on the elements in the Extensions tab for additional items. (see image below)
<extension
point="com.ibm.team.process.service.operationParticipants">
<operationParticipant
class="com.sd.tools.CreateApprovalParticipant"
id="com.sd.tools.workitem.createapproval.participant"
name="Create Approval Participant"
operationId="com.ibm.team.workitem.operation.workItemSave">
<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>
<description>
some description here
</description>
</operationParticipant>
</extension>
you can get to it from the plugin.xml editor UI as well.. right click on the elements in the Extensions tab for additional items. (see image below)
<extension
point="com.ibm.team.process.service.operationParticipants">
<operationParticipant
class="com.sd.tools.CreateApprovalParticipant"
id="com.sd.tools.workitem.createapproval.participant"
name="Create Approval Participant"
operationId="com.ibm.team.workitem.operation.workItemSave">
<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>
<description>
some description here
</description>
</operationParticipant>
</extension>