Show source code and calculate metrics for imported objects

Add the links and properties to .uax files that let CAST Imaging display the source code of imported objects and calculate metrics on them
Updated

Overview

Objects imported with the Universal Importer have no source code position by default, so their code cannot be displayed and no metrics are calculated on them. This page lists the links and properties to add to the .uax files to enable both.

Display source code

Three conditions must be met for each imported object. In the examples, the object proc_B is defined in the file C:\test.pli.

  1. An isInSourceLink must link the object to the file that contains it. Each file must also have an isInSourceLink to itself:

    <instance id="" instanceOf="isInSourceLink">
        <link caller="proc_B" callee="test.pli"/>
    </instance>
    
  2. The object must inherit from the bookmark category, and its source property must contain the path of the file:

    <bookmark source="C:\test.pli"/>
    
  3. The object must inherit from the POSITIONABLE category, and its POSITIONS property must contain the name of the file followed by the position of the object: start line, start column, end line and end column:

    <POSITIONABLE POSITIONS="test.pli(122,10,144,13) "/>
    

The source code can then be displayed, but with a warning that the file may no longer be synchronized with the repository. To avoid this warning, give each file the date it was last modified, in the lastModifiedDate property of the synchronizable category. The values are the year, month, day, hour, minute and second:

<synchronizable lastModifiedDate="(2006,11,22,14,43,46)"/>

Calculate metrics

Three conditions must be met for metrics to be calculated on an imported object:

  1. The object type must inherit from the METRICABLE category in the metamodel.
  2. An isInSourceLink must link the object to its file, as described above.
  3. The source property of the bookmark category must contain the path of the file, as described above.