Startseite / Plugin-Entwicklung / Universelle Erweiterungen / Datenzugriff / Nutzung als Report / Reports anzeigen und aktualisieren
Displaying and Updating Reports
Reports which are available in the user interface of SiteArchitect and/or ContentCreator may be opened (displayed) and updated by various programmatic means. This enables plug-in and template developers to provide interactions with reports through executable code as well as through JavaScript added to templates' output channels.
Depending on the availability of a Filterable aspect in a Data Access Plug-In's data stream builder class, updating a report's results set may also include setting and resetting the report's filters.
The methodologies described here can only be used in client contexts that support FirstSpirit reports, i.e., while running in SiteArchitect or a ContentCreator environment. Only reports available in the current client session can be displayed. |
Displaying Reports from Java Code
Available in SiteArchitect and ContentCreator. |
FirstSpirit Developer API Interface: de.espirit.firstspirit.ui.operations.ShowReportOperation
Developer API documentation: ShowReportOperation
The FirstSpirit APIs provide an operation object ShowReportOperation which may be obtained from an OperationAgent (see "Obtaining Agents" in Accessing FirstSpirit Functionality), which is available to plug-ins running in SiteArchitect and ContentCreator environments.
This operation may be used to display reports provided by Data Access Plug-Ins and Legacy Report Plug-Ins; each time ShowReportOperation#perform(...) is called, the displayed report's results will be refreshed. Optionally, this operation provides a method which may be used to configure any of the report's filters before refreshing the report's results.
The following example assumes that a context object context of type SpecialistsBroker is available in the code snippet's scope, configures a ShowReportOperation object to set a boolean filter named germanText (see "Providing Aspects" in Data Stream Builder for an overview of available parameters and information about the parameter factory class), and finally performs the operation to display the report of the Data Access Plug-In class MyDataAccessPlugin described in this chapter.
final OperationAgent operationAgent = context.requireSpecialist(OperationAgent.TYPE);
final ShowReportOperation showReportOperation = operationAgent.getOperation(ShowReportOperation.TYPE);
// ShowReportOperation isn't available in every context, OperationAgent#getOperation(...) may return null!
if (showReportOperation != null) {
// Instantiate a parameter object with a name matching that defined
// in the Data Access Plug-In's Filterable aspect implementation.
final ParameterBoolean displayGermanResults = Parameter.Factory.createBoolean("germanText", null, null);
// Set the parameter values for the parameters defined above.
showReportOperation.setParameter(displayGermanResults, false);
// Perform the operation, referencing the class object MyDataAccessPlugin
showReportOperation.perform(MyDataAccessPlugin.class);
}
Displaying Reports Using JavaScript
Available in ContentCreator |
ContentCreator's JavaScript API supports display and configuration of reports in the ContentCreator user interface. For further information, see Template development / ContentCreator / JavaScript API / Reports.