Builds a promotion mechanic type, which is the behaviour behind a promotion such as a prize draw or an instant win. Obtained from promotionMechanicTypeBuilder on the controller mappings. Set the templates used to edit, summarise and show the mechanic to participants, plus the functions that create its metrics and save its details, then call build to register it. Both chained setters and plain bean setters are exported, so either style works from JavaScript.

Group: Builders


Properties

PropertyReturnsDescription
createMetricsFnStringName of the function that creates the metrics recorded for promotions using this mechanic.
descriptionStringDescription shown to administrators alongside the mechanic name.
editTemplateStringRepository path of the template used to configure a promotion that uses this mechanic.
iconStringIcon class shown beside the mechanic in the promotion editor. Defaults to a generic picture icon.
idStringUnique identifier for the mechanic type, stored against promotions that use it.
participantTemplateStringRepository path of the template shown to a participant taking part in the promotion.
saveMechanicDetailsFnStringName of the function called to save the mechanic's own settings when a promotion is saved.
summaryTemplateStringRepository path of the template that renders the mechanic's summary in the admin promotion list.
supportsWebsitebooleanWhether promotions using this mechanic can be run on a public website as well as in the admin console.
titleStringHuman readable name shown when an administrator chooses a mechanic for a promotion.

Methods

build() · getId() · getTitle() · getIcon() · getDescription() · setDescription(String description) · getEditTemplate() · setEditTemplate(String editTemplate) · getSummaryTemplate() · setSummaryTemplate(String summaryTemplate) · getParticipantTemplate() · setParticipantTemplate(String participantTemplate) · getCreateMetricsFn() · setCreateMetricsFn(String createMetricsFn) · getSaveMechanicDetailsFn() · setSaveMechanicDetailsFn(String saveMechanicDetailsFn) · isSupportsWebsite() · setSupportsWebsite(boolean supportsWebsite) · description(String s) · icon(String s) · editTemplate(String s) · summaryTemplate(String s) · participantTemplate(String s) · createMetricsFn(String s) · saveMechanicDetailsFn(String s) · supportsWebsite(boolean b)

build()

Returns: RepoAppPromotionMechanicType

Creates the promotion mechanic type from the configured values and registers it against this app. The type is still created and returned once the engine has initialised, but it is no longer registered.

getId()

Returns: String

Unique identifier for the mechanic type, stored against promotions that use it.

getTitle()

Returns: String

Human readable name shown when an administrator chooses a mechanic for a promotion.

getIcon()

Returns: String

Icon class shown beside the mechanic in the promotion editor. Defaults to a generic picture icon.

getDescription()

Returns: String

Description shown to administrators alongside the mechanic name.

setDescription(String description)

Returns: void

Sets the description shown to administrators alongside the mechanic name.

ParameterDescription
descriptionthe description text

getEditTemplate()

Returns: String

Repository path of the template used to configure a promotion that uses this mechanic.

setEditTemplate(String editTemplate)

Returns: void

Sets the repository path of the template used to configure a promotion that uses this mechanic.

ParameterDescription
editTemplatethe edit template path

getSummaryTemplate()

Returns: String

Repository path of the template that renders the mechanic's summary in the admin promotion list.

setSummaryTemplate(String summaryTemplate)

Returns: void

Sets the repository path of the template that renders the mechanic's summary in the admin promotion list.

ParameterDescription
summaryTemplatethe summary template path

getParticipantTemplate()

Returns: String

Repository path of the template shown to a participant taking part in the promotion.

setParticipantTemplate(String participantTemplate)

Returns: void

Sets the repository path of the template shown to a participant taking part in the promotion.

ParameterDescription
participantTemplatethe participant template path

getCreateMetricsFn()

Returns: String

Name of the function that creates the metrics recorded for promotions using this mechanic.

setCreateMetricsFn(String createMetricsFn)

Returns: void

Sets the name of the function that creates the metrics recorded for promotions using this mechanic.

ParameterDescription
createMetricsFnthe create metrics function name

getSaveMechanicDetailsFn()

Returns: String

Name of the function called to save the mechanic's own settings when a promotion is saved.

setSaveMechanicDetailsFn(String saveMechanicDetailsFn)

Returns: void

Sets the name of the function called to save the mechanic's own settings when a promotion is saved.

ParameterDescription
saveMechanicDetailsFnthe save details function name

isSupportsWebsite()

Returns: boolean

Whether promotions using this mechanic can be run on a public website as well as in the admin console.

setSupportsWebsite(boolean supportsWebsite)

Returns: void

Sets whether promotions using this mechanic can be run on a public website.

ParameterDescription
supportsWebsitetrue if the mechanic supports websites

description(String s)

Returns: PromotionMechanicTypeBuilder

Sets the description shown to administrators alongside the mechanic name.

ParameterDescription
sthe description text

icon(String s)

Returns: PromotionMechanicTypeBuilder

Sets the icon class shown beside the mechanic in the promotion editor, replacing the default picture icon.

ParameterDescription
sthe icon CSS classes

editTemplate(String s)

Returns: PromotionMechanicTypeBuilder

Sets the repository path of the template used to configure a promotion that uses this mechanic.

ParameterDescription
sthe edit template path

summaryTemplate(String s)

Returns: PromotionMechanicTypeBuilder

Sets the repository path of the template that renders the mechanic's summary in the admin promotion list.

ParameterDescription
sthe summary template path

participantTemplate(String s)

Returns: PromotionMechanicTypeBuilder

Sets the repository path of the template shown to a participant taking part in the promotion.

ParameterDescription
sthe participant template path

createMetricsFn(String s)

Returns: PromotionMechanicTypeBuilder

Sets the name of the function that creates the metrics recorded for promotions using this mechanic.

ParameterDescription
sthe create metrics function name

saveMechanicDetailsFn(String s)

Returns: PromotionMechanicTypeBuilder

Sets the name of the function called to save the mechanic's own settings when a promotion is saved.

ParameterDescription
sthe save details function name

supportsWebsite(boolean b)

Returns: PromotionMechanicTypeBuilder

Sets whether promotions using this mechanic can be run on a public website.

ParameterDescription
btrue if the mechanic supports websites
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.