This lesson shows how to add stereotype data to a BIRT
report design.
To add stereotype data:
- To continue designing, click the Layout tab
in the report design editor.
- Create a data set for business use cases:
- In the Data Explorer view, right-click Data
Sets; then click New Data Set.
- In the Data Set Name field, type Business
Use Cases, click Next, and click Next again.
- On the Row Mapping page, click in the Expression field,
press Ctrl+Space, and double-click getElementsWithStereotype.
- In the expression, replace inputXPath with //*,
and replace inputStereotypes with Business
Modeling::BusinessUseCase. When you generate the report,
this expression finds all the elements in the model that are stereotyped
as a business use case.
- Set the value for Type to uml:UseCase.
To do this, under Browse, click the down arrow
and click Sample Business Model.emx.
- In the model structure hierarchy, click <BusinessUseCase>
Sample Use Case, click the right-arrow (>) button for
the Type field, and click OK.
- Set the value for Stereotypes to Business
Modeling::BusinessUseCase. To do this, click the right-arrow
button for the Stereotypes field.
- Click Next to go to the Column
Mapping page.
- Under Browse, click the down
arrow, and click uml:UseCase.
- In the structure hierarchy, click name,
and then click the right-arrow button.
- Under Browse, click the down
arrow, and click Business Modeling::BusinessUseCase,
which displays the structure hierarchy for the stereotypes.
- In the structure hierarchy, click the Category stereotype
attribute and click the right-arrow button.
- Edit the query for the Category item by adding /@name to
the end of the expression. The category value is an enumeration literal,
but the report should show the name of the category literal.
- In the structure hierarchy, click the Possibilities stereotype
attribute, and click the right-arrow button.
- In the structure hierarchy, click the SpecialRequirements stereotype
attribute and click the right-arrow button.
- Click Finish.
- In the Edit Data Set window, click OK.
- Add a business use-case table to the report.
- At the end of the report, add a section for business
use cases: In the Palette view, click Label and
drag the cursor into the report design editor.
- Set the label text to Business Use Cases and
apply the style that you used for the Use Case Diagrams label. Remember
that this style includes a page break before the label.
- From the Data Explorer, drag Business Use
Cases to the end of the report design. When you generate
the report, BIRT creates a table with data for each column of the
Business Use Cases data set.
- Change the header label name to Use
Case Name.
- To create a style for all the column headers in the
table, click the Table icon below the tab, and right-click the icon
for the Table Header row. In the style, specify a font and background
color for the column headers.
- In a separate style for the table, add a 12–point margin
at the top and bottom of the table.
- Save the report design file.
- In the report design editor, click the Preview tab.
The stereotype property values of the business use case from the
Sample Business Model.emx instance model are displayed. Except for the differences in style characteristics, the
English version of the report should look similar to the following
figure:
Continue your report design by adding group data.