Hi,
I am trying to write code that uses the RTC Plain Java API to perform some queries on work items for reporting purposes. I am using RTC 4.0.3. I am able to get references to most clients using the often demonstrated technique of doing, for example,
ITeamBuildClient teamBuildClient = (ITeamBuildClient) teamRepository.getClientLibrary(ITeamBuildClient.class);
IWorkspaceManager workspaceManager = (IWorkspaceManager) teamRepository.getClientLibrary(IWorkspaceManager.class);
IAuditableClient auditableClient = (IAuditableClient) teamRepository.getClientLibrary(IAuditableClient.class);
These work fine and I am able to query relevant information with all of them, with the exception of IWorkItemClient or IWorkItemCommon. If I do:
IWorkItemClient workItemClient = (IWorkItemClient) teamRepository.getClientLibrary(IWorkItemClient.class);
I get the following stacktrace:
java.lang.NullPointerException
at com.ibm.team.workitem.common.internal.DeliverableCache.<init>(DeliverableCache.java:35)
at com.ibm.team.workitem.common.internal.WorkItemCommon.<init>(WorkItemCommon.java:168)
at com.ibm.team.workitem.client.internal.WorkItemClient.<init>(WorkItemClient.java:368)
at com.ibm.team.workitem.client.internal.WorkItemClientLibraryFactory.createClientLibrary(WorkItemClientLibraryFactory.java:17)
at com.ibm.team.repository.client.internal.ClientLibraryFactoryRegistry.getClientLibrary(ClientLibraryFactoryRegistry.java:90)
at com.ibm.team.repository.client.internal.TeamRepository.getClientLibrary(TeamRepository.java:519)
at test.ScmTest.main(ScmTest.java:162)
I have also tried to get around the problem by using IQueryableAttributeFactory, but that also gives a NPE in the following form:
java.lang.NullPointerException
at com.ibm.team.workitem.common.internal.expression.WorkItemQueryAttributeFactory.cacheCustomAttributesFromWorkitemTypes(WorkItemQueryAttributeFactory.java:444)
at com.ibm.team.workitem.common.internal.expression.WorkItemQueryAttributeFactory.updateCache(WorkItemQueryAttributeFactory.java:132)
at com.ibm.team.workitem.common.internal.util.CacheHelper.internalCheckCache(CacheHelper.java:114)
at com.ibm.team.workitem.common.internal.util.CacheHelper.checkCache(CacheHelper.java:89)
at com.ibm.team.workitem.common.internal.expression.WorkItemQueryAttributeFactory.findAttribute(WorkItemQueryAttributeFactory.java:97)
at test.ScmTest.main(ScmTest.java:131)
I have also tried a couple of other techniques but all lead to the same end issue, which is that a part of the code calls the (deprecated) IAuditableCommon.getPeer() method, which always returns a null. What is the purpose of that method and is there a way to get around it, especially in the context of getting an instance of IWorkItemClient?
Thanks.