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.?
Accepted answer
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);
scmService.getHistoryForVersionable(historyProvider, versionableHandle, 100, false, null, null);
This would return you 100 of the most recent states of the file.
Comments
thank you sir.
Also can you tell me regarding getService(IScmService.class) and
(IVersionableHandle) type
(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).