How to get ProviderFactory on client ?
Team,
<self-answered question>
Suppose you want to get ChangeSetLinks programmatically on a client.
You found ChangeSetLinks.findLinks(providerFactory, changeSetHandle, linkTypeIds, monitor)
You have a changeSetHandle, get the linkTypeIds by:
new String[] { ILinkConstants.CHANGESET_WORKITEM_LINKTYPE_ID }
(as seen in Ralph Schoons Blog)
But how to obtain a providerFactory on the client?
<self-answered question>
Suppose you want to get ChangeSetLinks programmatically on a client.
You found ChangeSetLinks.findLinks(providerFactory, changeSetHandle, linkTypeIds, monitor)
You have a changeSetHandle, get the linkTypeIds by:
new String[] { ILinkConstants.CHANGESET_WORKITEM_LINKTYPE_ID }
(as seen in Ralph Schoons Blog)
But how to obtain a providerFactory on the client?
One answer
The providerFactory can be obtained by:
(ProviderFactory) teamRepository.getClientLibrary(ProviderFactory.class)
Thus,
List<ILink> links ChangeSetLinks
.findLinks(
(ProviderFactory) teamRepository.getClientLibrary(ProviderFactory.class),
changeSetHandle,
new String[] { ILinkConstants.CHANGESET_WORKITEM_LINKTYPE_ID },
monitor);
will get you all work item links from a change set handle.
(ProviderFactory) teamRepository.getClientLibrary(ProviderFactory.class)
Thus,
List<ILink> links ChangeSetLinks
.findLinks(
(ProviderFactory) teamRepository.getClientLibrary(ProviderFactory.class),
changeSetHandle,
new String[] { ILinkConstants.CHANGESET_WORKITEM_LINKTYPE_ID },
monitor);
will get you all work item links from a change set handle.
Comments
very cool. thanks Arne!
mow, in my copy stream utility, I really need to fixup all the links, because all the workitem numbers have changed,. I know what the new workitem number is for all the old info.
I haven't looked.. is there an easy way to create the links too?
I'm assuming like all other cases, the link itself is immuatable, so has to be deleted and recreated to have the right ends.
Sam, I have not dabbled with link creation too much yet, but once I do and I find an easy way, I will share.
- Arne