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 taskanaEngine, 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 id)Gets a User.UsernewUser()Returns a new User with all fields being empty.UserupdateUser(User userToUpdate)Updates an existing User.
-
-
-
Constructor Detail
-
UserServiceImpl
public UserServiceImpl(InternalTaskanaEngine taskanaEngine, 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 id) throws UserNotFoundException
Description copied from interface:UserService- Specified by:
getUserin interfaceUserService- Parameters:
id- 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 database
-
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
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-admin
-
deleteUser
public void deleteUser(String id) throws UserNotFoundException, NotAuthorizedException
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-admin
-
-