Records one allocation of points made by the points engine, linking the credit or debit it created back to whatever caused it. An allocation comes from one of two places. Sales data allocations have a source, and the CSV of sales data record IDs they were calculated from; recognition allocations have a recognition level instead, and a period as well when the topic is periodic. At most one of the points credit and the points debit is set, so the net points allocated by a set of rows is the sum of their credits less their debits. A row with a zero amount and no credit or debit is a marker saying the source records were processed but earned nothing, and a row with an error message records a failure while processing them.
Group: Database Entities
Implements: Serializable, Relational
Properties
| Property | Returns | Description |
|---|---|---|
| adminDomain | Organisation | The admin organisation which owns this allocation, taken from the source data series' organisation or from the recognition level when the allocation is created. Reads are scoped by it so one account never sees another account's allocations. |
| createdDate | Date | The date and time this allocation was made, which for a sales data allocation is when the record was processed rather than the date of the sale itself. Allocation listings are ordered by it, most recent first. |
| errorMsg | String | The message recorded when the points engine failed while processing this allocation's sales data records, truncated to 2000 characters, or null if it succeeded. Rows with an error carry a zero amount and no credit or debit. |
| id | long | Unique identifier for this allocation, assigned by the database when the row is first saved. |
| period | RecognitionPeriod | The period this allocation was made for, when awarded via a periodic recognition topic. Null for non-periodic topics. Used to scope continuous points reconciliation to a single period, so a prior period's payout is never netted against a later period's entitlement. |
| points | Points | The points credit this allocation created, or null if the allocation created a debit instead, earned nothing, or failed. |
| pointsAmount | BigDecimal | The number of points this allocation moved, held as a positive magnitude. Whether it was added or taken away is decided by which of the points credit and the points debit is set, not by the sign. Zero on a marker row for source records which earned nothing, and on an error row. |
| pointsDebit | PointsDebit | The points debit this allocation created, or null if the allocation created a credit instead, earned nothing, or failed. Only one of the credit and the debit is ever set on a single allocation. |
| recognitionLevel | RecognitionLevel | The recognition level which generated this allocation, if any. Used for topic-based (non sales-data) points allocations, eg from continuous level points awards. Null for allocations made from a sales data source. |
| salesDataRecordIds | String | Comma separated IDs of the sales data records this allocation was calculated from, limited to 2000 characters. Blank for allocations made from a recognition level, which have no sales data behind them. Call salesRecordIds to read it as a list of numbers. |
| source | PointsAllocationSource | The sales data source whose records triggered this allocation, ie a rule over a SalesDataSeries. Null for allocations made from a recognition level, which use the recognition level instead. |
Methods
getId() · getAdminDomain() · getPoints() · getPointsDebit() · getSalesDataRecordIds() · getErrorMsg() · getSource() · getRecognitionLevel() · getPeriod() · getPointsAmount() · getCreatedDate() · salesRecordIds() · containsSalesRecord(SalesDataRecord record)
getId()
Returns: long
Unique identifier for this allocation, assigned by the database when the row is first saved.
getAdminDomain()
Returns: Organisation
The admin organisation which owns this allocation, taken from the source data series' organisation or from the recognition level when the allocation is created. Reads are scoped by it so one account never sees another account's allocations.
getPoints()
Returns: Points
The points credit this allocation created, or null if the allocation created a debit instead, earned nothing, or failed.
getPointsDebit()
Returns: PointsDebit
The points debit this allocation created, or null if the allocation created a credit instead, earned nothing, or failed. Only one of the credit and the debit is ever set on a single allocation.
getSalesDataRecordIds()
Returns: String
Comma separated IDs of the sales data records this allocation was calculated from, limited to 2000 characters. Blank for allocations made from a recognition level, which have no sales data behind them. Call salesRecordIds to read it as a list of numbers.
getErrorMsg()
Returns: String
The message recorded when the points engine failed while processing this allocation's sales data records, truncated to 2000 characters, or null if it succeeded. Rows with an error carry a zero amount and no credit or debit.
getSource()
Returns: PointsAllocationSource
The sales data source whose records triggered this allocation, ie a rule over a SalesDataSeries. Null for allocations made from a recognition level, which use the recognition level instead.
getRecognitionLevel()
Returns: RecognitionLevel
The recognition level which generated this allocation, if any. Used for topic-based (non sales-data) points allocations, eg from continuous level points awards. Null for allocations made from a sales data source.
getPeriod()
Returns: RecognitionPeriod
The period this allocation was made for, when awarded via a periodic recognition topic. Null for non-periodic topics. Used to scope continuous points reconciliation to a single period, so a prior period's payout is never netted against a later period's entitlement.
getPointsAmount()
Returns: BigDecimal
The number of points this allocation moved, held as a positive magnitude. Whether it was added or taken away is decided by which of the points credit and the points debit is set, not by the sign. Zero on a marker row for source records which earned nothing, and on an error row.
getCreatedDate()
Returns: Date
The date and time this allocation was made, which for a sales data allocation is when the record was processed rather than the date of the sale itself. Allocation listings are ordered by it, most recent first.
salesRecordIds()
Returns: List<Long>
Reads the stored CSV of sales data record IDs as a list of numbers. Returns an empty list, never null, when there are none, which is always the case for an allocation made from a recognition level. Entries which are not a positive number are skipped rather than reported.
containsSalesRecord(SalesDataRecord record)
Returns: boolean
Says whether the given sales data record is one of those this allocation was calculated from. The stored CSV is parsed on every call, so read salesRecordIds once instead when checking a number of records.
| Parameter | Description |
|---|---|
record | the sales data record to look for |