[closed] Fetch the History of a Component in EWM client using RTC API
Hello,
We are trying to fetch the history of a component from EWM client.
We are trying two methods here.
1st the method:
private static void getChangeHistoryOfComponent(IWorkspaceConnection streamConnection, IComponentHandle component, IProgressMonitor monitor) throws TeamRepositoryException {
IChangeHistory change = streamConnection.changeHistory(component);
System.out.println(change.previousHistory(monitor));
System.out.println(change.getHistoryDescriptor(false, monitor).toString());
System.out.println(change.recent(monitor));
}
the output:
null
com.ibm.team.scm.client.internal.ClientEraDescriptor@e60c466
[com.ibm.team.scm.client.internal.ClientChangeSetEntry@3c577368, com.ibm.team.scm.client.internal.ClientChangeSetEntry@57c7ec30, com.ibm.team.scm.client.internal.ClientChangeSetEntry@729de0e1, com.ibm.team.scm.client.internal.ClientChangeSetEntry@2c8c42c, com.ibm.team.scm.client.internal.ClientChangeSetEntry@5032b2e]
This is not in String/readable format. Is there any way I can convert it to readable format.
Is there any way we can achieve this?
2nd Method
we referred this link from jazz.net :
https://jazz.net/forum/questions/267038/how-to-get-operationhistory-of-the-stream-programmatically-using-rtc-api" class="fui-Link ___1rxvrpe f2hkw1w f3rmtva f1ewtqcl fyind8e f1k6fduh f1w7gpdv fk6fouc fjoy568 figsok6 f1hu3pq6 f11qmguv f19f4twv f1tyq0we f1g0x7ka fhxju0i f1qch9an f1cnd47f fqv5qza f1vmzxwi f1o700av f13mvf36 f1cmlufx f9n3di6 f1ids18y f1tx3yz7 f1deo86v f1eh06m1 f1iescvh fhgqx19 f1olyrje f1p93eir f1nev41a f1h8hb77 f1lqvz6u f10aw75t fsle3fq f17ae5zn" href="https://jazz.net/forum/questions/267038/how-to-get-operationhistory-of-the-stream-programmatically-using-rtc-api" rel="noreferrer noopener" target="_blank" title="https://jazz.net/forum/questions/267038/how-to-get-operationhistory-of-the-stream-programmatically-using-rtc-api">https://jazz.net/forum/questions/267038/how-to-get-operationhistory-of-the-stream-programmatically-using-rtc-api
here they are fetching operationHistory of a stream, which gives the output for me.
When I try a similar API for a component,
the method:
private static void getChangeHistoryOfComponent2(String uuidOfComponent,ITeamRepository teamRepository) throws TeamRepositoryException {
ParmsGetComponentHistory parms = new ParmsGetComponentHistory();
parms.componentItemId= uuidOfComponent;
parms.desiredPageSize = 1;
IScmRichClientRestService scmService = (IScmRichClientRestService) ((IClientLibraryContext) teamRepository).getServiceInterface(IScmRichClientRestService.class);
ScmComponentHistory componentHistory = scmService.getComponentHistory(parms);
if (componentHistory.getHistoryEntries().size() > 0) {
ScmWorkspaceHistoryEntry entry = (ScmWorkspaceHistoryEntry) componentHistory.getHistoryEntries().get(0);
ScmWorkspaceOperationDescription description = entry.getDescription();
System.out.println(description);
}
}
I am getting an error:
Exception in thread "main" com.ibm.team.repository.common.TeamRepositoryException: Internal error
at com.ibm.team.repository.common.internal.marshal.util.MarshallerUtil.decodeExceptions(MarshallerUtil.java:377)
at com.ibm.team.repository.common.internal.marshal.util.MarshallerUtil.decodeExceptions(MarshallerUtil.java:347)
at com.ibm.team.repository.common.internal.marshal.util.MarshallerUtil.decodeFault(MarshallerUtil.java:312)
at com.ibm.team.repository.transport.client.RemoteTeamServer.constructExceptionFromFault(RemoteTeamServer.java:2556)
at com.ibm.team.repository.transport.client.RemoteTeamServer.appendNestedException(RemoteTeamServer.java:2539)
at com.ibm.team.repository.transport.client.RemoteTeamServer.throwHttpClientError(RemoteTeamServer.java:2438)
at com.ibm.team.repository.transport.client.RemoteTeamServer.executeMethod(RemoteTeamServer.java:1425)
at com.ibm.team.repository.transport.client.RemoteTeamServer.executeMethod(RemoteTeamServer.java:1245)
at com.ibm.team.repository.transport.client.RemoteTeamService.executeCancelableHttpMethod(RemoteTeamService.java:659)
at com.ibm.team.repository.transport.client.RemoteTeamService.invokeModelledRestService(RemoteTeamService.java:273)
at com.ibm.team.repository.transport.client.RemoteTeamService.invoke(RemoteTeamService.java:190)
at com.ibm.team.repository.transport.client.ServiceInvocationHandler.invoke(ServiceInvocationHandler.java:43)
at jdk.proxy2/jdk.proxy2.$Proxy26.getComponentHistory(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at com.ibm.team.repository.client.internal.ServiceInterfaceProxy.invokeServiceCall(ServiceInterfaceProxy.java:254)
at com.ibm.team.repository.client.internal.ServiceInterfaceProxy.invoke(ServiceInterfaceProxy.java:110)
at jdk.proxy2/jdk.proxy2.$Proxy26.getComponentHistory(Unknown Source)
at com.mbag.mbse.BaselineHandler.getChangeHistoryOfComponent2(BaselineHandler.java:74)
at com.mbag.mbse.BaselineHandler.main(BaselineHandler.java:62)
Caused by: java.lang.IllegalArgumentException
... 22 more
at this line ScmComponentHistory componentHistory = scmService.getComponentHistory(parms);
Do we know any ways to resolve this?
The question has been closed for the following reason: "Duplicate Question" by rschoon Apr 29, 10:18 a.m.