Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to retrieve IBaseLineSetHandle from URI (rather than UUID) ?

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

1

0 votes


Accepted answer

Permanent link
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

2 votes

Comments

Thanks for sharing Arne!


One other answer

Permanent link
how is it that u have the URI? but not the UUID?

0 votes

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 ;-)

I read your words, but didn't get any info!..

where did u get the 'parameter' data from?   I got the point IF you had a URI, how to find the object.

above it says 'snapshotIdentifier', what is that? cause u CREATE the URI from it.

you must have some piece of code that s running for same reason.


Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938
× 21
× 6

Question asked: Jun 10 '14, 3:22 p.m.

Question was seen: 4,738 times

Last updated: Jun 11 '14, 7:16 a.m.

Confirmation Cancel Confirm