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?
Accepted answer
Do you want to restrict the direction of a link type according to the work item type?
Comments
Would you mind sharing or pointing me in the right direction to setting up my environment to do this?
As soon as possible I will share with you the most useful code snippets of my plugin.
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.
3 other answers
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.
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
@Ralph Schoon
Does operational behavior for work item save server is called for any link types?
<o:p> </o:p>
Comments
No, I mentioned this in my last comment on the accepted answer.