Document Generation Service
The following describes the Document Generation Service.
Document Generation Service is part of the acceleratorservices Extension. It offers the functionality to generate a document from the given Velocity template.
Overview
Document Generation Service is designed to provide a Media object from the given Velocity template. This service takes the unique identification number (UID) of the document page template and the business process to generate the media object. This businessProcess object is then used to prepare the context for the document, which is required by the RendererService to render the media object from the given Velocity template.
Document Generation Service API
DocumentGenerationService:
public interface DocumentGenerationService
{
/**
* Generates {@link MediaModel} from given business process and document page
*
* @param frontendTemplateName
* the code of the template to use for script generation
* @param businessProcessModel
* Business process object
* @return the {@link MediaModel}
*/
MediaModel generate(final String frontendTemplateName, final BusinessProcessModel businessProcessModel);
}
Spring Configuration
The below code snippet shows how the DocumentGenerationService is defined in the Spring configuration.
acceleratorservices-spring.xml:
<alias alias="documentGenerationService" name="defaultDocumentGenerationService"/>
<bean id="defaultDocumentGenerationService"
class="de.hybris.platform.acceleratorservices.document.service.impl.DefaultDocumentGenerationService"
parent="abstractBusinessService">
<property name="rendererService" ref="rendererService"/>
<property name="mediaService" ref="mediaService"/>
<property name="catalogVersionService" ref="catalogVersionService"/>
<property name="documentContextFactory" ref="documentContextFactory"/>
<property name="documentMediaFolderName" value="documents"/>
<property name="guidKeyGenerator" ref="guidKeyGenerator"/>
<property name="documentCatalogFetchStrategy" ref="documentCatalogFetchStrategy"/>
<property name="documentPageService" ref="documentPageService"/>
<property name="mimeType" value="image/png"/>
</bean>