Manages selector lists that scope things like reward eligibility and recognition nominations to a set of users, groups, organisations or org types. A selector list is JSON text built from KSelectorItem entries, each recording an inclusive or exclusive rule for one entity, and this class edits, parses and evaluates those lists on behalf of callers such as PromotionsManager and RecognitionManager.
Group: Managers
Methods
setSelector(String jsonText, boolean addOrRemove, String type, String filterType, long id)
Returns: String
Adds or removes a single entry in a JSON-encoded selector list and returns the updated list as JSON text. Existing entries are given fresh display text for the current tenant, and if an item is added its display text is resolved before the list is re-serialised.
| Parameter | Description |
|---|---|
jsonText | the existing selector list, as JSON text produced by this same method or by parseSelectors |
addOrRemove | true to add a new selector entry, false to remove the matching existing one |
type | the kind of entity being selected, eg user, group, org or orgtype |
filterType | "inclusive" or "exclusive" |
id | the id of the user, group, org or orgtype being selected |
toJson(List<KSelectorItem> items)
Returns: String
Serialises a list of selector items to JSON text, in the format used throughout the class. Returns null if the given list is null.
| Parameter | Description |
|---|---|
items | the selector items to serialise, or null |
toJson(KSelectorItem item)
Returns: String
Serialises a single selector item to JSON text, in the format used throughout the class.
| Parameter | Description |
|---|---|
item | the selector item to serialise |
parseSelectors(String jsonText)
Returns: List<KSelectorItem>
Parses a JSON-encoded selector list and resolves fresh display text for the current tenant on each typed entry.
| Parameter | Description |
|---|---|
jsonText | the selector list as JSON text, as produced by setSelector or toJson |
contains(Profile nominator, List<KSelectorItem> selectors)
Returns: boolean
Checks whether a profile is matched by a list of selector items, applying inclusive and exclusive rules across users, groups, organisations and org types for the current tenant.
| Parameter | Description |
|---|---|
nominator | the profile to test against the selectors |
selectors | the selector items to evaluate |