public class UserDataServiceImpl extends AbstractUserDataService implements org.springframework.beans.factory.InitializingBean
UserData
storage. All UserData
returned from and persisted
with this service will be testrun-specific. The testrun-identifier is set in the constructor.Modifier and Type | Class and Description |
---|---|
static class |
UserDataServiceImpl.Range |
UserDataService.UserCallback
DEFAULT_DOMAIN
Constructor and Description |
---|
UserDataServiceImpl(com.mongodb.Mongo mongo,
String dbName,
String collectionName)
Deprecated.
|
UserDataServiceImpl(org.springframework.data.mongodb.core.MongoTemplate mongo,
String collectionName) |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
long |
countCloudAwareUsers()
Count the number of cloud-enabled users, regardless of signup state
|
long |
countUsers() |
long |
countUsers(boolean created) |
long |
countUsers(String domain,
boolean created) |
void |
createNewUser(UserData data) |
UserData |
findUserByEmail(String email)
Find a user by email address
|
UserData |
findUserByUsername(String username)
Find a user by username
|
UserData |
findUserByUserName(String userName)
Find a user by it's username.
|
Iterator<String> |
getDomainsIterator()
An iterator over networks in the users collection.
|
UserData |
getRandomUser()
Select a random, pre-created user.
|
UserData |
getRandomUserFromDomain(String domain)
Select a random, pre-created user.
|
UserData |
getRandomUserFromDomains(List<String> domains)
Select a random, pre-created user that is a member of one of the given domains.
|
protected List<UserData> |
getUsers(boolean created,
int startIndex,
int count) |
Iterator<UserData> |
getUsersByDomainIterator(String domain)
Iterate over users in the given network.
|
List<UserData> |
getUsersInDomain(String domain,
int startIndex,
int count)
Access users by their user domain using paging
|
List<UserData> |
getUsersInDomain(String domain,
int startIndex,
int count,
boolean created)
Return a maximum of "max" users in the network with id "networkId" and given created flag.
|
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
|
void |
setUserCreated(String username,
boolean created)
Change the 'created' state of the user i.e.
|
void |
setUserNodeId(String username,
String nodeId)
Store a node ID associated with the username
|
void |
setUserPassword(String username,
String password)
Update a user's password
|
void |
setUserTicket(String username,
String ticket)
Store an authentication token (ticket) against a username
|
getCreatedUsers, getUsersPendingCreation
public UserDataServiceImpl(org.springframework.data.mongodb.core.MongoTemplate mongo, String collectionName)
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
public void createNewUser(UserData data)
createNewUser
in interface UserDataService
public void setUserTicket(String username, String ticket)
setUserTicket
in interface UserDataService
public void setUserPassword(String username, String password)
setUserPassword
in interface UserDataService
public void setUserNodeId(String username, String nodeId)
setUserNodeId
in interface UserDataService
public void setUserCreated(String username, boolean created)
setUserCreated
in interface UserDataService
public long countUsers(boolean created)
countUsers
in interface UserDataService
created
- true to only count users present in Alfrescopublic long countUsers(String domain, boolean created)
countUsers
in interface UserDataService
domain
- the domain to searchcreated
- true to only count users present in Alfrescopublic long countUsers()
countUsers
in interface UserDataService
public UserData findUserByUsername(String username)
findUserByUsername
in interface UserDataService
UserData
found otherwise nullpublic UserData findUserByEmail(String email)
findUserByEmail
in interface UserDataService
UserData
found otherwise nullprotected List<UserData> getUsers(boolean created, int startIndex, int count)
getUsers
in class AbstractUserDataService
created
- true to only count users present in Alfrescopublic UserData getRandomUser()
UserDataService
getRandomUser
in interface UserDataService
public void setUserCloudSignUp(String username, CloudSignUpData cloudSignUp)
setUserCloudSignUp
in interface UserDataService
username
- the usernamecloudSignUp
- the new registration data to setpublic long countCloudAwareUsers()
countCloudAwareUsers
in interface UserDataService
public List<UserData> getUsersWithoutCloudSignUp(int startIndex, int count)
getUsersWithoutCloudSignUp
in interface UserDataService
public List<UserData> getUsersInDomain(String domain, int startIndex, int count)
UserDataService
getUsersInDomain
in interface UserDataService
domain
- the user domainstartIndex
- the start index for pagingcount
- the number of users to retrieveUserDataService.DEFAULT_DOMAIN
public List<UserData> getUsersInDomain(String domain, int startIndex, int count, boolean created)
UserDataService
getUsersInDomain
in interface UserDataService
domain
- the user domainstartIndex
- the start index for pagingcount
- the number of users to retrievecreated
- is the user created or not?UserDataService.DEFAULT_DOMAIN
public Iterator<String> getDomainsIterator()
UserDataService
getDomainsIterator
in interface UserDataService
UserDataService.DEFAULT_DOMAIN
public UserData findUserByUserName(String userName)
findUserByUserName
in interface UserDataService
UserData
found. Null, if user doesn't exist.UserDataService.DEFAULT_DOMAIN
public UserData getRandomUserFromDomain(String domain)
UserDataService
getRandomUserFromDomain
in interface UserDataService
domain
- the user domainUserDataService.DEFAULT_DOMAIN
public UserData getRandomUserFromDomains(List<String> domains)
UserDataService
getRandomUserFromDomains
in interface UserDataService
UserDataService.DEFAULT_DOMAIN
public Iterator<UserData> getUsersByDomainIterator(String domain)
UserDataService
getUsersByDomainIterator
in interface UserDataService
domain
- the user domainUserDataService.DEFAULT_DOMAIN
Copyright © 2014. All rights reserved.