It's all about the answers!

Ask a question

API to get the details of a person who commit code to RTC


shruti gudagur (2811115) | asked Jun 05 '14, 1:17 a.m.
Hello,

How can i get the details like name/usrid, email address of a person who committed code to RTC.
is there any command to get these details..? or any API's?

Thanks & Regards
Shruti

One answer



permanent link
Ajay Mallikarjunaiah (148410) | answered Jun 05 '14, 1:39 a.m.
edited Jun 05 '14, 2:29 a.m.
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());
        }
    }

Comments
shruti gudagur commented Jun 05 '14, 2:25 a.m.

Hello Ajay,

 java.util.List<iworkspacehandle> workspaceList = iWorkspaceManager.findWorkspaces(criteria, maxSize, monitor);

can i know what is maxSize and iworkspacehandle?


Ajay Mallikarjunaiah commented Jun 05 '14, 2:30 a.m.

Hi..,

I'm sorry.
I've modified the method..,
You can now have a look at it.


shruti gudagur commented Jun 05 '14, 4:50 a.m.

Hello Ajay,

What is ITeamRepository repository and IProgressMonitor monitor ?

Thanks & Regards
Shruti

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.