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

Equivalent method to fetchCompleteState

 Is there any equivalent method for fetchCompleteState on versionableManager to fetch data of historic files? I'm having troubles with retrieving file name of file added in previous changelists. Here is example:

Changelist 1:     
add file: src/newFile.java

Changelist 2:     
modify file: src/newFile.java

Changelist 3:     
rename file: src/newFile.java -> src/newFile_rename.java

And now when I'm trying to get file name or file path of file in changelist 1 using following code:

// change is IChange, versionableManager is IVersionableManager     
// method getFilePath retrieve file path using ancestors     
file = versionableManager.fetchCompleteState(change.afterState(), monitor);     
if (file instanceof IFolder) {         
    IFolder folder = (IFolder) file;         
    relativePath = getFilePath(file, workspaceConnection.configuration(changeSet.getComponent()), monitor);
    fileName = folder.getName();     
} else {
    relativePath = getFilePath(file, workspaceConnection.configuration(changeSet.getComponent()), monitor);    
    fileName = ((FileItem) file).getName();     
}

I'm getting name and path of renamed file. How to get it's old name and path?

0 votes



One answer

Permanent link
 Ok found the solution:
IFileItemHandle fileItemHandle = (IFileItemHandle) IFileItem.ITEM_TYPE.createItemHandle(change.afterState().getItemId(), change.afterState().getStateId());
file = versionableManager.fetchCompleteState(fileItemHandle, monitor);

if (file instanceof IFolder) {         
    IFolder folder = (IFolder) file;         
    relativePath = getFilePath(file, workspaceConnection.configuration(changeSet.getComponent()), monitor);
    fileName = folder.getName();      
} else {
    relativePath = getFilePath(file, workspaceConnection.configuration(changeSet.getComponent()), monitor);    
    fileName = ((FileItem) file).getName();     
}

But still having isses with resolving file path. Anyways this is a big step.

0 votes

Your answer

Register or log in 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.

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,938

Question asked: May 06 '13, 11:18 a.m.

Question was seen: 4,207 times

Last updated: May 07 '13, 4:30 a.m.

Confirmation Cancel Confirm