It's all about the answers!

Ask a question

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


S. M. (114) | asked Mar 05 '21, 4:47 a.m.

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!

One answer



permanent link
Ralph Schoon (63.7k33648) | answered Mar 05 '21, 5:19 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Mar 05 '21, 7:55 a.m.

 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>

Your answer


Register or 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.