Jirong Hu (jirong.hu@gmail.com)
December 21 2009
1 The Requirement
The first requirement came from our deployment team. After a new release of an application is built, they are normally required to be deployed to different environments for different purposes. The deployment team requires a separate ALMRequest to be submitted for each deployment request to each environment. However, there is a lot common information among these ALMRequests including associated ALMTasks. So the deployment team is asking for a way to clone these ALMRequests. The requirements are:
- Have a way to clone such an ALMRequest.
- All fields in the original request must be coped, including ALMTasks.
2 The Design
There is a similar function available in the ALM schema for ALMProject as shown below:
It’s implemented as a record hook as shown below:
However, I am following this tech-note to implement my function to clone the ALMRequest:
Clone a defect (http://www.ibm.com/developerworks/rational/library/4379.html)
3 The Implementation
3.1 Add UI
Following the exact same way of Copy Project, we can copy these UI controls from ALMProject record and paste them here in the form of ALMRequest.
3.2 Add a New Field
Add a new filed for the headline of the cloned request if user wants to enter a new headline during the copy.
3.3 Add a Record Script
The Copy Request button will call the Record Hook, ALM_CopyRequest.
4 Source Code
Attached is the Perl source code for the record script:
Here are a few comments regarding the script:
- CloneRecord function from the tech-note is used to clone all fields of ALMRequest.
- However, the referenced field such as ALMTask and Comments canèt be cloned because one ALMTask can only be associated with one ALMRequest.
- So all referenced fields have to be cloned individually as well.
- After the referenced field is cloned, they also need to be modified to point to the new cloned ALMRequest.