Interface RouteGroup.ListRouteMounter<T>
- All Superinterfaces:
RouteGroup.RouteMounter
- Enclosing interface:
- RouteGroup
A "list" route is a route that returns a list of items. Using a list route mounter is used for routes that
want automatic handling for paging (limit + offset), filtering (field[eq]=value), sorting (sortBy=asc(field)),
and searching (search=term1%20term2).
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionautomaticFieldResolution
(boolean deepKeys) Will create an automaticFilterSortPageHelper.FieldResolver
based upon the item serializer, by serializing each item and looking within the resulting json for fields.fieldResolver
(FilterSortPageHelper.FieldResolver<T> fieldResolver) A list route needs a field resolver in order to support sortBy, search, or filter parameters.default RouteGroup.ListRouteMounter<T>
ignoredFields
(String... ignoredFields) Equivalent to calling ignoredFields(Set.of("field1", "field2", "etc"))ignoredFields
(Set<String> ignoredFields) Fields that are being handled before going to `FilterSortPageRouteAdapter`, and can be ignored from further filtering.itemSchema
(com.inductiveautomation.ignition.common.gson.JsonObject itemSchema) If provided, and ifRouteGroup.RouteMounter.openApi(Consumer)
is invoked, the open api operation object will include a schema for the array of items (plus metadata) returned by this route.default RouteGroup.ListRouteMounter<T>
itemSerializer
(com.inductiveautomation.ignition.common.gson.Gson gson) Equivalent to calling itemSerializer(gson::toJsonTree)itemSerializer
(Function<T, com.inductiveautomation.ignition.common.gson.JsonElement> itemSerializer) Unlike free-form routes, list routes always return json as a result.metadataMetric
(Function<RequestContext, org.apache.commons.lang3.tuple.Pair<String, com.codahale.metrics.Metric>> metricResolver) If specified, the given resolver will be invoked once per route request, to provide aMetric
that will be included in the response's metadata section.default RouteGroup.ListRouteMounter<T>
metadataMetrics
(String... metricKeys) Convenience method that will create metadata metric resolvers that look up the given metric keys in the default registry found atGatewayContext.getMetricRegistry()
default RouteGroup.ListRouteMounter<T>
searchFields
(String... searchFields) Equivalent to calling searchFields(Set.of("field1", "field2", "etc"))searchFields
(Set<String> searchFields) Must be specified in order to enable searching.Methods inherited from interface com.inductiveautomation.ignition.gateway.dataroutes.RouteGroup.RouteMounter
acceptedTypes, accessControl, cache, cache, concurrency, gzip, gzip, handler, itemListHandler, method, mount, nocache, openApi, renderer, requirePermission, type
-
Method Details
-
fieldResolver
A list route needs a field resolver in order to support sortBy, search, or filter parameters. The field resolver understands how to extract the value of a field from an item given a field name. If an explicit field resolver is not specified, one will be automatically created using theitemSerializer(Function)
. -
automaticFieldResolution
Will create an automaticFilterSortPageHelper.FieldResolver
based upon the item serializer, by serializing each item and looking within the resulting json for fields. Note that this may be inefficient compared to a bespoke field resolver, and routes that expect large result sets should probably not use this method.- Parameters:
deepKeys
- If true, keys will be resolved usingJsonPath
so that fields nested deeply within the object may be resolved.
-
itemSerializer
RouteGroup.ListRouteMounter<T> itemSerializer(Function<T, com.inductiveautomation.ignition.common.gson.JsonElement> itemSerializer) Unlike free-form routes, list routes always return json as a result. The item serializer is used to convert each item into a json element. -
itemSerializer
default RouteGroup.ListRouteMounter<T> itemSerializer(com.inductiveautomation.ignition.common.gson.Gson gson) Equivalent to calling itemSerializer(gson::toJsonTree) -
searchFields
Must be specified in order to enable searching. Specifies which fields should be searched through if a search string is provided. Fields are expected to be strings, or will beObject.toString()
'ed in order to match search queries. -
searchFields
Equivalent to calling searchFields(Set.of("field1", "field2", "etc")) -
ignoredFields
Fields that are being handled before going to `FilterSortPageRouteAdapter`, and can be ignored from further filtering. -
ignoredFields
Equivalent to calling ignoredFields(Set.of("field1", "field2", "etc")) -
metadataMetric
RouteGroup.ListRouteMounter<T> metadataMetric(Function<RequestContext, org.apache.commons.lang3.tuple.Pair<String, com.codahale.metrics.Metric>> metricResolver) If specified, the given resolver will be invoked once per route request, to provide aMetric
that will be included in the response's metadata section. This method may be invoked multiple times to include multiple metrics. -
itemSchema
RouteGroup.ListRouteMounter<T> itemSchema(com.inductiveautomation.ignition.common.gson.JsonObject itemSchema) If provided, and ifRouteGroup.RouteMounter.openApi(Consumer)
is invoked, the open api operation object will include a schema for the array of items (plus metadata) returned by this route. -
metadataMetrics
Convenience method that will create metadata metric resolvers that look up the given metric keys in the default registry found atGatewayContext.getMetricRegistry()
-