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
- 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 and select version 1.0 or 1.1. Click Next.
- Select the record types to which you want to apply the package.
- Optional: If you applied the OSLCLinks package v1.1 and
you want to use state predicate support to map Rational®
ClearQuest® states
or status to OSLC states, then you must add a global Perl script named
OSLC_CQ_State_Mappingand provide an implementation: - Click Finish.
The OSLCLinks package is applied to the schema that you selected. Verify the package installation by looking for a new OSLCLink stateless record type in the schema.
See the Applying Packages help for more information about applying packages.
- Restart the Rational® ClearQuest® CM Server.
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_Mappingand provide an implementation.- Navigate to the associated with the schema, right click, and select Add.
- 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_Mappingscript. 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_Predicatesaction 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-inprogressandoslc_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-closedequals 1 while the other fields with names prefixed withoslc_cmequal 0. - Reopen the defect and verify that
oslc_cm-inprogressequals 1 while the other fields with names prefixed withoslc_cmequal 0.