Class HibernateUserDAO

    • Method Detail

      • ignoreCaseLogin

        public static boolean ignoreCaseLogin()
      • delete

        public boolean delete​(long userId,
                              int code)
        Description copied from interface: PersistentObjectDAO
        This method deletes an entity and you can give a deletion code
        Specified by:
        delete in interface PersistentObjectDAO<User>
        Overrides:
        delete in class HibernatePersistentObjectDAO<User>
        Parameters:
        userId - ID of the entity which should be deleted
        code - Deletion code
        Returns:
        if the record has been successfully deleted
      • findByName

        public List<User> findByName​(String name)
        Description copied from interface: UserDAO
        This method finds an User by name.
        Specified by:
        findByName in interface UserDAO
        Parameters:
        name - The name of wanted User.
        Returns:
        Collection of selected users.
      • findByUsername

        public User findByUsername​(String username)
        Description copied from interface: UserDAO
        This method finds an User by its username. The search is case sensitive.
        Specified by:
        findByUsername in interface UserDAO
        Parameters:
        username - username of wanted User.
        Returns:
        Wanted User or null if user doesn't exist.
      • findByUsernameIgnoreCase

        public User findByUsernameIgnoreCase​(String username)
        Description copied from interface: UserDAO
        This method finds an User by its username. The search is case insensitive.
        Specified by:
        findByUsernameIgnoreCase in interface UserDAO
        Parameters:
        username - username of wanted User.
        Returns:
        Wanted User or null if user doesn't exist.
      • findByUsernameAndName

        public List<User> findByUsernameAndName​(String username,
                                                String name)
        Description copied from interface: UserDAO
        This method finds an User by username and name.
        Specified by:
        findByUsernameAndName in interface UserDAO
        Parameters:
        username - The username of wanted user
        name - The name of wanted user
        Returns:
        Collection of selected users
      • store

        public boolean store​(User user,
                             UserHistory transaction)
        Description copied from interface: UserDAO
        This method persists the user object and insert a new user history entry.
        Specified by:
        store in interface UserDAO
        Parameters:
        user - the user to store
        transaction - entry to log the event
        Returns:
        True if successfully stored in a database.
      • validateUser

        public boolean validateUser​(String username)
        Description copied from interface: UserDAO
        Validates an username only (the password content is not inspectged.
        Specified by:
        validateUser in interface UserDAO
        Parameters:
        username - Username of the User to be validated.
        Returns:
        True if User is valid.
      • getPasswordTtl

        public int getPasswordTtl()
      • isPasswordExpired

        public boolean isPasswordExpired​(String username)
        Description copied from interface: UserDAO
        Is password expired.
        Specified by:
        isPasswordExpired in interface UserDAO
        Parameters:
        username - Username of the User to be validate.
        Returns:
        True if the password is expired
      • count

        public int count​(Long tenantId)
        Description copied from interface: UserDAO
        Counts the total number of standard users
        Specified by:
        count in interface UserDAO
        Parameters:
        tenantId - identifier of the tenant
        Returns:
        total number of guest users
      • countGuests

        public int countGuests​(Long tenantId)
        Description copied from interface: UserDAO
        Counts the total number of guest users
        Specified by:
        countGuests in interface UserDAO
        Parameters:
        tenantId - identifier of the tenant
        Returns:
        total number of guest users
      • delete

        public boolean delete​(long userId,
                              UserHistory transaction)
        Description copied from interface: UserDAO
        This method deletes the user object and insert a new user history entry.
        Specified by:
        delete in interface UserDAO
        Parameters:
        userId - The id of the user to delete
        transaction - entry to log the event
        Returns:
        True if successfully deleted from the database.
      • setUserHistoryDAO

        public void setUserHistoryDAO​(UserHistoryDAO userHistoryDAO)
      • setUserListenerManager

        public void setUserListenerManager​(UserListenerManager userListenerManager)
      • findUserSettings

        public Map<String,​Generic> findUserSettings​(long userId,
                                                          String namePrefix)
        Description copied from interface: UserDAO
        Retrieves the settings for a user. The settings are stored as Generics of type usersetting.
        Specified by:
        findUserSettings in interface UserDAO
        Parameters:
        userId - Identifier of the user
        namePrefix - Name prefix of the property (optional)
        Returns:
        The map setting_name-generic
      • setGenericDAO

        public void setGenericDAO​(GenericDAO genericDAO)
      • findAdminUser

        public User findAdminUser​(String tenantName)
        Description copied from interface: UserDAO
        Retrieve the administrator for the given tenant. The general rule is that the administrator's username is:
        1. admin if the tenant is default
        2. adminTenantname in all other cases
        Specified by:
        findAdminUser in interface UserDAO
        Parameters:
        tenantName - name of the tenant
        Returns:
        the user to administrate the tenant
      • findByGroup

        public Set<User> findByGroup​(long groupId)
        Description copied from interface: UserDAO
        Retrieves the users belonging to a given group.
        Specified by:
        findByGroup in interface UserDAO
        Parameters:
        groupId - Identifier of the group
        Returns:
        the set of groups
      • getUser

        public User getUser​(String username)
        Description copied from interface: UserDAO
        Depending on the global setting, it invokes findByUsername or findByUsernameIgnoreCase
        Specified by:
        getUser in interface UserDAO
        Parameters:
        username - The username of the user
        Returns:
        The found user