Package africa.absa.inception.reporting
Class ReportingService
- java.lang.Object
-
- africa.absa.inception.reporting.ReportingService
-
- All Implemented Interfaces:
IReportingService
@Service public class ReportingService extends Object implements IReportingService
The ReportingService class provides the Reporting Service implementation.- Author:
- Marcus Portmann
-
-
Field Summary
-
Fields inherited from interface africa.absa.inception.reporting.IReportingService
SYSTEM_USERNAME
-
-
Constructor Summary
Constructors Constructor Description ReportingService(javax.validation.Validator validator, DataSource dataSource, ReportDefinitionRepository reportDefinitionRepository, ReportDefinitionSummaryRepository reportDefinitionSummaryRepository)Constructs a new ReportingService.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateReportDefinition(ReportDefinition reportDefinition)Create the new report definition.byte[]createReportPDF(String reportDefinitionId, Map<String,Object> parameters)Create the PDF for the report using a connection retrieved from the application data source.byte[]createReportPDF(String reportDefinitionId, Map<String,Object> parameters, Connection connection)Create the PDF for the report.byte[]createReportPDF(String reportDefinitionId, Map<String,Object> parameters, Document document)Create the PDF for the report.voiddeleteReportDefinition(String reportDefinitionId)Delete the existing report definition.StringgetLocalReportFolderPath()Returns the real path to the folder where the local Jasper reports are stored.ReportDefinitiongetReportDefinition(String reportDefinitionId)Retrieve the report definition.StringgetReportDefinitionName(String reportDefinitionId)Retrieve the name of the report definition.List<ReportDefinition>getReportDefinitions()Returns all the report definitions.List<ReportDefinitionSummary>getReportDefinitionSummaries()Returns the summaries for all the report definitions.ReportDefinitionSummarygetReportDefinitionSummary(String reportDefinitionId)Retrieve the summary for the report definition.booleanreportDefinitionExists(String reportDefinitionId)Check whether the report definition exists.voidsetLocalReportFolderPath(String localReportFolderPath)Set the real path to the folder where the local Jasper reports are stored.voidupdateReportDefinition(ReportDefinition reportDefinition)Update the report definition.
-
-
-
Constructor Detail
-
ReportingService
public ReportingService(javax.validation.Validator validator, @Qualifier("applicationDataSource") DataSource dataSource, ReportDefinitionRepository reportDefinitionRepository, ReportDefinitionSummaryRepository reportDefinitionSummaryRepository)Constructs a new ReportingService.- Parameters:
validator- the JSR-303 validatordataSource- the data source used to provide connections to the application databasereportDefinitionRepository- the Report Definition RepositoryreportDefinitionSummaryRepository- the Report Definition Summary Repository
-
-
Method Detail
-
createReportDefinition
@Transactional public void createReportDefinition(ReportDefinition reportDefinition) throws InvalidArgumentException, DuplicateReportDefinitionException, ServiceUnavailableException
Description copied from interface:IReportingServiceCreate the new report definition.- Specified by:
createReportDefinitionin interfaceIReportingService- Parameters:
reportDefinition- the ReportDefinition instance containing the information for the new report definition- Throws:
InvalidArgumentException- if an argument is invalidDuplicateReportDefinitionException- if the report definition already existsServiceUnavailableException- if the report definition could not be created
-
createReportPDF
public byte[] createReportPDF(String reportDefinitionId, Map<String,Object> parameters) throws InvalidArgumentException, ReportDefinitionNotFoundException, ServiceUnavailableException
Description copied from interface:IReportingServiceCreate the PDF for the report using a connection retrieved from the application data source.- Specified by:
createReportPDFin interfaceIReportingService- Parameters:
reportDefinitionId- the ID for the report definitionparameters- the parameters for the report- Returns:
- the PDF data for the report
- Throws:
InvalidArgumentException- if an argument is invalidReportDefinitionNotFoundException- if the report definition could not be foundServiceUnavailableException- if the report definition could not be created
-
createReportPDF
public byte[] createReportPDF(String reportDefinitionId, Map<String,Object> parameters, Connection connection) throws InvalidArgumentException, ReportDefinitionNotFoundException, ServiceUnavailableException
Description copied from interface:IReportingServiceCreate the PDF for the report.- Specified by:
createReportPDFin interfaceIReportingService- Parameters:
reportDefinitionId- the ID for the report definitionparameters- the parameters for the reportconnection- the database connection used to retrieve the report data- Returns:
- the PDF data for the report
- Throws:
InvalidArgumentException- if an argument is invalidReportDefinitionNotFoundException- if the report definition could not be foundServiceUnavailableException- if the PDF for the report could not be created
-
createReportPDF
public byte[] createReportPDF(String reportDefinitionId, Map<String,Object> parameters, Document document) throws InvalidArgumentException, ReportDefinitionNotFoundException, ServiceUnavailableException
Description copied from interface:IReportingServiceCreate the PDF for the report.- Specified by:
createReportPDFin interfaceIReportingService- Parameters:
reportDefinitionId- the ID for the report definitionparameters- the parameters for the reportdocument- the XML document containing the report data- Returns:
- the PDF data for the report
- Throws:
InvalidArgumentException- if an argument is invalidReportDefinitionNotFoundException- if the report definition could not be foundServiceUnavailableException- if the PDF for the report could not be created
-
deleteReportDefinition
@Transactional public void deleteReportDefinition(String reportDefinitionId) throws InvalidArgumentException, ReportDefinitionNotFoundException, ServiceUnavailableException
Description copied from interface:IReportingServiceDelete the existing report definition.- Specified by:
deleteReportDefinitionin interfaceIReportingService- Parameters:
reportDefinitionId- the ID for the report definition- Throws:
InvalidArgumentException- if an argument is invalidReportDefinitionNotFoundException- if the report definition could not be foundServiceUnavailableException- if the report definition could not be deleted
-
getLocalReportFolderPath
public String getLocalReportFolderPath()
Description copied from interface:IReportingServiceReturns the real path to the folder where the local Jasper reports are stored.- Specified by:
getLocalReportFolderPathin interfaceIReportingService- Returns:
- the real path to the folder where the local Jasper reports are stored
-
getReportDefinition
public ReportDefinition getReportDefinition(String reportDefinitionId) throws InvalidArgumentException, ReportDefinitionNotFoundException, ServiceUnavailableException
Description copied from interface:IReportingServiceRetrieve the report definition.- Specified by:
getReportDefinitionin interfaceIReportingService- Parameters:
reportDefinitionId- the ID for the report definition- Returns:
- the report definition
- Throws:
InvalidArgumentException- if an argument is invalidReportDefinitionNotFoundException- if the report definition could not be foundServiceUnavailableException- if the report definition could not be retrieved
-
getReportDefinitionName
public String getReportDefinitionName(String reportDefinitionId) throws InvalidArgumentException, ReportDefinitionNotFoundException, ServiceUnavailableException
Description copied from interface:IReportingServiceRetrieve the name of the report definition.- Specified by:
getReportDefinitionNamein interfaceIReportingService- Parameters:
reportDefinitionId- the ID for the report definition- Returns:
- the name of the report definition
- Throws:
InvalidArgumentException- if an argument is invalidReportDefinitionNotFoundException- if the report definition could not be foundServiceUnavailableException- if the name of the report definition could not be retrieved
-
getReportDefinitionSummaries
public List<ReportDefinitionSummary> getReportDefinitionSummaries() throws ServiceUnavailableException
Description copied from interface:IReportingServiceReturns the summaries for all the report definitions.- Specified by:
getReportDefinitionSummariesin interfaceIReportingService- Returns:
- the summaries for all the report definitions
- Throws:
ServiceUnavailableException- if the report definition summaries could not be retrieved
-
getReportDefinitionSummary
public ReportDefinitionSummary getReportDefinitionSummary(String reportDefinitionId) throws InvalidArgumentException, ReportDefinitionNotFoundException, ServiceUnavailableException
Description copied from interface:IReportingServiceRetrieve the summary for the report definition.- Specified by:
getReportDefinitionSummaryin interfaceIReportingService- Parameters:
reportDefinitionId- the ID for the report definition- Returns:
- the summary for the report definition
- Throws:
InvalidArgumentException- if an argument is invalidReportDefinitionNotFoundException- if the report definition could not be foundServiceUnavailableException- if the report definition summary could not be retrieved
-
getReportDefinitions
public List<ReportDefinition> getReportDefinitions() throws ServiceUnavailableException
Description copied from interface:IReportingServiceReturns all the report definitions.- Specified by:
getReportDefinitionsin interfaceIReportingService- Returns:
- the report definitions
- Throws:
ServiceUnavailableException- if the report definitions could not be retrieved
-
reportDefinitionExists
public boolean reportDefinitionExists(String reportDefinitionId) throws InvalidArgumentException, ServiceUnavailableException
Description copied from interface:IReportingServiceCheck whether the report definition exists.- Specified by:
reportDefinitionExistsin interfaceIReportingService- Parameters:
reportDefinitionId- the ID for the report definition- Returns:
- true if the report definition exists or false otherwise
- Throws:
InvalidArgumentException- if an argument is invalidServiceUnavailableException- if the check for the existing report definition failed
-
setLocalReportFolderPath
public void setLocalReportFolderPath(String localReportFolderPath)
Description copied from interface:IReportingServiceSet the real path to the folder where the local Jasper reports are stored.- Specified by:
setLocalReportFolderPathin interfaceIReportingService- Parameters:
localReportFolderPath- the real path to the folder where the local Jasper reports are stored
-
updateReportDefinition
@Transactional public void updateReportDefinition(ReportDefinition reportDefinition) throws InvalidArgumentException, ReportDefinitionNotFoundException, ServiceUnavailableException
Description copied from interface:IReportingServiceUpdate the report definition.- Specified by:
updateReportDefinitionin interfaceIReportingService- Parameters:
reportDefinition- the ReportDefinition instance containing the updated information for the report definition- Throws:
InvalidArgumentException- if an argument is invalidReportDefinitionNotFoundException- if the report definition could not be foundServiceUnavailableException- if the report definition could not be updated
-
-