Defines one rule that transforms a points allocation, by adding to it, multiplying it, or transferring the points to another profile or organisation. Rules are looked up by the reward the points are being allocated to, and can be narrowed further to a single recipient. When a rule fires the add value is applied first, then the multiply value, and then the MVEL expression if one is set; an expression that evaluates to false stops the allocation altogether. Where a transfer target is set the whole calculated amount goes to that entity, otherwise only the difference between the calculated and the original amount is issued to the original recipient. A rule is active only between its start and end dates, and where a promotion is attached that promotion decides eligibility and applies its own dates as well. Rules are soft deleted, which renames them and hides them from the finders.

Group: Database Entities

Implements: Serializable


Properties

PropertyReturnsDescription
addValueBigDecimalAmount added to the points being allocated before anything else is applied. A negative value subtracts, and null leaves the amount alone.
createdByProfileThe profile of the administrator who created this rule.
createdDateDateWhen this rule was created.
dataSeriesSalesDataSeriesThe sales data series this rule was meant to be limited to. Nothing in the points allocation processing reads it, so setting it has no effect on which allocations the rule fires for.
deletedByProfileThe profile of the administrator who soft deleted this rule, or null if it has not been deleted.
deletedDateDateWhen this rule was soft deleted. A rule with a value here never fires and is skipped by the finders, but its history is kept.
endDateDateThe rule does not fire after this date. Null means it never stops.
idlongPrimary key of this rule, assigned when it is first saved.
issueToBaseEntityRestricts the rule to allocations made to this one profile or organisation. Null means the rule applies to every recipient.
modifiedByProfileThe profile of the administrator who last changed this rule.
modifiedDateDateWhen this rule was last changed. Stored to day precision only.
multValueBigDecimalFactor the points are multiplied by after the add value has been applied. A negative value divides by its size instead of multiplying, zero has no effect, and null leaves the amount alone.
mvelExpressionStringMVEL expression evaluated after the add and multiply values have been applied, to work out the final amount. It is given the reward, the original amount, the running amount, the recipient as issueTo, the organisation and a formatter. Returning false means do not allocate at all; any other result becomes the amount.
nameStringPath-safe identifier for this rule, unique within the organisation among rules that have not been deleted. Soft deleting a rule renames it so the name becomes free again.
notesStringFree-text notes for administrators explaining what this rule is for. Not shown to participants.
promotionRewardOptional promotion that gates this rule. When one is set the recipient must be eligible for the promotion, and the promotion's own viewable window and start and end dates must allow it, before the rule fires.
reasonMvelStringMVEL template evaluated to produce the reason recorded against the points this rule allocates, which is what a participant sees in their points history. It is given the rule, the reward, the amounts, the original reason, the organisation and the recipient as issueTo. Null keeps the original reason.
rewardDestRewardThe reward, that is the points bucket, whose allocations this rule applies to. Rules are looked up by this reward, so a rule with none set is never found by the allocation processing.
startDateDateThe rule does not fire before this date. Null means it has always been active.
titleStringFree-text display label shown to administrators in the rules list. It is not unique and is not safe to use as a lookup key.
transferToBaseEntitySends the points this rule calculates to this profile or organisation instead of the original recipient, and sends the whole calculated amount rather than just the difference. Null leaves the points with the original recipient.

Methods

getRewardDest() · setRewardDest(Reward rewardDest) · getPromotion() · setPromotion(Reward promotion) · getAddValue() · setAddValue(BigDecimal addValue) · getMultValue() · setMultValue(BigDecimal multValue) · getIssueTo() · setIssueTo(BaseEntity issueTo) · getTransferTo() · setTransferTo(BaseEntity transferTo) · getId() · setId(long id) · getName() · setName(String name) · getTitle() · setTitle(String title) · getDataSeries() · setDataSeries(SalesDataSeries dataSeries) · getModifiedDate() · setModifiedDate(Date modifiedDate) · getModifiedBy() · setModifiedBy(Profile modifiedBy) · getCreatedDate() · setCreatedDate(Date createdDate) · getCreatedBy() · setCreatedBy(Profile createdBy) · getDeletedDate() · setDeletedDate(Date deletedDate) · getDeletedBy() · setDeletedBy(Profile deletedBy) · getMvelExpression() · setMvelExpression(String mvelExpression) · getNotes() · setNotes(String notes) · setOrganisation(Organisation organisation) · getStartDate() · setStartDate(Date startDate) · getEndDate() · setEndDate(Date endDate) · getReasonMvel() · setReasonMvel(String reasonMvel)

getRewardDest()

Returns: Reward

The reward, that is the points bucket, whose allocations this rule applies to. Rules are looked up by this reward, so a rule with none set is never found by the allocation processing.

setRewardDest(Reward rewardDest)

Returns: void

Sets the reward whose allocations this rule applies to.

ParameterDescription
rewardDestthe reward that triggers this rule

getPromotion()

Returns: Reward

Optional promotion that gates this rule. When one is set the recipient must be eligible for the promotion, and the promotion's own viewable window and start and end dates must allow it, before the rule fires.

setPromotion(Reward promotion)

Returns: void

Sets the promotion that gates this rule.

ParameterDescription
promotionthe gating promotion, or null for no gating

getAddValue()

Returns: BigDecimal

Amount added to the points being allocated before anything else is applied. A negative value subtracts, and null leaves the amount alone.

setAddValue(BigDecimal addValue)

Returns: void

Sets the amount added to the points being allocated.

ParameterDescription
addValuethe amount to add, negative to subtract, or null for none

