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
| Property | Returns | Description |
|---|---|---|
| createMetricsFn | String | Name of the function that creates the metrics recorded for promotions using this mechanic. |
| description | String | Description shown to administrators alongside the mechanic name. |
| editTemplate | String | Repository path of the template used to configure a promotion that uses this mechanic. |
| icon | String | Icon class shown beside the mechanic in the promotion editor. Defaults to a generic picture icon. |
| id | String | Unique identifier for the mechanic type, stored against promotions that use it. |
| participantTemplate | String | Repository path of the template shown to a participant taking part in the promotion. |
| saveMechanicDetailsFn | String | Name of the function called to save the mechanic's own settings when a promotion is saved. |
| summaryTemplate | String | Repository path of the template that renders the mechanic's summary in the admin promotion list. |
| supportsWebsite | boolean | Whether promotions using this mechanic can be run on a public website as well as in the admin console. |
| title | String | Human 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.
| Parameter | Description |
|---|---|
description | the 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.
| Parameter | Description |
|---|---|
editTemplate | the 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.
| Parameter | Description |
|---|---|
summaryTemplate | the 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.
| Parameter | Description |
|---|---|
participantTemplate | the 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.
| Parameter | Description |
|---|---|
createMetricsFn | the 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.
| Parameter | Description |
|---|---|
saveMechanicDetailsFn | the 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.
| Parameter | Description |
|---|---|
supportsWebsite | true if the mechanic supports websites |
description(String s)
Returns: PromotionMechanicTypeBuilder
Sets the description shown to administrators alongside the mechanic name.
| Parameter | Description |
|---|---|
s | the description text |
icon(String s)
Returns: PromotionMechanicTypeBuilder
Sets the icon class shown beside the mechanic in the promotion editor, replacing the default picture icon.
| Parameter | Description |
|---|---|
s | the icon CSS classes |
editTemplate(String s)
Returns: PromotionMechanicTypeBuilder
Sets the repository path of the template used to configure a promotion that uses this mechanic.
| Parameter | Description |
|---|---|
s | the 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.
| Parameter | Description |
|---|---|
s | the summary template path |
participantTemplate(String s)
Returns: PromotionMechanicTypeBuilder
Sets the repository path of the template shown to a participant taking part in the promotion.
| Parameter | Description |
|---|---|
s | the participant template path |
createMetricsFn(String s)
Returns: PromotionMechanicTypeBuilder
Sets the name of the function that creates the metrics recorded for promotions using this mechanic.
| Parameter | Description |
|---|---|
s | the 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.
| Parameter | Description |
|---|---|
s | the save details function name |
supportsWebsite(boolean b)
Returns: PromotionMechanicTypeBuilder
Sets whether promotions using this mechanic can be run on a public website.
| Parameter | Description |
|---|---|
b | true if the mechanic supports websites |