Class DefaultAuditReportDataService

java.lang.Object
de.hybris.platform.auditreport.service.impl.DefaultAuditReportDataService
All Implemented Interfaces:
AuditReportDataService

public class DefaultAuditReportDataService extends Object implements 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 Details

  • Constructor Details

    • DefaultAuditReportDataService

      public DefaultAuditReportDataService()
  • Method Details

    • createReport

      public AuditReportDataModel createReport(CreateAuditReportParams params)
      Description copied from interface: AuditReportDataService
      Creates a new report for given parameters. The created report is saved in database before return.
      Specified by:
      createReport in interface AuditReportDataService
      Parameters:
      params - parameters needed to generate the report.
      Returns:
      the new report with audit data.
    • deleteReportsForItem

      public void deleteReportsForItem(ItemModel item)
      Description copied from interface: AuditReportDataService
      Deletes all reports generated for given ItemModel
      Specified by:
      deleteReportsForItem in interface AuditReportDataService
      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 1811
      Creates a map which stores binary representation of the reports (keys = files names). It uses converter strategies to 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 1811
      Creates a map which stores binary representation of the reports (keys = files names). It uses converter strategies to 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 uses converter strategies to 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 1811
      Creates 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 IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      1811
      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.
    • compressContentStream

      protected InputStream compressContentStream(Map<String,InputStream> filesByName) throws IOException
      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 1811
      Saves an audit report with given identifier and content. Reports are stored in folder returned by getReportFileName().
      Parameters:
      rootItem - item for which the report is generated
      reportId - the report identifier.
      configName - name of the AuditReportConfigModel used to generate report
      content - 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 by getReportFileName().
      Parameters:
      rootItem - item for which the report is generated
      reportId - the report identifier.
      configName - name of the AuditReportConfigModel used to generate report
      content - the content saved in report media. @return the saved audit report.
    • createReportFileName

      protected String createReportFileName()
      Creates report file name which always ends with ".zip".
      Returns:
      the report file name.
    • getReportFileName

      public String getReportFileName()
    • setReportFileName

      public void setReportFileName(String reportFileName)
      Sets a name of the ZIP archive saved in the report media. By default the service uses DEFAULT_FILE_NAME. If file name does not end with ".zip" extension, then it will be appended.
      Parameters:
      reportFileName - the ZIP archive name.
    • getAuditViewService

      public AuditViewService getAuditViewService()
    • setAuditViewService

      public void setAuditViewService(AuditViewService auditViewService)
    • getMediaService

      public MediaService getMediaService()
    • setMediaService

      public void setMediaService(MediaService mediaService)
    • getModelService

      public ModelService getModelService()
    • setModelService

      public void setModelService(ModelService modelService)
    • getUserService

      public UserService getUserService()
    • setUserService

      public void setUserService(UserService userService)
    • getReportViewConverterStrategies

      public List<ReportViewConverterStrategy> getReportViewConverterStrategies()
    • setReportViewConverterStrategies

      public void setReportViewConverterStrategies(List<ReportViewConverterStrategy> reportViewConverterStrategies)
    • getReportFolderName

      public String getReportFolderName()
    • setReportFolderName

      public void setReportFolderName(String reportFolderName)
    • getFlexibleSearchService

      protected FlexibleSearchService getFlexibleSearchService()
    • setFlexibleSearchService

      public void setFlexibleSearchService(FlexibleSearchService flexibleSearchService)