Owns the recognition domain: topics, levels, badges, periods, awards, points allocations and nominations that make up Kademi's gamification and leaderboard features. Registered as the "recognitionManager" service, so its exported methods are reachable from server-side JS as recognitionManager.methodName(...). As a StartableService it also wires up the event listeners that trigger an automatic recognition scan: profile subscription changes, module progress, sales data records and reward grant or debit events all funnel through to rescan the affected topics' levels, and a scheduled job periodically fires or cancels due level notifications.

Group: Managers

Implements: StartableService


Properties

PropertyReturnsDescription
allRecognitionPointsRuleTypesList<RecognitionPointsRuleType>The recognition points rule types registered in the account, used to calculate points for a level or badge from a formula rather than a fixed amount.
appIndexersList<AppIndexer>The search indexers this manager contributes to the account's search index - currently just the indexer for recognition period results, so leaderboard results can be found through search.
periodicTopicsList<RecognitionTopic>Every periodic recognition topic configured for the current tenant organisation.
recognitionServiceRecognitionServiceThe underlying recognition service that this manager delegates most of its calculations and persistence to.
topicsList<RecognitionTopic>Every recognition topic configured for the current tenant organisation.

Methods

getAppIndexers() · parsePointsRuleConfig(BaseRecognition recognition) · buildRecognitionPointsDescription(BaseRecognition recognition) · duplicatePeriod(RecognitionPeriod sourcePeriod, Organisation parentOrg, Date start, Date end) · deletePeriodResults(RecognitionPeriod period) · closePeriod(RecognitionPeriod period) · getAllRecognitionPointsRuleTypes() · findRecognitionPointsRuleType(String id) · newCalcContext() · calcCurrentValue(RecognitionTopic topic, BaseEntity participant) · calcCurrentValue(RecognitionTopic topic, BaseEntity participant, CalcContext calcContext) · calcCurrentValueForPeriod(RecognitionPeriod period, BaseEntity participant) · calcCurrentValueForPeriod(RecognitionPeriod period, BaseEntity participant, CalcContext calcContext) · findPeriodForDate(RecognitionTopic topic, Date now, BaseEntity participant) · findAllPeriodsForDate(RecognitionTopic topic, Date now) · periodLeaderboard(RecognitionPeriod period) · findParticipants(RecognitionTopic topic) · findParticipantsForPeriod(RecognitionPeriod period) · isElligibleForTopicLevels(RecognitionTopic topic, BaseEntity participant) · scanPeriod(RecognitionPeriod period) · scanLevels(RecognitionTopic topic, BaseEntity participant) · scanLevels(RecognitionPeriod period, BaseEntity participant) · getLevelStatus(RecognitionTopic topic, BaseEntity participant) · getLevelStatus(RecognitionTopic topic, BaseEntity participant, CalcContext calcContext) · buildLevelSummary(RecognitionTopic topic, BaseEntity participant) · buildLevelSummary(RecognitionTopic topic, BaseEntity participant, RecognitionPeriod period) · nextLevel(RecognitionTopic topic, BigDecimal thisLevel, BaseEntity participant) · calcActualPointsAwarded(RecognitionTopic topic, BaseEntity participant) · calcActualPointsAwarded(RecognitionPeriod period, BaseEntity participant) · findPointsAllocations(RecognitionTopic topic, BaseEntity participant) · findPointsAllocations(RecognitionTopic topic, BaseEntity participant, RecognitionPeriod period) · findSourceRecords(RecognitionTopic topic, BaseEntity participant) · findSourceRecords(RecognitionTopic topic, BaseEntity participant, RecognitionPeriod period) · achievementsSummary(BaseEntity participant) · scanLevels(RecognitionTopic topic) · processDueLevelNotificationsForCurrentOrg() · processDueLevelNotificationsForProfile(BaseEntity participant) · processDueCloseToLevelNotificationsForCurrentOrg() · processDueCloseToLevelNotificationsForProfile(BaseEntity participant) · createAward(BaseRecognition recog, BaseEntity participant, Date awardedDate) · findLevel(RecognitionTopic topic, BigDecimal value) · findLevelAmountForParticipant(RecognitionLevel level, BaseEntity participant) · findLevelAmountForParticipant(RecognitionPeriod period, RecognitionLevel level, BaseEntity participant) · findLevelAmount(RecognitionAward award) · hasLevel(RecognitionTopic topic, BigDecimal value) · findPendingNominations() · findBadgesForNomination(Profile nominator, RecognitionTopic topic) · awardBadge(RecognitionBadge badge, BaseEntity awardToEntity) · awardBadge(RecognitionBadge badge, BaseEntity awardToEntity, Date awardDate) · removeAwardBadge(RecognitionBadge badge, BaseEntity awardToEntity) · getBadge(long id) · findPeriod(long id) · findAward(long id) · deleteAward(RecognitionAward award) · deleteRecognition(BaseRecognition recog) · isRelatedToPeriodResult(BaseRecognition recog) · getNomination(long id) · createNomination(RecognitionBadge badge, Profile nominee, Profile nominator, String reason) · createTopic(String topicName, String topicTitle) · createAssetForRecognition(BaseRecognition r, ContentType type) · processNomination(RecognitionNomination nomination, Profile currentUser, boolean accept) · findBaseRecognitionAssetTypes() · findTopic(String topicName) · findTopicById(long id) · getCurrentLevelAward(RecognitionTopic topic, BaseEntity participant) · findStagingLinks(RecognitionTopic topic) · findStagingLinks(RecognitionPeriod period) · deleteStagedPoints(RecognitionTopic topic) · deleteStagedPoints(RecognitionPeriod period) · getTopics() · getPeriodicTopics() · forceCurrentLevel(BaseEntity participant, RecognitionLevel newLevel, Date awardedDate) · forceCurrentLevel(BaseEntity participant, RecognitionLevel newLevel, Date awardedDate, RecognitionPeriod period) · getRecognitionService() · findAwardsForEntity(BaseEntity baseEntity) · findLevelAwards(BaseEntity participant, RecognitionTopic topic) · findLevelAwardsForPeriod(BaseEntity participant, RecognitionPeriod period) · findBadgeAwards(BaseEntity participant, RecognitionTopic topic) · findParticipants(BaseEntity entity, RecognitionTopic t) · findParticipantsForPeriod(BaseEntity entity, RecognitionPeriod period) · startTopicScan(RecognitionTopic topic) · startTopicScan(RecognitionTopic topic, boolean revertToDryRunAfterComplete) · startTopicScan(RecognitionPeriod period) · startTopicScan(RecognitionPeriod period, boolean revertToDryRunAfterComplete) · createLevel(RecognitionTopic topic, String levelName, String levelTitle, Object levelAmount) · newLevelBuilder(RecognitionTopic topic, String levelName) · createRecognitionPeriod(RecognitionTopic topic, Reward promotion) · findPeriodResults(RecognitionPeriod period, int startPos, int pageSize) · countPeriodResults(RecognitionPeriod period) · findPeriodResults(RecognitionPeriod period, int max) · findPeriodResultForParticipant(RecognitionPeriod period, BaseEntity participant) · findClosedPeriods(RecognitionTopic topic, BaseEntity participant) · findAllClosedPeriods(RecognitionTopic topic, BaseEntity participant) · findAllPublishedPeriods(RecognitionTopic topic, BaseEntity participant) · findAllPublishedPeriods(RecognitionTopic topic, BaseEntity participant, Boolean excludeClosedPeriod) · findPeriodsForParticipant(RecognitionTopic topic, BaseEntity participant) · findPeriod(RecognitionTopic topic, BaseEntity participant, Date now) · findPeriodProjectedResult(RecognitionPeriod period, BaseEntity participant, Date now, BigDecimal actualValue) · createBadge(RecognitionTopic topic, String badgeName, String badgeTitle) · updateBaseRecognition(BaseRecognition baseRecognition) · newTopicBuilder(String name, String title) · newBadgeBuilder(RecognitionTopic topic, String name) · deleteRecognitionPeriod(RecognitionPeriod period)

