It's all about the answers!

Ask a question

How to get a VersionableHandle given a file name & versi

Swathi Rao (5112) | asked Jan 20 '08, 12:06 p.m.
I would like to retrieve the content of a specific file version from the server. Given the name and full path to a file and the file version number, how is it possible to retrieve the VersionableHandle?

The SCM code snippet example currently available shows how to get a handle to a file in the Jazz server for a locally loaded file in the Eclipse workspace. However I would like to get it for any file in a SCM stream or workspace.

The article on "Jazz Platform Architecture - Notes on service programming model" mentions that we need to use IFileSystemService for file system related service calls. But when I looked at the Jazz source code, I found that SCMPlatform.getWorkspaceManager.fetchCompleteStates was used in most places. Could someone also recommend the right approach to retrieve a file item from the server.


Accepted answer

permanent link
Priyadarshini Gorur (3313) | answered Apr 30 '18, 12:32 p.m.
edited Jun 15 '18, 2:35 a.m.

Just to add to the previous answer, to retrieve the content of a specific file version, after getting the IVersionable:

IVersionedContentManager versionedContentManager = SCMPlatform.getWorkspaceManager(repository).getSCMContentManager();
IFileItem file = (IFileItem) version;
InputStream stream = versionedContentManager.retrieveContentStream(versionHandle, file.getContent(), monitor);

Ralph Schoon selected this answer as the correct answer

Atul Kumar commented May 01 '18, 12:13 p.m.

An update after 4 years! Cool :)

2 other answers

permanent link
Atul Kumar (1872129) | answered Jun 17 '14, 1:50 a.m.
IVersionableHandle versionHandle = (IVersionableHandle) IFileItem.ITEM_TYPE.createItemHandle(UUID.valueOf(fileUuid), UUID.valueOf(stateUuid));
IVersionableManager verManager = SCMPlatform.getWorkspaceManager(repository).versionableManager();
IVersionable version = verManager.fetchCompleteState(versionHandle, monitor);

permanent link
Atul Kumar (1872129) | answered May 01 '18, 12:13 p.m.

The question was asked some 10 years back, BTW ;)

Priyadarshini Gorur commented May 02 '18, 2:51 a.m.

Just for the benefit of others, if at all :)

Your answer

Register or to post your answer.