RTC API - how to create a link to a changeSet
I need to be able to create a link to an IChangeSet which I would then include in an email. I've gotten as far as
for one instance.
While I'm expecting something like:
https://fullyqualifieddomainwithoptionalport/ccm/rest/of/link
How would I go about doing this?
I think I may need to use getPublicRepositoryURL() along with some other methods before I get there.
Thanks
IReferenceFactory.INSTANCE.createReferenceToItem(ChangeSetHandle).createURI().toString()which is giving me: itemOid/com.ibm.team.scm.ChangeSet/_MAfk4NTPEeSroOe43qBfkg
for one instance.
While I'm expecting something like:
https://fullyqualifieddomainwithoptionalport/ccm/rest/of/link
How would I go about doing this?
I think I may need to use getPublicRepositoryURL() along with some other methods before I get there.
Thanks
Accepted answer
This is most likely not the URL you want. If I copy the URI in the Eclipse client I get this form of a URL
https://clm.example.com:9443/ccm/resource/itemOid/com.ibm.team.scm.ChangeSet/_K6Bi8MMyEeS_OtxSf45u8Q
Or
https://clm.example.com:9443/ccm/resource/itemOid/com.ibm.team.scm.ChangeSet/_K6Bi8MMyEeS_OtxSf45u8Q?Workspace=_GcrsgH-oEeSHhcw_WFU6CQ
if the workspace is of interest.
Or https://clm.example.com:9443/ccm/resource/itemOid/com.ibm.team.scm.ChangeSet/_cjx2gIBYEeSaLuTOD5yLUA?projectAreaId=_55re8H-nEeSHhcw_WFU6CQ&workspace=_G5hZgH-oEeSHhcw_WFU6CQ in the Web UI. So I would assume it looks at least like
https://clm.example.com:9443/ccm/resource/itemOid/com.ibm.team.scm.ChangeSet/_cjx2gIBYEeSaLuTOD5yLUA where the last part of the URL is the UUID of the change set.
Look into the class Location. There are different ways to create Locations from data. e.g. Location.namedLocation() the same for creating references
IReferenceFactory.INSTANCE.createReferenceToItem() and IReferenceFactory.INSTANCE
.createReferenceFromURI()
The method to create the location, the location format and the way to create the reference must match.
https://clm.example.com:9443/ccm/resource/itemOid/com.ibm.team.scm.ChangeSet/_K6Bi8MMyEeS_OtxSf45u8Q
Or
https://clm.example.com:9443/ccm/resource/itemOid/com.ibm.team.scm.ChangeSet/_K6Bi8MMyEeS_OtxSf45u8Q?Workspace=_GcrsgH-oEeSHhcw_WFU6CQ
if the workspace is of interest.
Or https://clm.example.com:9443/ccm/resource/itemOid/com.ibm.team.scm.ChangeSet/_cjx2gIBYEeSaLuTOD5yLUA?projectAreaId=_55re8H-nEeSHhcw_WFU6CQ&workspace=_G5hZgH-oEeSHhcw_WFU6CQ in the Web UI. So I would assume it looks at least like
https://clm.example.com:9443/ccm/resource/itemOid/com.ibm.team.scm.ChangeSet/_cjx2gIBYEeSaLuTOD5yLUA where the last part of the URL is the UUID of the change set.
Look into the class Location. There are different ways to create Locations from data. e.g. Location.namedLocation() the same for creating references
IReferenceFactory.INSTANCE.createReferenceToItem() and IReferenceFactory.INSTANCE
.createReferenceFromURI()
The method to create the location, the location format and the way to create the reference must match.
One other answer
Look into the code of https://rsjazz.wordpress.com/2015/02/27/a-rtc-workitem-command-line-version-2-2/
Comments
I couldn't find what I'm looking for here. I think the most relevant file is WorkItemHelper.java. I see that it creates references from URIs but not the other way round. I may be mistaken.
I ended up doing it like this:
getPublicRepositoryURL() + "web/projects/" + projectArea.getName() +"#action=com.ibm.team.scm.viewChangeSet&changeSetItemId=" + changeSetUUID.getUuidValue() + "&projectAreaItemId=" + projectArea.getItemId().getUuidValue();
for those who need it.