getAppIndexers()

Returns: List<AppIndexer>

The search indexers this manager contributes to the account's search index - currently just the indexer for recognition period results, so leaderboard results can be found through search.

parsePointsRuleConfig(BaseRecognition recognition)

Returns: Map<String,String>

Parses a recognition's stored points rule configuration string into a map of parameter name to value, for the recognition's configured points rule type to use when calculating points.

ParameterDescription
recognitionthe recognition whose points rule configuration should be parsed

buildRecognitionPointsDescription(BaseRecognition recognition)

Returns: String

Builds a human-readable description of a recognition's configured points rule, by parsing its stored configuration and asking the matching points rule type to describe it. Returns null if the recognition has no points rule type configured, or a warning string if the configured rule type id is not registered.

ParameterDescription
recognitionthe recognition to describe the points rule for

duplicatePeriod(RecognitionPeriod sourcePeriod, Organisation parentOrg, Date start, Date end)

Returns: RecognitionPeriod

Duplicates a recognition period for a different organisation: clones the source period's promotion, scopes the new promotion's participant selector to the given organisation, and creates a new period linking to it under the source period's topic. Used to roll a periodic topic's promotion out to a new organisation without recreating its configuration by hand. Requires a logged in user, and the source period must not already be deleted.

ParameterDescription
sourcePeriodthe period whose promotion configuration should be duplicated
parentOrgthe organisation the new period's promotion is scoped to
startthe start date of the new period's promotion
endthe end date of the new period's promotion

deletePeriodResults(RecognitionPeriod period)

Returns: void

Deletes every recorded result (ranking row) for a recognition period, without affecting the period itself, its awards, or its points allocations. Used before rescanning a period so stale rankings do not linger alongside freshly calculated ones.

