Class UserServiceImpl
- java.lang.Object
-
- pro.taskana.user.internal.UserServiceImpl
-
- All Implemented Interfaces:
UserService
public class UserServiceImpl extends Object implements UserService
-
-
Constructor Summary
Constructors Constructor Description UserServiceImpl(InternalTaskanaEngine internalTaskanaEngine, UserMapper userMapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UsercreateUser(User userToCreate)Creates a new User.voiddeleteUser(String id)Deletes a User.UsergetUser(String userId)Gets a User.List<User>getUsers(Set<String> userIds)Gets multiple Users.UsernewUser()Returns a new User with all fields being empty.UserupdateUser(User userToUpdate)Updates an existing User.
-
-
-
Constructor Detail
-
UserServiceImpl
public UserServiceImpl(InternalTaskanaEngine internalTaskanaEngine, UserMapper userMapper)
-
-
Method Detail
-
newUser
public User newUser()
Description copied from interface:UserServiceReturns a new User with all fields being empty.It will be only generated but not yet inserted until method UserService.createUser(User) is called.
- Specified by:
newUserin interfaceUserService- Returns:
- the new User
-
getUser
public User getUser(String userId) throws UserNotFoundException, InvalidArgumentException
Description copied from interface:UserService- Specified by:
getUserin interfaceUserService- Parameters:
userId- the id of the User to be retrieved- Returns:
- the retrieved User
- Throws:
UserNotFoundException- if there does not exist a User with the specified id inside the databaseInvalidArgumentException- if the userIds parameter is NULL or empty
-
getUsers
public List<User> getUsers(Set<String> userIds) throws InvalidArgumentException
Description copied from interface:UserServiceGets multiple Users.If a userId can't be found in the database it will be ignored. If none of the given userIds is valid, the returned list will be empty.
- Specified by:
getUsersin interfaceUserService- Parameters:
userIds- the ids of the Users to be retrieved- Returns:
- the retrieved Users
- Throws:
InvalidArgumentException- if the userIds parameter is NULL or empty
-
createUser
public User createUser(User userToCreate) throws InvalidArgumentException, NotAuthorizedException, UserAlreadyExistException
Description copied from interface:UserServiceCreates a new User.If all checks have passed the specified User will be inserted into the database. The id of the User must be set and should be unique, such that no other User with same id is already existing in the database. The first name and the last name must not be null. The fields for the full name and the long name are set according to following rules:
- fullName = lastName, firstName
- longName = lastName, firstName - (id)
- Specified by:
createUserin interfaceUserService- Parameters:
userToCreate- the User which should be inserted- Returns:
- the inserted User
- Throws:
InvalidArgumentException- if some fields are not set properlyNotAuthorizedException- if the current user is not admin or business-adminUserAlreadyExistException- if there already exists a User with the specified id inside the database
-
updateUser
public User updateUser(User userToUpdate) throws UserNotFoundException, NotAuthorizedException, InvalidArgumentException
Description copied from interface:UserServiceUpdates an existing User.If a User with the specified id exists in the database and if the current user is allowed to perform the operation, the User gets updated according to the set fields of the passed object.
- Specified by:
updateUserin interfaceUserService- Parameters:
userToUpdate- the User which should be updated- Returns:
- the updated User
- Throws:
UserNotFoundException- if there does not exist a User with the specified id inside the databaseNotAuthorizedException- if the current user is not admin or business-adminInvalidArgumentException- if some fields are not set properly
-
deleteUser
public void deleteUser(String id) throws UserNotFoundException, NotAuthorizedException, InvalidArgumentException
Description copied from interface:UserServiceDeletes a User.If a User with the specified id exists in the database and if the current user is allowed to perform the operation, the User gets deleted.
- Specified by:
deleteUserin interfaceUserService- Parameters:
id- the id of the User which should be deleted- Throws:
UserNotFoundException- if there does not exist a User with the specified id inside the databaseNotAuthorizedException- if the current user is not admin or business-adminInvalidArgumentException- if the userIds parameter is NULL or empty
-
-