Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Is it possible to restrict link types available between work items?

Hi,

I am using RTC 6.0.3.

Is there a way to provide link constraints within RTC like RDNG? For example, I have one work item which resolves another work item. In the available link types, resolves and resolved by are accessible from either direction. Am I able to restrict the resolves link type so that it is not possible to put incorrect relationships in place?

0 votes


Accepted answer

Permanent link

Do you want to restrict the direction of a link type according to the work item type?

When I asked the question, it was not possible; I have not checked if newer RTC versions have this feature.
Actually, I developed a server-side Java plugin to prevent "wrong" links from being created.
Anyway, the check runs after the link has been set, and raises an error on the work item save.

Timothy Distel selected this answer as the correct answer

0 votes

Comments

Would you mind sharing or pointing me in the right direction to setting up my environment to do this?

Are you familiar with RTC plugins (extensions) development?
To learn how to setup the environment, read this article: https://jazz.net/library/article/1000

As soon as possible I will share with you the most useful code snippets of my plugin.

Basically, you must retrieve all links set on a work item, their type, their direction and the (other) linked work item.
Once you have these pieces of information, you can check whether the link is a valid one or not.

I've completed the first lab of the workshop which I believe completely sets up my own personal environment, separate from the actual environment I'll end up deploying to. I'm not sure of everything I would need to modify to connect this to my actual environment, and I don't have the most experience with java or eclipse so this is a little daunting. Would it be possible for us to establish another means of communication, other than replying to one another on the jazz forum?

The Lab 1 is only setting up the environment you need. You should perform the whole workshop. As I answered in my blog, all the steps you do will be needed later in your production environment.

Finally you want to create an advisor / pre condition (not a follow up action like in the workshop). However except small changes to the Interfaces the steps are very similar. You can find examples for that and for the API on my blog. Search the blog for Advisor and Link API to find the posts.

Thank you for the extra information Ralph! Will do.

And also the operational behavior for work item save server is not called for these link types:

Tracks <-> Contributes to
Related Change Request <-> Related Change Request
Affects Plan Item <-> Affects Plan Item
Affected by Defect <-> Affected by Defect

This is a limitation that is known for some time.

showing 5 of 6 show 1 more comments

3 other answers

Permanent link

You would have to create a work item save pre-condition that prevents this, You can do that for certain link types. There is no built in functionality at the moment.

0 votes


Permanent link

Timothy,
look at these code snippets I extracted from my plugin:

// retrieve the list of links ("references") set on the WI you are saving
IWorkItemReferences refs = saveParameter.getNewReferences();
List<IEndPointDescriptor> workItemReferencesTypes = refs.getTypes();
// for each link type you found, retrieve the linked items
for (IEndPointDescriptor linkDesc : workItemReferencesTypes) {
    List<IReference> listReferences = refs.getReferences(linkDesc);
    for (IReference reference : listReferences) {
    if (reference.isItemReference()) {
        referencedItem = ((IItemReference) reference).getReferencedItem();
        String itemKind = referencedItem.getItemType().getName();
        // check whether the linked item is a WI
        if (referencedItem instanceof IWorkItemHandle) {
            workLinked = (IWorkItem) repositoryItemService.fetchItem(referencedItem, IRepositoryItemService.COMPLETE);
            // retrieve the type of the linked WI     
            String linkedWorkItemType = workLinked.getWorkItemType();
            // is it a valid link?
            // ......
            // ......
        }
    }
}


If you the whole code, please provide me with your email, and I will send it to you.

0 votes

Comments

Luca,

That is beyond generous, and I thank you for being so helpful. I may be far out from actually developing extensions (2-3 months) but I would love to receive the code so that when I do get to that point I have a reference not only for this particular use case but, more valuable to me, I can dissect the code to help me understand how to develop other extensions in the future. If you wouldn't mind, my email address is: timothy.distel@igimail.com


Permanent link

@Ralph Schoon
Does operational behavior for work item save server is called for any link types?

Will it call for Parent<->Child or Resolves<->Resolved By or any other link types?

<o:p> </o:p>

0 votes

Comments

No, I mentioned this in my last comment on the accepted answer. 

The link types the operational behavior for work item save server is not called for at least these link types:

Tracks <-> Contributes to
Related Change Request <-> Related Change Request
Affects Plan Item <-> Affects Plan Item
Affected by Defect <-> Affected by Defect


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
× 6,131

Question asked: Jul 11 '18, 10:10 a.m.

Question was seen: 2,686 times

Last updated: May 30 '22, 2:08 a.m.

Confirmation Cancel Confirm