Package com.orchestranetworks.addon.dqid.dashboard


package com.orchestranetworks.addon.dqid.dashboard

Provides classes to operate with add-on's dashboard.

Dashboard export

You can export a dashboard to the PDF or XML format.

All required information of an export is encapsulated in DashboardExportSpec. You will need to specify a dashboard and a dashboard context using their unique codes in DashboardConfiguration.

        DashboardConfiguration dashboardConfiguration = DashboardConfiguration.getDashboardConfigForProductionStorage(
                        repository,
                        dashboardCode,
                        dashboardContextCode);
        DashboardExportSpec exportSpec = new DashboardExportSpec(
                        DashboardExportType.DASHBOARD_TO_PDF,
                        dashboardConfiguration,
                        repository,
                        new File(pdfFilePath),
                        session);               
        

Then you can get an instance of DashboardOperations and start to export the dashboard:

        DashboardOperations dashboardOperations = DashboardOperationsFactory.getDashboardOperations();
        dashboardOperations.export(exportSpec);
        

Please note that the dashboard context code in DashboardConfiguration is optional. In case you want to export a dashboard at a certain data space, data set, or table, please use the other constructors of DashboardExportSpec. For example:

        DashboardExportSpec exportSpec = new DashboardExportSpec(
                        DashboardExportType.DASHBOARD_TO_PDF,
                        dashboardConfiguration,
                        dataset,
                        new File(pdfFilePath),
                        session);
        

The specification also allows to set an XML file as the input of the export. This is useful in case you want to update the default PDF content together with a customized stylesheet (please refer to the 'Export template' table in the 'Dashboard configuration' domain for more details).

In order to do that, you will need to export the dashboard to the XML format first:

        File xmlFile = new File(xmlFilePath);
        DashboardExportSpec xmlExportSpec = new DashboardExportSpec(
                        DashboardExportType.DASHBOARD_TO_XML,
                        dashboardConfiguration,
                        dataset,
                        xmlFile,
                        session);
        dashboardOperations.export(xmlExportSpec);
        

Then customize the exported XML file to meet your requirement. Please make sure the new XML file comply with the XML schema definition defined by the add-on, otherwise the next export to PDF file will fail. The 'ebx-addon-dqid-export-dashboard.xsd' file can be found in the documentation folder of {addon.label} in the add-on bundle.

        DashboardExportSpec pdfExportSpec = new DashboardExportSpec(
                        DashboardExportType.DASHBOARD_TO_PDF,
                        dashboardConfiguration,
                        dataset,
                        new File(pdfFilePath),
                        session);
        pdfExportSpec.setXmlFile(File xmlFile);
        dashboardOperations.export(pdfExportSpec);