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 AbstractUserManagerCreated 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 UseraddUser(User user)Add a User.voidaddUserUnchecked(User user)Add a user to the database without checking for consistency or adjusting the password.UsercreateGuestUser()Factory method to create the guest user.UsercreateUser(String username, String fullName, String emailAddress)Factory method to create new User Objects based on provider specific implementation.UserQuerycreateUserQuery()Factory method to createUserQuerys based on provider specific implementations.voiddeleteUser(String username)Delete a user using the username.voideraseDatabase()UserfindUser(String username)Find a User using a User name.UserfindUser(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)StringgetDescriptionKey()StringgetId()An Identifier for the UserManager.List<? extends User>getUsers()Get the List ofUserobjects.List<? extends User>getUsers(boolean orderAscending)booleanisFinalImplementation()booleanisReadOnly()Is the UserManager read only? if so then create and modify actions are to be disabledvoidsetEntityManager(javax.persistence.EntityManager em)UserupdateUser(User user)Update a User.UserupdateUser(User user, boolean passwordChangeRequired)booleanuserExists(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:UserManagerIs 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:UserManagerAn 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:UserManagerFactory 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:UserManagerFactory method to createUserQuerys based on provider specific implementations.- Returns:
- the provider implementation of UserQuery
-
getUsers
public List<? extends User> getUsers() throws UserManagerException
Description copied from interface:UserManagerGet the List ofUserobjects.- Returns:
- the List of
UserObjects. - 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:UserManagerAdd 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:UserManagerUpdate 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:UserManagerFind 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:UserManagerFind 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:UserManagerFind users matching properties, ordering and range as specified by theUserQuery.- Parameters:
queryParam- the query.- Returns:
- a List of
Userobjects. - Throws:
UserManagerException
-
userExists
public boolean userExists(String principal) throws UserManagerException
Description copied from interface:UserManagertrue 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:UserManagerDelete 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:UserManagerAdd 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:
isFinalImplementationin interfaceUserManager- Overrides:
isFinalImplementationin 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:UserManagerFactory method to create the guest user.- Specified by:
createGuestUserin interfaceUserManager- Overrides:
createGuestUserin classAbstractUserManager- Returns:
- The guest user
- Throws:
UserManagerException
-
-