Class UserDao
- java.lang.Object
-
- org.apache.openmeetings.db.dao.user.UserDao
-
- All Implemented Interfaces:
IDataProviderDao<User>,IGroupAdminDataProviderDao<User>
@Repository @Transactional public class UserDao extends Object implements IGroupAdminDataProviderDao<User>
CRUD operations forUser- Author:
- swagner, solomax, vasya
-
-
Field Summary
Fields Modifier and Type Field Description static StringFETCH_GROUP_BACKUPstatic StringFETCH_GROUP_GROUP
-
Constructor Summary
Constructors Constructor Description UserDao()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description longadminCount(String search)Count the number of instances ofIGroupAdminDataProviderDaolongadminCount(String search, Long adminId)Count the number of instances ofIGroupAdminDataProviderDaoList<User>adminGet(String search, long start, long count, String order)Get a list of instances ofIGroupAdminDataProviderDaoList<User>adminGet(String search, Long adminId, long start, long count, String order)Get a list of instances ofIGroupAdminDataProviderDaobooleancheckEmail(String email, User.Type type, Long domainId, Long id)Checks if a mail is already taken by someone elsebooleancheckLogin(String login, User.Type type, Long domainId, Long id)check for duplicateslongcount()Count the number of instances ofIDataProviderDaolongcount(String search)Count the number of instances ofIDataProviderDaolongcount(String search, boolean filterContacts, Long currentUserId)longcountUsers(String search, Long currentUserId)voiddelete(User u, Long userId)Delete an instance ofIDataProviderDaoList<User>get(long first, long count)Get a list of instances ofIDataProviderDaoUserget(Long id)Get an instance of anIDataProviderDaoList<User>get(String search, boolean excludeContacts, long first, long count)List<User>get(String search, long start, long count, String order)Get a list of instances ofIDataProviderDaoList<User>get(String search, long start, long count, String sort, boolean filterContacts, Long currentUserId)List<User>get(Collection<Long> ids)List<User>getAllBackupUsers()List<User>getAllUsers()UsergetByActivationHash(String hash)UsergetByEmail(String email)UsergetByEmail(String email, User.Type type, Long domainId)List<User>getByExpiredHash(long ttl)UsergetByLogin(String login, User.Type type, Long domainId)UsergetContact(String email, Long ownerId)UsergetContact(String email, String firstName, String lastName, Long ownerId)UsergetContact(String email, String firstName, String lastName, Long langId, String tzId, Long ownerId)UsergetContact(String email, String firstName, String lastName, Long langId, String tzId, User owner)UsergetContact(String email, User owner)static Set<User.Right>getDefaultRights()UsergetExternalUser(String extId, String extType)static UsergetNewUserInstance(User currentUser)Get a new instance of theUserentity, with all default values setSet<User.Right>getRights(Long id)UsergetUserByHash(String hash)Userlogin(String userOrEmail, String userpass)login logicvoidpurge(User u, Long userId)UserresetPassword(User u, String password)LongsearchCountUserProfile(Long userId, String text, String offers, String search)List<User>searchUserProfile(Long userId, String text, String offers, String search, String orderBy, long start, long max, boolean asc)LongselectMaxFromUsersWithSearch(String search)Userupdate(User u, Long userId)Update an instance ofIDataProviderDaoUserupdate(User user, String password, Long updatedBy)booleanvalidLogin(String login)booleanverifyPassword(Long userId, String password)Returns true if the password is correct-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.openmeetings.db.dao.IDataProviderDao
get
-
-
-
-
Field Detail
-
FETCH_GROUP_GROUP
public static final String FETCH_GROUP_GROUP
- See Also:
- Constant Field Values
-
FETCH_GROUP_BACKUP
public static final String FETCH_GROUP_BACKUP
- See Also:
- Constant Field Values
-
-
Method Detail
-
getDefaultRights
public static Set<User.Right> getDefaultRights()
-
getNewUserInstance
public static User getNewUserInstance(User currentUser)
Get a new instance of theUserentity, with all default values set- Parameters:
currentUser- - the user to copy time zone from- Returns:
- new User instance
-
get
public List<User> get(long first, long count)
Description copied from interface:IDataProviderDaoGet a list of instances ofIDataProviderDao- Specified by:
getin interfaceIDataProviderDao<User>- Parameters:
first- - the start to range to retrievecount- - maximum instance count to retrieve- Returns:
- list of instances in the range specified
-
get
public List<User> get(String search, long start, long count, String sort, boolean filterContacts, Long currentUserId)
-
adminGet
public List<User> adminGet(String search, long start, long count, String order)
Description copied from interface:IGroupAdminDataProviderDaoGet a list of instances ofIGroupAdminDataProviderDao- Specified by:
adminGetin interfaceIGroupAdminDataProviderDao<User>- Parameters:
search- - string search criteria to filter entitiesstart- - the start to range to retrievecount- - maximum instance count to retrieveorder- - column and sort order- Returns:
- list of instances in the range specified
-
adminGet
public List<User> adminGet(String search, Long adminId, long start, long count, String order)
Description copied from interface:IGroupAdminDataProviderDaoGet a list of instances ofIGroupAdminDataProviderDao- Specified by:
adminGetin interfaceIGroupAdminDataProviderDao<User>- Parameters:
search- - string search criteria to filter entitiesadminId- - id of group admin userstart- - the start to range to retrievecount- - maximum instance count to retrieveorder- - column and sort order- Returns:
- list of instances in the range specified
-
count
public long count()
Description copied from interface:IDataProviderDaoCount the number of instances ofIDataProviderDao- Specified by:
countin interfaceIDataProviderDao<User>- Returns:
- count of instances
-
count
public long count(String search)
Description copied from interface:IDataProviderDaoCount the number of instances ofIDataProviderDao- Specified by:
countin interfaceIDataProviderDao<User>- Parameters:
search- - string search criteria to filter entities- Returns:
- count of instances satisfying given search criteria
-
adminCount
public long adminCount(String search)
Description copied from interface:IGroupAdminDataProviderDaoCount the number of instances ofIGroupAdminDataProviderDao- Specified by:
adminCountin interfaceIGroupAdminDataProviderDao<User>- Parameters:
search- - string search criteria to filter entities- Returns:
- count of instances satisfying given search criteria
-
adminCount
public long adminCount(String search, Long adminId)
Description copied from interface:IGroupAdminDataProviderDaoCount the number of instances ofIGroupAdminDataProviderDao- Specified by:
adminCountin interfaceIGroupAdminDataProviderDao<User>- Parameters:
search- - string search criteria to filter entitiesadminId- - id of group admin user- Returns:
- count of instances satisfying given search criteria
-
update
public User update(User u, Long userId)
Description copied from interface:IDataProviderDaoUpdate an instance ofIDataProviderDao- Specified by:
updatein interfaceIDataProviderDao<User>- Parameters:
u- - entity to be updateduserId- - user performed update- Returns:
- - updated entity
-
resetPassword
public User resetPassword(User u, String password) throws NoSuchAlgorithmException
- Throws:
NoSuchAlgorithmException
-
update
public User update(User user, String password, Long updatedBy) throws NoSuchAlgorithmException
- Throws:
NoSuchAlgorithmException
-
get
public User get(Long id)
Description copied from interface:IDataProviderDaoGet an instance of anIDataProviderDao- Specified by:
getin interfaceIDataProviderDao<User>- Parameters:
id- - id of instance to retrieve- Returns:
- instance with the id gived
-
delete
public void delete(User u, Long userId)
Description copied from interface:IDataProviderDaoDelete an instance ofIDataProviderDao- Specified by:
deletein interfaceIDataProviderDao<User>- Parameters:
u- - entity to be deleteduserId- - user performed delete
-
get
public List<User> get(Collection<Long> ids)
-
checkLogin
public boolean checkLogin(String login, User.Type type, Long domainId, Long id)
check for duplicates- Parameters:
login- - login to checktype- - userUser.Typeto checkdomainId- - domain to checkid- - id of current user to allow self update- Returns:
truein case login is allowed
-
checkEmail
public boolean checkEmail(String email, User.Type type, Long domainId, Long id)
Checks if a mail is already taken by someone else- Parameters:
email- - email to checktype- - userUser.Typeto checkdomainId- - domain to checkid- - id of current user to allow self update- Returns:
truein case email is allowed
-
validLogin
public boolean validLogin(String login)
-
selectMaxFromUsersWithSearch
public Long selectMaxFromUsersWithSearch(String search)
- Parameters:
search- - term to search- Returns:
- - number of matching user
-
verifyPassword
public boolean verifyPassword(Long userId, String password)
Returns true if the password is correct- Parameters:
userId- - id of the user to checkpassword- - password to check- Returns:
trueif entered password is correct
-
getContact
public User getContact(String email, String firstName, String lastName, Long langId, String tzId, Long ownerId)
-
getContact
public User getContact(String email, String firstName, String lastName, Long langId, String tzId, User owner)
-
getByActivationHash
public User getByActivationHash(String hash)
- Parameters:
hash- - activation hash- Returns:
- user with this hash
-
searchUserProfile
public List<User> searchUserProfile(Long userId, String text, String offers, String search, String orderBy, long start, long max, boolean asc)
-
searchCountUserProfile
public Long searchCountUserProfile(Long userId, String text, String offers, String search)
-
get
public List<User> get(String search, long start, long count, String order)
Description copied from interface:IDataProviderDaoGet a list of instances ofIDataProviderDao- Specified by:
getin interfaceIDataProviderDao<User>- Parameters:
search- - string search criteria to filter entitiesstart- - the start to range to retrievecount- - maximum instance count to retrieveorder- - column and sort order- Returns:
- list of instances in the range specified
-
getRights
public Set<User.Right> getRights(Long id)
-
login
public User login(String userOrEmail, String userpass) throws org.apache.openmeetings.util.OmException
login logic- Parameters:
userOrEmail- - login or email of the user being testeduserpass- - password of the user being tested- Returns:
- User object in case of successful login
- Throws:
org.apache.openmeetings.util.OmException- in case of any issue
-
-