com.atlassian.crowd.model.principal
Interface PrincipalDAO

All Superinterfaces:
ObjectDao
All Known Implementing Classes:
PrincipalDAOHibernate

public interface PrincipalDAO
extends ObjectDao

Persistance methods necessary to modify an InternalDirectory principal.


Method Summary
 RemotePrincipal add(RemotePrincipal principal)
          Adds the RemotePrincipal to the datastore.
 BatchResult<RemotePrincipal> addAll(java.util.Set<RemotePrincipal> principals)
          Adds a collection of RemotePrincipal to the datastore.
 RemotePrincipal findByName(long directoryID, java.lang.String name)
          Finds the RemotePrincipal based on the passed in principal name.
 java.util.Collection<RemotePrincipal> findByNames(long directoryID, java.util.Collection<java.lang.String> names)
          Finds a collection of RemotePrincipal by searching the directoryID and name primary keys.
 void remove(RemotePrincipal principal)
          Removes a RemotePrincipal from the datastore.
 java.util.List<RemotePrincipal> search(SearchContext searchContext)
          Performs a search for RemotePrincipals based on a given SearchContext.
 RemotePrincipal update(RemotePrincipal principal)
          Updates an RemotePrincipal in the datastore.
 
Methods inherited from interface com.atlassian.crowd.util.persistence.hibernate.ObjectDao
getPersistentClass, load, remove, save, update
 

Method Detail

add

RemotePrincipal add(RemotePrincipal principal)
                    throws org.springframework.dao.DataAccessException
Adds the RemotePrincipal to the datastore.

Parameters:
principal - The principal to persist.
Returns:
The persisted principal.
Throws:
org.springframework.dao.DataAccessException - Generic persistance exception thrown if adding the principal fails.

addAll

BatchResult<RemotePrincipal> addAll(java.util.Set<RemotePrincipal> principals)
                                    throws org.springframework.dao.DataAccessException
Adds a collection of RemotePrincipal to the datastore. This will attempt to batch process as much of the set as possible. If some principals fail, it will still commit the principals that are successfully added. If a principal exists, it will be updated with the new principal data (ie. overwrite).

Parameters:
principals - The principals to persist.
Returns:
principals that failed to be added.
Throws:
org.springframework.dao.DataAccessException - Generic persistance exception thrown if adding the principal fails.

findByName

RemotePrincipal findByName(long directoryID,
                           java.lang.String name)
                           throws org.springframework.dao.DataAccessException,
                                  ObjectNotFoundException
Finds the RemotePrincipal based on the passed in principal name.

Parameters:
name - The name of the principal to find.
directoryID - the id of the Directory you are searching
Returns:
The RemotePrincipal from the datastore.
Throws:
org.springframework.dao.DataAccessException - Generic persistance exception thrown if finding the principal fails.
ObjectNotFoundException - If the RemotePrincipal based on the passed in name is not found.

update

RemotePrincipal update(RemotePrincipal principal)
                       throws org.springframework.dao.DataAccessException
Updates an RemotePrincipal in the datastore.

Parameters:
principal - The principal to update.
Returns:
The updated RemotePrincipal.
Throws:
org.springframework.dao.DataAccessException - Generic persistance exception thrown if updating the principal fails

search

java.util.List<RemotePrincipal> search(SearchContext searchContext)
                                       throws org.springframework.dao.DataAccessException,
                                              InvalidSearchTermException
Performs a search for RemotePrincipals based on a given SearchContext.

Parameters:
searchContext - The search context to find a given list of principal.
Returns:
A List of RemotePrincipals found from the SearchContext.
Throws:
org.springframework.dao.DataAccessException - Generic persistance exception thrown if searching for the principal fails.
InvalidSearchTermException - if not all required attributes for a search are present in the Context

remove

void remove(RemotePrincipal principal)
            throws org.springframework.dao.DataAccessException
Removes a RemotePrincipal from the datastore.

Parameters:
principal - The principal to remove.
Throws:
org.springframework.dao.DataAccessException - Generic persistance exception thrown if removing the principal fails.

findByNames

java.util.Collection<RemotePrincipal> findByNames(long directoryID,
                                                  java.util.Collection<java.lang.String> names)
                                                  throws org.springframework.dao.DataAccessException
Finds a collection of RemotePrincipal by searching the directoryID and name primary keys.

Parameters:
directoryID - directory ID to restrict search to.
names - names to find.
Returns:
all the principals matching the search criteria.
Throws:
org.springframework.dao.DataAccessException - generic persistence exception.


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.