ParameterDescription
periodthe period whose results should be deleted

closePeriod(RecognitionPeriod period)

Returns: void

Finalises a recognition period: awards each participant's final points for the period (topping up a continuous-mode topic's already-reconciled points, or awarding the outstanding lump sum for an award-on-level-reached topic) and marks the period as processed. This is one-way - a dry-run topic has nothing real to close, and closing again, or before results have been calculated, is rejected.

ParameterDescription
periodthe period to close

getAllRecognitionPointsRuleTypes()

Returns: List<RecognitionPointsRuleType>

The recognition points rule types registered in the account, used to calculate points for a level or badge from a formula rather than a fixed amount.

findRecognitionPointsRuleType(String id)

Returns: RecognitionPointsRuleType

Finds a registered recognition points rule type by its id.

ParameterDescription
idthe rule type's id

newCalcContext()

Returns: CalcContext

Creates a fresh, empty calculation context for tracking cache state and call depth across a single recognition value calculation. Callers that want several calculations to share cached lookups should create one explicitly and pass it through, rather than relying on the overloads that create a new one per call.

calcCurrentValue(RecognitionTopic topic, BaseEntity participant)

Returns: BigDecimal

Calculates a participant's current value for a topic (for example, total sales or total points, depending on the topic's data source), using a fresh calculation context. This is potentially expensive - prefer the overload that accepts a CalcContext when making several calculations together, so cached lookups can be reused.

ParameterDescription
topicthe topic to calculate the current value for
participantthe participant to calculate the current value for

calcCurrentValue(RecognitionTopic topic, BaseEntity participant, CalcContext calcContext)

Returns: BigDecimal

Calculates a participant's current value for a topic (for example, total sales or total points, depending on the topic's data source), for a non-periodic topic. Potentially expensive - may query source records or run a metric calculation depending on the topic's configuration.

ParameterDescription
topicthe topic to calculate the current value for
participantthe participant to calculate the current value for
calcContextthe calculation context to use, allowing cached lookups to be reused across several calculations

calcCurrentValueForPeriod(RecognitionPeriod period, BaseEntity participant)

Returns: BigDecimal

Calculates a participant's current value for a single period of a periodic topic, using a fresh calculation context.

ParameterDescription
periodthe period to calculate the current value for
participantthe participant to calculate the current value for

calcCurrentValueForPeriod(RecognitionPeriod period, BaseEntity participant, CalcContext calcContext)

Returns: BigDecimal

Calculates a participant's current value for a single period of a periodic topic, scoped to the period's start and end dates.

ParameterDescription
periodthe period to calculate the current value for
participantthe participant to calculate the current value for
calcContextthe calculation context to use, allowing cached lookups to be reused across several calculations

findPeriodForDate(RecognitionTopic topic, Date now, BaseEntity participant)

Returns: RecognitionPeriod

Finds the recognition period for which the given participant is eligible and which covers the given date. Returns null if no suitable period can be found, or if the topic is not configured for periodicity.

ParameterDescription
topicthe topic to find a period within
nowthe date the period must cover
participantthe participant who must be eligible for the period

findAllPeriodsForDate(RecognitionTopic topic, Date now)

Returns: List<RecognitionPeriod>

Finds every period in a topic that covers the given date. For most topics this returns at most one period, but overlapping periods are technically possible, so this returns all of them rather than assuming uniqueness.

ParameterDescription
topicthe topic to find periods within
nowthe date the periods must cover

periodLeaderboard(RecognitionPeriod period)

Returns: RecognitionPeriodLeaderboard

Builds a leaderboard helper for a recognition period, used to page through ranked results and look up the current user's own ranking without repeating the underlying query each time.

ParameterDescription
periodthe period to build a leaderboard for

findParticipants(RecognitionTopic topic)

Returns: Collection<? extends BaseEntity>

Finds every entity currently eligible to participate in a topic - a profile or organisation, depending on whether the topic is configured for organisation-level awards.

ParameterDescription
topicthe topic to find participants for

findParticipantsForPeriod(RecognitionPeriod period)

Returns: Collection<? extends BaseEntity>

Finds every entity currently eligible to participate in a recognition period.

ParameterDescription
periodthe period to find participants for

isElligibleForTopicLevels(RecognitionTopic topic, BaseEntity participant)

Returns: boolean

Whether the given participant is eligible to participate in level awards for a non-periodic topic.

ParameterDescription
topicthe topic to check eligibility for
participantthe participant to check eligibility for

scanPeriod(RecognitionPeriod period)

Returns: void

Scans every eligible participant of a recognition period, recalculating and recording each one's level and points, then updates the period's rankings. This is the main entry point for recalculating a whole period's results, for example after configuration changes or as part of a scheduled or manually triggered scan.

ParameterDescription
periodthe period to scan

scanLevels(RecognitionTopic topic, BaseEntity participant)

