Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

[closed] Retrieving file path from moved file in VCS

 Hello, 

I'm working on retrieving information from RTC repository. I've managed to successfully gather information from: add, modify, delete operations. Unfortunately I have no idea how to get any information from move and reparent changes. 

here is sample of my code:
IVersionable before = versionableManager.fetchCompleteState(change.beforeState(), monitor);
IVersionable after = versionableManager.fetchCompleteState(change.afterState(), monitor);
String beforePath = getFilePath(before, workspaceConnection.configuration(changeSet.getComponent()), monitor, true);
String afterPath = getFilePath(after, workspaceConnection.configuration(changeSet.getComponent()), monitor, false)
where change is instance of IChange and versionableManager is IVersionableManager.

This part of code suppose to get information about relative path of file/directory before change has been made and relative path after change has occured.

private String getFilePath(IVersionableHandle folder, IConfiguration config, IProgressMonitor monitor, Boolean searchInHistory) throws TeamRepositoryException {
        List lst = new ArrayList<IVersionableHandle>(), ancestors;
        lst.add(folder);

        if (searchInHistory) {
            ancestors = config.determineAncestorsInHistory(lst, monitor);
        } else {
            ancestors = config.locateAncestors(lst, monitor);
        }

        return getFullPath(ancestors);
    } 

private String getFullPath(List ancestor) throws TeamRepositoryException {
        String directoryPath = "";
        for (Object ancestorObj : ancestor) {
            IAncestorReport ancestorImpl = (IAncestorReport) ancestorObj;
            for (Object nameItemPairObj : ancestorImpl.getNameItemPairs()) {
                INameItemPair nameItemPair = (INameItemPair) nameItemPairObj;
                String pathName = nameItemPair.getName();
                if (pathName != null && !pathName.equals("")) {
                    directoryPath = directoryPath + "\\" + pathName;
                }
            }
        }
        return directoryPath;
    }

Unfortunately instead of getting 2 different relative path, I'm getting same ones. What am I doing wrong?

0 votes


The question has been closed for the following reason: "The question was asked and answered here: https://jazz.net/forum/questions/112124/resolving-path-of-iversionable-in-selected-state" by tmok Jul 17 '13, 11:15 a.m.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,934
× 1,202
× 1

Question asked: Apr 25 '13, 11:28 a.m.

Question was seen: 4,536 times

Last updated: Jul 17 '13, 11:15 a.m.

Confirmation Cancel Confirm