It's all about the answers!

Ask a question

How to get all changesets for each single component


1
1
Bastian W (217) | asked Oct 15 '15, 12:20 p.m.
edited Oct 16 '15, 6:03 a.m.
Hi all,

i want to get all changesets from a component from the Source Control in RTC.
First i have list all streams and then every component of each single stream.
See the code below:

//List all Stream for each single ProjectArea

 IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(teamRepository);
 IWorkspaceSearchCriteria stcriteria = IWorkspaceSearchCriteria.FACTORY.newInstance();
                   
 stcriteria.setKind(IWorkspaceSearchCriteria.STREAMS);
 stcriteria.setPartialOwnerNameIgnoreCase(projectArea.getName());             
                   
 List <IWorkspaceHandle> workspaceHandles = workspaceManager.findWorkspaces(stcriteria,Integer.MAX_VALUE,monitor);
IWorkspaceConnection workspaceConnection = workspaceManager.getWorkspaceConnection(workspaceHandles.get(0),monitor);
                       
System.out.println("Streams: ");
System.out.println(workspaceConnection.getName());


 //List all Components for each single ProjectArea
                   
List components = teamRepository.itemManager().fetchCompleteItems(workspaceConnection.getComponents(), IItemManager.DEFAULT, null);
                    for (Iterator<IComponent> it = components.iterator(); it.hasNext();) {
                        IComponent component = it.next();
                        System.out.println("Components: ");
                        System.out.println(component.getName());
                    }

List components = teamRepository.itemManager().fetchCompleteItems(workspaceConnection.getComponents(), IItemManager.DEFAULT, null);
                    for (Iterator<IComponent> it = components.iterator(); it.hasNext();) {
                        IComponent component = it.next();
                        System.out.println("Components: ");
                        System.out.println(component.getName());                       
                    }

Now i try to get the changesets of the components. I want to know the changesets after one defined date. I tried the following thing:

IChangeSetSearchCriteria criteria = IChangeSetSearchCriteria.FACTORY.newInstance();
criteria.setModifiedAfter(timestamp);              /// the timestamp is for example 01.10.2015
.......need help here.......= workspaceManager.findChangeSets(criteria,512, null);



Is it right? but now i don't know how to handle the changeset. How can i list and view them?
It would be very nice, if someone can help me!

Best Regards!



Comments
Chris McGee commented Oct 20 '15, 2:29 p.m.
FORUM MODERATOR / JAZZ DEVELOPER

Fetching all of the change sets in a project area and the components can be an expensive operation. What's the purpose here?

Btw, I posted an answer on your other question. Maybe that is helpful with this question?

https://jazz.net/forum/questions/208609/how-to-use-changesets-for-the-last-modification-in-the-source-control-java-api?page=1&focusedAnswerId=209390#209390

One answer



permanent link
Bastian W (217) | answered Oct 16 '15, 6:02 a.m.
Hello,

ich found the solution for me:

expanded to my first post:

IChangeSetSearchCriteria criteria = IChangeSetSearchCriteria.FACTORY.newInstance();
                        criteria.setModifiedAfter(timestamp);
                        criteria.setComponent(component);
                       
                        List<IChangeSetHandle> workspacehandle = workspaceManager.findChangeSets(criteria,512, null);
                        for (Iterator<IChangeSetHandle> changeset = workspacehandle.iterator(); changeset.hasNext();) {
                            IChangeSetHandle changesethandle = changeset.next();
                            System.out.println("Changesets: ");
                            System.out.println(changesethandle.getItemId());

Now i get all Changesets for each single component.

Best Regards!

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.