Changing the author of a change set via the java API
8 answers
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.
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.
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.
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.
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.
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)
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.
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.