public class DefaultUserService extends Object implements UserService
Default implementation of the user service that retrieves user information from AnyWorkObject
s 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
User s 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)
UserService
Returns the User
with the given id.
getUser
in interface UserService
userId
- the user id, not nullpublic void setActive(String userId, boolean isActive)
UserService
Set the state of the user object.
setActive
in interface UserService
userId
- the user id, not nullisActive
- true if the user gets activated, false otherwisepublic Optional<User> findUser(Predicate predicate, UserService.UserSearchScope searchScope)
UserService
Finds the User
that matches the given predicate.
findUser
in interface UserService
predicate
- the predicate to apply, never nullsearchScope
- the boundaries within which to searchpublic com.google.common.collect.ImmutableList<User> findUsers(Predicate predicate, UserService.UserSearchScope searchScope)
UserService
Finds the User
s that match the given predicate.
findUsers
in interface UserService
predicate
- the predicate to apply, never nullsearchScope
- the boundaries within which to searchpublic String getSystemAdminUserId()
UserService
Returns 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 UserService
public String createUser(User user)
UserService
Persists the given User
object as an AnyWorkObject
with type WorkObjectTypes.USER_TYPE
and
the predefined user variables.
createUser
in interface UserService
user
- the user to be created, not nullpublic String updateUser(User user)
UserService
Updates 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 UserService
user
- the user to be updated, not nullCopyright © 2010 - 2019 edorasware ag. All Rights Reserved.