It's all about the answers!

Ask a question

how to get link to a fileitem in ALM RTC if i have itemid/iversionable/ifilitem


akshay p (153) | asked Feb 26 '19, 6:32 a.m.
edited Feb 26 '19, 6:35 a.m.

how to get link to a fileitem in ALM RTC if i have itemid/iversionable/ifilitem


Comments
David Lafreniere commented Feb 26 '19, 9:35 a.m.
FORUM MODERATOR / JAZZ DEVELOPER

Can you navigate the current RTC SCM Web UI and provide an example of the type of link you are looking for?


akshay p commented Feb 28 '19, 1:56 a.m.

https://xyz#action=com.ibm.team.scm.browseElement&workspaceItemId=_efg&componentItemId=_abc&itemType=com.ibm.team.filesystem.FileItem&itemId=_mnp


David Lafreniere commented Feb 28 '19, 9:48 a.m.
FORUM MODERATOR / JAZZ DEVELOPER

We just generate the URL in Javascript code, so there's no API or way to re-use it.
Fortunately, now that you know the format you can write your own code to build up the URL (and just replace the itemIds where necessary)


akshay p commented Mar 01 '19, 12:28 a.m.

atleast can i find the stream ids/snapshot ids where this file belongs to?


akshay p commented Mar 01 '19, 12:29 a.m.

i know the format but i really need snapshot/stream ids mandatory to build a link to file item


akshay p commented Mar 01 '19, 12:29 a.m.

please advise


David Lafreniere commented Mar 01 '19, 12:44 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
Please see the answer to:
(Short answer is 'no', as the filestate could exist in hundreds of streams / snapshots)
showing 5 of 7 show 2 more comments

One answer



permanent link
Steven Hovater (686) | answered Mar 01 '19, 1:02 p.m.
Use the item id and stateId in an scm query.
First, get a handle:
   IVersionableHandle nvh = (IVersionableHandle) IFileItem.ITEM_TYPE.createItemHandle(repo, itemIdUUID,
     stateIdUUID);
   IChangeSetSearchCriteria criteria = IChangeSetSearchCriteria.FACTORY.newInstance();
   criteria.setItem(nvh);
   IChangeSetHandle csets[] = scmQuerySrv.findChangeSets(criteria, Integer.MAX_VALUE, null, null);
Now that you have the change sets, you can do another query to find the streams/workspaces.
cheers
Steve

Comments
David Lafreniere commented Mar 01 '19, 1:21 p.m.
FORUM MODERATOR / JAZZ DEVELOPER

Only problem with this is it finds all change sets that touch the file, but based on the previous questions from Akshay, it sounds like a specific file state is requested, in which this approach will not work directly. But I suppose you could fetch all the change sets, then go through the changes of each change set to find the file you one, then check if the stateID matches what you are looking for. Then that would give you 'one' change set that has the fileState (keep in mind there could be multiple change sets in the repo that have the fileState [ex: one could be delivered to a main stream, and the other change set could be delivered to a maintenance stream). Note: This approach would be pretty expensive to do, so hopefully this is not an action that is performed often.


akshay p commented Mar 04 '19, 2:31 a.m. | edited Mar 04 '19, 2:31 a.m.

thanks a lot steven sir and david sir


akshay p commented Mar 04 '19, 2:32 a.m. | edited Mar 04 '19, 2:33 a.m.

@David, can you please give me format for scm queries for finding changset and streams


David Lafreniere commented Mar 04 '19, 4:11 p.m.
FORUM MODERATOR / JAZZ DEVELOPER

Your answer


Register or to post your answer.