Custom Data Holder Generation Apex Class
Table of Contents
Custom Data Holder Generation Apex Class
The RIO Education - Reporting Engine allows you to override the standard data holder generation behavior. There are two required setup:
- Develop a data holder executable Apex class.
- Define the class name on the related Reporting Query.
Data Holder Executable Class
You need to create an Apex class that extends the rio_edrept.REPT_DataHolderExecutable class and override the run() method.
global without sharing class REPT_DataHolder_EXE extends rio_edrept.REPT_DataHolderExecutable { /** * @description Method to be implemented by the classes that extend this abstract class. This is the method that will be called by the REPT_Data_Manager */ public override void run(rio_edrept.DataHolderInfo dataHolderInfo) { if (rio_edrept.UTIL_AppSetting.isDataGeneratorBatchMode()) { REPT_CustomJob_BATCH dhJob = new REPT_CustomJob_BATCH( dataHolderInfo.dataHolderQuery, dataHolderInfo.reportType, dataHolderInfo.reportVariant, dataHolderInfo.reportingExport.Id, dataHolderInfo.reportingExport.rio_edrept__Report_Version__c, dataHolderInfo.reportingExport.rio_edrept__Reporting_Year__c, dataHolderInfo.targetObjectName, dataHolderInfo.fileType, dataHolderInfo.fileSection ); Database.executeBatch(dhJob, rio_edrept.UTIL_AppSetting.getDataGeneratorBatchSize()); } else if (rio_edrept.UTIL_AppSetting.isDataGeneratorQueueableMode()) { REPT_CustomJob_QUEUE dhJob = new REPT_CustomJob_QUEUE( dataHolderInfo.dataHolderQuery, dataHolderInfo.reportType, dataHolderInfo.reportVariant, dataHolderInfo.reportingExport.Id, dataHolderInfo.reportingExport.rio_edrept__Report_Version__c, dataHolderInfo.reportingExport.rio_edrept__Reporting_Year__c, dataHolderInfo.targetObjectName, dataHolderInfo.fileType, dataHolderInfo.fileSection ); if (!Test.isRunningTest()) { System.enqueueJob(dhJob); } } } }
Status logging
It is recommended to implement a proper status logging in your custom batchable or queueable Apex class to allow the RIO Education - Reporting Engine to track the status correctly.
To log the status for an asynchronous job, you can use the following methods from rio_edrept.UTIL_Logging class.
rio_edrept.UTIL_Logging.logJobStarted(rExportId, jobId, jobName, jobType, jobRef, logMessage); rio_edrept.UTIL_Logging.logJobCompleted(rExportId, jobId, jobName, jobType, jobRef, logMessage); rio_edrept.UTIL_Logging.logJobFailed(rExportId, jobId, jobName, jobType, jobRef, logMessage);
Set Class Name on Reporting Export
Once the custom Apex class is created, you can define the Apex class name on the Reporting Query's Data Holder Generation Class Name.