Developing a Report
Purpose
This topic explains how to extend an overridable API to generate a human-readable regulatory submission report for both non-revisable and revisable regulatory submissions. The default implementation provides a basic PDF report intended for demonstration purposes. However, implementors can create submission-specific reports that comply with agency requirements.
Overview
The default behavior generates a PDF report for the primary content of a regulatory submission and associates it with the submission. While this may suffice for some cases, most agencies require customized formats and layouts.
To achieve this, you can:
• Override the generatePrimaryContent method in a custom processor class.
• Or extend the provided helper class GeneratePrimaryContentAsPDF for advanced customization.
Solution Steps
1. Create a custom regulatory submission processor class that overrides the generatePrimaryContent method.
2. Implement custom logic for generating a human-readable report.
3. Register your custom class in services.xconf.
Solution Elements
|
Element
|
Type
|
Description
|
|
RegulatorySubmission generatePrimaryContent(RegulatorySubmission regulatorySubmission)
|
API
|
|
|
This API is deprecated and will be removed in a future release.
|
Generates primary content for a regulatory submission.
|
|
RegulatorySubmission generatePrimaryContent(RegulatorySubmission regulatorySubmission, boolean draft)
|
API
|
Generates a sample of the primary content for a regulatory submission.
|
Default Behavior
• Creates a PDF report for the primary content of a regulatory submission.
• If draft = TRUE, adds a DRAFT watermark on each page.
• Associates the generated PDF as the primary content on the submission.
• Report layout:
◦ Uses Report Screen Layout if available.
◦ Falls back to Primary Attributes and More Attributes layouts, if Report Screen Layout is not available.
• Includes Table Data, Subjects, and Drivers linked to the submission.
• Intended for demonstration purposes, but may suit some submission types.
• Implementors can create submission-specific reports matching agency requirements.
Customizing Primary Content
To customize,
• Create a Java class extending SimpleRegulatorySubmissionProcessor or a revisable subtype processor. The revisable subtype processor can include AERSubmissionProcessor, ERSubmissionProcessor, RPSSubmissionProcessor, or UDISubmissionProcessor.
• Override the generatePrimaryContent() method.
The following example shows a new custom class with the overridden generatePrimaryContent method:
public RegulatorySubmission generatePrimaryContent(RegulatorySubmission regulatorySubmission, boolean draft) throws Exception
{
String fileName = "RegSub_Report.pdf";
// This method will get all the primary contents form the Regulatory Submission and create a formatted output for storing.
InputStream in = generatePDF(regulatorySubmission);
// This method will get the formatted output and check all the validations to store the PDF report as Primary content.
RegulatoryContentHelper.getService().storePrimaryContent(regulatorySubmission, in, fileName);
return regulatorySubmission;
}
}
While you can implement your own logic from scratch, the platform provides a helper class GeneratePrimaryContentAsPDF that simplifies PDF generation and storage. You can extend this class for advanced customization.
GeneratePrimaryContentAsPDF Class
This class implements the core functionality for creating and storing a PDF report as the primary content.
Key Features
• Generates a PDF report intended for a regulatory submission that includes submission attributes, subjects, drivers, and table data.
• Stores the generated PDF as the primary content for the submission.
• Allows customization of methods like generatePrimaryContent and createHeader.
• Manages PDF formatting, fonts, layout, headers, and styling.
• Supports both draft and final versions of reports, including watermarking for drafts.
Usage
• Developers can subclass this class to customize header content, formatting, or other report details.
• Designed for safe extension in custom code.
Supported API
|
Method
|
Purpose
|
|
generatePrimaryContent()
|
Generates and stores the PDF report.
|
|
createHeader()
|
Builds the header section for the PDF.
|
Default Behavior of generatePrimaryContent
• Determines the output file name based on whether the report is a draft or final:
For example:
◦ Draft: RegSub_Report_draft.pdf
◦ Final: RegSub_Report.pdf
• Invokes generatePDF(regulatorySubmission) to create the PDF content.
• Stores the generated PDF as the primary content for the submission using:
RegulatoryContentHelper.getService().storePrimaryContent
• Always generates a new PDF for the given submission and replaces existing primary content.
Default Behavior of createHeader
• Builds the header section for the Regulatory Submission PDF.
• Collects key details about the submission, such as localized type name, submission name and identifier, and the current timestamp.
• Creates a single-column table with three rows: type name, submission name and identifier, and current date and time. Each row uses bold font and is centered aligned.
• Wraps the table in a borderless PdfPCell and returns it for inclusion in the PDF.
Parent topic