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 for User
Author:
swagner, vasya
  • Field Details

  • Constructor Details

    • UserDao

      public UserDao()
  • Method Details

    • getDefaultRights

      public static Set<User.Right> getDefaultRights()
    • getNewUserInstance

      public static User getNewUserInstance(User currentUser)
      Get a new instance of the User entity, 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: IDataProviderDao
      Get a list of instances of IDataProviderDao
      Specified by:
      get in interface IDataProviderDao<User>
      Parameters:
      first - - the start to range to retrieve
      count - - maximum instance count to retrieve
      Returns:
      list of instances in the range specified
    • get

      public List<User> get(String search, boolean excludeContacts, long start, long count)
    • get

      public List<User> get(String search, long start, long count, org.apache.wicket.extensions.markup.html.repeater.util.SortParam<String> sort, boolean filterContacts, Long currentUserId)
    • adminGet

      public List<User> adminGet(String search, long start, long count, org.apache.wicket.extensions.markup.html.repeater.util.SortParam<String> sort)
      Description copied from interface: IGroupAdminDataProviderDao
      Get a list of instances of IGroupAdminDataProviderDao
      Specified by:
      adminGet in interface IGroupAdminDataProviderDao<User>
      Parameters:
      search - - string search criteria to filter entities
      start - - the start to range to retrieve
      count - - maximum instance count to retrieve
      sort - - 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, org.apache.wicket.extensions.markup.html.repeater.util.SortParam<String> sort)
      Description copied from interface: IGroupAdminDataProviderDao
      Get a list of instances of IGroupAdminDataProviderDao
      Specified by:
      adminGet in interface IGroupAdminDataProviderDao<User>
      Parameters:
      search - - string search criteria to filter entities
      adminId - - id of group admin user
      start - - the start to range to retrieve
      count - - maximum instance count to retrieve
      sort - - column and sort order
      Returns:
      list of instances in the range specified
    • searchUserProfile

      public List<User> searchUserProfile(Long userId, String search, String userOffers, String userSearches, org.apache.wicket.extensions.markup.html.repeater.util.SortParam<String> sort, long start, long count)
    • count

      public long count()
      Description copied from interface: IDataProviderDao
      Count the number of instances of IDataProviderDao
      Specified by:
      count in interface IDataProviderDao<User>
      Returns:
      count of instances
    • count

      public long count(String search)
      Description copied from interface: IDataProviderDao
      Count the number of instances of IDataProviderDao
      Specified by:
      count in interface IDataProviderDao<User>
      Parameters:
      search - - string search criteria to filter entities
      Returns:
      count of instances satisfying given search criteria
    • countUsers

      public long countUsers(String search, Long currentUserId)
    • count

      public long count(String search, boolean filterContacts, Long currentUserId)
    • adminCount

      public long adminCount(String search)
      Description copied from interface: IGroupAdminDataProviderDao
      Count the number of instances of IGroupAdminDataProviderDao
      Specified by:
      adminCount in interface IGroupAdminDataProviderDao<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: IGroupAdminDataProviderDao
      Count the number of instances of IGroupAdminDataProviderDao
      Specified by:
      adminCount in interface IGroupAdminDataProviderDao<User>
      Parameters:
      search - - string search criteria to filter entities
      adminId - - id of group admin user
      Returns:
      count of instances satisfying given search criteria
    • searchCountUserProfile

      public Long searchCountUserProfile(Long userId, String search, String userOffers, String userSearches)
    • update

      public User update(User u, Long userId)
      Description copied from interface: IDataProviderDao
      Update an instance of IDataProviderDao
      Specified by:
      update in interface IDataProviderDao<User>
      Parameters:
      u - - entity to be updated
      userId - - 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: IDataProviderDao
      Get an instance of an IDataProviderDao
      Specified by:
      get in interface IDataProviderDao<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: IDataProviderDao
      Delete an instance of IDataProviderDao
      Specified by:
      delete in interface IDataProviderDao<User>
      Parameters:
      u - - entity to be deleted
      userId - - user performed delete
    • purge

      public void purge(User u, Long userId)
    • get

      public List<User> get(Collection<Long> ids)
    • getAllUsers

      public List<User> getAllUsers()
    • getAllBackupUsers

      public List<User> getAllBackupUsers()
    • checkLogin

      public boolean checkLogin(String login, User.Type type, Long domainId, Long id)
      check for duplicates
      Parameters:
      login - - login to check
      type - - user User.Type to check
      domainId - - domain to check
      id - - id of current user to allow self update
      Returns:
      true in 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 check
      type - - user User.Type to check
      domainId - - domain to check
      id - - id of current user to allow self update
      Returns:
      true in case email is allowed
    • validLogin

      public boolean validLogin(String login)
    • getByLogin

      public User getByLogin(String _login, User.Type type, Long domainId)
    • getByEmail

      public User getByEmail(String email)
    • getByEmail

      public User getByEmail(String _email, User.Type type, Long domainId)
    • getUserByHash

      public User getUserByHash(String hash)
    • 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 check
      password - - password to check
      Returns:
      true if entered password is correct
    • getContact

      public User getContact(String email, Long ownerId)
    • getContact

      public User getContact(String email, User owner)
    • getContact

      public User getContact(String email, String firstName, String lastName, Long ownerId)
    • 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
    • getExternalUser

      public User getExternalUser(String extId, String extType)
    • get

      public List<User> get(String search, long start, long count, org.apache.wicket.extensions.markup.html.repeater.util.SortParam<String> sort)
      Description copied from interface: IDataProviderDao
      Get a list of instances of IDataProviderDao
      Specified by:
      get in interface IDataProviderDao<User>
      Parameters:
      search - - string search criteria to filter entities
      start - - the start to range to retrieve
      count - - maximum instance count to retrieve
      sort - - 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 OmException
      login logic
      Parameters:
      userOrEmail - - login or email of the user being tested
      userpass - - password of the user being tested
      Returns:
      User object in case of successful login
      Throws:
      OmException - in case of any issue
    • getByExpiredHash

      public List<User> getByExpiredHash(long ttl)