Class PathQueryDirective
java.lang.Object
ch.tocco.nice2.templating.impl.freemarker.directives.PathQueryDirective
- All Implemented Interfaces:
Nice2TemplateDirective
,TemplateIdentifiers
,freemarker.template.TemplateDirectiveModel
,freemarker.template.TemplateModel
public class PathQueryDirective
extends Object
implements Nice2TemplateDirective, TemplateIdentifiers
executes a query using the path query builder
parameters:
name: name of the variable
paths: string, comma seperated list of paths to be loaded
limit: optional, number, limit for the query
returns a List of Maps that can be accessed similarly to an EntityListSequenceModel
example:
[@pathQuery name="memberships" paths="relSingle_user.firstname,relSingle_user.lastname,relSingle_user.relAddress_user.relAddress.company_c")]find Membership[/@pathQuery]
[#list memberships as membership]
${membership.relUser.firstname} ${membership.relUser.lastname}
...
[/#list]
-
Nested Class Summary
Nested classes/interfaces inherited from interface ch.tocco.nice2.templating.api.freemarker.directives.TemplateIdentifiers
TemplateIdentifiers.Scope
-
Field Summary
Fields inherited from interface ch.tocco.nice2.templating.api.freemarker.directives.TemplateIdentifiers
BASEDATA_VAR, DELIMITER_PARAM, ENTITY_PARAM, INLINE_TEMPLATE, KEY, LIMIT_PARAM, LINE_END_PARAM, LINE_START_PARAM, NAME_PARAM, PATH_PARAM, PATHS_PARAM, PATTERN_PARAM, RECIPIENT_VAR, SCOPE_PARAM, SENDER_VAR, SINGLE_BASE_VAR, TARGET_VAR, VALUE_PARAM
Fields inherited from interface freemarker.template.TemplateModel
NOTHING
-
Constructor Summary
ConstructorDescriptionPathQueryDirective
(Context context, PersistenceService persistenceService, QueryPopulator queryPopulator, PathQueryTemplateHelper pathQueryTemplateHelper) -
Method Summary
-
Constructor Details
-
PathQueryDirective
public PathQueryDirective(Context context, PersistenceService persistenceService, QueryPopulator queryPopulator, PathQueryTemplateHelper pathQueryTemplateHelper)
-
-
Method Details
-
execute
public void execute(freemarker.core.Environment env, Map params, freemarker.template.TemplateModel[] loopVars, freemarker.template.TemplateDirectiveBody body) throws freemarker.template.TemplateException, IOException - Specified by:
execute
in interfacefreemarker.template.TemplateDirectiveModel
- Throws:
freemarker.template.TemplateException
IOException
-