Registration API a repository app's server side JavaScript uses to declare everything the app contributes to the platform. An instance is created for each installed app and is bound into the app's script engine as the global variable controllerMappings. It is also the object model that the app's controllers.xml file deserialises into. App code calls the builder and add methods on it while the engine is initialising to register controllers, portlets, menus, roles, reports, event listeners, journey fields, KEditor components, payment and SMS providers, MCP tools and more. Registration only takes effect during initialisation. Once init has finished the list is marked immutable and most add methods silently ignore further calls.
Group: App Definitions
Implements: Serializable, JsExecutor
Properties
| Property | Returns | Description |
|---|---|---|
| adminMappings | List<ControllerMapping> | Controller mappings this app serves in the admin console, each binding a URL pattern to a JavaScript function and template. |
| adminPortletMappings | List<PortletMapping> | Portlets this app contributes to admin pages. A portlet mapping names the page section it renders into and the function and template used to render it. |
| appendConfigFunction | Object | Function registered by appendConfigFunction that lists this app's configuration items. It is called with a config item list builder, for example function myConfigAppender(configBuilder) that builds a properties map per item and calls configBuilder.add with the item name, type and properties. |
| appIndexersFunction | Object | Function registered by appIndexersFunction that returns this app's search indexers. Whether it is present is cached per account, so apps without indexers are not initialised unnecessarily. |
| applyConfigFunction | Object | Function registered by applyConfigFunction that applies imported configuration changes to this app. |
| appName | String | Name of the app this mapping list belongs to, as installed on the account, for example admin-lib. |
| authenticationHandlerMappings | List<JsAuthHandlerMapping> | Custom authentication handlers this app registered through the authentication handler builder. |
| autoApplyTypeIds | List<String> | Configuration item type identifiers this app is willing to have applied automatically, rather than only on an explicit import. |
| browseResourcesFunction | Object | Function registered by browseResourcesFunction that lists the app's resources when a website path is browsed. |
| builtTables | List<Table> | Join tables built by the app through addJoinTable. These are the concrete table objects registered with the query subsystem. |
| captchaVerifyFn | String | Name of the JavaScript function this app provides to verify a captcha response, as registered by the captcha method. Its presence is what marks the app as a captcha provider. |
| checkoutRuleTypes | List<RepoAppCustomCheckoutRuleType> | Custom shopping cart checkout rule types this app contributes, registered through the checkout rule type builder. |
| components | List<KEditorComponent> | KEditor components this app contributes, registered through the addComponent methods or declared as component elements in controllers.xml. |
| emailSenderDetails | EmailSenderDetails | Email sender registration for this app, set by building email sender details. Its presence is what marks the app as able to send email. |
| engagementScoringFactorType | List<EngagementScoringFactorType> | Engagement scoring factor types registered by this app through addEngagementScoringFactorType. |
| engine | KademiScriptEngine | Script engine the app's JavaScript runs in, created during initialisation from the app's sources and engine version. |
| esMappingsDetails | List<ESMappingsDetails> | |
| eventListeners | List<RepoAppEventListener> | Event listeners this app has registered through addEventListener and addEventListenerForType. Each pairs an event type or class with the function to run. |
| funnelActionTypes | List<FunnelActionType> | Funnel action types registered by this app through addFunnelActionType. A funnel action type is a step an automation can perform when it runs. |
| funnelActionTypesFunction | Object | JavaScript function registered by funnelActionTypesFunction that builds funnel action types on demand. |
| funnelTriggerTypes | List<FunnelTriggerType> | Funnel trigger types registered by this app through addFunnelTriggerType. A funnel trigger type defines an event that can start or advance an automation. |
| funnelTriggerTypesFunction | Object | JavaScript function registered by funnelTriggerTypesFunction that builds funnel trigger types on demand. |
| hash | String | Git style content hash of the app repository branch that this mapping list was built from. Used to look up the app's file contents through the data session manager. |
| indexQueryActionTypes | List<IndexQueryActionType> | Deprecated no-op, retained for backwards compatibility with apps that still call it. Always returns null, because index query action types are now registered through the implementation builder for indexQueryActionTypes. |
| initDate | Date | Time at which the app's engine was last initialised. Useful for telling whether a deployed change has been picked up. |
| initError | Exception | Exception that stopped the app's engine from initialising, most often a JavaScript syntax or load error. When this is set the app is loaded but non functional. |
| initLogs | List<String> | Log lines captured while the app's engine was being initialised, used to show load time messages in the app admin screens. |
| journeyFields | List<Field> | Statically declared fields this app contributes for use in segments, journeys and queries. Dynamically produced fields come from the journey fields function instead. |
| journeyFieldsFunction | Object | Function registered by journeyFieldsFunction that produces this app's fields dynamically. |
| jsImplementations | Map<String,JsImplementation> | Implementations this app supplies for named extension points, keyed by interface name. Created on first access, so this never returns null. |
| jsServices | Map<String,JsService> | Named JavaScript services this app publishes for other apps to call, keyed by service name. Created on first access, so this never returns null. |
| list | List<ControllerMapping> | Website controller mappings registered by this app, the same list returned by getWebsiteMappings. |
| mailboxMappings | List<MailboxMapping> | Mailbox handlers this app registered through the mailbox controller, each binding an inbound email address pattern to a function. Created on first access, so this never returns null. |
| menuMappings | List<MenuMapping> | Menu handlers this app registered through the menu controller, which let the app contribute items to menus at runtime. Created on first access, so this never returns null. |
| menus | List<AppMenuItem> | Admin menu items this app adds, as declared by the menu elements in controllers.xml. |
| metricTypes | List<MetricType> | Metric types registered by this app through newMetricTypeBuilder. The list is made immutable once the app has initialised. |
| nodeTypes | List<NodeTypeBean> | Journey node types this app contributes, registered through addNodeType, addActionNodeType and addGoalNodeType. |
| onAppDisabled | String | Name of the function called when the app is disabled on an account, as declared by the onAppDisabled attribute in controllers.xml. |
| onAppEnabled | String | Name of the function called when the app is enabled on an account, as declared by the onAppEnabled attribute in controllers.xml. |
| onAppUpdated | String | Name of the function called when the app is updated to a new version, as declared by the onAppUpdated attribute in controllers.xml. |
| orgTabMappings | List<ProfileTabMapping> | Extra tabs and summary panels this app adds to the admin organisation page, registered through adminOrgTab. |
| orgTimelineMapping | ProfileTimelineMapping | Function this app contributes to the organisation timeline, registered through setOrgTimelineFunction. |
| paymentProviderDetails | PaymentProviderDetails | Payment provider registration for this app, set by building payment provider details. Its presence is what marks the app as a payment provider for shopping carts. |
| pointsExpiryRuleTypes | List<PointsExpiryRuleType> | Points expiry rule types this app contributes, registered through the points expiry rule type builder. These decide when awarded points expire. |
| pointsRuleTypes | List<PointsRuleType> | Points rule types this app contributes, registered through the points rule type builder. These decide how points are awarded. |
| profileTabMappings | List<ProfileTabMapping> | Extra tabs and summary panels this app adds to the admin profile page, registered through adminProfileTab. |
| profileTimelineMapping | ProfileTimelineMapping | Function this app contributes to the user timeline, registered through setUserTimelineFunction. It is called to add stream items to a profile's timeline. |
| promotionMechanicTypes | List<PromotionMechanicType> | Promotion mechanic types this app contributes, registered through the promotion mechanic type builder. |
| queries | List<RepoAppQuery> | Saved search queries this app contributes, registered through addQuery from JSON files in the app repository. |
| queryTables | List<RepoQueryTableDef> | Query table definitions registered by the app through addTableDef. A query table exposes a JavaScript function as a tabular data source that reports and the admin UI can select from. |
| recipe | Recipe | Recipe declared by the app, describing the ordered stages and steps used to configure the app after it is enabled. |
| repoAppSettings | List<RepoAppSettings> | Settings declarations for this app, from the settings elements in controllers.xml. They describe the configuration fields shown when an administrator sets the app up. |
| repoName | String | Name of the repository the app was loaded from. Set to the same value as the app name during initialisation. |
| reports | List<Report> | Reports this app contributes, from both JSON report files and reports registered in JavaScript. The list is made immutable once the app has initialised. |
| roles | List<Role> | Security roles this app declares, combining both the original role declarations and the version two roles from controllers.xml. Builds a new list on each call. |
| signinProviderMappings | List<RepoSigninProviderBean> | Admin sign in providers this app contributes, such as an external identity provider offered on the admin sign in page. |
| signinProvidersFn | String | Name of the function that returns this app's admin sign in providers, as registered through signinProviderDetails. |
| smsProviderDetails | SmsProviderDetails | SMS provider registration for this app, set by building SMS provider details. Its presence is what marks the app as able to send text messages. |
| sources | List<String> | Paths of the JavaScript source files the app loads into its engine, in the order they are declared in controllers.xml. |
| tableActionHandlers | List<TableActionHandler> | Table action handlers registered by this app through newTableActionHandlerBuilder. |
| templates | List<TemplateDef> | Page and email templates this app makes available to content editors, registered through addTemplate and addEdmTemplate. |
| triggerTypeMappings | List<TriggerTypeMapping> | Legacy automation trigger types registered through automationTrigger. New apps should register funnel trigger types with addFunnelTriggerType instead. |
| websiteMappings | List<ControllerMapping> | Controller mappings this app serves on website root folders, each binding a URL pattern to a JavaScript function and template. |
| websitePortletMappings | List<PortletMapping> | Portlets this app contributes to website pages, including the captcha portlet registered by the captcha method. |
| websiteSigninProviderMappings | List<RepoSigninProviderBean> | Website sign in providers this app contributes, offered on website sign in pages rather than the admin console. |
| websiteSigninProvidersFn | String | Name of the function that returns this app's website sign in providers, as registered through websiteSigninProviderDetails. |
Methods
getHash() · findHash(String path) · listFiles(String path) · getRecipe() · getQueryTables() · getBuiltTables() · promotionMechanicTypeBuilder(String id, String title) · templateDefBuilder(String path, String name) · pointsRuleTypeBuilder(String id, String title) · pointsExpiryRuleTypeBuilder(String id, String title) · checkoutRuleTypeBuilder(String id, String title) · indexQueryActionTypeBuilder(String id, String title) · getIndexQueryActionTypes() · getFunnelTriggerTypes() · addFunnelTriggerType(String id, String title, String eventId) · addFunnelTriggerType(String id, String title, String eventId, List<FunnelTriggerType> list) · funnelTriggerTypesFunction(Object fn) · getFunnelTriggerTypesFunction() · getFunnelActionTypes() · addFunnelActionType(String id, String title) · addFunnelActionType(String id, String title, List<FunnelActionType> actionTypes) · funnelActionTypesFunction(Object fn) · getFunnelActionTypesFunction() · getCaptchaVerifyFn() · captcha(String captchaVerifyFn, String portletTemplate, String portletInitFunction) · addQuery(String path, List<String> indexNames, List<String> roleNames) · addTableDef(String id, String desc, String functionName) · addTableDef(String id, String desc, String functionName, String headersFnName) · joinTableBuilder() · addJoinTable(JoinTableBuilder b) · addTemplate(String parentPath, String fileName, String description, boolean contentTemplate) · addEdmTemplate(String parentPath, String fileName, String description, boolean contentTemplate) · addNodeType(String name, String template) · addActionNodeType(String name, String template, String jsMethod) · addGoalNodeType(String name, String jsTemplate, String jsMethod) · addGoalNodeType(String name, String jsTemplate, String jsMethod, String jsOnEnterMethod) · addEngagementScoringFactorType(String id, String label, Object getProperties, Object findEngagementDatesFn) · getEngagementScoringFactorType() · newTableActionHandlerBuilder() · getTableActionHandlers() · newMetricTypeBuilder() · getMetricTypes() · addJourneyField(String id, String label, String type, String input, List<String> operators, Object evalFunction) · addNumericJourneyField(String id, String label, boolean integer, Object evalFunction) · addTextJourneyField(String id, String label, Object evalFunction) · addTextJourneyField(String id, String label, Object evalFunction, List<Field> fields) · addFieldV2(String id, String label, String returnType, Object parentTypes, Object evalFunction) · newFieldBuilder(String id, String label) · addFieldV2(String id, String label, String returnType, Object parentTypes, Object evalFunction, List<Field> fields) · addJourneyFieldSelect(String id, String label, String type, List<String> values, List<String> operators, Object evalFunction) · addJourneyFieldSelect(String id, String label, String type, List<String> values, List<String> operators, Object evalFunction, List<Field> fields) · addComponent(String compId, String type, String desc, String jsFile, String editorHtml, String previewImage, String renderTemplate, String settingsTemplate) · addComponent(String compId, String type, String desc, String categories, String jsFile, String editorHtml, String previewImage, String renderTemplate, String settingsTemplate) · addComponent(String appId, String compId, String type, String desc) · addComponent(String appId, String compId, String type, String desc, String categories) · addComponent(String appId, String compId, List<String> types, String desc, String categories) · addComponent(String appId, String compId) · browseResourcesFunction(Object fn) · getBrowseResourcesFunction() · appIndexersFunction(Object fn) · getAppIndexersFunction() · appendConfigFunction(Object fn) · getAppendConfigFunction() · applyConfigFunction(Object fn) · getApplyConfigFunction() · getAutoApplyTypeIds() · getList() · getSources() · getMenus() · getInitDate() · getInitError() · getInitLogs() · getEngine() · getOnAppUpdated() · getOnAppEnabled() · getOnAppDisabled() · getWebsiteMappings() · getAdminMappings() · getAdminPortletMappings() · getTemplates() · getWebsitePortletMappings() · getProfileTabMappings() · getOrgTabMappings() · getTriggerTypeMappings() · getSigninProviderMappings() · getWebsiteSigninProviderMappings() · getEventListeners() · getProfileTimelineMapping() · getOrgTimelineMapping() · getJsServices() · newServiceBuilder(String serviceName) · getJsImplementations() · newImplementationBuilder(String interfaceName) · getDynamicIdpPaths(String type) · getWebsocketMapping(String type) · getSseMapping(String type) · getWebsiteMcpMapping(String type) · getAdminMcpMapping(String type) · getAuthenticationHandlerMappings() · getMailboxMappings() · getMenuMappings() · paymentProviderDetails() · smsProviderDetails() · emailSenderDetails() · adminController() · websiteController() · adminPortletController() · websitePortletController() · websocketController() · dynamicIdpPaths() · sseController() · websiteMcpController() · adminMcpController() · authenticationHandler() · adminProfileTab() · adminOrgTab() · mailboxController() · menuController() · automationTrigger() · signinProvider() · websiteSigninProvider() · signinProviderDetails() · websiteSigninProviderDetails() · getSigninProvidersFn() · getWebsiteSigninProvidersFn() · esMappingsController() · cacheBuilder() · getCacheValue(String cacheName, String key, Callable<Object> loader) · addEventListener(String eventType, boolean enabled, Object function) · addEventListenerForType(String eventClassName, boolean enabled, Object function) · setUserTimelineFunction(Object func) · setOrgTimelineFunction(Object func) · call(String execFn, Object args) · callWithThrow(String execFn, Object args) · getAppName() · getRepoName() · getPaymentProviderDetails() · getSmsProviderDetails() · getEmailSenderDetails() · executeJs(Object func, Object args) · getRoles() · triggerEvent(String eventDefId, Map<String,Object> eventProperties) · newEventDefinitionBuilder(String id) · addReport(String pathToJsonFile) · addReport(String reportId, String title, String description, String reportTemplate, String function, String attachmentContentType, String attachmentExtension) · addReport(String reportId, String title, String description, String reportTemplate, VarArgFunction functionPtr, String attachmentContentType, String attachmentExtension) · addQueryTableReport(String reportId, String title, String description, String reportTemplate, String queryTableId, String attachmentContentType, String attachmentExtension) · getReports() · getNodeTypes() · getJourneyFields() · getJourneyFieldsFunction() · journeyFieldsFunction(Object fn) · repoAppPaymentResult() · getComponents() · getRepoAppSettings() · getQueries() · getCheckoutRuleTypes() · getPromotionMechanicTypes() · getPointsRuleTypes() · getPointsExpiryRuleTypes()
getHash()
Returns: String
Git style content hash of the app repository branch that this mapping list was built from. Used to look up the app's file contents through the data session manager.
findHash(String path)
Returns: String
Looks up the content hash of a single file or directory inside the app's repository at the given path. Reads the app's data session, so it hits the blob store rather than being a plain field read.
| Parameter | Description |
|---|---|
path | path within the app repository, for example /theme/page.html |
listFiles(String path)
Returns: Map<String,String>
Lists the files in one directory of the app's repository, returning file name to content hash. Ordering is not preserved and sub directories are not included. Reads the app's data session, so it is not a cheap field access.
| Parameter | Description |
|---|---|
path | path of the directory within the app repository |
getRecipe()
Returns: Recipe
Recipe declared by the app, describing the ordered stages and steps used to configure the app after it is enabled.
getQueryTables()
Returns: List<RepoQueryTableDef>
Query table definitions registered by the app through addTableDef. A query table exposes a JavaScript function as a tabular data source that reports and the admin UI can select from.
getBuiltTables()
Returns: List<Table>
Join tables built by the app through addJoinTable. These are the concrete table objects registered with the query subsystem.
promotionMechanicTypeBuilder(String id, String title)
Returns: PromotionMechanicTypeBuilder
Starts building a promotion mechanic type contributed by this app. Set the templates and function names on the returned builder and then call build to register the mechanic so it can be selected when configuring a promotion.
| Parameter | Description |
|---|---|
id | unique identifier for the mechanic type, stored against promotions that use it |
title | human readable name shown when choosing a mechanic type |
templateDefBuilder(String path, String name)
Returns: TemplateDefBuilder
Starts building a page template definition contributed by this app. Set the title, page type and editor on the returned builder and then call build to add the template to the list of templates content editors can choose from.
| Parameter | Description |
|---|---|
path | repository path of the template file, for example /theme/mypage.html |
name | the template name, used as its identifier |
pointsRuleTypeBuilder(String id, String title)
Returns: PointsRuleTypeBuilder
Starts building a points rule type contributed by this app. Set the include and process function names and any configuration fields on the returned builder, then call build to register the rule type for use in points programmes.
| Parameter | Description |
|---|---|
id | unique identifier for the points rule type |
title | human readable name shown when choosing a rule type |
pointsExpiryRuleTypeBuilder(String id, String title)
Returns: PointsExpiryRuleTypeBuilder
Starts building a points expiry rule type contributed by this app, which decides when accrued points expire. Call build on the returned builder to register it.
| Parameter | Description |
|---|---|
id | unique identifier for the points expiry rule type |
title | human readable name shown when choosing an expiry rule type |
checkoutRuleTypeBuilder(String id, String title)
Returns: CheckoutRuleTypeBuilder
Starts building a custom shopping cart checkout rule type contributed by this app. Checkout rules can validate the cart items and take part in processing the checkout. Call build on the returned builder to register the rule type.
| Parameter | Description |
|---|---|
id | unique identifier for the checkout rule type |
title | human readable name shown when choosing a checkout rule type |
indexQueryActionTypeBuilder(String id, String title)
Returns: IndexQueryActionTypeBuilder
Deprecated no-op, retained for backwards compatibility with apps that still call it. Use the implementation builder for indexQueryActionTypes instead.
| Parameter | Description |
|---|---|
id | unique identifier for the action type, ignored |
title | human readable name for the action type, ignored |
getIndexQueryActionTypes()
Returns: List<IndexQueryActionType>
Deprecated no-op, retained for backwards compatibility with apps that still call it. Always returns null, because index query action types are now registered through the implementation builder for indexQueryActionTypes.
getFunnelTriggerTypes()
Returns: List<FunnelTriggerType>
Funnel trigger types registered by this app through addFunnelTriggerType. A funnel trigger type defines an event that can start or advance an automation.
addFunnelTriggerType(String id, String title, String eventId)
Returns: FunnelTriggerTypeBuilder
Starts building a funnel trigger type that fires on the given app event, adding it to this app's own list of trigger types. Configure the returned builder and call build to register it.
| Parameter | Description |
|---|---|
id | unique identifier for the trigger type |
title | human readable name shown when choosing a trigger |
eventId | identifier of the event that fires this trigger |
addFunnelTriggerType(String id, String title, String eventId, List<FunnelTriggerType> list)
Returns: FunnelTriggerTypeBuilder
Starts building a funnel trigger type that fires on the given app event, adding it to the supplied list rather than to this app's own list. Used when trigger types are produced dynamically by a funnel trigger types function.
| Parameter | Description |
|---|---|
id | unique identifier for the trigger type |
title | human readable name shown when choosing a trigger |
eventId | identifier of the event that fires this trigger |
list | the list the built trigger type is added to |
funnelTriggerTypesFunction(Object fn)
Returns: ControllerMappingList
Registers a JavaScript function that produces funnel trigger types on demand instead of declaring them statically at load time. The function is called with the list to add trigger types to.
| Parameter | Description |
|---|---|
fn | the JavaScript function that populates the trigger type list |
getFunnelTriggerTypesFunction()
Returns: Object
JavaScript function registered by funnelTriggerTypesFunction that builds funnel trigger types on demand.
getFunnelActionTypes()
Returns: List<FunnelActionType>
Funnel action types registered by this app through addFunnelActionType. A funnel action type is a step an automation can perform when it runs.
addFunnelActionType(String id, String title)
Returns: FunnelActionTypeBuilder
Starts building a funnel action type, adding it to this app's own list of action types. Configure the returned builder with the function that performs the action and call build to register it.
| Parameter | Description |
|---|---|
id | unique identifier for the action type |
title | human readable name shown when choosing an action |
addFunnelActionType(String id, String title, List<FunnelActionType> actionTypes)
Returns: FunnelActionTypeBuilder
Starts building a funnel action type, adding it to the supplied list rather than this app's own list. Used when action types are produced dynamically by a funnel action types function.
| Parameter | Description |
|---|---|
id | unique identifier for the action type |
title | human readable name shown when choosing an action |
actionTypes | the list the built action type is added to |
funnelActionTypesFunction(Object fn)
Returns: ControllerMappingList
Registers a JavaScript function that produces funnel action types on demand instead of declaring them statically at load time. The function is called with the list to add action types to.
| Parameter | Description |
|---|---|
fn | the JavaScript function that populates the action type list |
getFunnelActionTypesFunction()
Returns: Object
JavaScript function registered by funnelActionTypesFunction that builds funnel action types on demand.
getCaptchaVerifyFn()
Returns: String
Name of the JavaScript function this app provides to verify a captcha response, as registered by the captcha method. Its presence is what marks the app as a captcha provider.
captcha(String captchaVerifyFn, String portletTemplate, String portletInitFunction)
Returns: void
Registers this app as a captcha provider. Records the verification function name and also registers a website portlet in the captcha section that renders the captcha UI from the given template.
| Parameter | Description |
|---|---|
captchaVerifyFn | name of the function that verifies a submitted captcha response |
portletTemplate | repository path of the template that renders the captcha UI |
portletInitFunction | optional name of a function called before the portlet is rendered, may be null |
addQuery(String path, List<String> indexNames, List<String> roleNames)
Returns: void
Registers a saved search query held as a JSON file in the app repository, so it appears in the query picker under the file's name. Reads the file contents at registration time and logs a warning if it is missing. Does nothing once the app's engine has finished initialising.
| Parameter | Description |
|---|---|
path | repository path of the JSON query definition file |
indexNames | names of the search indexes the query can be run against, may be null |
roleNames | names of the roles a user must hold to run the query, may be null for no restriction |
addTableDef(String id, String desc, String functionName)
Returns: RepoQueryTableDef
Registers a query table backed by a JavaScript function, making the function's rows available to reports and the admin table views. Chain addHeader calls on the returned definition to declare the column headings. See the query table tutorial in the Kademi developer documentation for a worked example.
| Parameter | Description |
|---|---|
id | unique identifier for the table |
desc | human readable name for the table, shown when choosing a data source |
functionName | name of the global JavaScript function that loads the rows |
addTableDef(String id, String desc, String functionName, String headersFnName)
Returns: RepoQueryTableDef
Registers a query table backed by a JavaScript function, with a second function supplying the column headings instead of them being declared statically. Use this when the columns depend on account configuration.
| Parameter | Description |
|---|---|
id | unique identifier for the table |
desc | human readable name for the table, shown when choosing a data source |
functionName | name of the global JavaScript function that loads the rows |
headersFnName | name of the global JavaScript function that returns the column headings |
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 app so it can be queried and reported on. The table is still built and returned once the engine has initialised, but it is no longer added to the app's list.
| Parameter | Description |
|---|---|
b | the configured join table builder |
addTemplate(String parentPath, String fileName, String description, boolean contentTemplate)
Returns: ControllerMappingList
Registers a page template held in the app repository so that content editors can use it. Does nothing once the app's engine has finished initialising.
| Parameter | Description |
|---|---|
parentPath | absolute path to the folder containing the template |
fileName | the template file name without its suffix |
description | a meaningful description of the template, shown when choosing one |
contentTemplate | true to let users create new pages with this template |
addEdmTemplate(String parentPath, String fileName, String description, boolean contentTemplate)
Returns: ControllerMappingList
Registers an email template held in the app repository, the same as addTemplate except the template is opened with the EDM editor and is backed by a dummy EDM resource rather than a website page.
| Parameter | Description |
|---|---|
parentPath | absolute path to the folder containing the template |
fileName | the template file name without its suffix |
description | a meaningful description of the template, shown when choosing one |
contentTemplate | true to let users create new emails with this template |
addNodeType(String name, String template)
Returns: ControllerMappingList
Registers a plain journey node type rendered from the given template. Use addActionNodeType or addGoalNodeType instead when the node needs to run JavaScript.
| Parameter | Description |
|---|---|
name | unique name of the node type, shown in the journey editor |
template | repository path of the template that renders the node's configuration UI |
addActionNodeType(String name, String template, String jsMethod)
Returns: ControllerMappingList
Registers a journey action node type. When a lead reaches a node of this type the named JavaScript function is run to perform the action.
| Parameter | Description |
|---|---|
name | unique name of the node type, shown in the journey editor |
template | repository path of the template that renders the node's configuration UI |
jsMethod | name of the global JavaScript function that performs the action |
addGoalNodeType(String name, String jsTemplate, String jsMethod)
Returns: ControllerMappingList
Registers a journey goal node type. The named JavaScript function is evaluated to decide whether a lead has met the goal and so may pass the node.
| Parameter | Description |
|---|---|
name | unique name of the node type, shown in the journey editor |
jsTemplate | repository path of the template that renders the node's configuration UI |
jsMethod | name of the global JavaScript function that decides whether the goal is met |
addGoalNodeType(String name, String jsTemplate, String jsMethod, String jsOnEnterMethod)
Returns: ControllerMappingList
Registers a journey goal node type with an additional function that runs when a lead enters the node. Use the on enter function for work that needs a resolved lead, because the match function is also evaluated with a null lead while journey entry criteria are being checked.
| Parameter | Description |
|---|---|
name | unique name of the node type, shown in the journey editor |
jsTemplate | repository path of the template that renders the node's configuration UI |
jsMethod | name of the global JavaScript function that decides whether the goal is met |
jsOnEnterMethod | optional name of a function called when the node is entered with a resolved lead, including on the very first node of a newly created lead |
addEngagementScoringFactorType(String id, String label, Object getProperties, Object findEngagementDatesFn)
Returns: ControllerMappingList
Registers an engagement scoring factor type, which contributes dates of engagement activity to a lead's engagement score. Both arguments may be given either as a function name or as an actual JavaScript function. Does nothing once the app's engine has finished initialising.
| Parameter | Description |
|---|---|
id | unique identifier for the scoring factor type |
label | human readable name shown when configuring engagement scoring |
getProperties | function returning the configurable properties of the factor |
findEngagementDatesFn | function returning the dates on which the lead engaged |
getEngagementScoringFactorType()
Returns: List<EngagementScoringFactorType>
Engagement scoring factor types registered by this app through addEngagementScoringFactorType.
newTableActionHandlerBuilder()
Returns: JsTableActionHandlerBuilder
Starts building a table action handler, which is a named action offered against the rows of an uploaded data table. Configure the returned builder and call its build method to register the handler.
getTableActionHandlers()
Returns: List<TableActionHandler>
Table action handlers registered by this app through newTableActionHandlerBuilder.
newMetricTypeBuilder()
Returns: JsMetricTypeBuilder
Starts building a metric type, which defines a measure this app contributes to reporting and dashboards. Configure the returned builder and call its build method to register the metric type.
getMetricTypes()
Returns: List<MetricType>
Metric types registered by this app through newMetricTypeBuilder. The list is made immutable once the app has initialised.
addJourneyField(String id, String label, String type, String input, List<String> operators, Object evalFunction)
Returns: ControllerMappingList
Registers a version one journey field, which can be used as a condition when segmenting profiles or building journeys. New apps should prefer newFieldBuilder, which produces the version two fields. Throws if the eval function is neither a function name nor a callable function.
| Parameter | Description |
|---|---|
id | unique identifier for this field, which must be unique across all apps |
label | a user friendly label shown in the condition editor |
type | one of string, integer, double, date, time, datetime or boolean |
input | radio, or null for the default input. To use a select box call addJourneyFieldSelect instead |
operators | the comparison operators the field allows |
evalFunction | either the name of a function or an actual function, evaluated to produce the field value |
addNumericJourneyField(String id, String label, boolean integer, Object evalFunction)
Returns: ControllerMappingList
Registers a numeric version one journey field, using the standard numeric comparison operators. Throws if the eval function is neither a function name nor a callable function.
| Parameter | Description |
|---|---|
id | unique identifier for this field, which must be unique across all apps |
label | a user friendly label shown in the condition editor |
integer | true for a whole number field, false for a decimal one |
evalFunction | either the name of a function or an actual function, evaluated to produce the field value |
addTextJourneyField(String id, String label, Object evalFunction)
Returns: ControllerMappingList
Registers a text version one journey field on this app, using the standard text comparison operators.
| Parameter | Description |
|---|---|
id | unique identifier for this field, which must be unique across all apps |
label | a user friendly label shown in the condition editor |
evalFunction | either the name of a function or an actual function, evaluated to produce the field value |
addTextJourneyField(String id, String label, Object evalFunction, List<Field> fields)
Returns: ControllerMappingList
Registers a text version one journey field into the supplied field list rather than this app's own list. Used when fields are produced dynamically by a journey fields function. Throws if the eval function is neither a function name nor a callable function.
| Parameter | Description |
|---|---|
id | unique identifier for this field, which must be unique across all apps |
label | a user friendly label shown in the condition editor |
evalFunction | either the name of a function or an actual function, evaluated to produce the field value |
fields | the list the built field is added to |
addFieldV2(String id, String label, String returnType, Object parentTypes, Object evalFunction)
Returns: ControllerMappingList
Registers a version two field in one call, which is a shorthand for configuring a field builder and building it. Version two fields are typed and can hang off a parent type, so they can be chained in queries.
| Parameter | Description |
|---|---|
id | unique identifier for this field, which must be unique across all apps |
label | a user friendly label shown in the condition editor |
returnType | one of datetime, string, integer, boolean or double, or the name of an object type such as Profile or Lead |
parentTypes | the type or types this field hangs off, given as a list, an array or a single string, or null for a root field |
evalFunction | either the name of a function or an actual function, evaluated to produce the field value |
newFieldBuilder(String id, String label)
Returns: FieldV2Builder
Starts building a version two field on this app. Chain the returned builder's methods to configure the field and then call build to create and register it.
| Parameter | Description |
|---|---|
id | unique identifier for this field, which must be unique across all apps |
label | a user friendly label shown in the condition editor |
addFieldV2(String id, String label, String returnType, Object parentTypes, Object evalFunction, List<Field> fields)
Returns: ControllerMappingList
Registers a version two field into the supplied field list rather than this app's own list. Note that only the identifier and label are carried through to the built field by this overload.
| Parameter | Description |
|---|---|
id | unique identifier for this field, which must be unique across all apps |
label | a user friendly label shown in the condition editor |
returnType | one of datetime, string, integer, boolean or double, or the name of an object type such as Profile or Lead |
parentTypes | the type or types this field hangs off, given as a list, an array or a single string, or null for a root field |
evalFunction | either the name of a function or an actual function, evaluated to produce the field value |
fields | the list the built field is added to |
addJourneyFieldSelect(String id, String label, String type, List<String> values, List<String> operators, Object evalFunction)
Returns: ControllerMappingList
Registers a version one journey field rendered as a select box with a fixed list of values, added to this app's field list.
| Parameter | Description |
|---|---|
id | unique identifier for this field, which must be unique across all apps |
label | a user friendly label shown in the condition editor |
type | one of string, integer, double, date, time, datetime or boolean |
values | the values offered in the select box |
operators | the comparison operators the field allows |
evalFunction | either the name of a function or an actual function, evaluated to produce the field value |
addJourneyFieldSelect(String id, String label, String type, List<String> values, List<String> operators, Object evalFunction, List<Field> fields)
Returns: ControllerMappingList
Registers a version one select journey field into the supplied field list rather than this app's own list. Used when fields are produced dynamically by a journey fields function. Throws if the eval function is neither a function name nor a callable function.
| Parameter | Description |
|---|---|
id | unique identifier for this field, which must be unique across all apps |
label | a user friendly label shown in the condition editor |
type | one of string, integer, double, date, time, datetime or boolean |
values | the values offered in the select box |
operators | the comparison operators the field allows |
evalFunction | either the name of a function or an actual function, evaluated to produce the field value |
fields | the list the built field is added to |
addComponent(String compId, String type, String desc, String jsFile, String editorHtml, String previewImage, String renderTemplate, String settingsTemplate)
Returns: ControllerMappingList
Registers a KEditor component with every path given explicitly. A component is a drag and drop block that content editors can place on a page. Does nothing once the app's engine has finished initialising.
| Parameter | Description |
|---|---|
compId | globally unique identifier for the component |
type | the resource type this component applies to, matched with the resource's is method |
desc | a user friendly description shown in the component picker |
jsFile | path of the client side script that initialises the component editor |
editorHtml | the HTML inserted into the content editor when the component is dropped in, later replaced by the rendered output |
previewImage | path of the image shown for the component in the content editor |
renderTemplate | path of the template that renders the component with live data |
settingsTemplate | path of the template that renders the component's settings panel |
addComponent(String compId, String type, String desc, String categories, String jsFile, String editorHtml, String previewImage, String renderTemplate, String settingsTemplate)
Returns: ControllerMappingList
Registers a KEditor component with every path given explicitly, and with categories that group it in the component picker. Does nothing once the app's engine has finished initialising.
| Parameter | Description |
|---|---|
compId | globally unique identifier for the component |
type | the resource type this component applies to, matched with the resource's is method |
desc | a user friendly description shown in the component picker |
categories | comma separated categories or tags used to group the component |
jsFile | path of the client side script that initialises the component editor |
editorHtml | the HTML inserted into the content editor when the component is dropped in, later replaced by the rendered output |
previewImage | path of the image shown for the component in the content editor |
renderTemplate | path of the template that renders the component with live data |
settingsTemplate | path of the template that renders the component's settings panel |
addComponent(String appId, String compId, String type, String desc)
Returns: ControllerMappingList
Registers a KEditor component using the standard file naming convention, so the script, templates and preview image paths are derived from the app identifier and component identifier. The simplest way to add a component with a single type and default options.
| Parameter | Description |
|---|---|
appId | the app path the component's files live under, normally the app name |
compId | globally unique identifier for the component, and the base name of its files |
type | the resource type this component applies to |
desc | a user friendly description shown in the component picker |
addComponent(String appId, String compId, String type, String desc, String categories)
Returns: ControllerMappingList
Registers a KEditor component using the standard file naming convention, with categories that group it in the component picker.
| Parameter | Description |
|---|---|
appId | the app path the component's files live under, normally the app name |
compId | globally unique identifier for the component, and the base name of its files |
type | the resource type this component applies to |
desc | a user friendly description shown in the component picker |
categories | comma separated categories or tags used to group the component |
addComponent(String appId, String compId, List<String> types, String desc, String categories)
Returns: ControllerMappingList
Registers a KEditor component using the standard file naming convention, applying to several resource types rather than one.
| Parameter | Description |
|---|---|
appId | the app path the component's files live under, normally the app name |
compId | globally unique identifier for the component, and the base name of its files |
types | the resource types this component applies to, may be null |
desc | a user friendly description shown in the component picker |
categories | comma separated categories or tags used to group the component |
addComponent(String appId, String compId)
Returns: ComponentBuilder
Starts building a KEditor component. Use this overload when the component needs several types, categories or default attributes; call build on the returned builder to register it.
| Parameter | Description |
|---|---|
appId | the app path the component's files live under, normally the app name |
compId | globally unique identifier for the component, and the base name of its files |
browseResourcesFunction(Object fn)
Returns: ControllerMappingList
Registers a function that lists the app's own resources for a given website path, so they appear in resource browsers such as the link picker. The function is called with the website root folder, the path and the list to add resource beans to.
| Parameter | Description |
|---|---|
fn | the JavaScript function that populates the resource list |
getBrowseResourcesFunction()
Returns: Object
Function registered by browseResourcesFunction that lists the app's resources when a website path is browsed.
appIndexersFunction(Object fn)
Returns: ControllerMappingList
Registers a function returning the app indexers this app contributes, which are what feed the app's own data into the search index. The function is called with no arguments and must return a list of indexers.
| Parameter | Description |
|---|---|
fn | the JavaScript function that returns the list of app indexers |
getAppIndexersFunction()
Returns: Object
Function registered by appIndexersFunction that returns this app's search indexers. Whether it is present is cached per account, so apps without indexers are not initialised unnecessarily.
appendConfigFunction(Object fn)
Returns: ControllerMappingList
Registers a function that describes this app's configuration items, so they can be exported and compared between accounts. The function is called with a config item list builder to add entries to.
| Parameter | Description |
|---|---|
fn | the JavaScript function that appends configuration items |
getAppendConfigFunction()
Returns: Object
Function registered by appendConfigFunction that lists this app's configuration items. It is called with a config item list builder, for example function myConfigAppender(configBuilder) that builds a properties map per item and calls configBuilder.add with the item name, type and properties.
applyConfigFunction(Object fn)
Returns: ControllerMappingList
Registers a function that applies configuration changes to this app, which is what makes the app's config importable. Without it the platform reports that the app cannot apply config changes. The function is called with the config deltas and an apply context.
| Parameter | Description |
|---|---|
fn | the JavaScript function that applies configuration changes |
getApplyConfigFunction()
Returns: Object
Function registered by applyConfigFunction that applies imported configuration changes to this app.
getAutoApplyTypeIds()
Returns: List<String>
Configuration item type identifiers this app is willing to have applied automatically, rather than only on an explicit import.
getList()
Returns: List<ControllerMapping>
Website controller mappings registered by this app, the same list returned by getWebsiteMappings.
getSources()
Returns: List<String>
Paths of the JavaScript source files the app loads into its engine, in the order they are declared in controllers.xml.
getMenus()
Returns: List<AppMenuItem>
Admin menu items this app adds, as declared by the menu elements in controllers.xml.
getInitDate()
Returns: Date
Time at which the app's engine was last initialised. Useful for telling whether a deployed change has been picked up.
getInitError()
Returns: Exception
Exception that stopped the app's engine from initialising, most often a JavaScript syntax or load error. When this is set the app is loaded but non functional.
getInitLogs()
Returns: List<String>
Log lines captured while the app's engine was being initialised, used to show load time messages in the app admin screens.
getEngine()
Returns: KademiScriptEngine
Script engine the app's JavaScript runs in, created during initialisation from the app's sources and engine version.
getOnAppUpdated()
Returns: String
Name of the function called when the app is updated to a new version, as declared by the onAppUpdated attribute in controllers.xml.
getOnAppEnabled()
Returns: String
Name of the function called when the app is enabled on an account, as declared by the onAppEnabled attribute in controllers.xml.
getOnAppDisabled()
Returns: String
Name of the function called when the app is disabled on an account, as declared by the onAppDisabled attribute in controllers.xml.
getWebsiteMappings()
Returns: List<ControllerMapping>
Controller mappings this app serves on website root folders, each binding a URL pattern to a JavaScript function and template.
getAdminMappings()
Returns: List<ControllerMapping>
Controller mappings this app serves in the admin console, each binding a URL pattern to a JavaScript function and template.
getAdminPortletMappings()
Returns: List<PortletMapping>
Portlets this app contributes to admin pages. A portlet mapping names the page section it renders into and the function and template used to render it.
getTemplates()
Returns: List<TemplateDef>
Page and email templates this app makes available to content editors, registered through addTemplate and addEdmTemplate.
getWebsitePortletMappings()
Returns: List<PortletMapping>
Portlets this app contributes to website pages, including the captcha portlet registered by the captcha method.
getProfileTabMappings()
Returns: List<ProfileTabMapping>
Extra tabs and summary panels this app adds to the admin profile page, registered through adminProfileTab.
getOrgTabMappings()
Returns: List<ProfileTabMapping>
Extra tabs and summary panels this app adds to the admin organisation page, registered through adminOrgTab.
getTriggerTypeMappings()
Returns: List<TriggerTypeMapping>
Legacy automation trigger types registered through automationTrigger. New apps should register funnel trigger types with addFunnelTriggerType instead.
getSigninProviderMappings()
Returns: List<RepoSigninProviderBean>
Admin sign in providers this app contributes, such as an external identity provider offered on the admin sign in page.
getWebsiteSigninProviderMappings()
Returns: List<RepoSigninProviderBean>
Website sign in providers this app contributes, offered on website sign in pages rather than the admin console.
getEventListeners()
Returns: List<RepoAppEventListener>
Event listeners this app has registered through addEventListener and addEventListenerForType. Each pairs an event type or class with the function to run.
getProfileTimelineMapping()
Returns: ProfileTimelineMapping
Function this app contributes to the user timeline, registered through setUserTimelineFunction. It is called to add stream items to a profile's timeline.
getOrgTimelineMapping()
Returns: ProfileTimelineMapping
Function this app contributes to the organisation timeline, registered through setOrgTimelineFunction.
getJsServices()
Returns: Map<String,JsService>
Named JavaScript services this app publishes for other apps to call, keyed by service name. Created on first access, so this never returns null.
newServiceBuilder(String serviceName)
Returns: JsServiceBuilder
Starts building a named JavaScript service that other apps can call. Set the service object on the returned builder and call build to publish it under the given name.
| Parameter | Description |
|---|---|
serviceName | the name other apps will look the service up by |
getJsImplementations()
Returns: Map<String,JsImplementation>
Implementations this app supplies for named extension points, keyed by interface name. Created on first access, so this never returns null.
newImplementationBuilder(String interfaceName)
Returns: JsImplementationBuilder
Starts building an implementation of a named extension point, which is the current way to plug into platform hooks such as index query action types. Set the implementation object on the returned builder and call build.
| Parameter | Description |
|---|---|
interfaceName | name of the extension point being implemented |
getDynamicIdpPaths(String type)
Returns: List<String>
Paths this app declares as dynamic identity provider endpoints for the given provider type, registered through the dynamic IDP paths builder.
| Parameter | Description |
|---|---|
type | the identity provider type to look up |
getWebsocketMapping(String type)
Returns: RepoAppWebsocketMapping
Websocket handler this app registered for the given channel type through the websocket controller.
| Parameter | Description |
|---|---|
type | the websocket channel type to look up |
getSseMapping(String type)
Returns: RepoAppSseMapping
Server sent events handler this app registered for the given stream type through the SSE controller.
| Parameter | Description |
|---|---|
type | the event stream type to look up |
getWebsiteMcpMapping(String type)
Returns: RepoAppMcpMapping
MCP server this app registered for the given type on the website side, which is what exposes the app's tools to AI clients on public websites.
| Parameter | Description |
|---|---|
type | the MCP server type to look up |
getAdminMcpMapping(String type)
Returns: RepoAppMcpMapping
MCP server this app registered for the given type on the admin side, which is what exposes the app's tools to AI clients in the admin console.
| Parameter | Description |
|---|---|
type | the MCP server type to look up |
getAuthenticationHandlerMappings()
Returns: List<JsAuthHandlerMapping>
Custom authentication handlers this app registered through the authentication handler builder.
getMailboxMappings()
Returns: List<MailboxMapping>
Mailbox handlers this app registered through the mailbox controller, each binding an inbound email address pattern to a function. Created on first access, so this never returns null.
getMenuMappings()
Returns: List<MenuMapping>
Menu handlers this app registered through the menu controller, which let the app contribute items to menus at runtime. Created on first access, so this never returns null.
paymentProviderDetails()
Returns: PaymentProviderDetailsBuilder
Starts building the payment provider details for this app, which is what registers it as a payment provider for shopping carts. Set the function names and payment form on the returned builder and call build.
smsProviderDetails()
Returns: SmsProviderDetailsBuilder
Starts building the SMS provider details for this app, which is what registers it as a provider for sending text messages. Set the properties on the returned builder and call build.
emailSenderDetails()
Returns: EmailSenderDetailsBuilder
Starts building the email sender details for this app, which is what registers it as an email sending app. Set the properties on the returned builder and call build.
adminController()
Returns: ControllerMappingBuilder
Starts building an admin controller, which binds a URL pattern under the admin console to a JavaScript function and a template. Call build on the returned builder to register it.
websiteController()
Returns: ControllerMappingBuilder
Starts building a website controller, which binds a URL pattern on a public website to a JavaScript function and a template. Call build on the returned builder to register it.
adminPortletController()
Returns: PortletMappingBuilder
Starts building an admin portlet, which renders extra content into a named section of an admin page. Call build on the returned builder to register it.
websitePortletController()
Returns: PortletMappingBuilder
Starts building a website portlet, which renders extra content into a named section of a website page. Call build on the returned builder to register it.
websocketController()
Returns: WebsocketMappingBuilder
Starts building a websocket handler, which lets the app receive and send messages on a named websocket channel. Call build on the returned builder to register it.
dynamicIdpPaths()
Returns: IdpDynamicPathsBuilder
Starts declaring dynamic identity provider paths for this app, so that requests to those paths are handled by the named provider type. Set the type and paths on the returned builder and call build.
sseController()
Returns: SseMappingBuilder
Starts building a server sent events handler, which lets the app push a stream of events to a connected browser. Call build on the returned builder to register it.
websiteMcpController()
Returns: McpMappingBuilder
Starts building an MCP server exposed on the website side, which publishes the app's tools to AI clients on public websites. Call build on the returned builder to register it.
adminMcpController()
Returns: McpMappingBuilder
Starts building an MCP server exposed on the admin side, which publishes the app's tools to AI clients in the admin console. Call build on the returned builder to register it.
authenticationHandler()
Returns: AuthHandlerBuilder
Starts building a custom authentication handler, letting the app authenticate requests itself rather than relying on the built in mechanisms. Call build on the returned builder to register it.
adminProfileTab()
Returns: ProfileTabsBuilder
Starts building an extra tab, and optionally a summary panel, on the admin profile page. Set the title, portlet id and rendering function on the returned builder and call build.
adminOrgTab()
Returns: ProfileTabsBuilder
Starts building an extra tab, and optionally a summary panel, on the admin organisation page.
mailboxController()
Returns: MailboxMappingBuilder
Starts building a mailbox handler, so the app can process inbound email delivered to a matching address. Call build on the returned builder to register it.
menuController()
Returns: MenuMappingBuilder
Starts building a menu handler, so the app can contribute or modify menu items at runtime rather than declaring them statically in controllers.xml. Call build on the returned builder to register it.
automationTrigger()
Returns: TriggerTypeBuilder
Starts building a legacy automation trigger type. New apps should use addFunnelTriggerType instead.
signinProvider()
Returns: SigninProviderBuilder
Starts building an admin sign in provider, which adds an alternative way to sign in to the admin console. Call build on the returned builder to register it.
websiteSigninProvider()
Returns: SigninProviderBuilder
Starts building a website sign in provider, which adds an alternative way to sign in to a public website.
signinProviderDetails()
Returns: SigninProviderDetailsBuilder
Starts building the admin sign in provider details for this app, where the provider list is produced by a function instead of being declared statically. Call build on the returned builder to register the function.
websiteSigninProviderDetails()
Returns: SigninProviderDetailsBuilder
Starts building the website sign in provider details for this app, where the provider list is produced by a function instead of being declared statically.
getSigninProvidersFn()
Returns: String
Name of the function that returns this app's admin sign in providers, as registered through signinProviderDetails.
getWebsiteSigninProvidersFn()
Returns: String
Name of the function that returns this app's website sign in providers, as registered through websiteSigninProviderDetails.
esMappingsController()
Returns: RepoEsMappingsBuilder
Starts declaring Elasticsearch index mappings for a database this app owns, so its documents are indexed with the right field types. Call build on the returned builder to register them.
cacheBuilder()
Returns: CacheBuilder
Starts building a named cache scoped to this app and its current repository hash, so cached values are discarded when the app is updated. Call build on the returned builder to create the cache.
getCacheValue(String cacheName, String key, Callable<Object> loader)
Returns: Object
Reads a value from one of this app's caches, calling the loader to compute it on a miss. The load is performed while holding the script context lock, so a JavaScript loader can safely run on the app's engine.
| Parameter | Description |
|---|---|
cacheName | name of the cache, as given to the cache builder |
key | the key to read within that cache |
loader | called to compute the value when it is not already cached |
addEventListener(String eventType, boolean enabled, Object function)
Returns: ControllerMappingList
Registers a listener for platform and app events, matched by the event's simple class name or, for trigger and app events, by its event id. The listener function is called with the current root folder and the event. Duplicate registrations of the same type, flag and function are ignored.
| Parameter | Description |
|---|---|
eventType | simple class name of the event, or the event id for a trigger or app event |
enabled | false to register the listener but leave it switched off |
function | the function to run, given either as a name or as an actual function |
addEventListenerForType(String eventClassName, boolean enabled, Object function)
Returns: ControllerMappingList
Registers a listener against a fully qualified event class or interface, rather than a simple name. If the named type is an interface then every event implementing it is handled. Duplicate registrations are ignored.
| Parameter | Description |
|---|---|
eventClassName | fully qualified name of the event class or interface to listen for |
enabled | false to register the listener but leave it switched off |
function | the function to run, given either as a name or as an actual function |
setUserTimelineFunction(Object func)
Returns: ControllerMappingList
Sets the function called when a profile's timeline is generated, so the app can add its own stream items to the timeline. The function is called with the page, the user and the list to add items to.
| Parameter | Description |
|---|---|
func | the timeline function, given either as a name or as an actual function |
setOrgTimelineFunction(Object func)
Returns: ControllerMappingList
Sets the function called when an organisation's timeline is generated, so the app can add its own stream items to it. Works the same way as setUserTimelineFunction but for organisations.
| Parameter | Description |
|---|---|
func | the timeline function, given either as a name or as an actual function |
call(String execFn, Object args)
Returns: Object
Calls a named function in the app's JavaScript engine and returns its result, yielding to the governor either side of the call so long running scripts can be interrupted. Returns null and logs a warning if the function does not exist or the engine failed to initialise.
| Parameter | Description |
|---|---|
execFn | name of the global function to call |
args | arguments passed to the function |
callWithThrow(String execFn, Object args)
Returns: Object
Calls a named function in the app's JavaScript engine, the same as call except that failures are thrown rather than swallowed. Use it when the caller needs to know the call failed.
| Parameter | Description |
|---|---|
execFn | name of the global function to call |
args | arguments passed to the function |
getAppName()
Returns: String
Name of the app this mapping list belongs to, as installed on the account, for example admin-lib.
getRepoName()
Returns: String
Name of the repository the app was loaded from. Set to the same value as the app name during initialisation.
getPaymentProviderDetails()
Returns: PaymentProviderDetails
Payment provider registration for this app, set by building payment provider details. Its presence is what marks the app as a payment provider for shopping carts.
getSmsProviderDetails()
Returns: SmsProviderDetails
SMS provider registration for this app, set by building SMS provider details. Its presence is what marks the app as able to send text messages.
getEmailSenderDetails()
Returns: EmailSenderDetails
Email sender registration for this app, set by building email sender details. Its presence is what marks the app as able to send email.
executeJs(Object func, Object args)
Returns: Object
Runs a function on the app's JavaScript engine, accepting either a function name or an actual callable function, and yields to the governor either side of the call. Script failures are logged with the app name and account and then rethrown as a runtime exception; a null or blank function simply returns null.
| Parameter | Description |
|---|---|
func | the function to run, given either as a name or as an actual callable function |
args | arguments passed to the function |
getRoles()
Returns: List<Role>
Security roles this app declares, combining both the original role declarations and the version two roles from controllers.xml. Builds a new list on each call.
triggerEvent(String eventDefId, Map<String,Object> eventProperties)
Returns: void
Fires an app event previously declared with newEventDefinitionBuilder, so that listeners in this and other apps can react to it. If no event definition matches the given id a warning is logged and nothing is fired.
| Parameter | Description |
|---|---|
eventDefId | id of the event definition to fire |
eventProperties | a map of string to object carrying the event's properties, passed on to listeners |
newEventDefinitionBuilder(String id)
Returns: RepoAppEventDefBuilder
Starts declaring an event this app can raise, which other apps can then listen for with addEventListener. Use the chaining methods on the returned builder to set the event's properties and call build to register it.
| Parameter | Description |
|---|---|
id | unique id for the event definition, which is also what triggerEvent is called with |
addReport(String pathToJsonFile)
Returns: void
Registers a report defined by a JSON file in the app repository. The file is read and parsed when the app initialises, and a warning is logged if it is missing or cannot be parsed.
| Parameter | Description |
|---|---|
pathToJsonFile | repository path of the JSON report definition |
addReport(String reportId, String title, String description, String reportTemplate, String function, String attachmentContentType, String attachmentExtension)
Returns: void
Registers a report rendered by a named JavaScript function and a template, optionally producing a downloadable attachment.
| Parameter | Description |
|---|---|
reportId | unique identifier for the report |
title | human readable title shown in the report list |
description | description shown alongside the title |
reportTemplate | repository path of the template that renders the report |
function | name of the global JavaScript function that produces the report data |
attachmentContentType | content type of the generated attachment, or null for an on screen report |
attachmentExtension | file extension of the generated attachment, or null for an on screen report |
addReport(String reportId, String title, String description, String reportTemplate, VarArgFunction functionPtr, String attachmentContentType, String attachmentExtension)
Returns: void
Registers a report rendered by an actual JavaScript function rather than a function name, which lets a closure be used.
| Parameter | Description |
|---|---|
reportId | unique identifier for the report |
title | human readable title shown in the report list |
description | description shown alongside the title |
reportTemplate | repository path of the template that renders the report |
functionPtr | the function that produces the report data |
attachmentContentType | content type of the generated attachment, or null for an on screen report |
attachmentExtension | file extension of the generated attachment, or null for an on screen report |
addQueryTableReport(String reportId, String title, String description, String reportTemplate, String queryTableId, String attachmentContentType, String attachmentExtension)
Returns: void
Registers a report whose rows come from a query table registered with addTableDef, rather than from a report function.
| Parameter | Description |
|---|---|
reportId | unique identifier for the report |
title | human readable title shown in the report list |
description | description shown alongside the title |
reportTemplate | repository path of the template that renders the report |
queryTableId | id of the query table supplying the report's rows |
attachmentContentType | content type of the generated attachment, or null for an on screen report |
attachmentExtension | file extension of the generated attachment, or null for an on screen report |
getReports()
Returns: List<Report>
Reports this app contributes, from both JSON report files and reports registered in JavaScript. The list is made immutable once the app has initialised.
getNodeTypes()
Returns: List<NodeTypeBean>
Journey node types this app contributes, registered through addNodeType, addActionNodeType and addGoalNodeType.
getJourneyFields()
Returns: List<Field>
Statically declared fields this app contributes for use in segments, journeys and queries. Dynamically produced fields come from the journey fields function instead.
getJourneyFieldsFunction()
Returns: Object
Function registered by journeyFieldsFunction that produces this app's fields dynamically.
journeyFieldsFunction(Object fn)
Returns: ControllerMappingList
Sets the function used to load this app's fields dynamically, given either as a closure or as a function name. It can be used instead of, or as well as, the statically declared fields added by the add field methods. The function is called with two arguments, the root folder and the field list to add to.
| Parameter | Description |
|---|---|
fn | the fields function, given either as a name or as an actual function |
repoAppPaymentResult()
Returns: RepoAppPaymentResult
Creates an empty payment result for a payment provider app to populate and return from its processing function.
getComponents()
Returns: List<KEditorComponent>
KEditor components this app contributes, registered through the addComponent methods or declared as component elements in controllers.xml.
getRepoAppSettings()
Returns: List<RepoAppSettings>
Settings declarations for this app, from the settings elements in controllers.xml. They describe the configuration fields shown when an administrator sets the app up.
getQueries()
Returns: List<RepoAppQuery>
Saved search queries this app contributes, registered through addQuery from JSON files in the app repository.
getCheckoutRuleTypes()
Returns: List<RepoAppCustomCheckoutRuleType>
Custom shopping cart checkout rule types this app contributes, registered through the checkout rule type builder.
getPromotionMechanicTypes()
Returns: List<PromotionMechanicType>
Promotion mechanic types this app contributes, registered through the promotion mechanic type builder.
getPointsRuleTypes()
Returns: List<PointsRuleType>
Points rule types this app contributes, registered through the points rule type builder. These decide how points are awarded.
getPointsExpiryRuleTypes()
Returns: List<PointsExpiryRuleType>
Points expiry rule types this app contributes, registered through the points expiry rule type builder. These decide when awarded points expire.