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
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
@Ralph Schoon
Does operational behavior for work item save server is called for any link types?
<o:p> </o:p>