It's all about the answers!

Ask a question

RTC: how to make mandatory the "Duplicate Of" link?


0
1
Luca Martinucci (1.0k284109) | asked Jan 20 '15, 11:22 a.m.
I need to enable this behavior in RTC (version 4.0.6):
  • when a work item is closed with the action Duplicate (and the resolution Duplicate), the Duplicated Of link must be mandatory, and the work item save must fail if such a link is not provided
I know that this is an out-of-the-box behavior in RTC, and I have seen it working in the past, but now I have made some changes to the project area (to the workflows and to the presentations), and it doesn't work any more, allowing users to close a record as a duplicate without linking it to another.
Can this feature be re-activated?

Accepted answer


permanent link
Luis Peregrina (18114) | answered Mar 03 '15, 10:22 p.m.
JAZZ DEVELOPER
Luca, since the validation is still hard-coded I found that changing the state id to that of the original workflow forces the check to happen ("r2" if I remember correctly).
Luca Martinucci selected this answer as the correct answer

Comments
Luca Martinucci commented Mar 04 '15, 4:57 a.m.

Luis, are you saying that I should change the state id of the "Closed" state to "r2"? (it currently "s5" in the bugzilla workflow I am using for Defects).
Also, is there any way to enable this behavior for the other workflows (so that I can enable it for Change Requests, Tasks, ...)?


Luis Peregrina commented Mar 04 '15, 8:27 a.m.
JAZZ DEVELOPER

I meant to say the resolution id. "r2" is the resolution id for state Closed - Duplicate.


Luis Peregrina commented Mar 05 '15, 1:28 p.m.
JAZZ DEVELOPER

 It seems there is a previous check too, the workflowid must match the defect workflow id or "bugzillaWorkflow"


Luis Peregrina commented Mar 09 '15, 1:26 p.m.
JAZZ DEVELOPER

About enabling this in other item types, they would need the same workflowDefeinition id, so only "bugzillaWorkflow" or the same id of the defect type.

2 other answers



permanent link
Susan Hanson (1.6k2189193) | answered Jan 20 '15, 12:43 p.m.
We have never been able to get this to work for anything that we have customized and therefore, have written a custom Validator to check for this.

Comments
Donna Thomas commented Mar 04 '15, 12:02 p.m.

Hi there - can you share what that validator looks like? Script or ?


1
Susan Hanson commented Mar 04 '15, 12:08 p.m.

Our resolution for duplicate all end with ".duplicate" in our configuration, so the validator does this:
if (wi.getResolution2().getStringIdentifier().endsWith(".duplicate")) {
  if (!hasDuplicateOfLink(saveParameter.getNewReferences())) {
     IAdvisorInfo createProblemInfo = collector.createProblemInfo("DuplicateOf Link Required", "To mark the work item as Duplicate, you must have a DuplicateOf link.","error");
     collector.addInfo(createProblemInfo);
     return;
  }
  return;
}

And the hasDuplicateOfLink method is:
private boolean hasDuplicateOfLink(IWorkItemReferences references) throws TeamRepositoryException {
    List<IReference> duplicateOfLinks = references.getReferences(WorkItemEndPoints.DUPLICATE_OF_WORK_ITEM);

    if (duplicateOfLinks == null) return false;
    if (duplicateOfLinks.size() < 1) return false;

    return true;
}


permanent link
sam detweiler (12.5k6188201) | answered Jan 20 '15, 1:17 p.m.
the check for this is hard coded to the IBM workitem type ID.

I opened enhancement 242467 to move this function to an external function



Comments
Luca Martinucci commented Jan 21 '15, 3:19 a.m.

Sam, are you saying that this behavior is "inherent" to a workitem type?
So, I wonder how it could suddenly "disappear" from that workitem type.
According to this enhancement request https://jazz.net/jazz/web/projects/Rational%20Team%20Concert#action=com.ibm.team.workitem.viewWorkItem&id=237971 , it is hard-coded in these workflows: EclipseWayWorkflow.ID and InternalWorkflowKeys.DEFECT_WORKFLOW_ID.
Anyway, I have a project area where Defects, which use the Default Workflow (id: bugzillaWorkflow) have this desired behavior on Duplicate.
In another project area (on a different RTC server, but with the same RTC version), Defects using the same workflow do not have this behavior.

Your answer


Register or to post your answer.