It's all about the answers!

Ask a question

fetch the History of a component in a stream in EWM client using RTC API


Yukti Bhat (261) | asked Apr 29, 5:42 a.m.

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?

One answer



permanent link
Ralph Schoon (63.3k33646) | answered Apr 29, 9:30 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I am not a expert for the EWM SCM API. The only suggestion I can provide here is:

  1. Read https://rsjazz.wordpress.com/2015/09/30/learning-to-fly-getting-started-with-the-rtc-java-apis/ and perform at least lab 1 of the EWM/RTC Extensions Workshop. 
  2. This provides you with the EWM SDK and you can look at the source code. You can also look into the unit tests. See how the API is used in the unit tests.
  3. You can also debug code e.g. plain Java client libraries based code.
Note that the answers you refer to also state that some of the classes being used are not API.

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.