Customize Report Writer Model Element Template

This tutorial teach how to customize the report writer template to show use case id when generate use case model element. This tutorial will teach how to edit report writer template XML in report write user interface instead of open the XML files in the installation folder. Report Writer is a flexible report generation function to generate software design specification with UML.

November 24, 2009
User Rating: / 2
Views: 3,037
PDF Link Add comments
Edition: Standard or above (Edition comparison)

Preparing your project

  1. Start with a new project.
  2. Create a new use case diagram and name it as My First Diagram.
    new use case diagram
  3. Draw the diagram as shown below:
    create use case diagram
  4. Right click on use case Transfer Money and select. Open Specification from popup menu.
    open use case spec
  5. Enter "UC-001" as the ID of use case and click OK to confirm editing.
    enter uc id
  6. Click on the Pin icon at the top right corner of specification dialog box.
    click pin
  7. Click on the Auto open specification when select button below.
    auto open spec
  8. Click on the Apply button at the bottom of dialog box.
  9. Select Pay Bill and enter "UC-002" as its ID.
    enter uc id2
  10. Click on Apply button at the bottom of dialog box.
  11. Select Donate Money and enter "UC-003" as its ID.
    enter uc id3
  12. Click OK to confirm editing.

Customizing template

  1. Start the report writer by selecting Tools > Report > Report Writer... from the main menu.
    start report writer
  2. In the Templates dialog box, enter My Company as company name, Sample Report as report name, select Blank as report template and click OK to proceed.
    template dialog
  3. We are going to create a template for use case. Therefore, expand the diagram tree and select use case Transfer Money from diagram My First Diagram.
    select use case
  4. We are going to create a new template. Instead of doing everything from scratch, we will duplicate an existing template, and modify it a bit to fit our need. Right click on template Basic Information and select Duplicate... from the popup menu.
    dup template
  5. In the Duplicate Template dialog box, change ID and name to Basic Information (with usecase ID), and click OK.
    dup template dialog box
  6. In the Edit Template dialog box, scroll down to the middle of the pane to look for the segment <ValueConditionChecker property="documentation" operator="NOT EQUAL" value="">, which represents the row of documentation in the basic information table.
    look for source
  7. We will copy it, and make it shows the ID of use case. Highlight the <ValueConditionChecker> block and press Ctrl-C to copy.
    highlight and copy
  8. Scroll to the top of editor to look for the segment: <DefaultConditionChecker property="rank" equalFlag="false">
  9. Press Enter to add a new line.
    add new line
  10. Press Ctrl-V to paste.
    pasted content
    Before we start editing the pasted content, let's take a look at the elements involved:
    ValueConditionChecker Check whether a property equals or not equals to an expected value. Proceed if matched, otherwise stop and proceed with sibling element. In this case, when documentation is non-empty, subsequent elements will be checked.
    ReportOptionChecker Check whether a report option matches with the expected value. Proceed if matched, otherwise stop and proceed with sibling element. In this case, when the option Click to Generate Model Element Documentation is on.
    TableRow A row in table.
    TableCell A cell in row.
    StaticText Fixed text that need to be specified in template.
    StringPropertyText The value of certain property. In this case, the documentation property of use case will be queried.
  11. For the element <ValueConditionChecker>, change the property attribute's value from documentation to useCaseID. This means to check whether the use case ID is empty or not. If non-empty, the subsequent segment will be checked.
    prop
  12. Remove <ReportOptionChecker> as it is not needed in our case.
    remove report option checker
  13. Look for the <StaticText> element under the first <TableCell>. Change the content from Documentation : to ID :.
    change static text
  14. Look for the <StringPropertyText> element under the first <TableCell>. Change the content from documentation to useCaseID. This means to query and print the value of useCaseID property of use case.
    change string prop text
  15. Click OK to finish editing.
  16. Select Basic Information (with usecase ID) from the template pane.
    select new template
  17. Drag it onto the report. You should see the ID row appear with UC-001, the ID of use case, printed.
    drag template to report writer
  18. Select Pay Bill in diagram navigator.
  19. Drag the template Basic Information (with usecase ID) onto the report. There should be one more section being created, with Pay Bill's ID show in a table.
    show pay bill basic info
  20. Select Donate Money in diagram navigator.
  21. Drag the template Basic Information (with usecase ID) onto the report.
    show donate money basic info

Rate this Article

Click on one of the stars below to rate this article from 1 (lowest) to 5 (highest).

You may be interested in

  1. Writing Effective Use Case
  2. Draw Entity Relationship Diagram (ERD)
    Tagged:
  3. UML Package Diagram
    Tagged:
  4. Produce UML Use Cases from Business Process Diagram (BPD)
  5. Oracle database design with Entity Relationship Diagram
Tags of this article:

Comments (1)

written by Jaylen on December 16, 2011

Thanks for sharing. Always good to find a real exerpt.

Write comment

Rating

Comment

Enter the calculation result

security code