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

How to fetch Iversionable/IfileItem of a file by passing itemid and stateid of the file

Is there any way i can get the IFileItem or Iversionable just by knowing ITEM id and state id ?

0 votes


Accepted answer

Permanent link

UUID itemId = getFileItemId();
UUID stateId = getFileState();
IComponentHandle componentHandle = getComponentHandle();
IWorkspaceConnection workspaceConnection = getWorkspaceConnection();


IFileItemHandle fileItemHandle = (IFileItemHandle) IFileItem.ITEM_TYPE.createItemHandle(itemId, stateId);
IFileItem file = (IFileItem) workspaceConnection.configuration(componentHandle).fetchCompleteItem(fileItemHandle, monitor);

Ralph Schoon selected this answer as the correct answer

0 votes

Comments
Currently i am taking State id and item id of a file from different location and these two parameters are of String type. How i can convert them into UUID type.

and one more thing is that, i have various baselines of same component and snapshots of streams. SO i don't want to pass/specify any specific component or stream as a input parameter.

I want to retrieve the file irrespective of streams, snapshots, baselines and JUST WANT TO USE UUID of ITEM ID AND STATE ID

The server API is: IScmService.fetchState(...)

Or from the client API you can call:
IVersionableManager vmgr = SCMPlatform.getWorkspaceManager(repo).versionableManager();
IVersionable versionable = vmgr.fetchCompleteState(versionableHandle, monitor);

how i can get relative path of the file?

You can use:

IScmService.configurationLocateAncestors(...)

or

IScmService.configurationDetermineAncestorsInHistory(...)  (this will give you the path of a file even if it was recently deleted in the stream - it goes through the change set history to try to find the path 'where the file used to be).

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
× 7,592
× 1,725

Question asked: Feb 11 '19, 4:36 a.m.

Question was seen: 3,020 times

Last updated: Feb 21 '19, 12:26 p.m.

Related questions
Confirmation Cancel Confirm