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 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 ClearQuest states or status to OSLC states,
then you must add a global Perl script named OSLC_CQ_State_Mapping and
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_Mapping script.
- 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.
- In the 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 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_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 ClearQuest client
to log in to the user database.
- Edit the All Defects query and add the following display fields: oslc_cm-inprogress and oslc_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 with oslc_cm equal
0.
- Reopen the defect and verify that oslc_cm-inprogress equals
1 while the other fields with names prefixed with oslc_cm equal
0.