Configuring Artefact Relaxation

In order to allow users to relax or exclude artefacts from the projects from the Artefact Tree, you need to reserve one measure that uses a special attribute used for relaxation and specify to which artefact types it applies.

The following is a basic example of how to allow users to relax folders and files in your model:

myModel/Analysis/Bundle.xml:
<ArtefactType id="RELAXABLE" heirs="FOLDER;FILES" />
<Measure measureId="RELAX" targetArtefactTypes="RELAXABLE"
  defaultValue="0" usedForRelaxation="true" />

Warning

Only one measure in your model may use the usedForRelaxation attribute.

By adding these two lines in your model, you allow users whose role grant the View Drafts of Projects and Modify Artefacts privileges to use the relaxation mechanism. For more information about using artefact relaxation from the web UI, consult the Getting Started Guide or the online help.

Impact on computations

When an artefact is relaxed, its metrics are ignored when computing metrics for other artefacts. This makes sense for example when relaxing a folder full of third-party code, because you may not want the total number of software lines of code to include third-party code.

In other situations, it does not make sense to exclude all metrics from relaxed artefacts: If you are analysing components of a system and aggregate memory usage information up to the application level for example, third-party components for which you relax source code issues should still be part of the total memory usage for the system. In the latter case, you can use the continueOnRelaxed attribute to indicate that some or all measures should be included in computations even if the artefact has been relaxed. This is explained in the two examples below.

In the following code continueOnRelaxed is set to true for the metric used to mark artefacts as relaxed (usedForRelaxation ). As a result, all measures of the relaxed artefact are included in computations for other artefacts:

<ArtefactType id="RELAXABLE" heirs="FOLDER;FILES" />
<Measure measureId="RELAX" targetArtefactTypes="RELAXABLE" usedForRelaxation="true"
  continueOnRelaxed="true" defaultValue="0"  />

In the following code, continueOnRelaxed is set to true at computation-level. As a result, the measure MEMORY is included in computations even when the artefact is relaxed. No other measures are included in computations for relaxed artefacts, since continueOnRelaxed is omitted from the definition of RELAX:

<ArtefactType id="RELAXABLE" heirs="FOLDER;FILES" />
<Measure measureId="RELAX" targetArtefactTypes="RELAXABLE" usedForRelaxation="true"
  defaultValue="0" />
<Measure measureId="MEMORY" defaultValue="0">  
  <Computation targetArtefactTypes="APPLICATION;FODLER" 
  result="SUM FILE.MEMORY FROM DESCENDANTS" continueOnRelaxed="true"/>
</Measure>

Only artefacts of type FOLDER and FILES should be relaxable. If you need to find out if an artefact is relaxed in your model, you can use the IS_RELAXED_ARTEFACT() function described in the section called “Conditional and Level-Related Functions”.