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.

ParameterDescription
jsonTextthe existing selector list, as JSON text produced by this same method or by parseSelectors
addOrRemovetrue to add a new selector entry, false to remove the matching existing one
typethe kind of entity being selected, eg user, group, org or orgtype
filterType"inclusive" or "exclusive"
idthe 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.

ParameterDescription
itemsthe 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.

ParameterDescription
itemthe 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.

ParameterDescription
jsonTextthe 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.

ParameterDescription
nominatorthe profile to test against the selectors
selectorsthe selector items to evaluate
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.