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

How to get all state ids of a file in ALM using its UUID?

I have a stream1 and a comp inside it. i created a file xyz here.
then i create another stream2 and use same comp as that of stream1. But i will modify xyz file in stream2.
I want to get all the state ids of xyz file by passing its UUID. Is there any method or API or way to get the states of xyz file in both streams 1 and 2 just by passing/using UUID of xyz file.?

0 votes


Accepted answer

Permanent link
To get the history of the file:
IScmService scmService = getService(IScmService.class);
ServiceHistoryProvider historyProvider = ServiceHistoryProvider.FACTORY.create(workspaceHandle, componentHandle);
IVersionableHandle versionableHandle = (IVersionableHandle) type.createItemHandle(Versionable_UUID, null);
scmService.getHistoryForVersionable(historyProvider, versionableHandle, 100, false, null, null);
This would return you 100 of the most recent states of the file.
akshay p selected this answer as the correct answer

0 votes

Comments
thank you sir.
Also can you tell me regarding getService(IScmService.class) and
(IVersionableHandle) type

IScmService scmService = ((IClientLibraryContext) repo).getServiceInterface(IScmService.class);
IItemType type = IItemType.IRegistry.INSTANCE.getItemType("FileItem", "com.ibm.team.filesystem");

thank you sir

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

Thanks in advance

how can i get the 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
× 10,927

Question asked: Feb 06 '19, 1:48 a.m.

Question was seen: 1,098 times

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

Confirmation Cancel Confirm