Class JpaUserManager
- java.lang.Object
-
- org.apache.archiva.redback.users.AbstractUserManager
-
- org.apache.archiva.redback.users.jpa.JpaUserManager
-
- All Implemented Interfaces:
UserManager
@Service("userManager#jpa") public class JpaUserManager extends AbstractUserManager
Created by martin on 20.09.16.
-
-
Field Summary
-
Fields inherited from class org.apache.archiva.redback.users.AbstractUserManager
log
-
Fields inherited from interface org.apache.archiva.redback.users.UserManager
GUEST_USERNAME
-
-
Constructor Summary
Constructors Constructor Description JpaUserManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description User
addUser(User user)
Add a User.void
addUserUnchecked(User user)
Add a user to the database without checking for consistency or adjusting the password.User
createGuestUser()
Factory method to create the guest user.User
createUser(String username, String fullName, String emailAddress)
Factory method to create new User Objects based on provider specific implementation.UserQuery
createUserQuery()
Factory method to createUserQuery
s based on provider specific implementations.void
deleteUser(String username)
Delete a user using the username.void
eraseDatabase()
User
findUser(String username)
Find a User using a User name.User
findUser(String username, boolean useCache)
Find a User using a User name.List<? extends User>
findUsersByEmailKey(String emailKey, boolean orderAscending)
List<? extends User>
findUsersByFullNameKey(String fullNameKey, boolean orderAscending)
List<? extends User>
findUsersByQuery(UserQuery queryParam)
Find users matching properties, ordering and range as specified by theUserQuery
.List<? extends User>
findUsersByUsernameKey(String usernameKey, boolean orderAscending)
String
getDescriptionKey()
String
getId()
An Identifier for the UserManager.List<? extends User>
getUsers()
Get the List ofUser
objects.List<? extends User>
getUsers(boolean orderAscending)
boolean
isFinalImplementation()
boolean
isReadOnly()
Is the UserManager read only? if so then create and modify actions are to be disabledvoid
setEntityManager(javax.persistence.EntityManager em)
User
updateUser(User user)
Update a User.User
updateUser(User user, boolean passwordChangeRequired)
boolean
userExists(String principal)
true if the user exists, false if it doesn't-
Methods inherited from class org.apache.archiva.redback.users.AbstractUserManager
addUserManagerListener, fireUserManagerInit, fireUserManagerUserAdded, fireUserManagerUserRemoved, fireUserManagerUserUpdated, getGuestUser, getListeners, initialize, removeUserManagerListener
-
-
-
-
Constructor Detail
-
JpaUserManager
public JpaUserManager()
-
-
Method Detail
-
setEntityManager
public void setEntityManager(javax.persistence.EntityManager em)
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:UserManager
Is the UserManager read only? if so then create and modify actions are to be disabled- Returns:
- boolean true if user manager is disabled
-
getId
public String getId()
Description copied from interface:UserManager
An Identifier for the UserManager.- Returns:
- the user manager identifier.
-
createUser
public User createUser(String username, String fullName, String emailAddress) throws UserManagerException
Description copied from interface:UserManager
Factory method to create new User Objects based on provider specific implementation. User objects created this way do not exist in the provider's underlying data store until a call toUserManager.addUser(User)
is made.- Parameters:
username
- the username for this user.fullName
- the full name for this user.emailAddress
- the email address for this user.- Returns:
- the new user object ready to use.
- Throws:
UserManagerException
-
createUserQuery
public UserQuery createUserQuery()
Description copied from interface:UserManager
Factory method to createUserQuery
s based on provider specific implementations.- Returns:
- the provider implementation of UserQuery
-
getUsers
public List<? extends User> getUsers() throws UserManagerException
Description copied from interface:UserManager
Get the List ofUser
objects.- Returns:
- the List of
User
Objects. - Throws:
UserManagerException
-
getUsers
public List<? extends User> getUsers(boolean orderAscending) throws UserManagerException
- Throws:
UserManagerException
-
addUser
public User addUser(User user) throws UserManagerException
Description copied from interface:UserManager
Add a User.- Parameters:
user
- the user to add.- Returns:
- the user that was just added.
- Throws:
UserManagerException
-
updateUser
public User updateUser(User user) throws UserManagerException
Description copied from interface:UserManager
Update a User.- Parameters:
user
- the user to update.- Returns:
- the user that was just updated.
- Throws:
UserNotFoundException
- if the user was not found to update.UserManagerException
-
findUser
public User findUser(String username) throws UserManagerException
Description copied from interface:UserManager
Find a User using a User name.- Parameters:
username
- the username to find.- Returns:
- the user.
- Throws:
UserNotFoundException
- if the user was not found.UserManagerException
-
findUser
public User findUser(String username, boolean useCache) throws UserManagerException
Description copied from interface:UserManager
Find a User using a User name.- Parameters:
username
- the username to find.useCache
- to use or not caching- Returns:
- the user.
- Throws:
UserNotFoundException
- if the user was not found.UserManagerException
-
findUsersByUsernameKey
public List<? extends User> findUsersByUsernameKey(String usernameKey, boolean orderAscending) throws UserManagerException
- Throws:
UserManagerException
-
findUsersByFullNameKey
public List<? extends User> findUsersByFullNameKey(String fullNameKey, boolean orderAscending) throws UserManagerException
- Throws:
UserManagerException
-
findUsersByEmailKey
public List<? extends User> findUsersByEmailKey(String emailKey, boolean orderAscending) throws UserManagerException
- Throws:
UserManagerException
-
findUsersByQuery
public List<? extends User> findUsersByQuery(UserQuery queryParam) throws UserManagerException
Description copied from interface:UserManager
Find users matching properties, ordering and range as specified by theUserQuery
.- Parameters:
queryParam
- the query.- Returns:
- a List of
User
objects. - Throws:
UserManagerException
-
userExists
public boolean userExists(String principal) throws UserManagerException
Description copied from interface:UserManager
true if the user exists, false if it doesn't- Returns:
- true, if user exists
- Throws:
UserManagerException
-
deleteUser
public void deleteUser(String username) throws UserManagerException
Description copied from interface:UserManager
Delete a user using the username.- Parameters:
username
- the username to look for.- Throws:
UserNotFoundException
- the user was not found.UserManagerException
-
addUserUnchecked
public void addUserUnchecked(User user) throws UserManagerException
Description copied from interface:UserManager
Add a user to the database without checking for consistency or adjusting the password. Should only be used for re-importing known-good data.- Parameters:
user
- the user to add- Throws:
UserManagerException
-
eraseDatabase
public void eraseDatabase()
-
updateUser
public User updateUser(User user, boolean passwordChangeRequired) throws UserManagerException
- Throws:
UserManagerException
-
getDescriptionKey
public String getDescriptionKey()
- Returns:
- a key to be able to customize label in UI
-
isFinalImplementation
public boolean isFinalImplementation()
- Specified by:
isFinalImplementation
in interfaceUserManager
- Overrides:
isFinalImplementation
in classAbstractUserManager
- Returns:
- true if this implementation is a final one and not a wrapper (configurable, cached)
-
createGuestUser
public User createGuestUser() throws UserManagerException
Description copied from interface:UserManager
Factory method to create the guest user.- Specified by:
createGuestUser
in interfaceUserManager
- Overrides:
createGuestUser
in classAbstractUserManager
- Returns:
- The guest user
- Throws:
UserManagerException
-
-