How to retrieve IBaseLineSetHandle from URI (rather than UUID) ?
Arne Bister (2.6k●1●28●32)
| asked Jun 10 '14, 3:22 p.m.
JAZZ DEVELOPER edited Jun 10 '14, 3:24 p.m.
Jazzers,
currently I am passing to my class a String which is the UUID of a snapshot. I am then transforming it to UUID snapId = UUID.valueOf(String) and finding the snapshot item handle by means of: IBaselineSetHandle snapshotHandle = (IBaselineSetHandle) IBaselineSet.ITEM_TYPE.createItemHandle(snapId, null); This works pretty well but I really would like to pass the full URI to the snapshot object rather than the UUID for various reasons. Is there any easy out of the box way of obtaining an ItemHandle from the URI of an object? Or do I need to write a parser for the URI, keeping in mind that while the UUID starts with _ there might be plenty _ elsewhere in the URI? If you know a call or have such a parser please share. Best, Arne |
Accepted answer
Thanks to Michael Valenta I was able to find an easy way to achieve this. This is the code snippet:
URI snapUri= URI.create(snapshotIdentifier.replaceAll(" ", "%20")); Location snapLoc = Location.location(snapUri); IBaselineSet snapshotItem = (IBaselineSet) teamRepository.itemManager().fetchCompleteItem(snapLoc,IItemManager.DEFAULT, monitor); The advantage of passing a snapshot URI rather than the UUID is that the URI can be easily retrieved e.g. from Snapshot Context Menu (copy URL). - Arne Ralph Schoon selected this answer as the correct answer
|
One other answer
how is it that u have the URI? but not the UUID?
Comments Sam, I am feeding that parameter manually into a build run. Previously, I simply copied the latter part of the URI because I only knew how to construct the ItemHandle from UUID. But I know that now ;-)
sam detweiler
commented Jun 11 '14, 7:16 a.m.
I read your words, but didn't get any info!..
|
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.