Class TemplateService

java.lang.Object
com.eurodyn.qlack.fuse.lexicon.service.TemplateService

@Transactional @Service @Validated public class TemplateService extends Object
A Template Service class contains the implementations of crud operations to database for template entity and language.
Author:
European Dynamics SA
  • Constructor Details

  • Method Details

    • createTemplate

      public String createTemplate(TemplateDTO template)
      Creates a template.
      Parameters:
      template - a DTO containing all information about persisted template
      Returns:
      the id of the persisted template
    • updateTemplate

      public void updateTemplate(TemplateDTO template)
      Updates persisted template.
      Parameters:
      template - a DTO containing the updated data of the persisted template
    • deleteTemplate

      public void deleteTemplate(String templateId)
      Deletes a persisted template by given id.
      Parameters:
      templateId - the id of the template to delete
    • getTemplate

      public TemplateDTO getTemplate(String templateId)
      Fetching a template that matches the given id.
      Parameters:
      templateId - the id of the persisted template
      Returns:
      the template matching the given id
    • getTemplateContentByName

      public Map<String,String> getTemplateContentByName(String templateName)
      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

      public String getTemplateContentByName(String templateName, String languageId)
      Fetches the content of a template matching the given name and language.
      Parameters:
      templateName - the name of the template
      languageId - 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 processed
      languageId - the id of the language of the template
      templateData - 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 processed
      locale - the locale of the template
      templateData - 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 template
      templateData - 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 processed
      languageId - the id of the language of the template
      templateData - 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 processed
      locale - the locale of the template
      templateData - a map containing pairs of template key/translation.
      Returns:
      the template content processed with the given data
    • processTemplate

      @Deprecated public String processTemplate(String templateBody, Map<String,Object> templateData)
      Deprecated.
      Creates a template from given argument and processes it with the given data.
      Parameters:
      templateBody - a String representation of the template
      templateData - a map containing pairs of template key/translation.
      Returns:
      the template content processed with the given data