com.atlassian.crowd.dao.directory
Class FailoverDirectoryDAO

java.lang.Object
  extended by com.atlassian.crowd.dao.directory.FailoverDirectoryDAO
All Implemented Interfaces:
DirectoryDao

public class FailoverDirectoryDAO
extends Object
implements DirectoryDao

Delegates to a primary DAO, but only if it is active, or to a secondary DAO otherwise.


Constructor Summary
FailoverDirectoryDAO(DirectoryDao primaryDao, DirectoryDao secondaryDao, DaoDiscriminator daoDiscriminator)
           
 
Method Summary
 Directory add(Directory directory)
          Store a new directory in the data store.
 List<Directory> findAll()
          Returns the list of all directories in the data store, or empty list if there are no directories.
 Directory findById(long directoryId)
          Returns the directory with the specified ID, throwing DirectoryNotFoundException if it cannot be found.
 Directory findByName(String name)
          Returns the directory with the specified name, throwing DirectoryNotFoundException if it cannot be found.
 void remove(Directory directory)
          Removes the specified directory from the data store.
 List<Directory> search(EntityQuery<Directory> entityQuery)
          Search for directories matching the specified query.
 Directory update(Directory directory)
          Persists any changes made to the provided directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FailoverDirectoryDAO

public FailoverDirectoryDAO(DirectoryDao primaryDao,
                            DirectoryDao secondaryDao,
                            DaoDiscriminator daoDiscriminator)
Parameters:
primaryDao - DAO that will be used unless it is inactive
secondaryDao - failover DAO that will be used only if the primary is inactive
daoDiscriminator - discriminator that indicates whether the primary DAO is active or not
Method Detail

findById

public Directory findById(long directoryId)
                   throws DirectoryNotFoundException
Description copied from interface: DirectoryDao
Returns the directory with the specified ID, throwing DirectoryNotFoundException if it cannot be found.

Specified by:
findById in interface DirectoryDao
Parameters:
directoryId - the ID of the directory to find
Returns:
the directory with the specified ID
Throws:
DirectoryNotFoundException - if there is no directory with the specified ID

findByName

public Directory findByName(String name)
                     throws DirectoryNotFoundException
Description copied from interface: DirectoryDao
Returns the directory with the specified name, throwing DirectoryNotFoundException if it cannot be found.

Specified by:
findByName in interface DirectoryDao
Parameters:
name - the name of the directory to find
Returns:
the directory with the specified name
Throws:
DirectoryNotFoundException - if there is no directory with the specified name

findAll

public List<Directory> findAll()
Description copied from interface: DirectoryDao
Returns the list of all directories in the data store, or empty list if there are no directories.

Specified by:
findAll in interface DirectoryDao

add

public Directory add(Directory directory)
Description copied from interface: DirectoryDao
Store a new directory in the data store.

Specified by:
add in interface DirectoryDao
Parameters:
directory - the directory to persist
Returns:
the newly-persisted directory, which should be used for subsequent operations

update

public Directory update(Directory directory)
                 throws DirectoryNotFoundException
Description copied from interface: DirectoryDao
Persists any changes made to the provided directory.

Specified by:
update in interface DirectoryDao
Parameters:
directory - the directory which has changes to persist
Returns:
the updated directory after it has been persisted, which should be used for subsequent operations
Throws:
DirectoryNotFoundException - if the directory is not found in the data store

remove

public void remove(Directory directory)
            throws DirectoryNotFoundException
Description copied from interface: DirectoryDao
Removes the specified directory from the data store.

Specified by:
remove in interface DirectoryDao
Parameters:
directory - the directory to remove
Throws:
DirectoryNotFoundException - if the directory does not exist

search

public List<Directory> search(EntityQuery<Directory> entityQuery)
Description copied from interface: DirectoryDao
Search for directories matching the specified query.

Specified by:
search in interface DirectoryDao
Parameters:
entityQuery - the search query to run against the directory data store
Returns:
a list of directories matching the query
See Also:
QueryBuilder.queryFor(java.lang.Class, com.atlassian.crowd.search.EntityDescriptor)


Copyright © 2013 Atlassian. All Rights Reserved.