API to get the details of a person who commit code to RTC
One answer
Hi,
The following method "may" work., I haven't tested personally.
Please do let me know if this works..
public void printModifiedByInRepositoryWorkspace(
ITeamRepository repository, IProgressMonitor monitor)
throws TeamRepositoryException, ItemNotFoundException {
IWorkspaceManager iWorkspaceManager = SCMPlatform
.getWorkspaceManager(repository);
int maxSize = 4;
monitor.subTask("Printing MODIFIED BY IN workspace");
IWorkspaceSearchCriteria criteria = IWorkspaceSearchCriteria.FACTORY
.newInstance();
criteria.setExactName("rtcWorkspace");
criteria.setKind(IWorkspaceSearchCriteria.WORKSPACES);
java.util.List<IWorkspaceHandle> workspaceList = iWorkspaceManager
.findWorkspaces(criteria, maxSize, monitor);
System.out.println("found " + workspaceList.size()
+ " matching workspaces");
for (IWorkspaceHandle iWorkspaceHandle : workspaceList) {
IWorkspace iWorkspace = (IWorkspace) repository.itemManager()
.fetchCompleteItem(iWorkspaceHandle, IItemManager.DEFAULT,
monitor);
IContributorHandle iContributorHandle = iWorkspace.getModifiedBy();
IContributor iContributor = (IContributor) repository.itemManager()
.fetchCompleteItem(iContributorHandle,
IItemManager.DEFAULT, monitor);
System.out.println(iContributor.getName() + "\t"
+ iContributor.getUserId() + "\t"
+ iContributor.getEmailAddress());
}
}
The following method "may" work., I haven't tested personally.
Please do let me know if this works..
public void printModifiedByInRepositoryWorkspace(
ITeamRepository repository, IProgressMonitor monitor)
throws TeamRepositoryException, ItemNotFoundException {
IWorkspaceManager iWorkspaceManager = SCMPlatform
.getWorkspaceManager(repository);
int maxSize = 4;
monitor.subTask("Printing MODIFIED BY IN workspace");
IWorkspaceSearchCriteria criteria = IWorkspaceSearchCriteria.FACTORY
.newInstance();
criteria.setExactName("rtcWorkspace");
criteria.setKind(IWorkspaceSearchCriteria.WORKSPACES);
java.util.List<IWorkspaceHandle> workspaceList = iWorkspaceManager
.findWorkspaces(criteria, maxSize, monitor);
System.out.println("found " + workspaceList.size()
+ " matching workspaces");
for (IWorkspaceHandle iWorkspaceHandle : workspaceList) {
IWorkspace iWorkspace = (IWorkspace) repository.itemManager()
.fetchCompleteItem(iWorkspaceHandle, IItemManager.DEFAULT,
monitor);
IContributorHandle iContributorHandle = iWorkspace.getModifiedBy();
IContributor iContributor = (IContributor) repository.itemManager()
.fetchCompleteItem(iContributorHandle,
IItemManager.DEFAULT, monitor);
System.out.println(iContributor.getName() + "\t"
+ iContributor.getUserId() + "\t"
+ iContributor.getEmailAddress());
}
}
Comments
Hello Ajay,
java.util.List<iworkspacehandle> workspaceList = iWorkspaceManager.findWorkspaces(criteria, maxSize, monitor);
can i know what is maxSize and iworkspacehandle?
Hi..,
I'm sorry.
I've modified the method..,
You can now have a look at it.
Hello Ajay,
What is ITeamRepository repository and IProgressMonitor monitor ?
Thanks & Regards
Shruti