It's all about the answers!

Ask a question

How to get a IWorkItemRepositoryService object?


S M (8622023) | asked Nov 12 '12, 11:30 a.m.
edited Nov 12 '12, 11:30 a.m.
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



permanent link
Ralph Schoon (63.7k33648) | answered Nov 12 '12, 11:55 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
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.

Comments
S M commented Nov 12 '12, 12:02 p.m.

Thanks! I'm working on the client side, but I have problems to find the appropriate client library...


permanent link
Ralph Schoon (63.7k33648) | answered Nov 12 '12, 12:16 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
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.

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.