Package org.openwms.core.uaa.impl
Class UserServiceImpl
java.lang.Object
org.openwms.core.uaa.impl.UserServiceImpl
- All Implemented Interfaces:
org.ameba.integration.FindOperations<User,,Long> org.ameba.integration.SaveOperations<User,,Long> UserService
An UserServiceImpl is a Spring managed transactional implementation of the
UserService. Using Spring 2 annotation support
autowires collaborators, therefore XML configuration becomes obsolete. This class is marked with Amebas TxService annotation to
benefit from Springs exception translation interceptor. Traditional CRUD operations are delegated to an UserRepository.
This implementation exists since Spring 2.0.
- Author:
- Heiko Scherrer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.springframework.security.crypto.password.PasswordEncoderprivate final org.springframework.context.ApplicationEventPublisherprivate static final org.slf4j.Loggerprivate final UserRepositoryprivate final RoleServiceprivate final GrantRepositoryprivate final Stringprivate final Stringprivate final org.ameba.i18n.Translatorprivate final UserMapperprivate final org.springframework.plugin.core.PluginRegistry<UserUpdater, String> private final jakarta.validation.Validator -
Constructor Summary
ConstructorsConstructorDescriptionUserServiceImpl(UserRepository repository, GrantRepository securityObjectDao, RoleService roleService, org.springframework.security.crypto.password.PasswordEncoder enc, org.ameba.i18n.Translator translator, jakarta.validation.Validator validator, UserMapper userMapper, org.springframework.plugin.core.PluginRegistry<UserUpdater, String> userUpdater, org.springframework.context.ApplicationEventPublisher eventPublisher, String systemUsername, String systemPassword) -
Method Summary
Modifier and TypeMethodDescription@NotNull Usercreate(@NotNull(groups=Create.class) @Valid User user, List<String> roleNames) Create a non-existing User.@NotNull SystemUserCreate and return theSystemUserwithout persisting this user.voidDelete anUser.@NotNull Collection<User> findAll()@NotNull User@NotNull UserfindByPKey(@NotBlank String pKey) Find and return anUserinstance.private UserfindByPKeyInternal(String pKey) findByUsername(@NotBlank String username) Find and return anUserinstance.@NotNull Usersave(@NotNull(groups=Modify.class) @Valid User user, List<String> roleNames) Save or update an already existingUser.@NotNull Userprivate UsersaveInternal(User entity) @NotNull UserVOupdatePassword(@NotBlank String pKey, @NotNull CharSequence newPassword) Update the password of theUser.voiduploadImageFile(@NotBlank String pKey, @jakarta.validation.constraints.NotNull byte[] image)
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
repository
-
securityObjectDao
-
roleService
-
enc
private final org.springframework.security.crypto.password.PasswordEncoder enc -
translator
private final org.ameba.i18n.Translator translator -
validator
private final jakarta.validation.Validator validator -
userMapper
-
userUpdater
-
eventPublisher
private final org.springframework.context.ApplicationEventPublisher eventPublisher -
systemUsername
-
systemPassword
-
-
Constructor Details
-
UserServiceImpl
UserServiceImpl(UserRepository repository, GrantRepository securityObjectDao, @Lazy RoleService roleService, org.springframework.security.crypto.password.PasswordEncoder enc, org.ameba.i18n.Translator translator, jakarta.validation.Validator validator, UserMapper userMapper, org.springframework.plugin.core.PluginRegistry<UserUpdater, String> userUpdater, org.springframework.context.ApplicationEventPublisher eventPublisher, @Value("${owms.security.system.username}") String systemUsername, @Value("${owms.security.system.password}") String systemPassword)
-
-
Method Details
-
save
@Validated(Modify.class) @Measured @NotNull public @NotNull User save(@NotNull(groups=Modify.class) @Valid @NotNull(groups=Modify.class) @Valid User user, List<String> roleNames) Save or update an already existingUser.- Specified by:
savein interfaceUserService- Parameters:
user- The instance to saveroleNames- A list of Role names to assign the User to- Returns:
- The saved instance
-
uploadImageFile
@Measured public void uploadImageFile(@NotBlank @NotBlank String pKey, @NotNull @jakarta.validation.constraints.NotNull byte[] image) - Specified by:
uploadImageFilein interfaceUserService- Parameters:
pKey- The persistent key of the Userimage- Image to be stored
-
save
-
saveInternal
-
createSystemUser
Create and return theSystemUserwithout persisting this user.Marked as read-only transactional method.
- Specified by:
createSystemUserin interfaceUserService- Returns:
- the SystemUser instance
-
create
@Measured @Validated(Create.class) @NotNull public @NotNull User create(@NotNull(groups=Create.class) @Valid @NotNull(groups=Create.class) @Valid User user, List<String> roleNames) Create a non-existing User.- Specified by:
createin interfaceUserService- Parameters:
user- The User instance to createroleNames- A list of Role names to assign the User to- Returns:
- The created instance
-
findByUsername
@Measured @NotNull public @NotNull Optional<User> findByUsername(@NotBlank @NotBlank String username) Find and return anUserinstance.- Specified by:
findByUsernamein interfaceUserService- Parameters:
username- The unique name of the User to search for- Returns:
- The instance
-
findByPKey
Find and return anUserinstance.- Specified by:
findByPKeyin interfaceUserService- Parameters:
pKey- The persistent identifier of the User to search for- Returns:
- The instance
-
findByPKeyInternal
-
delete
Delete anUser.- Specified by:
deletein interfaceUserService- Parameters:
pKey- The identifiable persistent key
-
updatePassword
@Measured @NotNull public @NotNull UserVO updatePassword(@NotBlank @NotBlank String pKey, @NotNull @NotNull CharSequence newPassword) throws InvalidPasswordException Update the password of theUser.- Specified by:
updatePasswordin interfaceUserService- Parameters:
pKey- The identifiable persistent keynewPassword- The new password- Returns:
- The updated instance
- Throws:
InvalidPasswordException
-
findAll
-
findById
-