getMultValue()

Returns: BigDecimal

Factor the points are multiplied by after the add value has been applied. A negative value divides by its size instead of multiplying, zero has no effect, and null leaves the amount alone.

setMultValue(BigDecimal multValue)

Returns: void

Sets the factor the points are multiplied by, where a negative value divides instead.

ParameterDescription
multValuethe multiplication factor, or null for none

getIssueTo()

Returns: BaseEntity

Restricts the rule to allocations made to this one profile or organisation. Null means the rule applies to every recipient.

setIssueTo(BaseEntity issueTo)

Returns: void

Restricts the rule to allocations made to a single profile or organisation.

ParameterDescription
issueTothe only recipient the rule applies to, or null for all

getTransferTo()

Returns: BaseEntity

Sends the points this rule calculates to this profile or organisation instead of the original recipient, and sends the whole calculated amount rather than just the difference. Null leaves the points with the original recipient.

setTransferTo(BaseEntity transferTo)

Returns: void

Sets the profile or organisation the calculated points are transferred to.

ParameterDescription
transferTothe entity to transfer the points to, or null to leave them with the original recipient

getId()

Returns: long

Primary key of this rule, assigned when it is first saved.

setId(long id)

Returns: void

Sets the primary key. Only meaningful for a rule that has not been saved yet.

ParameterDescription
idthe database identifier

getName()

Returns: String

Path-safe identifier for this rule, unique within the organisation among rules that have not been deleted. Soft deleting a rule renames it so the name becomes free again.

setName(String name)

Returns: void

Sets the path-safe unique name of this rule.

ParameterDescription
namethe rule's unique name

getTitle()

Returns: String

Free-text display label shown to administrators in the rules list. It is not unique and is not safe to use as a lookup key.

setTitle(String title)

Returns: void

Sets the display title shown to administrators.

ParameterDescription
titlethe rule's display title

getDataSeries()

Returns: SalesDataSeries

The sales data series this rule was meant to be limited to. Nothing in the points allocation processing reads it, so setting it has no effect on which allocations the rule fires for.

setDataSeries(SalesDataSeries dataSeries)

Returns: void

Sets the associated sales data series.

ParameterDescription
dataSeriesthe sales data series, or null

getModifiedDate()

Returns: Date

When this rule was last changed. Stored to day precision only.

setModifiedDate(Date modifiedDate)

Returns: void

Sets when this rule was last changed.

ParameterDescription
modifiedDatethe last modified date

getModifiedBy()

Returns: Profile

The profile of the administrator who last changed this rule.

setModifiedBy(Profile modifiedBy)

Returns: void

Sets the profile of the administrator who last changed this rule.

ParameterDescription
modifiedBythe last modifying profile

getCreatedDate()

Returns: Date

When this rule was created.

setCreatedDate(Date createdDate)

Returns: void

Sets when this rule was created.

ParameterDescription
createdDatethe creation timestamp

getCreatedBy()

Returns: Profile

The profile of the administrator who created this rule.

setCreatedBy(Profile createdBy)

Returns: void

Sets the profile of the administrator who created this rule.

ParameterDescription
createdBythe creating profile

getDeletedDate()

Returns: Date

When this rule was soft deleted. A rule with a value here never fires and is skipped by the finders, but its history is kept.

setDeletedDate(Date deletedDate)

Returns: void

Sets the soft deletion timestamp for this rule.

ParameterDescription
deletedDatethe deletion timestamp, or null to make the rule live again

getDeletedBy()

Returns: Profile

The profile of the administrator who soft deleted this rule, or null if it has not been deleted.

setDeletedBy(Profile deletedBy)

Returns: void

Sets the profile of the administrator who soft deleted this rule.

ParameterDescription
deletedBythe deleting profile, or null

getMvelExpression()

Returns: String

MVEL expression evaluated after the add and multiply values have been applied, to work out the final amount. It is given the reward, the original amount, the running amount, the recipient as issueTo, the organisation and a formatter. Returning false means do not allocate at all; any other result becomes the amount.

setMvelExpression(String mvelExpression)

Returns: void

Sets the MVEL expression that works out the final allocated amount.

ParameterDescription
mvelExpressionthe MVEL expression, or null for none

getNotes()

Returns: String

Free-text notes for administrators explaining what this rule is for. Not shown to participants.

setNotes(String notes)

Returns: void

Sets the administrator notes for this rule.

ParameterDescription
notesthe notes to record, or null

setOrganisation(Organisation organisation)

Returns: void

Sets the organisation this rule belongs to.

ParameterDescription
organisationthe owning organisation

getStartDate()

Returns: Date

The rule does not fire before this date. Null means it has always been active.

setStartDate(Date startDate)

Returns: void

Sets the date from which the rule fires.

ParameterDescription
startDatethe date the rule becomes active, or null for no lower bound

getEndDate()

Returns: Date

The rule does not fire after this date. Null means it never stops.

setEndDate(Date endDate)

Returns: void

Sets the date after which the rule no longer fires.

ParameterDescription
endDatethe date the rule stops being active, or null for no upper bound

getReasonMvel()

Returns: String

MVEL template evaluated to produce the reason recorded against the points this rule allocates, which is what a participant sees in their points history. It is given the rule, the reward, the amounts, the original reason, the organisation and the recipient as issueTo. Null keeps the original reason.

setReasonMvel(String reasonMvel)

Returns: void

Sets the MVEL template used to produce the reason recorded against the allocated points.

ParameterDescription
reasonMvelthe MVEL reason template, or null to keep the original reason
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.