Class DefaultAuditReportDataService

    • Constructor Detail

      • DefaultAuditReportDataService

        public DefaultAuditReportDataService()
    • Method Detail

      • populateReportGenerationContext

        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.
        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 java.util.Map<java.lang.String,​byte[]> evaluateStrategies​(java.util.List<ReportView> reports,
                                                                                  java.util.Map<java.lang.String,​java.lang.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:
        getReportViewConverterStrategies()
      • evaluateStrategies

        @Deprecated(since="1811",
                    forRemoval=true)
        protected java.util.Map<java.lang.String,​byte[]> evaluateStrategies​(java.util.stream.Stream<ReportView> reports,
                                                                                  java.util.Map<java.lang.String,​java.lang.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:
        getReportViewConverterStrategies()
      • evaluateStrategiesToStreams

        protected java.util.Map<java.lang.String,​java.io.InputStream> evaluateStrategiesToStreams​(java.util.stream.Stream<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). 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:
        getReportViewConverterStrategies()
      • createReportsViews

        @Deprecated(since="1811",
                    forRemoval=true)
        protected java.util.List<ReportView> createReportsViews​(ItemModel item,
                                                                java.lang.String configName,
                                                                boolean audit,
                                                                java.util.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 java.util.stream.Stream<ReportView> createReportsViewsStream​(ItemModel item,
                                                                               java.lang.String configName,
                                                                               boolean audit,
                                                                               java.util.Collection<LanguageModel> includedLanguages)
      • compressContent

        @Deprecated(since="1811",
                    forRemoval=true)
        protected byte[] compressContent​(java.util.Map<java.lang.String,​byte[]> filesByName)
                                  throws java.io.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:
        java.io.IOException - if any I/O error occurred.
      • compressContentStream

        protected java.io.InputStream compressContentStream​(java.util.Map<java.lang.String,​java.io.InputStream> filesByName)
                                                     throws java.io.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:
        java.io.IOException - if any I/O error occurred.
      • saveReport

        @Deprecated(since="1811",
                    forRemoval=true)
        protected AuditReportDataModel saveReport​(ItemModel rootItem,
                                                  java.lang.String reportId,
                                                  java.lang.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,
                                                  java.lang.String reportId,
                                                  java.lang.String configName,
                                                  java.io.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 java.lang.String createReportFileName()
        Creates report file name which always ends with ".zip".
        Returns:
        the report file name.
      • getReportFileName

        public java.lang.String getReportFileName()
      • setReportFileName

        public void setReportFileName​(java.lang.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.
      • setAuditViewService

        public void setAuditViewService​(AuditViewService auditViewService)
      • setMediaService

        public void setMediaService​(MediaService mediaService)
      • setModelService

        public void setModelService​(ModelService modelService)
      • setUserService

        public void setUserService​(UserService userService)
      • setReportViewConverterStrategies

        public void setReportViewConverterStrategies​(java.util.List<ReportViewConverterStrategy> reportViewConverterStrategies)
      • getReportFolderName

        public java.lang.String getReportFolderName()
      • setReportFolderName

        public void setReportFolderName​(java.lang.String reportFolderName)
      • setFlexibleSearchService

        public void setFlexibleSearchService​(FlexibleSearchService flexibleSearchService)