Jazz Register Log in
Jazz Forum Welcome to the Jazz Community Forum

Welcome to the Jazz Community Forum

Connect and collaborate with IBM Engineering experts and users

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

0 votes


Accepted answer

Permanent link
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.
Hendrik Haddorp selected this answer as the correct answer

0 votes

Comments

Thanks, that works. Only problem is that the API is not documented in the SDK. Strangely it only does a relatively simple call to Location.pathLocation(), which is part of the SDK. Is there no way to do this in a way that is documented?

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
× 51

Question asked: May 28 '13, 12:34 p.m.

Question was seen: 3,905 times

Last updated: May 29 '13, 5:29 a.m.

Confirmation Cancel Confirm