Monday, December 21, 2009

Clone an ALMRequest

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:

  1. Have a way to clone such an ALMRequest.
  2. 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:

clip_image002

It’s implemented as a record hook as shown below:

clip_image004

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.

clip_image006

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.

clip_image008

clip_image010

3.3 Add a Record Script

The Copy Request button will call the Record Hook, ALM_CopyRequest.

clip_image012

4 Source Code

Attached is the Perl source code for the record script: clip_image014

Here are a few comments regarding the script:

  1. CloneRecord function from the tech-note is used to clone all fields of ALMRequest.
  2. However, the referenced field such as ALMTask and Comments canèt be cloned because one ALMTask can only be associated with one ALMRequest.
  3. So all referenced fields have to be cloned individually as well.
  4. After the referenced field is cloned, they also need to be modified to point to the new cloned ALMRequest.