org.alfresco.bm.user
Class UserDataService

java.lang.Object
  extended by org.alfresco.bm.user.UserDataService

public class UserDataService
extends Object

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

Constructor Summary
UserDataService(org.springframework.data.mongodb.core.MongoTemplate mongo, String collectionName)
           
 
Method Summary
 void checkIndexes()
          Ensure that the MongoDB collection has the required indexes associated with this user bean.
 long countCreatedUsers()
          Get a count of usernames that are created in alfresco
 long countUsers()
           
 long countUsersPendingCreation()
          Get a count of usernames that are NOT created in alfresco
 void createNewUser(UserData data)
          Creates a new user in mongo.
 UserData findUserByUserName(String userName)
          Find a user by it's 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
 void markUserAsCreated(String userName)
          Mark the given user as "created in alfresco"
 void setTicketForUser(String userName, String ticket)
          Set the ticket value for the user with the given username.
 void updateUserNodeId(UserData user, String nodeId)
          Update the alfresco node-id for the given user in mongo and in given object.
 
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

checkIndexes

public void checkIndexes()
Ensure that the MongoDB collection has the required indexes associated with this user bean.

Parameters:
mongo - connection to MongoDB
collectionName - name of DB collection containing data

findUserByUserName

public UserData findUserByUserName(String userName)
Find a user by it's username.

Returns:
the UserData found. Null, if user doesn't exist.

setTicketForUser

public void setTicketForUser(String userName,
                             String ticket)
Set the ticket value for the user with the given username.


markUserAsCreated

public void markUserAsCreated(String userName)
Mark the given user as "created in alfresco"

Parameters:
userName - the name of the user that is created.

countUsers

public long countUsers()

countUsersPendingCreation

public long countUsersPendingCreation()
Get a count of usernames that are NOT created in alfresco

Returns:
Returns the number of users pending creation

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

countCreatedUsers

public long countCreatedUsers()
Get a count of usernames that are created in alfresco

Returns:
Returns the number of created users

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

createNewUser

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

Parameters:
data - user to create

updateUserNodeId

public void updateUserNodeId(UserData user,
                             String nodeId)
Update the alfresco node-id for the given user in mongo and in given object.

Parameters:
user - the user that is affected.
nodeId - node-id to set


Copyright © 2012. All Rights Reserved.