public class CrowdDirectoryServiceImpl extends Object implements CrowdDirectoryService
Constructor and Description |
---|
CrowdDirectoryServiceImpl(ApplicationFactory applicationFactory,
DirectoryInstanceLoader directoryInstanceLoader,
DirectoryManager directoryManager,
ApplicationManager applicationManager,
DirectoryValidatorFactory directoryValidatorFactory) |
Modifier and Type | Method and Description |
---|---|
Directory |
addDirectory(Directory directory)
Will add a new
Directory into the local database. |
List<Directory> |
findAllDirectories()
Will return a
List<Directory> ordered by the order specified by the application. |
Directory |
findDirectoryById(long directoryId)
Will return a
Directory based on the given directoryId |
Directory |
findDirectoryByName(String name)
Will return a
Directory based on the given name |
DirectorySynchronisationInformation |
getDirectorySynchronisationInformation(long directoryId)
Returns the synchronisation information for the directory.
|
ConnectionPoolProperties |
getStoredConnectionPoolProperties()
Retrieves the stored LDAP connection pool properties which will be applied when the system restarts.
|
ConnectionPoolProperties |
getSystemConnectionPoolProperties()
Retrieves the system LDAP connection pool properties (i.e.
|
boolean |
isDirectorySynchronisable(long directoryId)
Returns true if the underlying directory implementation supports manual synchronisation of the directory's local cache.
|
boolean |
isDirectorySynchronising(long directoryId)
Returns true if the given Directory is currently synchronising.
|
boolean |
isMembershipAggregationEnabled() |
boolean |
removeDirectory(long directoryId)
Will remove a directory from the Application, this will also remove all associated entities (users/groups/memberships).
|
void |
setConnectionPoolProperties(ConnectionPoolProperties poolProperties)
Stores the provided LDAP connection pool properties so they can be applied when the system next restarts.
|
void |
setDirectoryPosition(long directoryId,
int position)
Will place the directory with the given
directoryId and the passed in position in the current list of directories configured for an application. |
void |
setMembershipAggregationEnabled(boolean enabled)
Store the membership aggregation semantic to use across the directories.
|
boolean |
supportsNestedGroups(long directoryId)
Returns true if the underlying directory implementation supports nested groups.
|
void |
synchroniseDirectory(long directoryId)
Requests that this directory should update its cache by synchronising with the remote server.
|
void |
synchroniseDirectory(long directoryId,
boolean runInBackground)
Requests that this directory should update its cache by synchronising with the remote server.
|
void |
testConnection(Directory directory)
Test if a connection to the directory server can be established.
|
Directory |
updateDirectory(Directory directory)
Will update the
Directory . |
List<ValidationError> |
validateDirectoryConfiguration(Directory directory,
EnumSet<DirectoryValidationContext> validationContexts)
Will validate the attributes of the given directory, depending upon the directory type
|
public CrowdDirectoryServiceImpl(ApplicationFactory applicationFactory, DirectoryInstanceLoader directoryInstanceLoader, DirectoryManager directoryManager, ApplicationManager applicationManager, DirectoryValidatorFactory directoryValidatorFactory)
public Directory addDirectory(Directory directory) throws OperationFailedException
CrowdDirectoryService
Directory
into the local database.addDirectory
in interface CrowdDirectoryService
directory
- The directory to be savedDirectory
OperationFailedException
- if the operation failed for any reasonpublic List<ValidationError> validateDirectoryConfiguration(Directory directory, EnumSet<DirectoryValidationContext> validationContexts)
CrowdDirectoryService
validateDirectoryConfiguration
in interface CrowdDirectoryService
directory
- directory to be validatedvalidationContexts
- List of DirectoryValidationContext
that are required to be validatedList
, which are errors generated during validation, or an empty list if no error was generated@Nullable public Directory findDirectoryByName(String name)
CrowdDirectoryService
Directory
based on the given name
findDirectoryByName
in interface CrowdDirectoryService
name
- the name of the directoryDirectory
or null
if no directory exists with given namepublic void testConnection(Directory directory) throws OperationFailedException
CrowdDirectoryService
testConnection
in interface CrowdDirectoryService
directory
- Directory to testOperationFailedException
- underlying directory implementation failed to execute the operation.public List<Directory> findAllDirectories()
CrowdDirectoryService
List<Directory>
ordered by the order specified by the application.findAllDirectories
in interface CrowdDirectoryService
List<Directory>
or if there are no directories, an empty list (this should never happen)public Directory findDirectoryById(long directoryId)
CrowdDirectoryService
Directory
based on the given directoryId
findDirectoryById
in interface CrowdDirectoryService
directoryId
- the id of the directorynull
if the directory is not foundpublic Directory updateDirectory(Directory directory) throws OperationFailedException
CrowdDirectoryService
Directory
. The Directory must have at the bare minimum an Directory.getId()
, Directory.getName()
, Directory.getType()
and Directory.getImplementationClass()
}updateDirectory
in interface CrowdDirectoryService
directory
- the directory to updateOperationFailedException
- if the directory does not exist or the operation failed for any other reason.public void setDirectoryPosition(long directoryId, int position) throws OperationFailedException
CrowdDirectoryService
directoryId
and the passed in position
in the current list of directories configured for an application.setDirectoryPosition
in interface CrowdDirectoryService
directoryId
- the id of the directoryposition
- the position in the list of directories where you would like this one to beOperationFailedException
- if the directory does not exist or the operation failed for any other reasonpublic boolean removeDirectory(long directoryId) throws DirectoryCurrentlySynchronisingException, OperationFailedException
CrowdDirectoryService
removeDirectory
in interface CrowdDirectoryService
directoryId
- the directory id of the Directory
to remove.true
if the directory and associated entities were removed, or false
otherwiseDirectoryCurrentlySynchronisingException
- if the Directory is currently synchronising.OperationFailedException
- if the directory does not exist or the operation failed for any other reasonpublic boolean supportsNestedGroups(long directoryId) throws OperationFailedException
CrowdDirectoryService
supportsNestedGroups
in interface CrowdDirectoryService
directoryId
- ID of directory.OperationFailedException
- if the operation failed for any reasonpublic boolean isDirectorySynchronisable(long directoryId) throws OperationFailedException
CrowdDirectoryService
isDirectorySynchronisable
in interface CrowdDirectoryService
directoryId
- ID of directory.OperationFailedException
- if the operation failed for any reasonpublic void synchroniseDirectory(long directoryId) throws OperationFailedException
CrowdDirectoryService
If a synchronisation is currently in progress when this method is called, then this method does nothing.
synchroniseDirectory
in interface CrowdDirectoryService
directoryId
- ID of directory.OperationFailedException
- if the operation failed for any reasonpublic void synchroniseDirectory(long directoryId, boolean runInBackground) throws OperationFailedException
CrowdDirectoryService
If a synchronisation is currently in progress when this method is called, then this method does nothing if runInBackGround is true, otherwise it will throw OperationFailedException.
synchroniseDirectory
in interface CrowdDirectoryService
directoryId
- ID of directory.runInBackground
- If True the synchronise will happen asynchronously.OperationFailedException
- if the operation failed for any reasonpublic boolean isDirectorySynchronising(long directoryId) throws OperationFailedException
CrowdDirectoryService
isDirectorySynchronising
in interface CrowdDirectoryService
directoryId
- ID of directory.OperationFailedException
- if the operation failed for any reasonpublic DirectorySynchronisationInformation getDirectorySynchronisationInformation(long directoryId) throws OperationFailedException
CrowdDirectoryService
getDirectorySynchronisationInformation
in interface CrowdDirectoryService
directoryId
- ID of directoryOperationFailedException
- if the operation failed for any reasonpublic void setConnectionPoolProperties(ConnectionPoolProperties poolProperties)
CrowdDirectoryService
setConnectionPoolProperties
in interface CrowdDirectoryService
poolProperties
- the LDAP connection pool properties to be stored and applied on the next restartCrowdDirectoryService.getStoredConnectionPoolProperties()
,
CrowdDirectoryService.getSystemConnectionPoolProperties()
public ConnectionPoolProperties getStoredConnectionPoolProperties()
CrowdDirectoryService
getStoredConnectionPoolProperties
in interface CrowdDirectoryService
to retrieve the currently active settings
public ConnectionPoolProperties getSystemConnectionPoolProperties()
CrowdDirectoryService
getSystemConnectionPoolProperties
in interface CrowdDirectoryService
to retrieve the stored configuration which will be applied
when the system next restarts
public boolean isMembershipAggregationEnabled()
isMembershipAggregationEnabled
in interface CrowdDirectoryService
public void setMembershipAggregationEnabled(boolean enabled)
CrowdDirectoryService
setMembershipAggregationEnabled
in interface CrowdDirectoryService
enabled
- true if membership aggregation should be enabled, false to disableCopyright © 2021 Atlassian. All rights reserved.