Class GetListKeysMethod

java.lang.Object
ch.tocco.nice2.templating.impl.freemarker.methods.GetListKeysMethod
All Implemented Interfaces:
freemarker.template.TemplateMethodModel, freemarker.template.TemplateMethodModelEx, freemarker.template.TemplateModel

public class GetListKeysMethod extends Object implements freemarker.template.TemplateMethodModelEx
Returns a list of the keys of the entities in a list. For example, this method is useful if we need the keys of the entities in a query condition, but don't want to loop over the list to obtain the keys (as this would be very inefficient compared to this method, as an EntityHashModel would have to be created for each entity in the list). Example usage (see the `IN()` condition in the query): ``` [@pathQuery name="relevantRegistrations" paths="relUser.firstname,relUser.lastname,relEvent.label"] find Registration where relRegistration_status.unique_id == "booked" and IN(pk, [#list getListKeys(baseData) as key]${key?c}[#sep],[/#sep][/#list]) [/@pathQuery] ```
  • Constructor Details

    • GetListKeysMethod

      public GetListKeysMethod()
  • Method Details

    • exec

      public List<Serializable> exec(List parameters) throws freemarker.template.TemplateModelException
      Specified by:
      exec in interface freemarker.template.TemplateMethodModel
      Specified by:
      exec in interface freemarker.template.TemplateMethodModelEx
      Throws:
      freemarker.template.TemplateModelException