以下为
IBM Libray中的一篇文章,请大家翻译完就后发到我的邮箱(
showgoods@yahoo.com),这个译文将作为对大家初步考核的依据,也是为后面的任务分配做准备。
注:参加过一期项目的朋友就不需要翻译以下文章了
原文地址:
http://www.ibm.com/developerworks/rational/library/4702.html?S_TACT=105AGX15&S_CMP=EDU
Accessing the ClearCase Automation Library from ClearQuest hooks
Jennifer Haines (
jen.haines@gmail.com), IBM ClearQuest Administrator , Consultant
10 Apr 2007
Enhancing the IBM
Rational ClearQuest
schema by using stateless record types to create choicelists can help eliminate errors from manual entry in multiline text fields.
This program is for example purposes, and is provided as is. It has not been formally tested, and is not supported by IBM.
The problem
On my current
project, standard IBM® Rational ClearCase® functions such as creating or locking a ClearCase
project or stream, are tracked in IBM® Rational ClearQuest®. In order to request a new
project the user needs to specify the P
VOB Name, the source
project name, the source stream name, the baseline that the
project will be seeded with, and the new
project name. For other requests, such as locking a stream, there was a need to include information that was already contained in ClearQuest, for example, user names and IDs. Unfortunately, for both these types of requests this information had to be typed into the description field which is a free-form multi-line text field. This left the request prone to typographical errors and delayed completing the request.
The solution
The solution to this requires enhancing the ClearQuest schema with some new functionality. The first step is to add stateless record types to track the types of requests, ClearCase PVOB names, ClearCase Projects names, and types of ClearCase streams. The second step involves adding fields on the state-based record type (aka Incident) that reference these stateless record types and some multi-line string fields. Additionally, there was a new tab added to the Incident record type.
In this example, the fields that were added to the stateless record types were fairly basic and they are the business unit name, state (e.g. Active/Inactive), and the appropriate name (e.g. Project Name, PVOB Name, etc). Since these records can only be Active or Inactive there was not really a big need to create them as state-based record types, even though there is a state field.
Each of the fields added to the Incident record type had a custom choicelist. The fields that reference stateless record types query for active records associated with a specific business that is specified in the Incident. For example, this script was implemented as a global script to query against the stateless PVOB record:
Script to query PVOB record
sub CL_CC_PVOB_Name
{
my @ccpvobs;
my $business = $entity->GetFieldStringValue("Bus_Unit_Name");
my $session = $entity->GetSession();
my $queryDef = $session->BuildQuery("CC_PVOB");
$queryDef->BuildField("CC_PVOB_Name");
my $filter = $queryDef->BuildFilterOperator($CQPerlExt::CQ_BOOL_OP_AND);
$filter->BuildFilter("Bus_Unit_Name",$CQPerlExt::CQ_COMP_OP_EQ, [$business]);
my $resultSet = $session->BuildResultSet($queryDef);
$resultSet->Execute();
while ($resultSet->MoveNext == $CQPerlExt::CQ_SUCCESS)
{
my $ccpvobname = $resultSet->GetColumnValue(1);
push (@ccpvobs, $ccpvobname);
}
return @ccpvobs;
}
The fields that are used to gather information stored in ClearCase have custom choicelists as well, by using the ClearCase Automation Library (CAL). The following script gets the value of the ClearCase Target Project Name field and the ClearCase PVOB Name field and then uses the CAL to get information from ClearCase.
Script to extract ClearCase information
my $projectlist = $entity->GetFieldValue("CC_Target_Project_Nm")->GetValueAsList();
my $pvob = $entity->GetFieldStringValue("CC_PVOB_Name");
use Win32::OLE;
my $ct = Win32::OLE->new('ClearCase.ClearTool')
or die "Could not create the ClearTool object\n";
foreach $project (@$projectlist){
my @lsstream = $ct->CmdExec("lsstream -short -in project:$project\@\\$pvob");
foreach $stream (@lsstream) {
push (@choices,$stream);
}
}
By creating this functionality in ClearQuest, we can gather specific data for a particular task relating to the ClearCase Project or Stream, and these requests can then be completed more accurately and more efficiently.
[
本帖最后由 yunshan 于 2007-9-10 00:07 编辑 ]