Class DefaultAuditReportDataService
java.lang.Object
de.hybris.platform.auditreport.service.impl.DefaultAuditReportDataService
- All Implemented Interfaces:
AuditReportDataService
This service uses instances of
ReportViewConverterStrategy to generate a zip file containing files generated
by all of the strategies. The generated files contain representations of the ReportView's obtained for a
given configuration.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected byte[]compressContent(Map<String, byte[]> filesByName) Deprecated, for removal: This API element is subject to removal in a future version.1811protected InputStreamcompressContentStream(Map<String, InputStream> filesByName) Creates a byte array representation of ZIP archive.createReport(CreateAuditReportParams params) Creates a new report for given parameters.protected StringCreates report file name which always ends with ".zip".protected List<ReportView>createReportsViews(ItemModel item, String configName, boolean audit, Collection<LanguageModel> includedLanguages) Deprecated, for removal: This API element is subject to removal in a future version.since 1811protected Stream<ReportView>createReportsViewsStream(ItemModel item, String configName, boolean audit, Collection<LanguageModel> includedLanguages) voidDeletes all reports generated for givenItemModelevaluateStrategies(List<ReportView> reports, Map<String, Object> context) Deprecated, for removal: This API element is subject to removal in a future version.since 1811evaluateStrategies(Stream<ReportView> reports, Map<String, Object> context) Deprecated, for removal: This API element is subject to removal in a future version.since 1811protected Map<String,InputStream> evaluateStrategiesToStreams(Stream<ReportView> reports, Map<String, Object> context) Creates a map which stores binary representation of the reports (keys = files names).protected FlexibleSearchServicepopulateReportGenerationContext(ItemModel rootItem, String configName, String reportId, AuditReportTemplateModel template) Populates context map that will be passed to the report generation procedure.protected AuditReportDataModelsaveReport(ItemModel rootItem, String reportId, String configName, byte[] content) Deprecated, for removal: This API element is subject to removal in a future version.since 1811protected AuditReportDataModelsaveReport(ItemModel rootItem, String reportId, String configName, InputStream content) Saves an audit report with given identifier and content.voidsetAuditViewService(AuditViewService auditViewService) voidsetFlexibleSearchService(FlexibleSearchService flexibleSearchService) voidsetMediaService(MediaService mediaService) voidsetModelService(ModelService modelService) voidsetReportFileName(String reportFileName) Sets a name of the ZIP archive saved in the report media.voidsetReportFolderName(String reportFolderName) voidsetReportViewConverterStrategies(List<ReportViewConverterStrategy> reportViewConverterStrategies) voidsetUserService(UserService userService)
-
Field Details
-
DEFAULT_FILE_NAME
- See Also:
-
ZIP_MIME_TYPE
- See Also:
-
ZIP_EXTENSION
- See Also:
-
-
Constructor Details
-
DefaultAuditReportDataService
public DefaultAuditReportDataService()
-
-
Method Details
-
createReport
Description copied from interface:AuditReportDataServiceCreates a new report for given parameters. The created report is saved in database before return.- Specified by:
createReportin interfaceAuditReportDataService- Parameters:
params- parameters needed to generate the report.- Returns:
- the new report with audit data.
-
deleteReportsForItem
Description copied from interface:AuditReportDataServiceDeletes all reports generated for givenItemModel- Specified by:
deleteReportsForItemin interfaceAuditReportDataService- Parameters:
item- item to be used to lookup reports
-
populateReportGenerationContext
protected Map<String,Object> populateReportGenerationContext(ItemModel rootItem, String configName, String reportId, AuditReportTemplateModel template) Populates context map that will be passed to the report generation procedure.- Parameters:
rootItem- for which item / user the report is generated.configName- name of the configuration that was used to generate the report.reportId- name of the report.template- template used to generate the report view.- Returns:
- a map of values available in the report generation.
-
evaluateStrategies
@Deprecated(since="1811", forRemoval=true) protected Map<String,byte[]> evaluateStrategies(List<ReportView> reports, Map<String, Object> context) Deprecated, for removal: This API element is subject to removal in a future version.since 1811Creates a map which stores binary representation of the reports (keys = files names). It usesconverter strategiesto convert reports to binary format.- Parameters:
reports- the list with reports to convert.context- context object to pass in data to the used generation strategies.- Returns:
- the map with files.
- See Also:
-
evaluateStrategies
@Deprecated(since="1811", forRemoval=true) protected Map<String,byte[]> evaluateStrategies(Stream<ReportView> reports, Map<String, Object> context) Deprecated, for removal: This API element is subject to removal in a future version.since 1811Creates a map which stores binary representation of the reports (keys = files names). It usesconverter strategiesto convert reports to binary format.- Parameters:
reports- the list with reports to convert.context- context object to pass in data to the used generation strategies.- Returns:
- the map with files.
- See Also:
-
evaluateStrategiesToStreams
protected Map<String,InputStream> evaluateStrategiesToStreams(Stream<ReportView> reports, Map<String, Object> context) Creates a map which stores binary representation of the reports (keys = files names). It usesconverter strategiesto convert reports to binary format.- Parameters:
reports- the list with reports to convert.context- context object to pass in data to the used generation strategies.- Returns:
- the map with files.
- See Also:
-
createReportsViews
@Deprecated(since="1811", forRemoval=true) protected List<ReportView> createReportsViews(ItemModel item, String configName, boolean audit, Collection<LanguageModel> includedLanguages) Deprecated, for removal: This API element is subject to removal in a future version.since 1811Creates reports views for given item specified and configuration name.- Parameters:
item- the item for which report will be generated.configName- the configuration name used to create a new report.audit- if set to true the generated report will contain audit data. Otherwise data snapshot will be taken.includedLanguages- all mentioned languages will be included in the report. Other languages will be omitted. In case no language is set all available languages will be exported.- Returns:
- reports views.
-
createReportsViewsStream
protected Stream<ReportView> createReportsViewsStream(ItemModel item, String configName, boolean audit, Collection<LanguageModel> includedLanguages) -
compressContent
@Deprecated(since="1811", forRemoval=true) protected byte[] compressContent(Map<String, byte[]> filesByName) throws IOExceptionDeprecated, for removal: This API element is subject to removal in a future version.1811Creates a byte array representation of ZIP archive.- Parameters:
filesByName- the map where keys store files names and values store files content.- Returns:
- the input stream which represents ZIP archive.
- Throws:
IOException- if any I/O error occurred.
-
compressContentStream
Creates a byte array representation of ZIP archive.- Parameters:
filesByName- the map where keys store files names and values store files content.- Returns:
- the input stream which represents ZIP archive.
- Throws:
IOException- if any I/O error occurred.
-
saveReport
@Deprecated(since="1811", forRemoval=true) protected AuditReportDataModel saveReport(ItemModel rootItem, String reportId, String configName, byte[] content) Deprecated, for removal: This API element is subject to removal in a future version.since 1811Saves an audit report with given identifier and content. Reports are stored in folder returned bygetReportFileName().- Parameters:
rootItem- item for which the report is generatedreportId- the report identifier.configName- name of theAuditReportConfigModelused to generate reportcontent- the content saved in report media. @return the saved audit report.
-
saveReport
protected AuditReportDataModel saveReport(ItemModel rootItem, String reportId, String configName, InputStream content) Saves an audit report with given identifier and content. Reports are stored in folder returned bygetReportFileName().- Parameters:
rootItem- item for which the report is generatedreportId- the report identifier.configName- name of theAuditReportConfigModelused to generate reportcontent- the content saved in report media. @return the saved audit report.
-
createReportFileName
Creates report file name which always ends with ".zip".- Returns:
- the report file name.
-
getReportFileName
-
setReportFileName
Sets a name of the ZIP archive saved in the report media. By default the service usesDEFAULT_FILE_NAME. If file name does not end with ".zip" extension, then it will be appended.- Parameters:
reportFileName- the ZIP archive name.
-
getAuditViewService
-
setAuditViewService
-
getMediaService
-
setMediaService
-
getModelService
-
setModelService
-
getUserService
-
setUserService
-
getReportViewConverterStrategies
-
setReportViewConverterStrategies
public void setReportViewConverterStrategies(List<ReportViewConverterStrategy> reportViewConverterStrategies) -
getReportFolderName
-
setReportFolderName
-
getFlexibleSearchService
-
setFlexibleSearchService
-