com.atlassian.crowd.embedded.core
Class CrowdServiceImpl

java.lang.Object
  extended by com.atlassian.crowd.embedded.core.CrowdServiceImpl
All Implemented Interfaces:
CrowdService
Direct Known Subclasses:
CrowdAdminServiceImpl

public class CrowdServiceImpl
extends java.lang.Object
implements CrowdService

Default implementation of the CrowdService


Constructor Summary
CrowdServiceImpl(ApplicationFactory applicationFactory, ApplicationService applicationService, DirectoryInstanceLoader directoryInstanceLoader)
           
 
Method Summary
 User authenticate(java.lang.String name, java.lang.String credential)
          Authenticates a user with the given credential
protected  Application getApplication()
           
protected  DirectoryInstanceLoader getDirectoryInstanceLoader()
           
 Group getGroup(java.lang.String name)
          Finds the group that matches the supplied name.
 GroupWithAttributes getGroupWithAttributes(java.lang.String name)
          Finds the group that matches the supplied name.
 User getUser(java.lang.String name)
          Returns the user that matches the supplied name.
 UserWithAttributes getUserWithAttributes(java.lang.String name)
          Returns the user that matches the supplied name.
 boolean isGroupMemberOfGroup(Group childGroup, Group parentGroup)
          Returns true if the childGroup is a direct or indirect (nested) member of the parentGroup.
 boolean isUserMemberOfGroup(java.lang.String userName, java.lang.String groupName)
          Returns true if the user is a direct or indirect (nested) member of the group.
 boolean isUserMemberOfGroup(User user, Group group)
          Returns true if the user is a direct or indirect (nested) member of the group.
<T> java.lang.Iterable<T>
search(Query<T> query)
          Searches for entities (e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CrowdServiceImpl

public CrowdServiceImpl(ApplicationFactory applicationFactory,
                        ApplicationService applicationService,
                        DirectoryInstanceLoader directoryInstanceLoader)
Method Detail

authenticate

public User authenticate(java.lang.String name,
                         java.lang.String credential)
                  throws UserNotFoundException,
                         InactiveAccountException,
                         FailedAuthenticationException,
                         ExpiredCredentialException,
                         OperationFailedException
Description copied from interface: CrowdService
Authenticates a user with the given credential

Specified by:
authenticate in interface CrowdService
Parameters:
name - The name of the user (username).
credential - The supplied credential to authenticate with
Returns:
The populated user if the authentication is valid.
Throws:
UserNotFoundException - thrown if the name didn't resolve to a User
InactiveAccountException - The supplied user is inactive.
FailedAuthenticationException - Authentication with the provided credentials failed.
ExpiredCredentialException - The user's credentials have expired. The user must change their credentials in order to successfully authenticate.
OperationFailedException - underlying directory implementation failed to execute the operation.

getUser

public User getUser(java.lang.String name)
Description copied from interface: CrowdService
Returns the user that matches the supplied name.

Specified by:
getUser in interface CrowdService
Parameters:
name - the name of the user (username). Does not allow null, blank or empty strings.
Returns:
user entity or null if the user is not found

getUserWithAttributes

public UserWithAttributes getUserWithAttributes(java.lang.String name)
Description copied from interface: CrowdService
Returns the user that matches the supplied name.

Specified by:
getUserWithAttributes in interface CrowdService
Parameters:
name - the name of the user (username).
Returns:
user entity with attributes or null if the user is not found

getGroup

public Group getGroup(java.lang.String name)
Description copied from interface: CrowdService
Finds the group that matches the supplied name.

Specified by:
getGroup in interface CrowdService
Parameters:
name - the name of the group.
Returns:
group entity, null if not found.

getGroupWithAttributes

public GroupWithAttributes getGroupWithAttributes(java.lang.String name)
Description copied from interface: CrowdService
Finds the group that matches the supplied name.

Specified by:
getGroupWithAttributes in interface CrowdService
Parameters:
name - the name of the group.
Returns:
group entity with attributes, null if not found.

search

public <T> java.lang.Iterable<T> search(Query<T> query)
Description copied from interface: CrowdService
Searches for entities (e.g. Group or User) of type <T> that match the supplied search query. Search return types must be either String, User or Group.

Specified by:
search in interface CrowdService
Parameters:
query - Query for a given entity (e.g. Group or User)
Returns:
entities of type T matching the search query. An Iterable containing no results will be returned if there are no matches for the query.

isUserMemberOfGroup

public boolean isUserMemberOfGroup(java.lang.String userName,
                                   java.lang.String groupName)
                            throws UserNotFoundException,
                                   GroupNotFoundException
Description copied from interface: CrowdService
Returns true if the user is a direct or indirect (nested) member of the group.

Specified by:
isUserMemberOfGroup in interface CrowdService
Parameters:
userName - user to inspect.
groupName - group to inspect.
Returns:
true if and only if the user is a direct or indirect (nested) member of the group.
Throws:
UserNotFoundException - if the userName doesn't resolve to an existing user.
GroupNotFoundException - if the groupName doesn't resolve to an existing group.
See Also:
CrowdService.isUserMemberOfGroup(User, Group)

isUserMemberOfGroup

public boolean isUserMemberOfGroup(User user,
                                   Group group)
                            throws UserNotFoundException,
                                   GroupNotFoundException
Description copied from interface: CrowdService
Returns true if the user is a direct or indirect (nested) member of the group.

Specified by:
isUserMemberOfGroup in interface CrowdService
Parameters:
user - user to inspect.
group - group to inspect.
Returns:
true if and only if the user is a direct or indirect (nested) member of the group.
Throws:
UserNotFoundException - if the userName doesn't resolve to an existing user.
GroupNotFoundException - if the groupName doesn't resolve to an existing group.
See Also:
CrowdService.isUserMemberOfGroup(String, String)

isGroupMemberOfGroup

public boolean isGroupMemberOfGroup(Group childGroup,
                                    Group parentGroup)
                             throws GroupNotFoundException
Description copied from interface: CrowdService
Returns true if the childGroup is a direct or indirect (nested) member of the parentGroup.

Specified by:
isGroupMemberOfGroup in interface CrowdService
Parameters:
childGroup - group to inspect.
parentGroup - group to inspect.
Returns:
true if and only if the childGroup is a direct or indirect (nested) member of the parentGroup.
Throws:
GroupNotFoundException - if either groupd (childGroup or parentGroup) doesn't resolve to an existing group.

getApplication

protected Application getApplication()

getDirectoryInstanceLoader

protected DirectoryInstanceLoader getDirectoryInstanceLoader()


Copyright © 2010 Atlassian. All Rights Reserved.