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

Get IIteration by OSLC Uri (in RTC Java Plain API)

Hi, 


we are using the RTC Java Plain API to create iterations in a CM project area.

But we don't find a way to get the OSLC uri for a generated IIteration object.

And on the other hand, we want to access an IIteration for a given OSLC uri, e.g.

Is this possible with the RTC Java Plain API, and if so, can give some hints please.

Thanks for you help!

0 votes



One answer

Permanent link

 Steve,


the pieces I think I know below.

1. The itemHandle contains the UUID. 

com.ibm.team.repository.common.IItemHandle.getItemId()

2. The UUID can be converted to a string and would look like "_29rygDLaEeqnQ6MhncA" in your case above.

3. As explained in https://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/ , if you know the item type you can create an item handle using the UUID: 
Handles can be resolved and searched etc.

IItemHandle handle = [itemtype].ITEM_TYPE.createItemHandle(UUID.valueOf(uuid_string), null);

4. The URIs to different items look different. https://rsjazz.wordpress.com/2012/09/20/the-rtc-workitem-server-link-api-linking-to-work-items-and-other-elements/ explains the "Location" based URI and how to create one.


In the EWM SCM Utils https://github.com/jazz-community/ewm-scm-utils I use this code to create a URI for an item:

    public static URI getURIForItem(IItemHandle item) {
        Location location = Location.itemLocation(item, getPublicURI(item));
        return location.toAbsoluteUri();
    }

public static String getPublicURI(IItemHandle item) {
    return getPublicURI(((ITeamRepository) item.getOrigin()));
}

/**
 * Returns the public URI root used to construct public locations for the
 * given repository. If the repository has no public URI root configured,
 * its regular URI is returned.
 *
 * @param repo
 *            the repository
 * @return the public URI root for the repository (never <code>null</code>)
 */
public static String getPublicURI(ITeamRepository repo) {
    String uri = repo.publicUriRoot();
    if (uri == null) {
        uri = repo.getRepositoryURI();
    }
    return uri;
}




    </pre>
</div>
<div>
    <br>
</div>

0 votes

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,937

Question asked: Mar 05 '21, 4:47 a.m.

Question was seen: 1,270 times

Last updated: Mar 05 '21, 7:55 a.m.

Confirmation Cancel Confirm