public class DefaultUserService extends Object implements UserService
Default implementation of the user service that retrieves user information from AnyWorkObjects of type WorkObjectTypes.USER_TYPE via the AnyWorkObjectService.
All user fields that are derived from work object variables are fetched from the local variables only. This optimization is possible since it is a pre-condition that each user work object has values defined for all these variables.
UserService.UserSearchScope| Constructor and Description |
|---|
DefaultUserService(AnyWorkObjectService anyWorkObjectService,
SystemDefinitionHelper systemDefinitionHelper,
GroupService groupService,
UserUtils userUtils) |
| Modifier and Type | Method and Description |
|---|---|
String |
createUser(User user)
Persists the given
User object as an AnyWorkObject with type WorkObjectTypes.USER_TYPE and
the predefined user variables. |
Optional<User> |
findUser(Predicate predicate,
UserService.UserSearchScope searchScope)
Finds the
User that matches the given predicate. |
com.google.common.collect.ImmutableList<User> |
findUsers(Predicate predicate,
UserService.UserSearchScope searchScope)
Finds the
Users that match the given predicate. |
String |
getSystemAdminUserId()
Returns the id of the system admin user.
|
User |
getUser(String userId)
Returns the
User with the given id. |
void |
setActive(String userId,
boolean isActive)
Set the state of the user object.
|
String |
updateUser(User user)
Updates an already persisted user.
|
public DefaultUserService(AnyWorkObjectService anyWorkObjectService, SystemDefinitionHelper systemDefinitionHelper, GroupService groupService, UserUtils userUtils)
public User getUser(String userId)
UserServiceReturns the User with the given id.
getUser in interface UserServiceuserId - the user id, not nullpublic void setActive(String userId, boolean isActive)
UserServiceSet the state of the user object.
setActive in interface UserServiceuserId - the user id, not nullisActive - true if the user gets activated, false otherwisepublic Optional<User> findUser(Predicate predicate, UserService.UserSearchScope searchScope)
UserServiceFinds the User that matches the given predicate.
findUser in interface UserServicepredicate - the predicate to apply, never nullsearchScope - the boundaries within which to searchpublic com.google.common.collect.ImmutableList<User> findUsers(Predicate predicate, UserService.UserSearchScope searchScope)
UserServiceFinds the Users that match the given predicate.
findUsers in interface UserServicepredicate - the predicate to apply, never nullsearchScope - the boundaries within which to searchpublic String getSystemAdminUserId()
UserServiceReturns the id of the system admin user. Note that in a multi-tenant environment, the system admin user id is different for each tenant.
getSystemAdminUserId in interface UserServicepublic String createUser(User user)
UserServicePersists the given User object as an AnyWorkObject with type WorkObjectTypes.USER_TYPE and
the predefined user variables.
createUser in interface UserServiceuser - the user to be created, not nullpublic String updateUser(User user)
UserServiceUpdates an already persisted user. All user properties are updated except the following id’s: <ul> <li>User.id</li> <li>User.externalId</li> <li>User.tenantId</li> </ul>
updateUser in interface UserServiceuser - the user to be updated, not nullCopyright © 2010 - 2019 edorasware ag. All Rights Reserved.