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
| Property | Returns | Description |
|---|---|---|
| addValue | BigDecimal | Amount added to the points being allocated before anything else is applied. A negative value subtracts, and null leaves the amount alone. |
| createdBy | Profile | The profile of the administrator who created this rule. |
| createdDate | Date | When this rule was created. |
| dataSeries | 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. |
| deletedBy | Profile | The profile of the administrator who soft deleted this rule, or null if it has not been deleted. |
| deletedDate | 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. |
| endDate | Date | The rule does not fire after this date. Null means it never stops. |
| id | long | Primary key of this rule, assigned when it is first saved. |
| issueTo | BaseEntity | Restricts the rule to allocations made to this one profile or organisation. Null means the rule applies to every recipient. |
| modifiedBy | Profile | The profile of the administrator who last changed this rule. |
| modifiedDate | Date | When this rule was last changed. Stored to day precision only. |
| multValue | 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. |
| mvelExpression | 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. |
| name | 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. |
| notes | String | Free-text notes for administrators explaining what this rule is for. Not shown to participants. |
| promotion | 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. |
| reasonMvel | 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. |
| rewardDest | 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. |
| startDate | Date | The rule does not fire before this date. Null means it has always been active. |
| title | 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. |
| transferTo | 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. |
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.
| Parameter | Description |
|---|---|
rewardDest | the 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.
| Parameter | Description |
|---|---|
promotion | the 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.
| Parameter | Description |
|---|---|
addValue | the 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.
| Parameter | Description |
|---|---|
multValue | the 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.
| Parameter | Description |
|---|---|
issueTo | the 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.
| Parameter | Description |
|---|---|
transferTo | the 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.
| Parameter | Description |
|---|---|
id | the 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.
| Parameter | Description |
|---|---|
name | the 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.
| Parameter | Description |
|---|---|
title | the 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.
| Parameter | Description |
|---|---|
dataSeries | the 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.
| Parameter | Description |
|---|---|
modifiedDate | the 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.
| Parameter | Description |
|---|---|
modifiedBy | the last modifying profile |
getCreatedDate()
Returns: Date
When this rule was created.
setCreatedDate(Date createdDate)
Returns: void
Sets when this rule was created.
| Parameter | Description |
|---|---|
createdDate | the 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.
| Parameter | Description |
|---|---|
createdBy | the 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.
| Parameter | Description |
|---|---|
deletedDate | the 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.
| Parameter | Description |
|---|---|
deletedBy | the 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.
| Parameter | Description |
|---|---|
mvelExpression | the 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.
| Parameter | Description |
|---|---|
notes | the notes to record, or null |
setOrganisation(Organisation organisation)
Returns: void
Sets the organisation this rule belongs to.
| Parameter | Description |
|---|---|
organisation | the 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.
| Parameter | Description |
|---|---|
startDate | the 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.
| Parameter | Description |
|---|---|
endDate | the 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.
| Parameter | Description |
|---|---|
reasonMvel | the MVEL reason template, or null to keep the original reason |