Returns: void

Recalculates and records the given participant's level and points for a non-periodic topic.

ParameterDescription
topicthe topic to scan levels for, ignored (no-op) if null
participantthe participant to scan, ignored (no-op) if null

scanLevels(RecognitionPeriod period, BaseEntity participant)

Returns: void

Recalculates and records the given participant's level and points for a single period of a periodic topic.

ParameterDescription
periodthe period to scan levels for
participantthe participant to scan

getLevelStatus(RecognitionTopic topic, BaseEntity participant)

Returns: LevelStatus

The given participant's current level status for a non-periodic topic - their current level, the next level up, and their progress towards it - calculated with a fresh calculation context.

ParameterDescription
topicthe topic to get the level status for
participantthe participant to get the level status for

getLevelStatus(RecognitionTopic topic, BaseEntity participant, CalcContext calcContext)

Returns: LevelStatus

The given participant's current level status for a non-periodic topic - their current level, the next level up, and their progress towards it.

ParameterDescription
topicthe topic to get the level status for
participantthe participant to get the level status for
calcContextthe calculation context to use, allowing cached lookups to be reused across several calculations

buildLevelSummary(RecognitionTopic topic, BaseEntity participant)

Returns: LevelSummary

Builds the full level ladder for a participant in a non-periodic topic, or where no period is in scope.

ParameterDescription
topicthe topic whose levels should be summarised
participantthe participant to resolve participant-specific level amounts for

buildLevelSummary(RecognitionTopic topic, BaseEntity participant, RecognitionPeriod period)

Returns: LevelSummary

