It's all about the answers!

Ask a question

How to get ProviderFactory on client ?


Arne Bister (2.6k12832) | asked Mar 22 '14, 3:53 a.m.
JAZZ DEVELOPER
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?

One answer



permanent link
Arne Bister (2.6k12832) | answered Mar 22 '14, 3:56 a.m.
JAZZ DEVELOPER
edited Mar 22 '14, 3:58 a.m.
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.

Comments
sam detweiler commented Mar 22 '14, 7:20 a.m.

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.


Arne Bister commented Mar 24 '14, 6:25 a.m.
JAZZ DEVELOPER

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

Your answer


Register or to post your answer.