Aggregates the fields contributed by every active FieldProviderApplication and resolves kcode template placeholders and funnel rule queries against them. Reached from platform code as C(FieldsService.class), FieldsService is the single point apps go through to list available merge fields, look one up by id, substitute kcode placeholders such as inside a template, and turn a saved rules JSON expression into an Elasticsearch query, a match test, or a list of matching profiles. Results of getAllFields are cached per root folder.


Properties

PropertyReturnsDescription
allFieldBeansList<FieldBean>Returns all fields available for the current root folder, converted to the JSON-serializable FieldBean form for sending to the admin UI.
allFieldsList<Field>Returns all fields available for the current root folder, from every active field-providing app, using the current root folder's cached list if one has already been built.
templatePatternPattern

Methods

getAllFields() · findFields(int version) · getAllFields(RootFolder rootFolder) · fieldsForApps(FieldProviderApplication apps) · getAllFieldBeans() · getAllFieldBeans(RootFolder rootFolder) · getFieldById(String id, RootFolder rf) · getFieldById(String id, List<Field> fields) · getNumProfiles(String rulesJson) · loadRules(Group group) · loadRules(String rulesJson) · buildMembersQuery(String rulesJson)

getAllFields()

Returns: List<Field>

Returns all fields available for the current root folder, from every active field-providing app, using the current root folder's cached list if one has already been built.

findFields(int version)

Returns: List<Field>

Finds all available fields whose field system version matches the given version.

ParameterDescription
versionthe field system version to match

getAllFields(RootFolder rootFolder)

Returns: List<Field>

Returns all fields available for the given root folder, from every active field-providing app. The result includes fields from every field system version, and is cached against the root folder's attributes so later calls for the same root folder do not recompute it.

ParameterDescription
rootFolderthe root folder to resolve fields for, or null to compute without caching

fieldsForApps(FieldProviderApplication apps)

Returns: List<Field>

Returns the fields contributed by the given apps only, with duplicate field ids removed.

ParameterDescription
appsthe field-providing apps to collect fields from

getAllFieldBeans()

Returns: List<FieldBean>

Returns all fields available for the current root folder, converted to the JSON-serializable FieldBean form for sending to the admin UI.

getAllFieldBeans(RootFolder rootFolder)

Returns: List<FieldBean>

Returns all fields available for the given root folder, converted to the JSON-serializable FieldBean form. Prefer this over the no-argument version when asking about a website other than the one currently being served: the field catalogue differs per site, because a field only exists where the app contributing it is active.

ParameterDescription
rootFolderthe root folder to resolve fields for, or null to use the current one

getFieldById(String id, RootFolder rf)

Returns: Field

Locates a field by its id among the fields available for the given root folder.

ParameterDescription
idthe field id to look up
rfthe root folder to resolve available fields against

getFieldById(String id, List<Field> fields)

Returns: Field

Locates a field by its id in the given list of fields.

ParameterDescription
idthe field id to look up, may be blank
fieldsthe fields to search

getNumProfiles(String rulesJson)

Returns: long

Counts the profiles that match the given rules JSON expression, without fetching the matching profiles themselves.

ParameterDescription
rulesJsonthe saved rules expression to match profiles against

loadRules(Group group)

Returns: Rules

Loads the query rules stored on the given group, if it is a rules-type group.

ParameterDescription
groupthe group to load rules from

loadRules(String rulesJson)

Returns: Rules

Parses a saved rules JSON expression into a Rules object that can build an Elasticsearch query.

ParameterDescription
rulesJsonthe rules expression to parse

buildMembersQuery(String rulesJson)

Returns: QueryBuilder

Builds the Elasticsearch query that selects the profiles matching the given rules JSON expression.

ParameterDescription
rulesJsonthe saved rules expression to build a query from
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.