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

How to get a VersionableHandle given a file name & versi

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.

Regards,
Swathi.

0 votes


Accepted answer

Permanent link

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

1 vote

Comments

An update after 4 years! Cool :)


2 other answers

Permanent link
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);

0 votes


Permanent link

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

0 votes

Comments

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

1 vote

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

Question asked: Jan 20 '08, 12:06 p.m.

Question was seen: 8,120 times

Last updated: Jun 15 '18, 2:35 a.m.

Confirmation Cancel Confirm