It's all about the answers!

Ask a question

Changing the author of a change set via the java API


Brian Green (5145) | asked Feb 27 '12, 8:05 p.m.
Is it possible to change the author of a change set via the java API? Also, is it possible to retrieve all change sets via the java API? I see that there's a MAX_QUERY_SIZE limit on the number of returned entries. How can I fetch more than that? Is there any kind of paging or something?

8 answers



permanent link
Brian Green (5145) | answered Feb 28 '12, 8:05 p.m.
Okay, I found the answer to one of my questions. To fetch all change sets, even exceeding the MAX_QUERY_SIZE, I found HistoryIterator. It doesn't look like I can import HistoryIterator and use it directly (though I'm a java noob), but reading the source for the class told me what to do.

It looks like it uses IWorkspaceConnection.changeHistory to fetch the change history for a component, and then repeatedly calls IChangeHistory.getHistoryDescriptors and IChangeHistoryDescriptor.previousHistory to fetch the entire history.

permanent link
Ralph Schoon (63.1k33646) | answered Feb 28 '12, 8:52 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Is it possible to change the author of a change set via the java API? Also, is it possible to retrieve all change sets via the java API? I see that there's a MAX_QUERY_SIZE limit on the number of returned entries. How can I fetch more than that? Is there any kind of paging or something?


Brian, do you refer to work items? I think I have seen the MAX_QUERY_SIZE but that was for work items.

permanent link
Brian Green (5145) | answered Feb 28 '12, 3:41 p.m.
Brian, do you refer to work items? I think I have seen the MAX_QUERY_SIZE but that was for work items.


I was referring to the second parameter on IWorkspaceManager.findChangeSets, which is 'maxResults'. The documentation I have says:

maxResults - The maximum number of results to return, must be >0, if larger than MAX_QUERY_SIZE, only MAX_QUERY_SIZE results will be returned.

So I was wondering how I could fetch all change sets, even if the number exceeds MAX_QUERY_SIZE.

permanent link
Ralph Schoon (63.1k33646) | answered Feb 28 '12, 3:43 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Brian, do you refer to work items? I think I have seen the MAX_QUERY_SIZE but that was for work items.


I was referring to the second parameter on IWorkspaceManager.findChangeSets, which is 'maxResults'. The documentation I have says:

maxResults - The maximum number of results to return, must be >0, if larger than MAX_QUERY_SIZE, only MAX_QUERY_SIZE results will be returned.

So I was wondering how I could fetch all change sets, even if the number exceeds MAX_QUERY_SIZE.

For Work items there is a similar limit.I was able to set it to maxint-1 or something. Not sure if you can change the user in the changest. I have not done a lot with the SCM API.

permanent link
Brian Green (5145) | answered Feb 28 '12, 10:45 p.m.
It looks like I might be able to change the author of a comment via IChangeEvent.setAuthor, and then IChangeEventService.save to save the change, but I'm not sure how to instantiate an IChangeEventService. Does anyone know how to do that, or does this sound like the right method?

permanent link
Ralph Schoon (63.1k33646) | answered Feb 29 '12, 2:37 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
It looks like I might be able to change the author of a comment via IChangeEvent.setAuthor, and then IChangeEventService.save to save the change, but I'm not sure how to instantiate an IChangeEventService. Does anyone know how to do that, or does this sound like the right method?


On the server you can get services using getService(IChangeEventService.class); inherited from AbstractService.

In the Client Library you can use teamRepository.getClientLibrary(IChangeEventService.class)

permanent link
Brian Green (5145) | answered Feb 29 '12, 4:18 p.m.
In the Client Library you can use teamRepository.getClientLibrary(IChangeEventService.class)


When I try that, getClientLibrary returns null. Is there something else that I also have to do to make that work?

permanent link
Ralph Schoon (63.1k33646) | answered Mar 01 '12, 2:37 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
The SDK if you hover over tha class and have it set up right says:

com.ibm.team.repository.common.service.IChangeEventService
Provides operations for creating, updating and deleting change events in the repository.

On the server, use AbstractService.getService(Class) to obtain an instance. This service is available remotely. (The client interface IChangeEventManager is the client-side counterpart of this service.)

Since:
0.5
@NoImplement
Clients must not implement this interface.


I can't find IChangeEventManager in the Javadoc for the Plain Java Client Libraries. Sorry, I can't help here.

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.