org.alfresco.bm.user
Class UserDataService

java.lang.Object
  extended by org.alfresco.bm.user.UserDataService
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean

public class UserDataService
extends Object
implements org.springframework.beans.factory.InitializingBean

Service providing access to UserData storage. All UserData returned from and persisted with this service will be testrun-specific. The testrun-identifier is set in the constructor.

Since:
1.1
Author:
Frederik Heremans, Derek Hulley

Constructor Summary
UserDataService(org.springframework.data.mongodb.core.MongoTemplate mongo, String collectionName)
           
 
Method Summary
 void afterPropertiesSet()
           
 long countCloudAwareUsers()
          Count the number of cloud-enabled users, regardless of signup state
 long countUsers()
           
 long countUsers(boolean created)
           
 void createNewUser(UserData data)
          Creates a new user in mongo.
 UserData findUserByEmail(String email)
          Find a user by email address
 UserData findUserByUsername(String username)
          Find a user by username
 List<UserData> getCreatedUsers(int startIndex, int count)
          Get a list of usernames that are created in alfresco with paging
 List<UserData> getUsersPendingCreation(int startIndex, int count)
          Get a list of usernames that are NOT created in alfresco with paging
 List<UserData> getUsersWithoutCloudSignUp(int startIndex, int count)
          Retrieves a selection of users that have no cloud signup details.
 void setUserCloudSignUp(String username, CloudSignUpData cloudSignUp)
          Set the registration data for a user
 boolean setUserCreated(String username, boolean created)
          Change the 'created' state of the user i.e.
 boolean setUserNodeId(String username, String nodeId)
          Store a node ID associated with the username
 boolean setUserPassword(String username, String password)
          Update a user's password
 boolean setUserTicket(String username, String ticket)
          Store an authentication token (ticket) against a username
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserDataService

public UserDataService(org.springframework.data.mongodb.core.MongoTemplate mongo,
                       String collectionName)
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception

createNewUser

public void createNewUser(UserData data)
Creates a new user in mongo.

Parameters:
data - user to create

setUserTicket

public boolean setUserTicket(String username,
                             String ticket)
Store an authentication token (ticket) against a username

Returns:
Returns true if the user data was updated

setUserPassword

public boolean setUserPassword(String username,
                               String password)
Update a user's password

Returns:
Returns true if the user data was updated

setUserNodeId

public boolean setUserNodeId(String username,
                             String nodeId)
Store a node ID associated with the username

Returns:
Returns true if the user data was updated

setUserCreated

public boolean setUserCreated(String username,
                              boolean created)
Change the 'created' state of the user i.e. whether the user exists on the server or not

Returns:
Returns true if the user data was updated

countUsers

public long countUsers(boolean created)
Parameters:
created - true to only count users present in Alfresco

countUsers

public long countUsers()
Returns:
a count of all users in any state

findUserByUsername

public UserData findUserByUsername(String username)
Find a user by username

Returns:
the UserData found otherwise null

findUserByEmail

public UserData findUserByEmail(String email)
Find a user by email address

Returns:
the UserData found otherwise null

getUsersPendingCreation

public List<UserData> getUsersPendingCreation(int startIndex,
                                              int count)
Get a list of usernames that are NOT created in alfresco with paging

Parameters:
startIndex - index to start getting users from
count - number of users to fetch
Returns:
List of user data, which may be empty or less than the required count

getCreatedUsers

public List<UserData> getCreatedUsers(int startIndex,
                                      int count)
Get a list of usernames that are created in alfresco with paging

Parameters:
startIndex - index to start getting users from
count - number of users to fetch
Returns:
List of user data, which may be empty or less than the required count

setUserCloudSignUp

public void setUserCloudSignUp(String username,
                               CloudSignUpData cloudSignUp)
Set the registration data for a user

Parameters:
username - the username
cloudSignUp - the new registration data to set

countCloudAwareUsers

public long countCloudAwareUsers()
Count the number of cloud-enabled users, regardless of signup state

Returns:
the number of users that have cloud registration details, regardless of state

getUsersWithoutCloudSignUp

public List<UserData> getUsersWithoutCloudSignUp(int startIndex,
                                                 int count)
Retrieves a selection of users that have no cloud signup details. Note they must also not be created in any instance of Alfresco.



Copyright © 2012. All Rights Reserved.