It's all about the answers!

Ask a question

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

akshay p (133) | asked Feb 06, 1:48 a.m.
edited Feb 06, 2:30 a.m. by Ralph Schoon (54.3k13641)

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.?

Accepted answer

permanent link
Shashikant Padur (3.8k27) | answered Feb 06, 2:47 a.m.
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

akshay p commented Feb 06, 6:37 a.m. | edited Feb 06, 6:37 a.m.
thank you sir.
Also can you tell me regarding getService(IScmService.class) and
(IVersionableHandle) type

Shashikant Padur commented Feb 06, 10:24 p.m.
IScmService scmService = ((IClientLibraryContext) repo).getServiceInterface(IScmService.class);
IItemType type = IItemType.IRegistry.INSTANCE.getItemType("FileItem", "");

akshay p commented Feb 11, 4:21 a.m. | edited Feb 11, 4:25 a.m.
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

akshay p commented Feb 21, 12:22 a.m.

how can i get the relative path of the file

David Lafreniere commented Feb 21, 12:23 p.m. | edited Feb 21, 12:25 p.m.
You can use:



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 to post your answer.