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 (111) | asked Feb 06, 1:48 a.m.
edited Feb 06, 2:30 a.m. by Ralph Schoon (54.0k13641)

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

One answer

permanent link
Shashikant Padur (3.6k27) | 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 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

Your answer

Register or to post your answer.