Package ru.bgcrm.dao.user

# Class UserDAO

java.lang.Object
ru.bgcrm.dao.CommonDAO
ru.bgcrm.dao.user.UserDAO

Direct Known Subclasses:
  `UserPermsetDAO`

public class UserDAO extends CommonDAO

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class ru.bgcrm.dao.CommonDAO

  `CommonDAO.ObjectExtractor<T>, CommonDAO.RecordUpdater<T extends Id>`

- ## Field Summary

  ### Fields inherited from class ru.bgcrm.dao.CommonDAO

  `con, log, SQL_AND, SQL_DELETE, SQL_DELETE_FROM, SQL_DESC, SQL_DISTINCT, SQL_FROM, SQL_GROUP_BY, SQL_INNER_JOIN, SQL_INSERT_IGNORE_INTO, SQL_INSERT_INTO, SQL_LEFT_JOIN, SQL_LIMIT, SQL_ON_DUP_KEY_UPDATE, SQL_ORDER_BY, SQL_REPLACE, SQL_SELECT, SQL_SELECT_ALL_FROM, SQL_SELECT_COUNT_ROWS, SQL_SET, SQL_UNION_ALL, SQL_UPDATE, SQL_VALUES, SQL_VALUES_1, SQL_VALUES_2, SQL_VALUES_3, SQL_VALUES_4, SQL_VALUES_5, SQL_WHERE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `UserDAO(Connection con)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addUserGroup(int userId, UserGroup group)`
  `void`
  `closeUserGroupPeriod(int userId, int groupId, Date date, Date dateFrom, Date dateTo)`
  `void`
  `deleteUser(int id)`
  `Map<Integer,Map<String,ConfigMap>>`
  `getAllPermissions(String tableName, String selectColumn)`
  `Map<Integer,Set<Integer>>`
  `getAllUserGroupIds()`
  `Map<Integer,List<UserGroup>>`
  `getAllUserGroups()`
  `Map<Integer,Map<String,ConfigMap>>`
  `getAllUserPerm()`
  `Map<Integer,List<Integer>>`
  `getAllUserPermsetIds()`
  `Map<Integer,Set<Integer>>`
  `getAllUserQueueIds()`
  `protected String`
  `getPageLimit(Page page)`
  `Map<String,ConfigMap>`
  `getPermissions(int userId)`
  `User`
  `getUser(int id)`
  Retrieves user by ID.
  `User`
  `getUserByLogin(String name)`
  `Set<Integer>`
  `getUserGroupIds(int userId)`
  `List<UserGroup>`
  `getUserGroupList(int userId, Date date)`
  `List<User>`
  `getUserList()`
  Complete user list with passwords.
  `List<User>`
  `getUserList(Set<Integer> groupIds)`
  `List<User>`
  `getUserList(Set<Integer> groupIds, String userTitleMask)`
  `List<User>`
  `getUserList(Set<Integer> groupIds, String userTitleMask, boolean loadPassword)`
  `List<User>`
  `getUserList(Set<Integer> groupFilter, Date dateGroupFrom, Date dateGroupTo)`
  `List<Integer>`
  `getUserPermsetIds(int userId)`
  `Set<Integer>`
  `getUserQueueIds(int userId)`
  `void`
  `removeUserGroup(int userId, int groupId, Date dateFrom, Date dateTo)`
  `void`
  `searchUser(Pageable<User> result, String filterLike, Set<Integer> groupFilter, Set<Integer> groupSelectFilter, Date date, Set<Integer> permsetFilter, int statusFilter)`
  `void`
  `searchUserListByEmail(Pageable<ParameterSearchedObject<User>> searchResult, List<Integer> emailParamIdList, String email)`
  Выбирает пользователей по параметру типа Email.
  `void`
  `updatePermissions(Set<String> action, Set<String> config, int userId)`
  `protected void`
  `updatePermissions(Set<String> action, Set<String> config, String table, String column, int id)`
  `void`
  `updatePersonalization(String mapDataBefore, User user)`
  Updates user personalization map in DB if it changes from `mapDataBefore`.
  `void`
  `updatePersonalization(User user, ConfigMap newMap)`
  `void`
  `updateUser(int userId, String title, String login, String pswd, String comment)`
  Deprecated.
  `void`
  `updateUser(User user)`
  `void`
  `updateUserGroups(User user)`
  Sets user groups to values from `User.getGroupIds()`, opened from current date.

  ### Methods inherited from class ru.bgcrm.dao.CommonDAO

  `deleteById, foundRows, getById, getGroupedIds, getGroupedIds, getIds, getIds, getPeriodSql, lastInsertId, setPeriodParamValue, setRecordCount, update, updateColumn, updateIds, updateIds, updateOrInsert`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### UserDAO

    public UserDAO(Connection con)

- ## Method Details

  - ### searchUser

    public void searchUser(Pageable<User> result, String filterLike, Set<Integer> groupFilter, Set<Integer> groupSelectFilter, Date date, Set<Integer> permsetFilter, int statusFilter) throws SQLException
    Throws:
      `SQLException`

  - ### searchUserListByEmail

    public void searchUserListByEmail(Pageable<ParameterSearchedObject<User>> searchResult, List<Integer> emailParamIdList, String email)
    Выбирает пользователей по параметру типа Email.
    Parameters:
      `searchResult` -
      `emailParamIdList` -
      `email` - Email, поиск идёт по точному совпадению и совпадению домена
    Throws:
      `SQLException`

  - ### getUserList

    public List<User> getUserList() throws SQLException
    Complete user list with passwords.
    Returns:
    Throws:
      `SQLException`

  - ### getUserList

    public List<User> getUserList(Set<Integer> groupIds) throws SQLException
    Throws:
      `SQLException`

  - ### getUserList

    public List<User> getUserList(Set<Integer> groupIds, String userTitleMask) throws SQLException
    Throws:
      `SQLException`

  - ### getUserList

    public List<User> getUserList(Set<Integer> groupIds, String userTitleMask, boolean loadPassword) throws SQLException
    Throws:
      `SQLException`

  - ### getUserList

    public List<User> getUserList(Set<Integer> groupFilter, Date dateGroupFrom, Date dateGroupTo) throws SQLException
    Throws:
      `SQLException`

  - ### getAllUserGroups

    public Map<Integer,List<UserGroup>> getAllUserGroups() throws SQLException
    Throws:
      `SQLException`

  - ### getUserGroupIds

    public Set<Integer> getUserGroupIds(int userId) throws SQLException
    Throws:
      `SQLException`

  - ### getAllUserGroupIds

    public Map<Integer,Set<Integer>> getAllUserGroupIds() throws SQLException
    Throws:
      `SQLException`

  - ### getUserPermsetIds

    public List<Integer> getUserPermsetIds(int userId) throws SQLException
    Throws:
      `SQLException`

  - ### getAllUserPermsetIds

    public Map<Integer,List<Integer>> getAllUserPermsetIds() throws SQLException
    Throws:
      `SQLException`

  - ### getUserQueueIds

    public Set<Integer> getUserQueueIds(int userId) throws SQLException
    Throws:
      `SQLException`

  - ### getAllUserQueueIds

    public Map<Integer,Set<Integer>> getAllUserQueueIds() throws SQLException
    Throws:
      `SQLException`

  - ### updateUser

    public void updateUser(User user) throws SQLException
    Throws:
      `SQLException`

  - ### getUserByLogin

    public User getUserByLogin(String name)

  - ### getUser

    public User getUser(int id) throws SQLException
    Retrieves user by ID.
    Parameters:
      `id` - unique ID.
    Returns:
      found user or `null`.
    Throws:
      `SQLException`

  - ### deleteUser

    public void deleteUser(int id) throws SQLException
    Throws:
      `SQLException`

  - ### getPageLimit

    protected String getPageLimit(Page page)
    Overrides:
      `getPageLimit` in class `CommonDAO`

  - ### getAllPermissions

    public Map<Integer,Map<String,ConfigMap>> getAllPermissions(String tableName, String selectColumn) throws SQLException
    Throws:
      `SQLException`

  - ### getAllUserPerm

    public Map<Integer,Map<String,ConfigMap>> getAllUserPerm() throws SQLException
    Throws:
      `SQLException`

  - ### updatePermissions

    public void updatePermissions(Set<String> action, Set<String> config, int userId) throws SQLException
    Throws:
      `SQLException`

  - ### updatePermissions

    protected void updatePermissions(Set<String> action, Set<String> config, String table, String column, int id) throws SQLException
    Throws:
      `SQLException`

  - ### getPermissions

    public Map<String,ConfigMap> getPermissions(int userId)

  - ### updatePersonalization

    public void updatePersonalization(String mapDataBefore, User user) throws SQLException
    Updates user personalization map in DB if it changes from `mapDataBefore`.
    Parameters:
      `mapDataBefore` - the current state of the map, `null` when no comparing is needed.
      `user` - the user with personalization to be updated.
    Throws:
      `SQLException`

  - ### updatePersonalization

    public void updatePersonalization(User user, ConfigMap newMap) throws SQLException
    Throws:
      `SQLException`

  - ### addUserGroup

    public void addUserGroup(int userId, UserGroup group) throws SQLException
    Throws:
      `SQLException`

  - ### removeUserGroup

    public void removeUserGroup(int userId, int groupId, Date dateFrom, Date dateTo) throws SQLException
    Throws:
      `SQLException`

  - ### getUserGroupList

    public List<UserGroup> getUserGroupList(int userId, Date date)

  - ### updateUserGroups

    public void updateUserGroups(User user) throws SQLException
    Sets user groups to values from `User.getGroupIds()`, opened from current date. All the existing groups are replaced.
    Parameters:
      `user` -
    Throws:
      `SQLException`

  - ### closeUserGroupPeriod

    public void closeUserGroupPeriod(int userId, int groupId, Date date, Date dateFrom, Date dateTo) throws SQLException
    Throws:
      `SQLException`

  - ### updateUser

    @Deprecated public void updateUser(int userId, String title, String login, String pswd, String comment) throws SQLException
    Deprecated.
    Throws:
      `SQLException`