Question & Answer
Question
This technote applies to IBM® Rational® Software Modeler as well as IBM Rational Software Architect and describes the steps that you can use to write a BIRT Report which gets the names of all the raised Exceptions for a given operation. This approach is generic to creating column mappings for any multi-valued reference feature (e.g., members of a package, etc).
Cause
Starting from version 7.5, both EMF and ODA (Open Data Access) drivers have parameterized dataset support. A custom XPath function is no longer required to write such a report.
Answer
The following steps will enable you to create a report that lists all operations with the names of the exceptions they raise:
1. Select File >New >Report project
2. Enter the Project Name: ParameterizedDataSetsProject
3. Select Window > Show View > Report Explorer
4. Copy UML Model > Blank UML Report into the new report project
5. Add a model to the project that contains Classes, Operations and Raised Exceptions
6. Double click on the report you have copied.
7. In the Report Perspective > Data Explorer, expand Data Source
8. Edit: Main Package
9. You will see a field called: Instance Models. Browse to the model added in Step 5.
10. Add a new Data Set called OpExceptions
11. In Query Parameters, add a parameter called opuri
12. In Row Mapping, click Browse and select the UML metamodel
From the resulting tree, select the Operation > raisedException.
Note that raisedException is a property of a UML Operation that gives the list of all the references to the raised exceptions.
By default this will add the Expression:
raisedException
13. Click on the greater than (>) sign to add the Type (it will be uml:Type)
Now modify the Expression so that it reads:
resolveURI($opuri)/raisedException
Note that $opuri is the reference to the value of the parameter opuri. The resolveURI is a function that returns the object corresponding to the URI passed as a parameter.This is documented in the InfoCenter and in the product Help, in the chapter:
Additional XPath functions for EMF and UML data sets.
See the related URL section for a link to the InfoCenter.
14. In Column Mapping, Browse for uml:Type and add the name field.
15. Click OK and then Finish to close the Data Set editor.
Report Layout:
1. Add a list to the report by right-clicking on the Report page and selecting: Insert->List)
2. In the Property Editor -List, Binding Tab, select the Data Set: Class Operations
3. Among the available Data Column Bindings, leave only: uri and qualifiedName and remove all the other ones
4. In the List Header, insert a Label and add the text: Operations with Raised Exceptions
5. In the List Detail, drop a Grid with dimensions: 1 Column, 3 Rows.
6. In the first row of the grid, drag and drop the qualifiedName column of the Data Set Class Operations.
7. In the second row of the grid, add a Label with text: Raised Exceptions
8. In the third row of the grid, drag and drop the entire data set OpExceptions. This will create a table.
9. Delete the Label name from the header row of the newly added table.
10. Select the Table, right click and select Edit Data Binding.
12. Click on Dataset Parameter Binding...
13. Select the parameter opuri and click Edit
14. In the Edit Data Set Parameter Binding, click the button fx near the Value field.
15. In the Expression Builder dialog, select:
Category: Available Column Bindings
Subcategory: List
Double Click to insert: uri
This will insert:
row["uri"]
16. Click OK to close all dialogs
The report layout should look like this:
Preview the report and you will see output like:
Related Information
Was this topic helpful?
Document Information
Modified date:
16 June 2018
UID
swg21329910