It's all about the answers!

Ask a question

How to fetch the history a versioned file in rtc programmatically


Chandan M B (1132963) | asked Sep 03 '15, 1:40 a.m.
Hi,
I am able to locate the file programmatically in rtc. But i need to check whether the file has history or not. Please let me know.

public static IVersionableHandle findFile(IFolderHandle root,

    IConfiguration iconfig, String fileName, IProgressMonitor monitor)

    throws TeamRepositoryException {

        System.out.println(fileName+ "---File Name---");
        String fileNamePath[] = { fileName };

        IVersionableHandle filePathHandle = null;

        // Check if file at this folder level

        filePathHandle = iconfig.resolvePath(root, fileNamePath, monitor);

        if (filePathHandle != null) {

            return filePathHandle;

        }

        @SuppressWarnings("unchecked")
        Map<String, IVersionableHandle> childEntries = iconfig.childEntries(root, monitor);

        for (Map.Entry<String, IVersionableHandle> next : childEntries.entrySet()) {

            IVersionableHandle nextVersionable = next.getValue();

            if (nextVersionable instanceof IFolderHandle) {

                filePathHandle = findFile((IFolderHandle) nextVersionable,iconfig, fileName, monitor);

                if (filePathHandle != null) {

                    System.out.println("Found file " + fileName);

                    break;

                }

            }

        }
        return filePathHandle;
    }

Be the first one to answer this question!


Register or to post your answer.