Class DefaultReportViewConverterStrategy
java.lang.Object
de.hybris.platform.auditreport.service.impl.AbstractTemplateViewConverterStrategy
de.hybris.platform.auditreport.service.impl.DefaultReportViewConverterStrategy
- All Implemented Interfaces:
ReportViewConverterStrategy
The strategy generates reports by using Apache Velocity templates. Velocity templates can operate on java object
(collection with reports, key
VELOCITY_CTX_REPORTS) or text representation of that java object (generated by
an implementation of the ReportViewConverterStrategy, key VELOCITY_CTX_REPORTS_TEXT).-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringKey under which a Velocity context stores a collection withReportViewobjects.static final StringKey under which a Velocity context stores text representation of the collection withReportViewobjects.Fields inherited from class de.hybris.platform.auditreport.service.impl.AbstractTemplateViewConverterStrategy
CTX_CONFIG_NAME, CTX_CURRENT_USER, CTX_REPORT_ID, CTX_ROOT_ITEM, CTX_TEMPLATE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected List<ReportConversionData>convert(List<ReportView> reports, RendererTemplateModel template, Map<String, Object> context) Deprecated, for removal: This API element is subject to removal in a future version.since 1811convert(Stream<ReportView> reports, RendererTemplateModel template, Map<String, Object> context) protected ReportConversionDataconvertUsingTemplate(RendererTemplateModel template, Map<String, Object> conversionContext) Converts the given reports to html format.createConversionContext(List<ReportView> reports, Map<String, Object> context) Deprecated, for removal: This API element is subject to removal in a future version.since 1811createConversionContext(Map<String, Object> context) Create context for conversion.Collection<org.apache.velocity.runtime.directive.Directive>protected RendererServiceprotected ReportViewConverterStrategyprepareAdditionalContext(Map<String, Object> context) Prepares a Velocity context.protected voidvoidsetCustomDirectives(Collection<org.apache.velocity.runtime.directive.Directive> customDirectives) voidsetI18NService(I18NService i18NService) voidsetRendererService(RendererService rendererService) voidsetReportName(String reportName) Sets a name of the report.voidsetSessionService(SessionService sessionService) voidsetTextConverterStrategy(ReportViewConverterStrategy textConverterStrategy) Sets an implementation of theReportViewConverterStrategywhich generates text representation of the report.Methods inherited from class de.hybris.platform.auditreport.service.impl.AbstractTemplateViewConverterStrategy
convert, convert
-
Field Details
-
VELOCITY_CTX_REPORTS
Key under which a Velocity context stores a collection withReportViewobjects.- See Also:
-
VELOCITY_CTX_REPORTS_TEXT
Key under which a Velocity context stores text representation of the collection withReportViewobjects.- See Also:
-
VELOCITY_CTX_GENERATED_TIMESTAMP
- See Also:
-
VELOCITY_CTX_GENERATED_BY
- See Also:
-
VELOCITY_CTX_GENERATED_FOR
- See Also:
-
VELOCITY_CTX_REPORT_NAME
- See Also:
-
VELOCITY_CTX_CONFIG_NAME
- See Also:
-
DEFAULT_FILE_NAME
- See Also:
-
TEMP_FILE_EXTENSION
- See Also:
-
TEMP_FILE_PREFIX
- See Also:
-
-
Constructor Details
-
DefaultReportViewConverterStrategy
public DefaultReportViewConverterStrategy()
-
-
Method Details
-
convert
@Deprecated(since="1811", forRemoval=true) protected List<ReportConversionData> convert(List<ReportView> reports, RendererTemplateModel template, Map<String, Object> context) Deprecated, for removal: This API element is subject to removal in a future version.since 1811Description copied from class:AbstractTemplateViewConverterStrategyCaution: as this method will be removedAbstractTemplateViewConverterStrategy.convert(java.util.stream.Stream, de.hybris.platform.commons.model.renderer.RendererTemplateModel, java.util.Map)will become abstract.- Specified by:
convertin classAbstractTemplateViewConverterStrategy
-
convert
public List<ReportConversionData> convert(Stream<ReportView> reports, RendererTemplateModel template, Map<String, Object> context) - Overrides:
convertin classAbstractTemplateViewConverterStrategy
-
createConversionContext
Create context for conversion.- Parameters:
context- a map used to pass in additional jsonData needed by the strategy.- Returns:
- context prepared to perform conversion
-
createConversionContext
@Deprecated(since="1811", forRemoval=true) protected Map<String,Object> createConversionContext(List<ReportView> reports, Map<String, Object> context) Deprecated, for removal: This API element is subject to removal in a future version.since 1811Create context for conversion.- Parameters:
reports- generated report viewcontext- a map used to pass in additional jsonData needed by the strategy.- Returns:
- context prepared to perform conversion
-
convertUsingTemplate
protected ReportConversionData convertUsingTemplate(RendererTemplateModel template, Map<String, Object> conversionContext) Converts the given reports to html format.- Parameters:
template- template used to convert the raw data into desired format.conversionContext- conversion context.- Returns:
- an object representing a generated report file.
-
registerRequiredCustomDirectives
protected void registerRequiredCustomDirectives() -
prepareAdditionalContext
Prepares a Velocity context.- Parameters:
context- original context passed to theAbstractTemplateViewConverterStrategy.convert(List, Map)method.- Returns:
VelocityContextcontaining the generation timestamp, report id, configuration name and user names (generated by and for).
-
getReportName
-
setReportName
Sets a name of the report. By default the strategy usesDEFAULT_FILE_NAME.- Parameters:
reportName- the report name.
-
getTextConverterStrategy
-
setTextConverterStrategy
Sets an implementation of theReportViewConverterStrategywhich generates text representation of the report.- Parameters:
textConverterStrategy- the strategy which produces text representation of the report.
-
getRendererService
-
setRendererService
-
getSessionService
-
setSessionService
-
getI18NService
-
setI18NService
-
getCustomDirectives
-
setCustomDirectives
public void setCustomDirectives(Collection<org.apache.velocity.runtime.directive.Directive> customDirectives)
-