Interface TemplateService

All Known Implementing Classes:
TemplateServiceImpl

public interface TemplateService
  • Method Details

    • loadTemplatesList

      List<TemplateService.EntityTemplate> loadTemplatesList(String templateEntityName, String entityName) throws RpcExecutionException
      creates a list of all templates of the given templateEntityName. It will return the template entities without any related module and those with the given entityName.
      Parameters:
      templateEntityName - the name of the template entities to load
      entityName - name of the entity which should limit the loaded entities
      Returns:
      a list of templates as string arrays.
      Throws:
      RpcExecutionException
    • getDefaultTemplateEntity

      Optional<Entity> getDefaultTemplateEntity(String templateEntityName, String entityName)
      returns the default template as an entity
      Parameters:
      templateEntityName - name of the template entity
      entityName - name of the entity where the action is executed (e.g. Registration)
      Returns:
      optional of the default template
    • getDefaultTemplateValues

      @Nullable @Nullable Map<String,Object> getDefaultTemplateValues(String templateEntityName, String entityName, URI localeId, @Nullable @Nullable String formName) throws UnresolvableUriException, UriStoreException
      Load values of the default entity template into a map
      Parameters:
      templateEntityName - name of template entity (e.g. Order_template)
      entityName - name of the entity where the action is executed (e.g. Registration)
      localeId - the locale to use for localized fields
      Returns:
      map containing entity values
      Throws:
      UnresolvableUriException
      UriStoreException
    • getDefaultTemplateValuesUsingCurrentLocale

      @Nullable @Nullable Map<String,Object> getDefaultTemplateValuesUsingCurrentLocale(String templateEntityName, String entityName, @Nullable @Nullable String formName)
      behaves the same way as getDefaultTemplateValues(String, String, URI, String) but uses the current locale instead of a provided one
    • getTemplateValues

      Map<String,Object> getTemplateValues(URI templateId, URI localeId, @Nullable @Nullable String formName) throws UnresolvableUriException, UriStoreException
      Load values of given template using the given locale
      Parameters:
      templateId - uri of the template
      localeId - uri of the locale
      Returns:
      map containing values of the entity
      Throws:
      UnresolvableUriException
      UriStoreException
    • getTemplateValuesUsingCurrentLocale

      Map<String,Object> getTemplateValuesUsingCurrentLocale(URI templateId, @Nullable @Nullable String formName) throws UnresolvableUriException, UriStoreException
      behaves the same way as getTemplateValues(URI, URI, String) but uses the current locale instead of a provided one
      Throws:
      UnresolvableUriException
      UriStoreException
    • applyTemplateValues

      void applyTemplateValues(Entity templateEntity, Entity targetEntity, List<String> fieldsToCopy, List<String> relationsToCopy)
      copy values from a template entity to a target entity in backend. only "non-empty" values are copied. if a field or relation does not exist on either the template or the target, it is ignored.
      Parameters:
      templateEntity - the template
      targetEntity - the target entity
      fieldsToCopy - a list of fields that should be copied. This method handles localized fields and copies values for each language separately.
      relationsToCopy - a list of relations that should be copied.