<report>

Abstract

Learn to configure the <report> element for Pull Reports™ Ad Hoc report and data service software.


Catalog Configuration Java API analog:  ReportConfiguration.Builder

The <report> element configures one Pull Report endpoint within the Pull Reports REST API.

A report consists of a exactly one <table> or <table_ref> element which is the base table of the report. The base table is always included within the Export Report REST API SQL from statement. Additionally, at least one base table <column> is always returned from the Export Report REST API endpoint. The report's base table may contain one or more nested <relationship> elements representing additional tables within the report's join tree.

A <report> element is always within one <catalog>. The report and catalog id attributes form the base URL path to all Pull Reports REST API endpoints like so:

/[context]/pullreports/catalog/[catalog id]/report/[report id]/[endpoint]

For this reason, choose report and catalog ids carefully since they are part of the semantic REST structure and will cause REST clients to break if changed.

Configure capabilities of the report's Export Report REST API endpoint such as the default base table columns or sorting behavior and availability of the report's kml and geojson formats with a child <export_config> element.

Configure report access control to all Pull Reports REST API endpoints with a child <access_control_voter> element.

Usage

Catalog with single <report>

The following example uses the real estate data model from the <relationship> documentation to demonstrate a minimal <report> configuration. In this example, the Export Report REST API will return only one database column, realestate.home.id.

Example 1. Via an XML Catalog file
<?xml version="1.0" encoding="UTF-8"?>
<catalog xmlns="http://www.pullreports.com/catalog-1.6.1" id="realestate" name="Real Estate Reports"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.pullreports.com/catalog-1.6.1
    https://www.pullreports.com/docs/xsd/pullreports-catalog-1.6.1.xsd">
    <report id="home" name="Home Report">
        <table id="home" name="realestate.home" displayName="Home"> 
            <column id="id" name="id" paramType="java.lang.Integer"/>
        </table>
    </report>
</catalog>

Example 2. Via the Catalog Configuration Java API

The following example is an identical Catalog Configuration Java API configuration.

package com.pullreports.examples.report;

import com.pullreports.model.CatalogId;
import com.pullreports.model.ColumnId;
import com.pullreports.model.ParamType;
import com.pullreports.model.ReportId;
import com.pullreports.model.TableId;
import com.pullreports.model.config.CatalogConfiguration;
import com.pullreports.model.config.CatalogConfigurationFactory;
import com.pullreports.model.config.ColumnConfiguration;
import com.pullreports.model.config.ReportConfiguration;
import com.pullreports.model.config.TableConfiguration;

import javax.servlet.ServletContext;
import java.util.Collections;
import java.util.List;

public class OneReportCatalogConfigurationFactory implements CatalogConfigurationFactory {

    @Override
    public CatalogConfiguration makeCatalog(ServletContext servletContext) {

        ColumnConfiguration idColumnConfiguration = new ColumnConfiguration.Builder(
            new ColumnId("id"),"id")
            .setParamType(ParamType.INTEGER).build();

        List<ColumnConfiguration> columnConfigurations = Collections.singletonList(idColumnConfiguration);

        TableConfiguration homeTableConfiguration = new TableConfiguration.Builder(
            new TableId("home"),"Home",columnConfigurations)
            .setName("realestate.home").build();

        ReportConfiguration homeReportConfiguration = new ReportConfiguration.Builder(
            new ReportId("home"),"Home Report",homeTableConfiguration).build();
        
        List<ReportConfiguration> reportConfigurations = Collections.singletonList(homeReportConfiguration);

        return new CatalogConfiguration(new CatalogId("realestate"),"Real Estate Reports",reportConfigurations);
    }
}

                

Catalog with multiple <report>s

A <catalog> may contain many reports up to the limit of the Pull Reportslicense. Reports within a catalog may share the same global <table>, <global_label_value_list>, and <column_group> configuration.

The following example demonstrates the configuration of two reports within one catalog using the real estate data model from the <relationship> documentation.

Example 3. Via an XML Catalog file
<?xml version="1.0" encoding="UTF-8"?>
<catalog xmlns="http://www.pullreports.com/catalog-1.6.1" id="realestate" name="Real Estate Reports"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.pullreports.com/catalog-1.6.1
    https://www.pullreports.com/docs/xsd/pullreports-catalog-1.6.1.xsd">
    <report id="home" name="Home Report">
        <table id="home" name="realestate.home" displayName="Home"> 
            <column id="id" name="id" paramType="java.lang.Integer"/>
        </table>
    </report>
    <report id="owner" name="Owner Report">
        <table id="owner" name="realestate.owner" displayName="Owner"> 
            <column id="first_name" name="first_name"/>
            <column id="last_name" name="last_name"/>
        </table>
    </report>
</catalog>

Example 4. Via the Catalog Configuration Java API

The following example is an identical Catalog Configuration Java API configuration.

package com.pullreports.examples.report;

