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. |
Accepted answer
Priyadarshini Gorur (331●3)
| answered Apr 30 '18, 12:32 p.m.
JAZZ DEVELOPER 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
|
2 other answers
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); |
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.