Why getOrigin() returns null on the server side
Hello!
I can not go through an initial problem getting a reference to current repository object. I need it to get the additional libraries which could help me to work with workitem attributes. I try to get the repository object in this way:
...IWorkItem wi...
ITeamRepository repo = (ITeamRepository) wi.getOrigin();
I tried next services as prerequisites in plugin.xml:
<prerequisites>
<requiredService interface="com.ibm.team.workitem.service.IWorkItemServer"/>
<requiredService interface="com.ibm.team.repository.service.IRepositoryItemService"/>
<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"/>
</prerequisites>
But every time, I get null instead of an existing object! And the question is, which service could be declared to get non null repository object?
Thank you in advance!
I can not go through an initial problem getting a reference to current repository object. I need it to get the additional libraries which could help me to work with workitem attributes. I try to get the repository object in this way:
...IWorkItem wi...
ITeamRepository repo = (ITeamRepository) wi.getOrigin();
I tried next services as prerequisites in plugin.xml:
<prerequisites>
<requiredService interface="com.ibm.team.workitem.service.IWorkItemServer"/>
<requiredService interface="com.ibm.team.repository.service.IRepositoryItemService"/>
<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"/>
</prerequisites>
But every time, I get null instead of an existing object! And the question is, which service could be declared to get non null repository object?
Thank you in advance!
Accepted answer
because your plugin extends AbstractSerivce you have access to methods to load other libraries
fWorkItemServer = getService(IWorkItemServer.class);
fAuditableCommon = getService(IAuditableCommon.class);
fcontributorService = getService(IContributorService.class);
fProcessServerService = getService(IProcessServerService.class);
fQueryService = getService(IQueryService.class);
fItemService = getService(IRepositoryItemService.class);
Comments
1 vote
showing 5 of 6
show 1 more comments