Builds the full level ladder for a participant: one level summary item per level in the topic, ordered by the participant-specific level amount (which resolves data-series and lookup-table overrides rather than just the level's default amount), each paired with the next level up so a UI can render the range a participant must cross to advance. The final (highest) level has a null next level and next level amount, since there is nothing further to advance to.

ParameterDescription
topicthe topic whose levels should be summarised
participantthe participant to resolve participant-specific level amounts for
periodthe currently relevant period, or null for a non-periodic topic

nextLevel(RecognitionTopic topic, BigDecimal thisLevel, BaseEntity participant)

Returns: Pair<RecognitionLevel,BigDecimal>

Finds the level whose participant-specific amount is the smallest amount still greater than the given level amount, ie the next level up from that amount.

ParameterDescription
topicthe topic to search levels within
thisLevelthe level amount to find the next level above
participantthe participant to resolve participant-specific level amounts for

calcActualPointsAwarded(RecognitionTopic topic, BaseEntity participant)

Returns: BigDecimal

Sums the points actually awarded to a participant for a topic, across all time rather than scoped to any single period, so an admin can compare it against the calculated points preview to see whether the participant has been paid what they are currently entitled to. For a continuous-mode topic this is the net of credits minus debits already reconciled via points allocations. For an award-once topic it is the sum of each non-deleted level award's own points credit - a regression debit under an award-once topic is never linked back to the topic in the data model, so is not reflected here; this matches the existing "total points" figure already shown for a topic's whole awards table.

ParameterDescription
topicthe topic to sum awarded points for
participantthe participant to sum awarded points for

calcActualPointsAwarded(RecognitionPeriod period, BaseEntity participant)

Returns: BigDecimal

Sums the points actually awarded to a participant for a period's topic. For a continuous-mode topic this is scoped to the given period (net of credits minus debits reconciled via points allocations); for an award-once topic it sums every level award's points credit for the topic across all periods, the same as the topic-only overload, since award-once points are not tracked per period.

ParameterDescription
periodthe period whose topic to sum awarded points for
participantthe participant to sum awarded points for

findPointsAllocations(RecognitionTopic topic, BaseEntity participant)

Returns: List<PointsAllocation>

As the period-scoped overload, for a non-periodic topic or where no period is in scope. Velocity resolves overloads by the declared argument types, so a template holding a possibly-unset period reference must branch to this overload rather than passing the period reference through - passing an unset (or wrongly-typed) reference straight into the period-scoped overload fails to resolve at all.

ParameterDescription
topicthe topic to find allocations for
participantthe participant the allocation's credit or debit was issued to

findPointsAllocations(RecognitionTopic topic, BaseEntity participant, RecognitionPeriod period)

Returns: List<PointsAllocation>

Finds the points allocation records linked to any level under the given topic where the credit or debit was issued to the given participant, optionally scoped to a single period so a UI can show only the allocations relevant to that period. When scoped to a period, this also includes level-only allocations which have no period link at all - unlike the stricter continuous-points reconciliation lookup, this method is for display purposes, where a level-only allocation is still relevant to the participant and topic and should not be hidden just because it isn't tied to this particular period.

ParameterDescription
topicthe topic to find allocations for
participantthe participant the allocation's credit or debit was issued to
periodthe period to scope allocations to, or null to return allocations across all periods (and non-periodic topics)

findSourceRecords(RecognitionTopic topic, BaseEntity participant)

Returns: List<?>

As the period-scoped overload, for a non-periodic topic or covering the topic's whole date range.

ParameterDescription
topicthe topic to find source records for
participantthe participant to find source records for

findSourceRecords(RecognitionTopic topic, BaseEntity participant, RecognitionPeriod period)

Returns: List<?>

Finds the underlying source records which feed into a topic's current value calculation for a participant. Only data-series and points-bucket topics are supported, since those are the only two types with a natural list of individual source records to show; elearning and metric topics return an empty list. At most MAX_SOURCE_RECORDS records are returned - there is no pagination, this is just a cap to avoid ever loading an unbounded result set.

ParameterDescription
topicthe topic to find source records for
participantthe participant to find source records for
periodthe period to scope records to, for a periodic topic - pass null for a non-periodic topic

achievementsSummary(BaseEntity participant)

Returns: AchievementsSummary

Builds the achievements summary for a participant across every recognition topic in the account.

ParameterDescription
participantthe participant to summarise achievements for

scanLevels(RecognitionTopic topic)

Returns: void

Scans the current user for a non-periodic topic, recalculating and recording their level and points.

ParameterDescription
topicthe topic to scan levels for

processDueLevelNotificationsForCurrentOrg()

Returns: int

Fires (or cancels) every due level notification of every type, belonging to the current tenant organisation only. For manual invocation from the topic admin page, so an admin does not have to wait for the next scheduled run, and other accounts' notifications are left untouched.

processDueLevelNotificationsForProfile(BaseEntity participant)

Returns: int

As the current-org overload, but restricted to due notifications for a single participant. For manually testing the feature against one profile without firing every other due notification in the account.

ParameterDescription
participantthe profile (or org) to process due level notifications for

processDueCloseToLevelNotificationsForCurrentOrg()

Returns: int

As the current-org overload, but restricted to close-to-level notifications.

processDueCloseToLevelNotificationsForProfile(BaseEntity participant)

Returns: int

As the per-profile overload, but restricted to close-to-level notifications.

ParameterDescription
participantthe profile (or org) to process due close-to-level notifications for

createAward(BaseRecognition recog, BaseEntity participant, Date awardedDate)

Returns: RecognitionAward

Creates (or updates) a recognition award for a participant. If the participant already has an award for this recognition, its awarded date is updated instead of creating a duplicate.

ParameterDescription
recogthe recognition (level or badge) to award
participantthe participant to award it to
awardedDatethe date the award was earned

findLevel(RecognitionTopic topic, BigDecimal value)

Returns: RecognitionLevel

Finds the highest level in a topic whose default level amount the given value meets or exceeds. Uses each level's default amount for comparison, not any participant-specific override.

ParameterDescription
topicthe topic to search levels within, or null to get no match
valuethe value to find the matching level for

findLevelAmountForParticipant(RecognitionLevel level, BaseEntity participant)

Returns: BigDecimal

The participant-specific amount at which the given level is reached, resolving any data-series or lookup-table override configured on the level rather than just its default amount.

ParameterDescription
levelthe level to find the participant-specific amount for
participantthe participant to resolve the amount for

findLevelAmountForParticipant(RecognitionPeriod period, RecognitionLevel level, BaseEntity participant)

Returns: BigDecimal

As the period-less overload, but resolves the level amount within the context of a specific period, for a level whose data-series or lookup-table override is period-scoped.

ParameterDescription
periodthe period to resolve the level amount within
levelthe level to find the participant-specific amount for
participantthe participant to resolve the amount for

findLevelAmount(RecognitionAward award)

Returns: BigDecimal

The participant-specific amount at which the level of the given award was reached, resolved within the award's period if it has one.

ParameterDescription
awardthe level award to find the level amount for

hasLevel(RecognitionTopic topic, BigDecimal value)

Returns: boolean

Whether the given value meets or exceeds any level's default amount in the topic.

ParameterDescription
topicthe topic to check
valuethe value to check

findPendingNominations()

Returns: List<RecognitionNomination>

Every recognition nomination pending review for the current tenant organisation.

findBadgesForNomination(Profile nominator, RecognitionTopic topic)

Returns: List<RecognitionBadge>

Finds every badge in a topic that the given profile is allowed to nominate someone for, based on each badge's configured nominator selector. A badge with no nominator selector configured is excluded, since it has no restriction to check against.

ParameterDescription
nominatorthe profile who would be making the nomination
topicthe topic to find nominatable badges within

awardBadge(RecognitionBadge badge, BaseEntity awardToEntity)

Returns: RecognitionAward

Awards a badge to an entity, unless they already have it - in which case this is a no-op that returns null rather than creating a duplicate award.

ParameterDescription
badgethe badge to award
awardToEntitythe entity to award the badge to

awardBadge(RecognitionBadge badge, BaseEntity awardToEntity, Date awardDate)

Returns: RecognitionAward

As the two-argument overload, but with an explicit awarded date rather than the current date.

ParameterDescription
badgethe badge to award
awardToEntitythe entity to award the badge to
awardDatethe date the badge was earned

removeAwardBadge(RecognitionBadge badge, BaseEntity awardToEntity)

Returns: void

Removes a participant's award of a badge, if they have one. Logs a warning and does nothing if they do not currently have the badge.

ParameterDescription
badgethe badge to remove
awardToEntitythe entity to remove the badge from

getBadge(long id)

Returns: RecognitionBadge

Finds a recognition badge by id, scoped to the current tenant organisation.

ParameterDescription
idthe badge's id

findPeriod(long id)

Returns: RecognitionPeriod

Finds a recognition period by id, scoped to the current tenant organisation.

ParameterDescription
idthe period's id

findAward(long id)

Returns: RecognitionAward

Finds a recognition award by id, scoped to the current tenant organisation.

ParameterDescription
idthe award's id

deleteAward(RecognitionAward award)

Returns: void

Deletes a recognition award, firing a recognition-lost event first so listeners can react (for example, a funnel automation) before the award record is removed.

ParameterDescription
awardthe award to delete, ignored (no-op) if null

deleteRecognition(BaseRecognition recog)

Returns: void

Physically deletes a recognition (level or badge) and every award linked to it.

ParameterDescription
recogthe recognition to delete

isRelatedToPeriodResult(BaseRecognition recog)

Returns: boolean

Whether a recognition (level or badge) is linked to any period result, either directly or through one of its awards. Used to warn before a destructive change that would affect period results already calculated for it.

ParameterDescription
recogthe recognition to check

getNomination(long id)

Returns: RecognitionNomination

Finds a recognition nomination by id, scoped to the current tenant organisation.

ParameterDescription
idthe nomination's id

createNomination(RecognitionBadge badge, Profile nominee, Profile nominator, String reason)

Returns: RecognitionNomination

Creates a nomination of a profile for a badge by another profile, first validating both against the badge's configured nominee and nominator selectors and rejecting the nomination if either is not eligible.

ParameterDescription
badgethe badge being nominated for
nomineethe profile being nominated
nominatorthe profile making the nomination
reasonthe reason given for the nomination

createTopic(String topicName, String topicTitle)

Returns: RecognitionTopic

Creates a new recognition topic and reports its creation to account telemetry.

ParameterDescription
topicNamethe unique, path-safe name for the topic
topicTitlethe display title for the topic

createAssetForRecognition(BaseRecognition r, ContentType type)

Returns: Asset

Creates a content asset for a recognition (level or badge) and links it to the recognition's asset id.

ParameterDescription
rthe recognition to create an asset for
typethe type of content asset to create

processNomination(RecognitionNomination nomination, Profile currentUser, boolean accept)

Returns: void

Accepts or rejects a recognition nomination. Accepting also creates the award for the nominated badge; rejecting just records the rejection.

ParameterDescription
nominationthe nomination to process
currentUserthe profile processing the nomination
accepttrue to accept the nomination, false to reject it

findBaseRecognitionAssetTypes()

Returns: Set<ContentType>

The content types applicable for a recognition's image asset.

findTopic(String topicName)

Returns: RecognitionTopic

Finds a recognition topic by name, scoped to the current tenant organisation.

ParameterDescription
topicNamethe topic's unique name

findTopicById(long id)

Returns: RecognitionTopic

Finds a recognition topic by id.

ParameterDescription
idthe topic's id

getCurrentLevelAward(RecognitionTopic topic, BaseEntity participant)

Returns: RecognitionAward

The highest level award the given participant currently holds in a topic - their current level.

ParameterDescription
topicthe topic to find the current level award for
participantthe participant to find the current level award for

Returns: List<StagingLink>

A single-item list linking to a topic's dry-run preview spreadsheet, if it has already been created.

ParameterDescription
topicthe topic to find a dry-run staging link for

Returns: List<StagingLink>

A single-item list linking to a recognition period's own dry-run preview spreadsheet, if it has already been created.

ParameterDescription
periodthe period to find a dry-run staging link for

deleteStagedPoints(RecognitionTopic topic)

Returns: void

Permanently discards every row recorded for a recognition topic's dry-run preview, without awarding anything - dry-run never creates any real records to award in the first place, so to get real points, temporarily switch the topic off dry-run and run it for real instead.

ParameterDescription
topicthe recognition topic to clear the dry-run preview for

deleteStagedPoints(RecognitionPeriod period)

Returns: void

Permanently discards every row recorded for a recognition period's own dry-run preview, without awarding anything.

ParameterDescription
periodthe period to clear the dry-run preview for

getTopics()

Returns: List<RecognitionTopic>

Every recognition topic configured for the current tenant organisation.

getPeriodicTopics()

Returns: List<RecognitionTopic>

Every periodic recognition topic configured for the current tenant organisation.

forceCurrentLevel(BaseEntity participant, RecognitionLevel newLevel, Date awardedDate)

Returns: RecognitionAward

Forces a participant directly to a given level for a non-periodic topic, overriding whatever their calculated level would be. Requires a logged in user.

ParameterDescription
participantthe participant to force the level for
newLevelthe level to force the participant to
awardedDatethe date to record the award as earned, or null to use the current date

forceCurrentLevel(BaseEntity participant, RecognitionLevel newLevel, Date awardedDate, RecognitionPeriod period)

Returns: RecognitionAward

As the three-argument overload, but scoped to a single period of a periodic topic.

ParameterDescription
participantthe participant to force the level for
newLevelthe level to force the participant to
awardedDatethe date to record the award as earned, or null to use the current date
periodthe period to force the level within

getRecognitionService()

Returns: RecognitionService

The underlying recognition service that this manager delegates most of its calculations and persistence to.

findAwardsForEntity(BaseEntity baseEntity)

Returns: List<RecognitionAward>

Every recognition award ever made to the given entity, across every topic.

ParameterDescription
baseEntitythe entity to find awards for

findLevelAwards(BaseEntity participant, RecognitionTopic topic)

Returns: List<RecognitionAward>

Every level award (excluding badge awards) made to a participant within a topic.

ParameterDescription
participantthe participant to find level awards for
topicthe topic to find level awards within

findLevelAwardsForPeriod(BaseEntity participant, RecognitionPeriod period)

Returns: List<RecognitionAward>

Every level award made to a participant within a single period of a topic.

ParameterDescription
participantthe participant to find level awards for
periodthe period to find level awards within

findBadgeAwards(BaseEntity participant, RecognitionTopic topic)

Returns: List<RecognitionAward>

Every badge award (excluding level awards) made to a participant within a topic.

ParameterDescription
participantthe participant to find badge awards for
topicthe topic to find badge awards within

findParticipants(BaseEntity entity, RecognitionTopic t)

Returns: List<? extends BaseEntity>

Finds every participant for a topic that is related to the given entity - not just the entity itself, but every entity related to it that is eligible to participate.

ParameterDescription
entitythe entity to find related participants for
tthe topic to find participants within

findParticipantsForPeriod(BaseEntity entity, RecognitionPeriod period)

Returns: List<? extends BaseEntity>

For the given entity (typically the current user), finds the participants relevant to a recognition period. If the entity is a profile and the period's promotion is profile-based, the entity itself is returned; if the promotion is organisation-based, this returns the organisations the entity has access to which are eligible for the promotion.

ParameterDescription
entitythe entity to find participants for
periodthe period to find participants within

startTopicScan(RecognitionTopic topic)

Returns: AsyncJob

Starts an asynchronous full scan of a non-periodic topic, recalculating levels for every participant. Not valid for a periodic topic, which must be scanned one period at a time instead.

ParameterDescription
topicthe topic to scan

startTopicScan(RecognitionTopic topic, boolean revertToDryRunAfterComplete)

Returns: AsyncJob

Starts an asynchronous full scan of a non-periodic topic, recalculating levels for every participant. Not valid for a periodic topic, which must be scanned one period at a time instead.

ParameterDescription
topicthe topic to scan
revertToDryRunAfterCompletewhen true, the topic's calc mode is switched back to dry-run once the scan finishes, regardless of what calc mode was in effect while it ran. Used to allow a single real-points scan on a dry-run topic without leaving it permanently out of dry-run mode.

startTopicScan(RecognitionPeriod period)

Returns: AsyncJob

Starts an asynchronous scan of a single period, recalculating levels for every participant in that period.

ParameterDescription
periodthe period to scan

startTopicScan(RecognitionPeriod period, boolean revertToDryRunAfterComplete)

Returns: AsyncJob

Starts an asynchronous scan of a single period, recalculating levels for every participant in that period. Not valid for a period that has already been closed.

ParameterDescription
periodthe period to scan
revertToDryRunAfterCompletewhen true, the period's topic is switched back to dry-run once the scan finishes, regardless of what calc mode was in effect while it ran. Used to allow a single real-points scan (publish or re-publish results) on a dry-run periodic topic without leaving it permanently out of dry-run mode.

createLevel(RecognitionTopic topic, String levelName, String levelTitle, Object levelAmount)

Returns: RecognitionLevel

Creates a level in a topic with a fixed threshold amount.

ParameterDescription
topicthe topic to create the level in
levelNamethe unique, path-safe name for the level
levelTitlethe display title for the level
levelAmountthe threshold amount at which the level is reached, coerced to a number

newLevelBuilder(RecognitionTopic topic, String levelName)

Returns: RecognitionLevelBuilder

Creates a new level builder for configuring and creating a level in a topic.

ParameterDescription
topicthe topic to create the level in
levelNamethe unique, path-safe name for the level

createRecognitionPeriod(RecognitionTopic topic, Reward promotion)

Returns: RecognitionPeriod

Creates a new period for a periodic topic, linked to the given promotion.

ParameterDescription
topicthe topic to create the period in
promotionthe promotion (reward) the period is linked to

findPeriodResults(RecognitionPeriod period, int startPos, int pageSize)

Returns: List<RecognitionPeriodResult>

A page of ranked results for a recognition period, for showing a leaderboard.

ParameterDescription
periodthe period to find results for
startPosthe zero-based index of the first result to return
pageSizethe maximum number of results to return

countPeriodResults(RecognitionPeriod period)

Returns: long

The total number of results recorded for a recognition period.

ParameterDescription
periodthe period to count results for

findPeriodResults(RecognitionPeriod period, int max)

Returns: List<RecognitionPeriodResult>

The highest-ranked results for a recognition period, up to a maximum count. Can be used to show leaderboards.

ParameterDescription
periodthe period to find results for
maxthe maximum number of results to return

findPeriodResultForParticipant(RecognitionPeriod period, BaseEntity participant)

Returns: RecognitionPeriodResult

Finds a specific participant's result for a recognition period.

ParameterDescription
periodthe period to find the result within
participantthe participant to find the result for

findClosedPeriods(RecognitionTopic topic, BaseEntity participant)

Returns: RecognitionPeriod

Finds the first closed period of a topic (one with a processed date) whose promotion has started and for which the given participant is eligible.

ParameterDescription
topicthe topic to find a closed period within
participantthe participant to check eligibility for

findAllClosedPeriods(RecognitionTopic topic, BaseEntity participant)

Returns: List<RecognitionPeriod>

Finds every closed period of a topic (one with a processed date) whose promotion has started and for which the given participant is eligible.

ParameterDescription
topicthe topic to find closed periods within
participantthe participant to check eligibility for

findAllPublishedPeriods(RecognitionTopic topic, BaseEntity participant)

Returns: List<RecognitionPeriod>

Finds every open, published period of a topic for which the given participant is eligible. Closed periods are excluded.

ParameterDescription
topicthe topic to find published periods within
participantthe participant to check eligibility for

findAllPublishedPeriods(RecognitionTopic topic, BaseEntity participant, Boolean excludeClosedPeriod)

Returns: List<RecognitionPeriod>

Finds every published period of a topic for which the given participant is eligible.

ParameterDescription
topicthe topic to find published periods within
participantthe participant to check eligibility for
excludeClosedPeriodif true, closed periods are excluded; defaults to true if null

findPeriodsForParticipant(RecognitionTopic topic, BaseEntity participant)

Returns: List<RecognitionPeriod>

Finds every active period of a topic for which the given participant is eligible.

ParameterDescription
topicthe topic to find periods within
participantthe participant to check eligibility for

findPeriod(RecognitionTopic topic, BaseEntity participant, Date now)

Returns: RecognitionPeriod

Finds the single active period of a topic that covers the given date and for which the given participant is eligible. Multiple overlapping periods are technically possible but would be a configuration error - there should only ever be one active period for a given participant and topic at a given date.

ParameterDescription
topicthe topic to find a period within
participantthe participant to check eligibility for
nowthe date the period must cover

findPeriodProjectedResult(RecognitionPeriod period, BaseEntity participant, Date now, BigDecimal actualValue)

Returns: PeriodProjectedResult

Builds a projected-result helper for a participant in a period, used to project their final value and level from their actual value so far and the proportion of the period elapsed.

ParameterDescription
periodthe period to project a result for
participantthe participant to project a result for
nowthe date to calculate elapsed proportion from
actualValuethe participant's actual value so far in the period

createBadge(RecognitionTopic topic, String badgeName, String badgeTitle)

Returns: RecognitionBadge

Creates a badge in a topic.

ParameterDescription
topicthe topic to create the badge in
badgeNamethe unique, path-safe name for the badge
badgeTitlethe display title for the badge

updateBaseRecognition(BaseRecognition baseRecognition)

Returns: void

Saves changes to a recognition (level or badge).

ParameterDescription
baseRecognitionthe recognition to save

newTopicBuilder(String name, String title)

Returns: RecognitionTopicBuilder

Creates a new RecognitionTopicBuilder which can be used to create a recognition topic

ParameterDescription
namethe name of the topic as a {@code String}
titlethe title of the topic as a {@code String}

newBadgeBuilder(RecognitionTopic topic, String name)

Returns: RecognitionBadgeBuilder

Creates a new RecognitionBadgeBuilder which can be used to create a recognition badge

ParameterDescription
topicthe topic to which the badge belongs as a {@code RecognitionTopic}
namethe name of the badge as a {@code String}

deleteRecognitionPeriod(RecognitionPeriod period)

Returns: void

Soft deletes the given recognition period

ParameterDescription
period{@code RecognitionPeriod} to be deleted
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.