public class SimpleCanonicalityChecker extends Object implements CanonicalityChecker
CanonicalityChecker
.
This implementation is not efficient for multiple calls, as it fetches required data incrementally.Modifier and Type | Field and Description |
---|---|
protected static int |
BATCH_SIZE |
Constructor and Description |
---|
SimpleCanonicalityChecker(DirectoryManager directoryManager,
List<Directory> directories) |
Modifier and Type | Method and Description |
---|---|
List<Directory> |
getDirectories() |
com.google.common.collect.SetMultimap<Long,String> |
groupByCanonicalId(Set<String> names,
EntityDescriptor entityDescriptor)
Returns names grouped by their canonical directory id.
|
void |
removeNonCanonicalEntities(com.google.common.collect.Multimap<Long,String> allNames,
EntityDescriptor entityDescriptor)
Given a username is duplicated in several
user directories under the same
application . |
protected static final int BATCH_SIZE
public SimpleCanonicalityChecker(DirectoryManager directoryManager, List<Directory> directories)
public void removeNonCanonicalEntities(com.google.common.collect.Multimap<Long,String> allNames, EntityDescriptor entityDescriptor)
CanonicalityChecker
Given a username is duplicated in several user directories
under the same
application
.
The user in the first directory, according to directory ordering is considered to be the canonical user for the given username, and the other users are shadowed and thus not to be returned from searches.
This method removes all entities which were found for a given directory, but were not canonical in it (they existed in a preceding directory, not necessarily in the allEntities map). The allEntities map will be mutated in the process. For example: Given the following directories and entities:removeNonCanonicalEntities
in interface CanonicalityChecker
allNames
- a directoryId to list of entities map containing the entities to check for canonicality.entityDescriptor
- the EntityDescriptor used to look up the entities that will be determined as canonicalpublic com.google.common.collect.SetMultimap<Long,String> groupByCanonicalId(Set<String> names, EntityDescriptor entityDescriptor)
CanonicalityChecker
groupByCanonicalId
in interface CanonicalityChecker
names
- names to be groupedentityDescriptor
- entity to which the names are referring topublic List<Directory> getDirectories()
getDirectories
in interface CanonicalityChecker
Copyright © 2020 Atlassian. All rights reserved.