Interface UserDAO

All Superinterfaces:
PersistentObjectDAO<User>
All Known Implementing Classes:
HibernateUserDAO

public interface UserDAO extends PersistentObjectDAO<User>
This class is a DAO-service for User-objects.
Version:
1.0
Author:
Michael Scholz, Marco Meschieri
  • Method Details

    • count

      int count(Long tenantId) throws PersistenceException
      Counts the total number of standard users
      Parameters:
      tenantId - identifier of the tenant
      Returns:
      total number of guest users
      Throws:
      PersistenceException - Error in the database
    • countGuests

      int countGuests(Long tenantId) throws PersistenceException
      Counts the total number of guest users
      Parameters:
      tenantId - identifier of the tenant
      Returns:
      total number of guest users
      Throws:
      PersistenceException - Error in the database
    • findByUsername

      User findByUsername(String username) throws PersistenceException
      This method finds an User by its username. The search is case sensitive.
      Parameters:
      username - username of wanted User.
      Returns:
      Wanted User or null if user doesn't exist.
      Throws:
      PersistenceException - Error in the data layer
    • findByUsernameIgnoreCase

      User findByUsernameIgnoreCase(String username) throws PersistenceException
      This method finds an User by its username. The search is case insensitive.
      Parameters:
      username - username of wanted User.
      Returns:
      Wanted User or null if user doesn't exist.
      Throws:
      PersistenceException - Error in the data layer
    • getUser

      User getUser(String username) throws PersistenceException
      Depending on the global setting, it invokes findByUsername or findByUsernameIgnoreCase
      Parameters:
      username - The username of the user
      Returns:
      The found user
      Throws:
      PersistenceException - Error in the data layer
    • findByLikeUsername

      List<User> findByLikeUsername(String username) throws PersistenceException
      This method finds an User by username.
      Parameters:
      username - The username of wanted User.
      Returns:
      Collection of selected users.
      Throws:
      PersistenceException - Error in the database
    • findByName

      List<User> findByName(String name) throws PersistenceException
      This method finds an User by name.
      Parameters:
      name - The name of wanted User.
      Returns:
      Collection of selected users.
      Throws:
      PersistenceException - Error in the database
    • findByUsernameAndName

      List<User> findByUsernameAndName(String username, String name) throws PersistenceException
      This method finds an User by username and name.
      Parameters:
      username - The username of wanted user
      name - The name of wanted user
      Returns:
      Collection of selected users
      Throws:
      PersistenceException - Error in the database
    • isPasswordExpired

      boolean isPasswordExpired(String username)
      Is password expired.
      Parameters:
      username - Username of the User to be validated.
      Returns:
      True if the password is expired
    • isInactive

      boolean isInactive(String username) throws PersistenceException
      Checks if a user is inactive, that is a user without interactions in the last X days after it has last enabled. We look at the User.getMaxInactivity() first and then we fallback to the general parameter security.user.maxinactivity
      Parameters:
      username - identifier of the user
      Returns:
      the last interaction time
      Throws:
      PersistenceException - Error in the database
    • delete

      void delete(long userId, UserHistory transaction) throws PersistenceException
      This method deletes the user object and insert a new user history entry.
      Parameters:
      userId - The id of the user to delete
      transaction - entry to log the event
      Throws:
      PersistenceException - error at database level
    • store

      void store(User user, UserHistory transaction) throws PersistenceException
      This method persists the user object and insert a new user history entry.
      Parameters:
      user - the user to store
      transaction - entry to log the event
      Throws:
      PersistenceException - error at database level
    • findUserSettings

      Map<String,Generic> findUserSettings(long userId, String namePrefix) throws PersistenceException
      Retrieves the settings for a user. The settings are stored as Generics of type usersetting.
      Parameters:
      userId - Identifier of the user
      namePrefix - Name prefix of the property (optional)
      Returns:
      The map setting_name-generic
      Throws:
      PersistenceException - Error in the database
    • findAdminUser

      User findAdminUser(String tenantName) throws PersistenceException
      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
      Parameters:
      tenantName - name of the tenant
      Returns:
      the user to administrate the tenant
      Throws:
      PersistenceException - Error in the database
    • findByGroup

      Set<User> findByGroup(long groupId) throws PersistenceException
      Retrieves the users belonging to a given group.
      Parameters:
      groupId - Identifier of the group
      Returns:
      the set of groups
      Throws:
      PersistenceException - Error in the database