It's all about the answers!

Ask a question

Get the repository URI for an IResource


Steve Barbieri (1111) | asked May 07 '12, 3:06 p.m.
JAZZ DEVELOPER
I have an IResource and I would like to get the repository URI associated with this IResource.

In RTC 3.0 I can do this:

IShareable shareable = (IShareable) resource.getAdapter(IShareable.class);
ISharingDescriptor sd = shareable.getShare(new NullProgressMonitor()).getSharingDescriptor();
String repositoryURI = sd.getRepositoryUri();


In RTC 4.0 getRepositoryUri() has been removed from ISharingDescriptor. I can do this:

IShareable shareable = (IShareable) resource.getAdapter(IShareable.class);
ISharingDescriptor sd = shareable.getShare(new NullProgressMonitor()).getSharingDescriptor();
UUID repositoryId = sd.getRepositoryId();
ITeamRepository teamRepository = TeamPlatform.getTeamRepositoryService().getTeamRepository(repositoryId);
String repositoryURI = teamRepository.getRepositoryURI();


But, in RTC 3.0, TeamPlatform.getTeamRepositoryService().getTeamRepository() can not take a UUID, it only takes a String.

Is there a way to write this code such that it works in both RTC 3.0 and 4.0?

Thanks,
Steve

Be the first one to answer this question!


Register or to post your answer.