It's all about the answers!

Ask a question

How to retrieve all the Changesets from a stream using plain java API


kiren sk (1515) | asked Jan 23 '14, 12:52 a.m.
 Hi,

I am a newbee to the RTC Java Api . I am trying to get all the delivered changesets against a project in RTC.

I was able to retrieve the streams created under the project using the below code .  Please help on how we can retrieve the changesets from the component lists. 

Also if some one can point to examples in RTC Jazz API it will be much helpful

final IWorkspaceManager mgr = SCMPlatform
.getWorkspaceManager(m_TeamRepo);

IWorkspaceSearchCriteria workspaceCriteria = WorkspaceSearchCriteria.FACTORY
.newInstance();
workspaceCriteria.setPartialOwnerName(projectName);
workspaceCriteria.setKind(IWorkspaceSearchCriteria.STREAMS);

List<IWorkspaceHandle> streamList;
try {
streamList = mgr.findWorkspaces(workspaceCriteria,
Integer.MAX_VALUE, new NullProgressMonitor());

for (IWorkspaceHandle iWorkspaceHandle : streamList) {
IWorkspace stream = (IWorkspace) iWorkspaceHandle
.getFullState();

IWorkspaceConnection workspaceConnection = mgr
.getWorkspaceConnection(iWorkspaceHandle, null);
List componentList = workspaceConnection.getComponents();

for (Object compHandle : componentList) {
// need help . 
}
}

Thanks

One answer



permanent link
sam detweiler (12.4k6179201) | answered Jan 23 '14, 5:28 a.m.
from the javadoc (make sure u get it)

IWorkspaceManager

findChangeSets

java.util.List findChangeSets(IChangeSetSearchCriteria criteria,
                              int maxResults,
                              org.eclipse.core.runtime.IProgressMonitor monitor)
                              throws TeamRepositoryException
Search the repository for changesets matching the specified criteria and return the matched changesets.

Parameters:
criteria - The criteria to look for, must not be null.
maxResults - The maximum number of results to return, must be >0, if larger than IWorkspaceManager.MAX_QUERY_SIZE , only IWorkspaceManager.MAX_QUERY_SIZE results will be returned.
monitor - a progress monitor, or null if progress reporting is not desired
Returns:
The list of changeset handles maching the criteria, never null. Ordered by modified date, most recent first.
Throws:
NotLoggedInException - if the operation fails because the client was not logged in to the repository
org.eclipse.core.runtime.OperationCanceledException - if the operation is canceled. Cancellation can occur even if no progress monitor is provided.
TeamRepositoryException - if the operation fails for any other reason



Your answer


Register or to post your answer.