Procedure for applying the OSLCLinks package
This topic describes how to apply the Rational® ClearQuest® OSLCLinks package version 1.0 or 1.1 to your schema by using the Rational ClearQuest Designer that is based on Eclipse technology.
About this task
Apply the OSLCLinks package v1.0 if you are running ClearQuest v7.1.2. Apply the OSLCLinks package v1.1 if you are running ClearQuest v7.1.2.1.
Procedure
Example
This section provides an example of applying the OSLCLinks package v1.1 to the DefectTracking schema and enabling the package for the Defect record type.
- In the Rational ClearQuest Designer, right-click the version of the schema to which you want to apply the package and select . The Package Wizard opens.
- Expand the OSLCLinks node in the list of packages, select version 1.1, and click Next.
- Enable the OSLCLinks package for the Defect record type.
- Add a global Perl script named
OSLC_CQ_State_Mapping
and provide an implementation.- Navigate to the Add. associated with the schema, right click, and select
- Enter the following text in the Hook name field
and then click OK:
OSLC_CQ_State_Mapping
- Add hook code to the
OSLC_CQ_State_Mapping
script. For example:sub OSLC_CQ_State_Mapping { my ($myentity, $hook_type) = @_; my $state = $myentity->GetFieldStringValue("State"); if ($hook_type eq "Validation") { if (($state eq "Assigned") || ($state eq "Opened")) { $myentity->SetFieldValue("oslc_cm-inprogress", "1"); } else { $myentity->SetFieldValue("oslc_cm-inprogress", "0"); } if ($state eq "Closed") { $myentity->SetFieldValue("oslc_cm-closed", "1"); } else { $myentity->SetFieldValue("oslc_cm-closed", "0"); } } }
This script is called by the initialization and validation hook of the
OSLC_State_Predicates
action of a Defect record. The script has two parameters: the current entity and the hook type. Depending on your requirements, you can add different codes according to the value of the hook type parameter. The example script shows a validation hook.
- Click Finish. The schema revision is checked in.
- Upgrade the user database.
- Verify the schema changes:
- Use your Rational ClearQuest client to log in to the user database.
- Edit the All Defects query and add the following display fields:
oslc_cm-inprogress
andoslc_cm-closed
. - Run the All Defects query.
- Select a defect in the query results that is in the Submitted state.
- Close the defect and verify that
oslc_cm-closed
equals 1 while the other fields with names prefixed withoslc_cm
equal 0. - Reopen the defect and verify that
oslc_cm-inprogress
equals 1 while the other fields with names prefixed withoslc_cm
equal 0.