Welcome to the Jazz Community Forum
URI for file

Hi,
I was hoping to be able to create an URI pointing to the Jazz web UI for a given file. My impression was that this is possible using com.ibm.team.repository.common.Location.contentLocation(IContent content, java.lang.String repoUrl, java.lang.String serviceName). However I'm not able to get an IContent object from an IFileItem object.
According to the com.ibm.team.repository.client.IContentManager JavaDoc IFileItem.getContet() should return an IContent object but in reality I get an IFileContent object and that does not seem to be compatible.
Would be great if somebody could tell me how this can be done.
regards,
Hendrik
I was hoping to be able to create an URI pointing to the Jazz web UI for a given file. My impression was that this is possible using com.ibm.team.repository.common.Location.contentLocation(IContent content, java.lang.String repoUrl, java.lang.String serviceName). However I'm not able to get an IContent object from an IFileItem object.
According to the com.ibm.team.repository.client.IContentManager JavaDoc IFileItem.getContet() should return an IContent object but in reality I get an IFileContent object and that does not seem to be compatible.
Would be great if somebody could tell me how this can be done.
regards,
Hendrik
Accepted answer

You can use
SCMLocationUtil#getVersionableLocation()
to construct a URI to a file. However, it requires a workspace and component as context.
Location versionableLocation = SCMLocationUtil.getVersionableLocation(repo.getRepositoryURI(), workspaceHandle, componentHandle, new Path(filePath));
versionableLocation.toAbsoluteUri().toASCIIString();
You won't really need the IFileItem as long as you know the path to the file.