How to get a IWorkItemRepositoryService object?
I'm trying to use the IWorkItemRepositoryService to get the history of a work item using the following code. However, I always get null when I try to get the IWorkItemRepositoryService object in the first line. Any hints how I can get an instance of this class?
IWorkItemRepositoryService service = (IWorkItemRepositoryService) repository.getClientLibrary(IWorkItemRepositoryService.class); if (service != null) {
ChangeLogDTO[] history = service.computeHistory((com.ibm.team.workitem.common.model.IWorkItem) item.getInternalRepresentation()); for (ChangeLogDTO change : history) {
System.out.println(change.toString());
}
2 answers
Hi,
you are trying to get the service as a client library, which is a call to get the client API.
From what I can see that internal Service is likely a part of the Server API. If you are working on the server you should extend AbstractService and use getService() to get it.
If you develop for the the Client Libraries, look for an analogue Client Library.
you are trying to get the service as a client library, which is a call to get the client API.
From what I can see that internal Service is likely a part of the Server API. If you are working on the server you should extend AbstractService and use getService() to get it.
If you develop for the the Client Libraries, look for an analogue Client Library.
There is
WorkItemClient aWorkItemClient = (WorkItemClient) teamRepository
.getClientLibrary(WorkItemClient.class);
But the class is internal and I am not sure if you can get it as a client. The IWorkitemClient which is the client library interface I am usually using does not expose a similar method.
WorkItemClient aWorkItemClient = (WorkItemClient) teamRepository
.getClientLibrary(WorkItemClient.class);
But the class is internal and I am not sure if you can get it as a client. The IWorkitemClient which is the client library interface I am usually using does not expose a similar method.