public class CanonicalityChecker extends Object
Modifier and Type | Field and Description |
---|---|
protected static int |
BATCH_SIZE |
Constructor and Description |
---|
CanonicalityChecker(DirectoryManager directoryManager,
List<Directory> directories,
boolean queryForAllEntities) |
Modifier and Type | Method and Description |
---|---|
List<Directory> |
getDirectories() |
void |
removeNonCanonicalEntities(com.google.common.collect.Multimap<Long,String> allNames,
EntityDescriptor entity)
Given a username is duplicated in several
user directories under the same
application . |
protected static final int BATCH_SIZE
public CanonicalityChecker(DirectoryManager directoryManager, List<Directory> directories, boolean queryForAllEntities)
directoryManager
- directories
- queryForAllEntities
- Whether it's allowed to query for all directory entities. This setting has strong
performance impact and makes sense to set it to true only if this object will be
used for multiple checks.public void removeNonCanonicalEntities(com.google.common.collect.Multimap<Long,String> allNames, EntityDescriptor entity)
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:allNames
- a directoryId to list of entities map containing the entities to check for canonicality.entity
- the EntityDescriptor used to look up the entities that will be determined as canonicalCopyright © 2020 Atlassian. All rights reserved.