IBM Support

How to create a BIRT report that shows operations' constraints by type (Pre-Condition, Body, Post-Condition)

Question & Answer


Question

How can you show the operations constraints grouped by type (Pre-Condition, Body, Post-Condition) using BIRT in IBM Rational Software Architect?

Cause

The type of an operation constraint is shown in the user interface in a drop-down list with the possible values: Pre-Condition, Body, Post-Condition.

However, there is no Type attribute of the uml:Constraint metaclass.

The uml:Operation metaclass contains three lists called: precondition, bodyCondition, postcondition.

Each of these lists contains the uniform resource identifiers of the constraints of given type.

Answer

SOLUTION

  1. Create a new BIRT Report

  2. Add a data source of type UML Model

  3. Add a Data Set called Operations with Row Query Expression: //Operation and Row Query Type uml:Operation

  4. Add the following Column Mapping with name, @name, andString in the first Column Query row and uri, getURI(.), and String in the second Column Query row:

  5. Add a new data set called OperationsWithPre

  6. Add a Query Parameter called: opuri

  7. Add a Row Mapping by browsing to Operation >Precondition (This will add the Row Query Expression: precondition), changing it to: resolveURI($opuri)/precondition and selecting the Row Mapping Type: uml:Constraint

  8. Add a Column Mapping with name, @name, and String in the first row of the Column Query

  9. Repeat Steps 5-8 to create similar data sets called OperationsWithBody for the bodyCondition listand OperationsWithPost for the postconditionlist

  10. Add a new list to display the information on the report

  11. Add a label with the text Operations in the Header of the list

  12. Bind the list to the Data Set > Operations. In the first row of the Data Column Binding, theName will be Column Binding, Display Name will be uri, the Data Type will be String, and the Expression will be dataSetRow["uri"]. The Column Binding (uri) will be used to determine the value of the parameter opuri in the nested table bound to theData Set > OperationsWithPost. Add a new table inside the List Detail section. The table should have one Column and one Detail.

  13. Bind the table to the Data Set > OperationsWithPre

  14. Click on Data Set Parameter Binding...

  15. Bring the parameter opuri to the Column Binding from the Data Set > Operations, as follows:

  16. Select the parameter, then click on the Edit button. This opens the Edit data set parameter binding dialog below:

  17. Click on the f x button. This opens the Expression Builder, from which you can make selections:

  18. Add a label in the Table Header with the text Preconditions

  19. Drop the name column of the Data Set > OperationsWithPre into the Table Detail

  20. Repeat the Steps 13-18 and create two tables, one for OperationsWithBody and one forOperationsWithPost. It may be easier to use the Outline view to arrange the tables inside the list:

The Report layout will look as follows:



The Report preview will look as follows:


An sample model and report are attached to this document. They were created using IBM Rational Software Architect 8.5:

BIRTProjectWithModel.zip

[{"Product":{"code":"SSYK2S","label":"Rational Software Architect Designer"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Reports","Platform":[{"code":"PF016","label":"Linux"},{"code":"PF033","label":"Windows"}],"Version":"8.5;8.0.4.1;8.0.4;8.0.3;8.0.2;8.0.1;8.0","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SS4JCV","label":"Rational Software Architect for WebSphere Software"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Reports","Platform":[{"code":"PF016","label":"Linux"},{"code":"PF033","label":"Windows"}],"Version":"8.0;8.0.1;8.0.2;8.0.3;8.0.4;8.0.4.1;8.5","Edition":"","Line of Business":{"code":"LOB15","label":"Integration"}}]

Document Information

Modified date:
10 September 2020

UID

swg21617033