import com.pullreports.model.CatalogId;
import com.pullreports.model.ColumnId;
import com.pullreports.model.ParamType;
import com.pullreports.model.ReportId;
import com.pullreports.model.TableId;
import com.pullreports.model.config.CatalogConfiguration;
import com.pullreports.model.config.CatalogConfigurationFactory;
import com.pullreports.model.config.ColumnConfiguration;
import com.pullreports.model.config.ReportConfiguration;
import com.pullreports.model.config.TableConfiguration;

import javax.servlet.ServletContext;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class TwoReportCatalogConfigurationFactory implements CatalogConfigurationFactory {

    @Override
    public CatalogConfiguration makeCatalog(ServletContext servletContext) {

        List<ReportConfiguration> reportConfigurations = Arrays.asList(
            makeHomeReportConfiguration(),makeOwnerReportConfiguration());

        return new CatalogConfiguration(new CatalogId("realestate"),"Real Estate Reports",reportConfigurations);
    }

    private ReportConfiguration makeHomeReportConfiguration() {

        ColumnConfiguration idColumnConfiguration = new ColumnConfiguration.Builder(
            new ColumnId("id"),"id")
            .setParamType(ParamType.INTEGER).build();

        List<ColumnConfiguration> columnConfigurations = Collections.singletonList(idColumnConfiguration);

        TableConfiguration homeTableConfiguration = new TableConfiguration.Builder(
            new TableId("home"),"Home",columnConfigurations)
            .setName("realestate.home").build();

        return new ReportConfiguration.Builder(
            new ReportId("home"),"Home Report",homeTableConfiguration).build();
    }

    private ReportConfiguration makeOwnerReportConfiguration() {

        ColumnConfiguration firstNameColumnConfiguration = new ColumnConfiguration.Builder(
            new ColumnId("first_name"),"first_name").build();

        ColumnConfiguration lastNameColumnConfiguration = new ColumnConfiguration.Builder(
            new ColumnId("last_name"),"last_name").build();

        List<ColumnConfiguration> columnConfigurations = Arrays.asList(
                firstNameColumnConfiguration
                ,lastNameColumnConfiguration);

        TableConfiguration ownerTableConfiguration = new TableConfiguration.Builder(
            new TableId("owner"),"Owner",columnConfigurations)
            .setName("realestate.owner").build();

        return new ReportConfiguration.Builder(
            new ReportId("owner"),"Owner Report",ownerTableConfiguration).build();
    }
}
                

Catalog with multiple <report>s using <table_ref>

The following example demonstrates the usage of global <table>s and <table_ref>s to reuse table configuration between <report>s and <relationship>s. The example extends the join trees of both report configurations from the previous example with child <relationship> elements.

Example 5. Via an XML Catalog file
<?xml version="1.0" encoding="UTF-8"?>
<catalog xmlns="http://www.pullreports.com/catalog-1.6.1" id="realestate" name="Real Estate Reports"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.pullreports.com/catalog-1.6.1
    https://www.pullreports.com/docs/xsd/pullreports-catalog-1.6.1.xsd">
    <report id="home" name="Home Report">
        <table_ref ref="home" id="home">
            <relationship>
                <join_table name="realestate.home_owner">
                    <join_columns>
                        <join_column columnName="home_id" referencedColumnName="id" />
                    </join_columns>
                    <inverse_join_columns>
                        <join_column columnName="owner_id" referencedColumnName="id" />
                   </inverse_join_columns>
                </join_table>
                <table_ref id="owner" ref="owner"/>
            </relationship>
        </table_ref>
    </report>
    <report id="owner" name="Owner Report">
        <table_ref id="owner" ref="owner">
            <relationship>
                <join_table name="realestate.home_owner">
                    <join_columns>
                        <join_column columnName="owner_id" referencedColumnName="id" />
                    </join_columns>
                    <inverse_join_columns>
                        <join_column columnName="home_id" referencedColumnName="id" />
                   </inverse_join_columns>
                </join_table>
                <table_ref id="home" ref="home"/>
            </relationship>
        </table_ref>
    </report>
    <table id="home" name="realestate.home" displayName="Home"> 
        <column id="id" name="id" paramType="java.lang.Integer"/>
    </table>
    <table id="owner" name="realestate.owner" displayName="Owner"> 
        <column id="first_name" name="first_name"/>
        <column id="last_name" name="last_name"/>
    </table>
</catalog>

Children

<description>?
<access_control_voter>?
<export_config>?
<table> | <table_ref>

Parents

<catalog>

Attributes

id

The unique id of the report within the parent <catalog> This id forms part of all Pull Reports REST API endpoints. For example, the following id configuration:

<report id="salary_summary" ...>

creates REST endpoints:

/[context]/pullreports/catalog/[catalog id]/report/salary_summary/[endpoint]

Report id's may be composed of alphabetical characters, digits, or the - and _ characters.

name

The human-readable name of the report.

The name value is reflected within the Pull Reports™ Report Creator, header component.

Additionally, the name forms the downloadable file name of the Export Report REST API kml and csv export formats.