Skip to main content

i want to display all the formet template that i am using in module

Comments

8 comments

  • Zendesk API User
    Author: aVogt - 7/31/2014 11:07

    I use this:

    ts = us.getStore(de.espirit.firstspirit.access.store.Store.Type.TEMPLATESTORE, false);

    FormatTemplates fts = ts.getFormatTemplates();

    Class templateClassName = java.lang.Class.forName("de.espirit.firstspirit.access.store.templatestore.FormatTemplate");

    listable = fts.getChildren(templateClassName, true);

    Andreas

    0
  • Zendesk API User
    Author: saurabh - 7/31/2014 12:03

    Thanks Andreas for answer.

    but my requirement is i want to collect first all the template(page, section,formet,datasource etc) from template store root and store in a list and then want to apply other logic by iterating each template if they are formet template do something else something.

    0
  • Zendesk API User
    Author: j_mueller - 7/31/2014 12:16

    I've implemented something similar once:

    map = new HashMap();

    map.put("PageTemplate", PageTemplate.class);

    map.put("SectionTemplate", SectionTemplate.class);

    map.put("FormatTemplate", FormatTemplate.class);

    map.put("LinkTemplate", LinkTemplate.class);

    map.put("Script", Script.class);

    map.put("Schema", Schema.class);

    map.put("Workflow", Workflow.class);

    set = map.keySet();

    for (s : set) {

          print("CHECKING TEMPLATES OF: " + s);

          print("-----------");

          templates = store.getChildren(map.get(s), true);

          for (tpl : templates) {

               print(tpl.getName());

         }

    }

    Syntax Highlighting ergänzt

    0
  • Zendesk API User
    Author: MichaelaReydt - 8/21/2014 11:10

    Hello Saurabh,

    do you need further help or did the given answers already help you? If so, it would be great if you mark the "correct answer".

    If you meanwhile found a solution by yourself, it would be very kind of you if you post it here.

    Best regards

    Michaela

    0
  • Zendesk API User
    Author: vijay1v - 8/21/2014 16:25

    Hi Saurabh

    list = context.requireSpecialist(StoreAgent.TYPE).getStore(Store.Type.TEMPLATESTORE).getChildren(de.espirit.firstspirit.access.store.templatestore.FormatTemplate.class, true).toList() will get you all the format templates.

    Regards

    Vijay

    0
  • Zendesk API User
    Author: j_mueller - 8/29/2014 9:42

    Hi Vijay,

    toList is not recommended, since it can cause performance issues!

    You can still iterate without the toList call though.

    Kind regards

    Julius

    0
  • Zendesk API User
    Author: stefanbrendle - 11/19/2020 17:20

    I tried "getChildren(de.espirit.firstspirit.store.access.sitestore.PageRefImpl)" but it didn't work. Previously I iterated it without any parameter at all and the classname of one of the elements of the result list had exactly this classname (I copied it from there). But no results.

    0
  • Zendesk API User
    Author: j_mueller - 11/20/2020 8:39

    Hi Stefan,

    sounds strange. The getChildren Method can be called on any Store, but passing PageRef doesn't make any sense when you're in the TemplateStore. TemplateStore can only return a template from the package "de.espirit.firstspirit.access.store.templatestore.*".

    PageRef will work when you're using the SiteStore.

    Also you shouldn't use "PageRefImpl" as it is not a part of the official FirstSpirit Access API. So you should basically use Classes/Interfaces from the package "de.espirit.firstspirit.access.*". In this case you would pass just the PageRef Interface instead of the PageRefImpl Class.

    Kind regards

    Julius

    0

Please sign in to leave a comment.