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.