Class UserServiceImpl
- All Implemented Interfaces:
UserService
-
Constructor Summary
ConstructorsConstructorDescriptionUserServiceImpl(InternalTaskanaEngine internalTaskanaEngine, UserMapper userMapper) -
Method Summary
Modifier and TypeMethodDescriptioncreateUser(User userToCreate) Creates a new User.voiddeleteUser(String id) Deletes a User.Gets a User.Gets multiple Users.newUser()Returns a new User with all fields being empty.updateUser(User userToUpdate) Updates an existing User.
-
Constructor Details
-
UserServiceImpl
-
-
Method Details
-
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
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
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, UserAlreadyExistException, NotAuthorizedException 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 properlyUserAlreadyExistException- if there already exists a User with the specified id inside the databaseNotAuthorizedException- if the current user is not admin or business-admin
-
updateUser
public User updateUser(User userToUpdate) throws UserNotFoundException, InvalidArgumentException, 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 databaseInvalidArgumentException- if some fields are not set properlyNotAuthorizedException- if the current user is not admin or business-admin
-
deleteUser
public void deleteUser(String id) throws UserNotFoundException, InvalidArgumentException, 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 databaseInvalidArgumentException- if the userIds parameter is NULL or emptyNotAuthorizedException- if the current user is not admin or business-admin
-