Class TemplateService
java.lang.Object
com.eurodyn.qlack.fuse.lexicon.service.TemplateService
A Template Service class contains the implementations of crud operations to database for template entity and
language.
- Author:
- European Dynamics SA
-
Constructor Summary
ConstructorDescriptionTemplateService
(TemplateRepository templateRepository, LanguageRepository languageRepository, TemplateMapper templateMapper) -
Method Summary
Modifier and TypeMethodDescriptioncreateTemplate
(TemplateDTO template) Creates a template.void
deleteTemplate
(String templateId) Deletes a persisted template by given id.getTemplate
(String templateId) Fetching a template that matches the given id.getTemplateContentByName
(String templateName) Fetches the content of a template matching the given name.getTemplateContentByName
(String templateName, String languageId) Fetches the content of a template matching the given name and language.processTemplate
(String templateBody, Map<String, Object> templateData) Deprecated.processTemplate
(String templateBody, Map<String, Object> templateData, boolean forceEmptyChecks) Creates a template from given argument and processes it with the given data.Deprecated.processTemplateByName
(String templateName, String languageId, Map<String, Object> templateData, boolean forceEmptyChecks) Retrieves a template that matches the given name and language and then processes it with the given data.Deprecated.processTemplateByNameAndLocale
(String templateName, String locale, Map<String, Object> templateData, boolean forceEmptyChecks) Retrieves a template that matches the given name and language and then processes it with the given data.void
updateTemplate
(TemplateDTO template) Updates persisted template.
-
Constructor Details
-
TemplateService
public TemplateService(TemplateRepository templateRepository, LanguageRepository languageRepository, TemplateMapper templateMapper)
-
-
Method Details
-
createTemplate
Creates a template.- Parameters:
template
- a DTO containing all information about persisted template- Returns:
- the id of the persisted template
-
updateTemplate
Updates persisted template.- Parameters:
template
- a DTO containing the updated data of the persisted template
-
deleteTemplate
Deletes a persisted template by given id.- Parameters:
templateId
- the id of the template to delete
-
getTemplate
Fetching a template that matches the given id.- Parameters:
templateId
- the id of the persisted template- Returns:
- the template matching the given id
-
getTemplateContentByName
Fetches the content of a template matching the given name.- Parameters:
templateName
- the name of the template- Returns:
- a map containing pairs of languageId/templateContent of the template matching the given name
-
getTemplateContentByName
Fetches the content of a template matching the given name and language.- Parameters:
templateName
- the name of the templatelanguageId
- the language of the template content- Returns:
- the template content
-
processTemplateByName
public String processTemplateByName(String templateName, String languageId, Map<String, Object> templateData, boolean forceEmptyChecks) Retrieves a template that matches the given name and language and then processes it with the given data.- Parameters:
templateName
- the name of the template that will be processedlanguageId
- the id of the language of the templatetemplateData
- a map containing pairs of template key/translation.forceEmptyChecks
- defines if ftl empty checks will be added to the template- Returns:
- the template content processed with the given data
-
processTemplateByNameAndLocale
public String processTemplateByNameAndLocale(String templateName, String locale, Map<String, Object> templateData, boolean forceEmptyChecks) Retrieves a template that matches the given name and language and then processes it with the given data.- Parameters:
templateName
- the name of the template that will be processedlocale
- the locale of the templatetemplateData
- a map containing pairs of template key/translation.forceEmptyChecks
- defines if ftl empty checks will be added to the template- Returns:
- the template content processed with the given data
-
processTemplate
public String processTemplate(String templateBody, Map<String, Object> templateData, boolean forceEmptyChecks) Creates a template from given argument and processes it with the given data.- Parameters:
templateBody
- a String representation of the templatetemplateData
- a map containing pairs of template key/translation.forceEmptyChecks
- defines if ftl empty checks will be added to the template- Returns:
- the template content processed with the given data
-
processTemplateByName
@Deprecated public String processTemplateByName(String templateName, String languageId, Map<String, Object> templateData) Deprecated.Retrieves a template that matches the given name and language and then processes it with the given data.- Parameters:
templateName
- the name of the template that will be processedlanguageId
- the id of the language of the templatetemplateData
- a map containing pairs of template key/translation.- Returns:
- the template content processed with the given data
-
processTemplateByNameAndLocale
@Deprecated public String processTemplateByNameAndLocale(String templateName, String locale, Map<String, Object> templateData) Deprecated.Retrieves a template that matches the given name and language and then processes it with the given data.- Parameters:
templateName
- the name of the template that will be processedlocale
- the locale of the templatetemplateData
- a map containing pairs of template key/translation.- Returns:
- the template content processed with the given data
-
processTemplate
Deprecated.Creates a template from given argument and processes it with the given data.- Parameters:
templateBody
- a String representation of the templatetemplateData
- a map containing pairs of template key/translation.- Returns:
- the template content processed with the given data
-