Custom reports sample details

You can run and rebuild this sample, and you can also look at source files to understand how this sample works.

Running this sample

Running the reports in Decision Center

To run the customized reports in Decision Center:

  1. Sign in to Decision Center(http://localhost:<PORT>/teamserver) with the following username and password:

    Username: rtsUser1

    Password: rtsUser1

  2. Switch to the loanvalidation-rules project.

  3. Click the Analyze tab.

    The Custom Reports section displays the list of available customized reports.

The Ruleflow Report provides detailed information on the content of a ruleflow.

To run the Ruleflow Report:

  1. Click Ruleflow Report.

    A new web page displays the Parameter dialog with the name of the query used to retrieve the ruleflow, and the username and password used for Decision Center. For more information, see Report parameters.

  2. Click OK.

    Decision Center displays the Ruleflow Report.

The Rule Expiration Report highlights the rules that have expired or that expire within 7, 30, or 90 days.

Note:

Before you run the report, create a new rule in Decision Center and set its Expiration Date to yesterday.

To run the Rule Expiration Report:

  1. Click Rule Expiration Report.

    A new web page displays the Parameter dialog with the name of the query used to retrieve the rules, and with the username and password used for Decision Center. For more information, see Report parameters.

  2. In the Expiration field, specify whether you want to display the rules that expire within 7, 30, or 90 days.

  3. Click OK.

    Decision Center displays the Rule Expiration Report and shows the expired rule in red. You can click the name of the rule (permalink) to access it directly.

The Rule Life Cycle Report shows rules created, updated, and deleted within a certain date range.

To run the Rule Life Cycle Report:

  1. Click Rule Life Cycle Report.

    A new web page displays the Parameter dialog with the name of the query used to retrieve the rules, and with the username and password used for Decision Center. For more information, see Report parameters.

  2. In the Range Date section, select the current date as End Date and leave the default value for the Start Date.

  3. Scroll down in the Parameter dialog to access the Filters section.

  4. In the Filters section, select all the available filters (Rules Created, Rules Updated, Rules Deleted).

    Note:

    To select more than one filter, use Ctrl, and Ctrl + Shift.

  5. Click OK.

    Decision Center displays the Rule Life Cycle Report. The report displays rules created, updated, or deleted within the date range you specified. You can click the name of the rule (permalink) to access it directly.

The Status Report shows the status of your rules.

To run the Status Report:

  1. Click Status Report.

    A new web page displays the Parameter dialog with the name of the query used to retrieve the rules, and with the username and password used for Decision Center. For more information, see Report parameters.

  2. In the Range Date section, select the current date as End Date and leave the default value for the Start Date.

  3. Scroll down in the Parameter dialog to access the Filters section.

  4. In the Filters section, select all the available filters (New, Defined, Validated, Rejected, Deployable).

  5. Click OK.

    Decision Center displays the Status Report. The report displays the rules with a New, Defined, Validated, Rejected, or Deployable status within the date range you specified. You can click the name of the rule (permalink) to access it directly.

Note:

Before you run the report, edit a rule in Decision Center , and change its status to New, Defined, Validated, Rejected, or Deployable.

The Updated Status Report shows which rules have been updated with a specific status within a specified date range.

To run the Updated Status Report:

  1. Click Updated Status Report.

    A new web page displays the Parameter dialog with the name of the query used to retrieve the rules, and with the username and password used for Decision Center. For more information, see Report parameters.

  2. In the Range Date section, select the current date as End Date and leave the default value for the Start Date.

  3. Scroll down in the Parameter dialog to access the Filters section.

  4. In the Filters section, select all the available filters (Rules with status changed to New, Defined, Validated, Rejected, and Deployable).

  5. Click OK.

    Decision Center displays the Updated Status Report. The report displays the rules that have had their status changed to New, Defined, Validated, Rejected, or Deployable within the date range you specified. You can click the name of the rule (permalink) to access it directly.

The Status Checkpoint Report shows the rules that have had a specific status since a specified date.

To run the Status Checkpoint Report:

  1. Click Status Checkpoint Report.

    A new web page displays the Parameter dialog with the name of the query used to retrieve the rules, and with the username and password used for Decision Center. For more information, see Report parameters.

  2. In the Range Date section, select the current date as Start Date.

  3. Scroll down in the Parameter dialog to access the Filters section.

  4. In the Filters section, select all the available filters (Rule Status New, Defined, Validated, Rejected, and Deployable).

  5. Click OK.

    Decision Center displays the Status Checkpoint Report. The report displays the rules that have had a status New, Defined, Validated, Rejected, or Deployable since the date you specified. You can click the name of the rule (permalink) to access it directly.

You can also run the reports in Rule Designer although the information is retrieved from Decision Center.

Running the reports in Rule Designer

To run the report in Rule Designer:

  1. Start Rule Designer

  2. Select the same workspace as before: <InstallDir>/teamserver/samples/servercustomreport/workspace.

  3. Make sure you are in the Report Design perspective.

There are four report templates available in the servercustomreport project:

The following procedures describe how to run each report.

Important:

When running the following reports, make sure that the URL in the Parameters dialog, contains the correct port number, and change it if necessary.

The Ruleflow Report provides detailed information on the content of the ruleflow.

To run the Ruleflow Report:

  1. In the Report Design perspective, in the Navigator, right-click the servercustomreport project, and click Refresh.

  2. Delete any existing .rptconfig file from the project.

  3. Double-click the ruleflow.rptdesign report template.

    The report template opens in the BIRT editor.

  4. Click the Preview tab.

    Rule Designer displays the Parameter dialog with the name of the query used to retrieve the ruleflow, and with the username and password used for Decision Center. Make sure that the URL contains the correct port for the sample server. For more information, see Report parameters.

  5. Click OK.

    Rule Designer displays the Ruleflow Report.

The Rule Expiration Report highlights the rules are expired or that expire within 7, 30, or 90 days.

If you have already created a new rule and set its Expiration Date to yesterday when you run the report in the Decision Center, you do not have to create a new one.

To run the Rule Expiration Report:

  1. In the Navigator, right-click the servercustomreport project, and click Refresh.

  2. Delete any existing .rptconfig file from the project.

  3. Double-click the rule_expiration.rptdesign report template.

    The report template opens in the BIRT editor.

  4. Click the Preview tab.

    Rule Designer displays the Parameter dialog with the name of the query used to retrieve the rules, and with the username and password used for Decision Center. Make sure that the URL contains the correct port for the sample server. For more information, see Report parameters.

  5. In the Expiration field, specify whether you want to display the rules that expire within 7, 30, or 90 days.

  6. Click OK.

    The Rule Expiration Report opens and shows the expired rule in red. You can click the name of the rule (permalink) to access it directly in Decision Center.

The Rule Life Cycle Report shows rules created, updated, and deleted within a certain date range.

To run the Rule Life Cycle Report:

  1. In the Navigator, right-click the servercustomreport project, and click Refresh.

  2. Delete any existing .rptconfig file from the project.

  3. Double-click the rule_lifecycle.rptdesign report template.

    The report template opens in the BIRT editor.

  4. Click the Preview tab.

    Rule Designer displays the Parameter dialog with the name of the query used to retrieve the rules, and with the username and password used for Decision Center. Make sure that the URL contains the correct port for the sample server. For more information, see Report parameters.

  5. In the Date Range section, select the current date as End Date and for the purposes of this sample, leave the default value for the Start Date.

  6. Scroll down in the Parameter dialog to access the Filters section.

  7. In the Filters list, select the following filters:

    • Rule Created

    • Rule Updated

    • Rule Deleted

  8. Click OK.

    The Rule Life Cycle Report displays rules created, updated, or deleted within the date range you specified. You can click the name of the rule (permalink) to access it directly.

The Status Report shows the status of your rules.

To run the Status Report:

  1. In the Navigator, right-click the servercustomreport project, and click Refresh.

  2. Delete any existing .rptconfig file from the project.

  3. Double-click the rule_lifecycle.rptdesign report template.

    The report template opens in the BIRT editor.

  4. Click the Preview tab.

    Rule Designer displays the Parameter dialog with the name of the query used to retrieve the rules, and with the username and password used for Decision Center. Make sure that the URL contains the correct port for the sample server. For more information, see Report parameters.

  5. In the Date Range section, select the current date as End Date and leave the default value for the Start Date.

  6. Scroll down in the Parameter dialog to access the Filters section.

  7. In the Filters list, select the following filters:

    • Rules with status 'New'

    • Rules with status 'Defined'

    • Rules with status 'Validated'

    • Rules with status 'Rejected'

    • Rules with status 'Deployable'

  8. Click OK.

    The Status Report displays the rules that have a New, Defined, Validated, Rejected, or Deployable status within the date range you specified. You can click the name of the rule (permalink) to access it directly.

The Updated Status Report shows which rules are updated with a specific status within a specified date range.

Before running the report, edit a rule, and change its status to New, Defined, Validated, Rejected, or Deployable.

To run the Updated Status Report:

  1. In the Navigator, right-click the servercustomreport project, and click Refresh.

  2. Delete any existing .rptconfig file from the project.

  3. Double-click the rule_lifecycle.rptdesign report template.

    The report template opens in the BIRT editor.

  4. Click the Preview tab.

    Rule Designer displays the Parameter dialog with the name of the query used to retrieve the rules, and with the username and password used for Decision Center. Make sure that the URL contains the correct port for the sample server. For more information, see Report parameters.

  5. In the Date Range section, select the current date as End Date and the default value for the Start Date.

  6. Scroll down in the Parameter dialog to access the Filters section.

  7. In the Filters list, select the following filters:

    • Rules with status changed to 'New'

    • Rules with status changed to 'Defined'

    • Rules with status changed to 'Validated'

    • Rules with status changed to 'Rejected'

    • Rules with status changed to 'Deployable'

  8. Click OK.

    The Updated Status Report displays the rules that have had their status changed to New, Defined, Validated, Rejected, or Deployable within the date range you specified. You can click the name of the rule (permalink) to access it directly.

The Status Checkpoint Report shows the rules that have had a specific status since a specified date.

To run the Status Checkpoint Report:

  1. In the Navigator, right-click the servercustomreport project, and click Refresh.

  2. Delete any existing .rptconfig file from the project.

  3. Double-click the rule_statuscheckpoint.rptdesign report template.

    The report template opens in the BIRT editor.

  4. Click the Preview tab.

    Rule Designer displays the Parameter dialog with the name of the query used to retrieve the rules, and with the username and password used for Decision Center. Make sure that the URL contains the correct port for the sample server. For more information, see Report parameters.

  5. In the Date Range section, select the current date as Start Date.

  6. Scroll down in the Parameter dialog to access the Filters section.

  7. In the Filters section, select all the available filters (Rule status New, Defined, Validated, Rejected, and Deployable.).

  8. Click OK.

    The Status Checkpoint Report displays the rules that have had a status New, Defined, Validated, Rejected, or Deployable since the date you specified. You can click the name of the rule (permalink) to access it directly.

You can modify a report in Rule Designer and redeploy the customized report to Decision Center. See Modifying a report in Rule Designer .

Note:

Before you start, make sure you are working in the Report Design perspective, and that the sample server is running, see Starting and stopping the sample server.

The following example illustrates how to customize the report to highlight the expiration date of an expired rule. To modify the Rule Expiration Report in Rule Designer:

Modifying a report in Rule Designer

  1. Double-click the rule_expiration.rptdesign report template.

    The report template opens in the BIRT editor.

  2. In the Layout tab of the report template, select the [expiration date] element.

  3. In the Property Editor, click the Highlights tab.

  4. Click Add.

    Rule Designer displays the New Highlight dialog.

  5. In the Condition section, enter the following values:

    • Select expirationdate, and then change row["expirationdate"] to row["expired"].

    • Select Equal to.

    • Enter true.

  6. In the Format section, set the formatting to red and bold.

  7. Click OK, and then click Save.

  8. Click the Preview tab, and wait for the report to display.

    Rule Designer displays the expiration date of the expired rule in red and bold.

Repackaging the Web application

After you have modified your report, you redeploy it to the customized BIRT web application.

To redeploy the report to the BIRT Web application:

  1. In the Samples Commands view, navigate to Samples Commands > Decision Center > Custom reports.

  2. Execute the run command to package the Web application.

  3. Wait until the Console shows that the build is successful.

Testing the report in Decision Center

You can now test the customized report in Decision Center.

Make sure that the sample server is still running. For more information about starting the sample server, see Starting and stopping the sample server.

To test the report in Decision Center:

  1. Sign in to Decision Center.

  2. Click the Analyze tab.

  3. Click the Rule Expiration Report link.

    The Parameter dialog is displayed, with the name of the query used to retrieve the rules, and with the username and password.

  4. In the Expiration field, specify whether you want to display the rules that expire within 7, 30, or 90 days.

    The Parameter dialog is displayed, with the name of the query used to retrieve the rules, and with the username and password.

  5. Click OK, and wait for the report to display. The expiration date of the expired rule is displayed in red and bold.

Rebuilding this sample

To rebuild this sample:

  1. In the Samples Commands view, navigate to Samples Commands > Decision Center > Custom reports.

  2. Execute the run command to rebuild the sample and deploy the .ear files.

How this sample works

The following figure illustrates integration in Decision Center:

Diagram showing integration of product
white BIRT Web Application: report\*.rptdesign, script\*.js, L10N\*.properties files
blue BIRT Web Application: WEB-INF\lib directory

The Decision Center Java™ Remote API is deployed within the BIRT web application.

A report execution request is activated when you click a link on the Analyze tab. This link points to the customized BIRT application. The http report execution request contains the values of the hidden parameters required to execute the report.

The report uses JavaScript data sets that rely on the Java Remote API of Decision Center and connects to Decision Center to collect the data required to populate the report.

You can run and customize the reports in Rule Designer, however the data used in the reports is retrieved from Decision Center. The following figure illustrates integration in Rule Designer:

Diagram shows interaction between product modules.
white Project artifact: *.rptdesign and *.js files
blue BIRT plug-in directory: \birt\WEB-INF\lib directory

The Decision Center Remote Java API is deployed in the BIRT Eclipse plug-in. The report uses JavaScript data sets that rely on the Decision Center Java Remote API.

The servercustomreport sample consists of two projects:

Sample packaging

The sample packaging is as follows:

File Description Rule Designer project directory BIRT project directory
*.rptdesign Report files <InstallDir>/studio/samples/brmanagement/servercustomreport /report
*.js JavaScript files <InstallDir>/studio/samples/brmanagement/servercustomreport/servercustomreport/scriptlib /scriptlib
*.*_en_US.properties L10N files <InstallDir>/studio/samples/brmanagement/servercustomreport/servercustomreport/L10N /L10N
samplereport.properties Configuration file   WEB-INF/lib/sample.jar

The Analyze tab is updated with a new Custom Reports section that displays the list of the new available reports:

Updating the Analyze tab

The sample uses the following files to update the Analyze tab with the new reports:

You use report parameters to filter the data in reports. When a report contains declared parameters:

Report parameters

You use these parameter values later in the report scripts.

CAUTION:

The Parameter dialog prompts you to enter your Decision Center username and password. When you do so and click OK, the values are sent across the network in clear text. To prevent this from happening:

  1. Deploy the customized BIRT web application in your application server so that access is through an HTTPS port. For more information, refer to your application server guide.

  2. Modify the servercustomreport/resources/samplereport.properties file by updating the following key: sample.birt.url=https://HOSTNAME:XXXX/rtsbirt/preview? where HOSTNAME is the name of the host and XXXX is the https port.

Parameter dialog

Use the following parameters to complete the Parameter dialog.

Data set Purpose
ParameterRangeDateDataSet This data set provides the startDate and endDate parameter values.
ParameterProjectDataDataSet This data set provides the project, baseline, and query parameter values.
ParameterRTSConnectivityDataSet This data set provides the datasourceand url parameter values.
ParameterFiltersDataSet This data set provides the filters parameters, such as Rules Created, Rules with status 'New', and Rules with status changed to 'Defined'.

The following table lists the filters used by the rule_lifecycle.rptdesign and rule_statuscheckpoint.rptdesign report templates:

Note:

Each time you create, update, delete, or restore a rule, a rule version is stored in the Decision Center database. Each version is identified by a version number with the following format versionMajor.versionMinor (for example, 1.1).

Report template Filter label Description JavaScript class
rule_lifecycle.rptdesign Rules Created This filter selects the rule if version 1.0 is created between the startDate and endDate parameters CreatedFilter()
Rules Deleted This filter selects the rule if there is at least one version considered as deleted between the startDate and endDate parameters DeletedFilter ()
Rules Updated This filter selects the rule if there is at least one version considered as an update (that is, version 1.0 is excluded as well as the deleted versions) between the startDate and endDate parameters UpdatedFilter ()
Rules with status 'New', 'Defined', 'Validated', 'Rejected', or 'Deployable' This filter selects the rule if there is at least one version of the rule with the status 'New', 'Defined', 'Validated', 'Rejected', or 'Deployable', and if the version date is between the startDate and endDate parameters StatusFilter()
Rules with status changed to any value, 'New', 'Defined', 'Validated', 'Rejected', 'Deployable' This filter selects the rule if there is at least one version of the rule with the status changed and if the version date is between the startDate and endDate parameters UpdatedStatusFilter()
rule_statuscheckpoint.rptdesign Rule with status 'New', 'Defined', 'Validated', 'Rejected', or 'Deployable' This filter selects the rule if it has the status set to 'New', 'Defined', 'Validated', 'Rejected', or 'Deployable' at least since the startDate StatusSinceFilter()

The Parameter dialog contains several parameters, some of which are hidden:

Note:

To keep this sample as simple as possible, the values are not validated. If you select the wrong values you might get errors when executing the report.

Tip:

To select more than one filter in the Parameter dialog, use Ctrl, and Ctrl + Shift.

The Parameter dialog displayed when executing the report in Decision Center is customized. You can modify the webcontent/birt/styles/dialogbase.css file to customize it yourself.

The data sets and data sources rely on JavaScript code that uses the Remote Java API of Decision Center.

All the reports use the RTSRepository JavaScript class to connect to Decision Center and execute queries.

Key JavaScript file Purpose
Repository.js This file connects to Decision Center and executes the query in Decision Center.
Datasource.js This file maintains the session to Decision Center.
ModelHelper.js This file handles the Decision Center object model by calling the Java API.

All the data sets are parameterized, except the first data set executed for a report.

To access the list of parameters for a specific data set:

  1. Right-click the data set in the Outline view and select Edit.

  2. In the Edit Data Set dialog, select Parameters.

In the report template, to view the value assigned to the parameter, right-click the List or Table elements (use the Outline view to easily locate them), and then click Edit Data Binding.

Source files

This sample is composed of two projects:

You can also view and modify the sample source files in Rule Designer. To import the sample into your workspace, click the Import projects link in the Samples and Tutorials view.