Fluent builder for constructing and persisting a new promotion (a Reward). Configure the desired fields with the setter methods, then call build to save the promotion together with its group and organisation filters. Obtained from PromotionsManager.newPromotionBuilder; every setter returns this builder so calls can be chained.

Group: Builders


Methods

group(Group g) · startDate(Date s) · endDate(Date s) · promoStatus(String s) · itemImage(String name, String hash) · promoStatusActive() · includedOrgType(OrgType g) · excludedOrgType(OrgType g) · includedOrg(Organisation g) · subTitle(String subTitle) · client(Organisation client) · featured(boolean featured) · category(RewardCategory category) · url(String url) · groupRequirements(String groupRequirements) · build()

group(Group g)

Returns: PromotionBuilder

Adds a group to the list of groups the built promotion will be filtered by.

ParameterDescription
gthe group to add

startDate(Date s)

Returns: PromotionBuilder

Sets the date the promotion opens.

ParameterDescription
sthe start date

endDate(Date s)

Returns: PromotionBuilder

Sets the date the promotion closes.

ParameterDescription
sthe end date

promoStatus(String s)

Returns: PromotionBuilder

Sets the status the built promotion will be created with, for example Reward.STATUS_ACTIVE.

ParameterDescription
sthe status value

itemImage(String name, String hash)

Returns: PromotionBuilder

Sets the item image for the promotion. Both name and hash must be non-null for the image to be applied.

ParameterDescription
namethe file name of the image
hashthe content hash of the already-stored image file

promoStatusActive()

Returns: PromotionBuilder

Sets the promotion status to Reward.STATUS_ACTIVE.

includedOrgType(OrgType g)

Returns: PromotionBuilder

Restricts the promotion to organisations of the given type.

ParameterDescription
gthe organisation type to include

excludedOrgType(OrgType g)

Returns: PromotionBuilder

Excludes organisations of the given type from the promotion.

ParameterDescription
gthe organisation type to exclude

includedOrg(Organisation g)

Returns: PromotionBuilder

Restricts the promotion to the given organisation, added as an inclusive participant selector.

ParameterDescription
gthe organisation to include

subTitle(String subTitle)

Returns: PromotionBuilder

Sets the promotion's subtitle, applied only if it is non-blank.

ParameterDescription
subTitlethe subtitle text

client(Organisation client)

Returns: PromotionBuilder

Sets the client organisation the promotion is created for.

ParameterDescription
clientthe client organisation

Returns: PromotionBuilder

Sets whether the promotion is flagged as featured.

ParameterDescription
featuredtrue to feature the promotion

category(RewardCategory category)

Returns: PromotionBuilder

Sets the reward category the promotion belongs to.

ParameterDescription
categorythe reward category

url(String url)

Returns: PromotionBuilder

Sets the promotion's url.

ParameterDescription
urlthe promotion url

groupRequirements(String groupRequirements)

Returns: PromotionBuilder

Sets how the promotion's group filters combine. Only "and" is currently supported; any other non-blank value causes build to throw an IllegalArgumentException.

ParameterDescription
groupRequirementsthe group combination mode, or null for the default (or) behaviour

build()

Returns: Reward

Validates and persists the configured promotion: creates the Reward, applies its image, points org type filters, client, featured flag, category, url, group requirements and participant selectors, then attaches any configured groups.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.