public class DefaultAuditReportDataService extends java.lang.Object implements AuditReportDataService
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.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_FILE_NAME |
protected static java.lang.String |
ZIP_EXTENSION |
protected static java.lang.String |
ZIP_MIME_TYPE |
| Constructor and Description |
|---|
DefaultAuditReportDataService() |
| Modifier and Type | Method and Description |
|---|---|
protected byte[] |
compressContent(java.util.Map<java.lang.String,byte[]> filesByName)
Creates a byte array representation of ZIP archive.
|
AuditReportDataModel |
createReport(CreateAuditReportParams params)
Creates a new report for given parameters.
|
protected java.lang.String |
createReportFileName()
Creates report file name which always ends with ".zip".
|
protected java.util.List<ReportView> |
createReportsViews(ItemModel item,
java.lang.String configName,
boolean audit,
java.util.Collection<LanguageModel> includedLanguages)
Creates reports views for given item specified and configuration name.
|
void |
deleteReportsForItem(ItemModel item)
Deletes all reports generated for given
ItemModel |
protected java.util.Map<java.lang.String,byte[]> |
evaluateStrategies(java.util.List<ReportView> reports,
java.util.Map<java.lang.String,java.lang.Object> context)
Creates a map which stores binary representation of the reports (keys = files names).
|
AuditViewService |
getAuditViewService() |
protected FlexibleSearchService |
getFlexibleSearchService() |
MediaService |
getMediaService() |
ModelService |
getModelService() |
java.lang.String |
getReportFileName() |
java.lang.String |
getReportFolderName() |
java.util.List<ReportViewConverterStrategy> |
getReportViewConverterStrategies() |
UserService |
getUserService() |
protected java.util.Map<java.lang.String,java.lang.Object> |
populateReportGenerationContext(ItemModel rootItem,
java.lang.String configName,
java.lang.String reportId,
AuditReportTemplateModel template)
Populates context map that will be passed to the report generation procedure.
|
protected AuditReportDataModel |
saveReport(ItemModel rootItem,
java.lang.String reportId,
java.lang.String configName,
byte[] content)
Saves an audit report with given identifier and content.
|
void |
setAuditViewService(AuditViewService auditViewService) |
void |
setFlexibleSearchService(FlexibleSearchService flexibleSearchService) |
void |
setMediaService(MediaService mediaService) |
void |
setModelService(ModelService modelService) |
void |
setReportFileName(java.lang.String reportFileName)
Sets a name of the ZIP archive saved in the report media.
|
void |
setReportFolderName(java.lang.String reportFolderName) |
void |
setReportViewConverterStrategies(java.util.List<ReportViewConverterStrategy> reportViewConverterStrategies) |
void |
setUserService(UserService userService) |
public static final java.lang.String DEFAULT_FILE_NAME
protected static final java.lang.String ZIP_MIME_TYPE
protected static final java.lang.String ZIP_EXTENSION
public AuditReportDataModel createReport(CreateAuditReportParams params)
AuditReportDataServicecreateReport in interface AuditReportDataServiceparams - parameters needed to generate the report.public void deleteReportsForItem(ItemModel item)
AuditReportDataServiceItemModeldeleteReportsForItem in interface AuditReportDataServiceitem - item to be used to lookup reportsprotected java.util.Map<java.lang.String,java.lang.Object> populateReportGenerationContext(ItemModel rootItem, java.lang.String configName, java.lang.String reportId, AuditReportTemplateModel template)
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.protected java.util.Map<java.lang.String,byte[]> evaluateStrategies(java.util.List<ReportView> reports, java.util.Map<java.lang.String,java.lang.Object> context)
converter strategies to convert reports to binary format.reports - the list with reports to convert.context - context object to pass in data to the used generation strategies.getReportViewConverterStrategies()protected java.util.List<ReportView> createReportsViews(ItemModel item, java.lang.String configName, boolean audit, java.util.Collection<LanguageModel> includedLanguages)
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.protected byte[] compressContent(java.util.Map<java.lang.String,byte[]> filesByName)
throws java.io.IOException
filesByName - the map where keys store files names and values store files content.java.io.IOException - if any I/O error occurred.protected AuditReportDataModel saveReport(ItemModel rootItem, java.lang.String reportId, java.lang.String configName, byte[] content)
getReportFileName().rootItem - item for which the report is generatedreportId - the report identifier.configName - name of the AuditReportConfigModel used to generate reportcontent - the content saved in report media. @return the saved audit report.protected java.lang.String createReportFileName()
public java.lang.String getReportFileName()
public void setReportFileName(java.lang.String reportFileName)
DEFAULT_FILE_NAME. If
file name does not end with ".zip" extension, then it will be appended.reportFileName - the ZIP archive name.public AuditViewService getAuditViewService()
public void setAuditViewService(AuditViewService auditViewService)
public MediaService getMediaService()
public void setMediaService(MediaService mediaService)
public ModelService getModelService()
public void setModelService(ModelService modelService)
public UserService getUserService()
public void setUserService(UserService userService)
public java.util.List<ReportViewConverterStrategy> getReportViewConverterStrategies()
public void setReportViewConverterStrategies(java.util.List<ReportViewConverterStrategy> reportViewConverterStrategies)
public java.lang.String getReportFolderName()
public void setReportFolderName(java.lang.String reportFolderName)
protected FlexibleSearchService getFlexibleSearchService()
public void setFlexibleSearchService(FlexibleSearchService flexibleSearchService)
Copyright © 2018 SAP SE. All Rights Reserved.