Class TemplateService

java.lang.Object
com.almis.awe.config.ServiceConfig
com.almis.awe.service.TemplateService
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

public class TemplateService extends ServiceConfig
Manage AWE screen access
  • Constructor Details

    • TemplateService

      public TemplateService(MenuService menuService, @Qualifier("elementsTemplateGroup") org.stringtemplate.v4.STGroup elementsTemplateGroup, @Qualifier("helpTemplateGroup") org.stringtemplate.v4.STGroup helpTemplateGroup, @Qualifier("screensTemplateGroup") org.stringtemplate.v4.STGroup screensTemplateGroup, QueryService queryService, TemplateDao templateDao)
      Autowired constructor
      Parameters:
      menuService - Menu service
      elementsTemplateGroup - Element templates
      helpTemplateGroup - Help templates
      screensTemplateGroup - Screen templates
      queryService - Query service
      templateDao - Template DAO
  • Method Details

    • getTemplate

      @Cacheable(value="screenTemplates", key="\'default\'") public String getTemplate() throws AWException
      Retrieve a screen template for the default option
      Returns:
      Template
      Throws:
      AWException - error generating template
    • getTemplate

      public String getTemplate(String view, String optionId) throws AWException
      Retrieve a screen template
      Parameters:
      view - Screen view
      optionId - Screen option identifier
      Returns:
      Template
      Throws:
      AWException - error generating template
    • generateScreenTemplate

      @Cacheable(value="screenTemplates", key="{ #p1, #p2 }") public String generateScreenTemplate(Screen screen, String view, String optionId) throws AWException
      Generate screen template
      Parameters:
      screen - Screen object
      view - Screen view
      optionId - Option identifier
      Returns:
      Screen template
      Throws:
      AWException - Error generating breadcrumbs
    • generateApplicationHelpTemplate

      public String generateApplicationHelpTemplate(boolean developers) throws AWException
      Generate application help template
      Parameters:
      developers - Help for developers
      Returns:
      Application help template
      Throws:
      AWException - Error generating breadcrumbs
    • generateOptionHelpTemplate

      public String generateOptionHelpTemplate(String optionId, boolean developers) throws AWException
      Generate option help template
      Parameters:
      optionId - Option identifier
      developers - Help for developers
      Returns:
      Application help template
      Throws:
      AWException - Error generating breadcrumbs
    • generateErrorTemplate

      public String generateErrorTemplate(AWException exc)
      Generate error template
      Parameters:
      exc - Exception
      Returns:
      Error screen template
    • getTagList

      public TagList getTagList(String tagListId) throws AWException
      Generates an taglist template from a screen and a taglist id
      Parameters:
      tagListId - Taglist identifier
      Returns:
      Taglist template
      Throws:
      AWException - error generating taglist template
    • getTagList

      public TagList getTagList(String optionId, String tagListId) throws AWException
      Generates an taglist template from a screen and a taglist id
      Parameters:
      optionId - Option identifier
      tagListId - Taglist identifier
      Returns:
      Taglist template
      Throws:
      AWException - error generating taglist template
    • getTagList

      public TagList getTagList(Screen screen, String tagListId) throws AWException
      Retrieve taglist
      Parameters:
      screen - Screen
      tagListId - Taglist identifier
      Returns:
      Taglist template
      Throws:
      AWException - error generating taglist template
    • loadTagListData

      public ServiceData loadTagListData(TagList tagList) throws AWException
      Retrieve taglist data
      Parameters:
      tagList - TagList
      Returns:
      ServiceData Taglist data
      Throws:
      AWException - error generating taglist template
    • generateTaglistTemplate

      public List<String> generateTaglistTemplate(TagList tagList, DataList data)
      Generates a taglist template from taglist and data
      Parameters:
      tagList - Tag list
      data - Data to fill
      Returns:
      Tag list template
    • renderTagList

      public String renderTagList(List<Element> templateList)
      Render taglist template
      Parameters:
      templateList - Template
      Returns:
      Template rendered
    • generateEmptyScreen

      public String generateEmptyScreen()
      Generates an empty screen
      Returns:
      Empty screen