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

  1. In the Rational ClearQuest Designer, right-click the version of the schema to which you want to apply the package and select Packages > Apply Package. The Package Wizard opens.
  2. Expand the OSLCLinks node in the list of packages and select version 1.0 or 1.1. Click Next.
  3. Select the record types to which you want to apply the package.
  4. 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_Mapping and provide an implementation:
    1. Navigate to the Global Scripts > Perl node associated with the schema, right click, and select Add.
    2. Enter the following text in the Hook name field and then click OK:
      OSLC_CQ_State_Mapping
    3. Add hook code to the OSLC_CQ_State_Mapping script.
  5. 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.

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.

  1. In the Rational ClearQuest Designer, right-click the version of the schema to which you want to apply the package and select Packages > Apply Package. The Package Wizard opens.
  2. Expand the OSLCLinks node in the list of packages, select version 1.1, and click Next.
  3. Enable the OSLCLinks package for the Defect record type.
  4. Add a global Perl script named OSLC_CQ_State_Mapping and provide an implementation.
    1. Navigate to the Global Scripts > Perl node associated with the schema, right click, and select Add.
    2. Enter the following text in the Hook name field and then click OK: OSLC_CQ_State_Mapping
    3. 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.

  5. Click Finish. The schema revision is checked in.
  6. Upgrade the user database.
  7. Verify the schema changes:
    1. Use your Rational ClearQuest client to log in to the user database.
    2. Edit the All Defects query and add the following display fields: oslc_cm-inprogress and oslc_cm-closed.
    3. Run the All Defects query.
    4. Select a defect in the query results that is in the Submitted state.
    5. Close the defect and verify that oslc_cm-closed equals 1 while the other fields with names prefixed with oslc_cm equal 0.
    6. Reopen the defect and verify that oslc_cm-inprogress equals 1 while the other fields with names prefixed with oslc_cm equal 0.