Cached, parsed representation of a tenant's query configuration repository: elastic search query definitions, reports, lookup tables, metrics, custom app-indexer fields and tables, and the JavaScript-defined rule types used for points, recognition and voucher expiry. QueryService builds and caches one instance per branch head hash of the account's query repository, and init runs the repository's own JavaScript sources against this instance so they can register additional indexed fields and tables. The intention is for this class to grow into the top level account settings object, holding queries as well as other account level configuration.


Properties

PropertyReturnsDescription
dataSeriesContentList<DataSeriesContent>Per data-series display configuration, such as help text and which custom fields to show, loaded from the account's controllers.xml.
fieldsList<AppIndexerField>The custom search index fields registered against this account's app indexers via addAppIndexedField.
initExceptionExceptionThe exception thrown while building the query script engine or initialising the account's rule types, if init failed.
lookupsListList<LookupTableBean>The lookup tables parsed from the ".lookup.xml" files in the account's query repository, used to map raw values to display values in reports.
mapOfMetricsMap<String,List<Metric>>Metrics grouped by the identifier of the thing they apply to, for example a promotion id such as "reward-mypromo". Built lazily on first call from the flat metrics list and cached.
metricsList<Metric>All metrics configured for the account, in the order they were declared.
pointsExpiryRuleTypesList<JsPointsExpiryRuleType>The custom rules, defined in the account's JavaScript, that calculate when earned reward points expire.
pointsRuleTypesList<JsPointsRuleType>The custom rules, defined in the account's JavaScript, that calculate how many reward points a record earns.
productCategoryContentList<ProductCategoryContent>Per product-category display configuration, such as help text and which custom fields to show, loaded from the account's controllers.xml.
queryListList<QueryBean>The elastic search query definitions parsed from the ".query.json" files in the account's query repository.
recognitionPointsRuleTypesList<RecognitionPointsRuleType>The rules, defined in the account's JavaScript, that calculate how many points a recognition award grants.
recordMatcherTypesList<JsRecordMatcherType>The custom rules, defined in the account's JavaScript, used to match records against other records or criteria.
reportListList<ReportBean>The report definitions parsed from the ".report.json" files in the account's query repository.
tablesIterable<Table>All tables available for querying and reporting: those declared in controllers.xml plus any join tables built at runtime via addJoinTable. A fresh combined list is built on every call.
voucherExpiryRuleTypesList<JsVoucherExpiryRuleType>The custom rules, defined in the account's JavaScript, that calculate when an issued voucher expires.

Methods

getMapOfMetrics() · getInitException() · getQueryList() · getReportList() · getLookupsList() · getDataSeriesContent() · getProductCategoryContent() · findDataSeriesContent(String seriesName) · findProductCategoryContent(String categoryName) · lookupTable(String name) · getMetrics() · metric(String name) · getPointsRuleTypes() · getPointsExpiryRuleTypes() · getRecognitionPointsRuleTypes() · getRecordMatcherTypes() · getVoucherExpiryRuleTypes() · getTables() · getFields() · addTableDef(String id, String desc, String functionName) · joinTableBuilder() · addJoinTable(JoinTableBuilder b) · addAppIndexedField(String appIndexerName, String fieldName, String mappingType, boolean notAnalyzed, String mappingContentFn) · executeJs(String jsFunc, Object args)

getMapOfMetrics()

Returns: Map<String,List<Metric>>

Metrics grouped by the identifier of the thing they apply to, for example a promotion id such as "reward-mypromo". Built lazily on first call from the flat metrics list and cached.

getInitException()

Returns: Exception

The exception thrown while building the query script engine or initialising the account's rule types, if init failed.

getQueryList()

Returns: List<QueryBean>

The elastic search query definitions parsed from the ".query.json" files in the account's query repository.

getReportList()

Returns: List<ReportBean>

The report definitions parsed from the ".report.json" files in the account's query repository.

getLookupsList()

Returns: List<LookupTableBean>

