How to fetch the history a versioned file in rtc programmatically
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;
}
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;
}