The lookup tables parsed from the ".lookup.xml" files in the account's query repository, used to map raw values to display values in reports.

getDataSeriesContent()

Returns: List<DataSeriesContent>

Per data-series display configuration, such as help text and which custom fields to show, loaded from the account's controllers.xml.

getProductCategoryContent()

Returns: List<ProductCategoryContent>

Per product-category display configuration, such as help text and which custom fields to show, loaded from the account's controllers.xml.

findDataSeriesContent(String seriesName)

Returns: DataSeriesContent

Looks up the display configuration for a named data series.

ParameterDescription
seriesNamethe name of the data series to look up

findProductCategoryContent(String categoryName)

Returns: ProductCategoryContent

Looks up the display configuration for a named product category.

ParameterDescription
categoryNamethe name of the product category to look up

lookupTable(String name)

Returns: LookupTableBean

Finds a configured lookup table by name.

ParameterDescription
namethe name of the lookup table to find

getMetrics()

Returns: List<Metric>

All metrics configured for the account, in the order they were declared.

metric(String name)

Returns: Metric

Finds a configured metric by its id.

ParameterDescription
namethe id of the metric to find

getPointsRuleTypes()

Returns: List<JsPointsRuleType>

The custom rules, defined in the account's JavaScript, that calculate how many reward points a record earns.

getPointsExpiryRuleTypes()

Returns: List<JsPointsExpiryRuleType>

The custom rules, defined in the account's JavaScript, that calculate when earned reward points expire.

getRecognitionPointsRuleTypes()

Returns: List<RecognitionPointsRuleType>

The rules, defined in the account's JavaScript, that calculate how many points a recognition award grants.

getRecordMatcherTypes()

Returns: List<JsRecordMatcherType>

The custom rules, defined in the account's JavaScript, used to match records against other records or criteria.

getVoucherExpiryRuleTypes()

Returns: List<JsVoucherExpiryRuleType>

The custom rules, defined in the account's JavaScript, that calculate when an issued voucher expires.

getTables()

Returns: Iterable<Table>

All tables available for querying and reporting: those declared in controllers.xml plus any join tables built at runtime via addJoinTable. A fresh combined list is built on every call.

getFields()

Returns: List<AppIndexerField>

The custom search index fields registered against this account's app indexers via addAppIndexedField.

addTableDef(String id, String desc, String functionName)

Returns: QueryTable

Registers a query table backed by a JavaScript function, making the function's rows available to reports and admin table views. Chain addHeader calls on the returned definition to declare the column headings.

ParameterDescription
idunique identifier for the table
deschuman readable name for the table, shown when choosing a data source
functionNamename of the global JavaScript function that loads the rows

joinTableBuilder()

Returns: JoinTableBuilder

Starts building a join table, which combines several existing tables into one queryable table. Pass the configured builder to addJoinTable to register the result.

addJoinTable(JoinTableBuilder b)

Returns: JoinTable

Builds the join table described by the given builder and registers it against this account so it can be queried and reported on.

ParameterDescription
bthe configured join table builder

addAppIndexedField(String appIndexerName, String fieldName, String mappingType, boolean notAnalyzed, String mappingContentFn)

Returns: void

Registers a custom field on a repo app's search index. The field's value for each item is computed by calling the named JavaScript function during indexing.

ParameterDescription
appIndexerNamethe id of the app indexer to add the field to
fieldNamename of the field as it appears in the search index
mappingTypethe search index mapping type, one of string, text, keyword, ip, ipfield, long, double, integer, geo, bool, boolean or date
notAnalyzedtrue if the field should be indexed without text analysis, for example for exact-match keyword fields
mappingContentFnname of the global JavaScript function that computes the field's value for an indexed item

executeJs(String jsFunc, Object args)

Returns: Object

Invokes a named global function in this account's query JavaScript engine.

ParameterDescription
jsFuncthe name of the global JavaScript function to invoke
argsthe arguments to pass to the function
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.