@Test @Sql(scripts = { "/sql/clearUserRoles.sql", "/sql/clearUsers.sql", "/sql/clearRoles.sql", "/sql/createRoles.sql", "/sql/clearAddresses.sql", "/sql/createUsers.sql" }) public void test_search_user_byId() { List<Long> idList = new ArrayList<Long>(); idList.add(1l); idList.add(2l); idList.add(3l); UserSearchCriteria userSearch = UserSearchCriteria.builder().tenantId("ap.public").id(idList).build(); List<User> actualList = userRepository.findAll(userSearch); assertThat(actualList.size() == 3); }
public List<User> findAll(UserSearchCriteria userSearch) { final List<Object> preparedStatementValues = new ArrayList<>(); String queryStr = userTypeQueryBuilder.getQuery(userSearch, preparedStatementValues); log.debug(queryStr); List<User> users = jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), userResultSetExtractor); enrichRoles(users); return users; }
UserRepository { public List<User> findAll(UserSearchCriteria userSearch) { final List<Object> preparedStatementValues = new ArrayList<>(); String queryStr = userTypeQueryBuilder.getQuery(userSearch, preparedStatementValues); log.debug(queryStr); List<User> users = jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), userResultSetExtractor); enrichRoles(users); return users; } }
UserRepository { public List<User> findAll(UserSearchCriteria userSearch) { final List<Object> preparedStatementValues = new ArrayList<>(); String queryStr = userTypeQueryBuilder.getQuery(userSearch, preparedStatementValues); log.debug(queryStr); List<User> users = jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), userResultSetExtractor); enrichRoles(users); return users; } @Autowired  UserRepository(RoleRepository roleRepository, UserTypeQueryBuilder userTypeQueryBuilder,
                   AddressRepository addressRepository, UserResultSetExtractor userResultSetExtractor,
                   JdbcTemplate jdbcTemplate,
                   NamedParameterJdbcTemplate namedParameterJdbcTemplate); }
UserRepository { public List<User> findAll(UserSearchCriteria userSearch) { final List<Object> preparedStatementValues = new ArrayList<>(); String queryStr = userTypeQueryBuilder.getQuery(userSearch, preparedStatementValues); log.debug(queryStr); List<User> users = jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), userResultSetExtractor); enrichRoles(users); return users; } @Autowired  UserRepository(RoleRepository roleRepository, UserTypeQueryBuilder userTypeQueryBuilder,
                   AddressRepository addressRepository, UserResultSetExtractor userResultSetExtractor,
                   JdbcTemplate jdbcTemplate,
                   NamedParameterJdbcTemplate namedParameterJdbcTemplate); List<User> findAll(UserSearchCriteria userSearch); boolean isUserPresent(String userName, String tenantId, UserType userType); User create(User user); void update(final User user, User oldUser); void fetchFailedLoginAttemptsByUser(String uuid); List<FailedLoginAttempt> fetchFailedAttemptsByUserAndTime(String uuid, long attemptStartDate); FailedLoginAttempt insertFailedLoginAttempt(FailedLoginAttempt failedLoginAttempt); void resetFailedLoginAttemptsForUser(String uuid); }
UserRepository { public List<User> findAll(UserSearchCriteria userSearch) { final List<Object> preparedStatementValues = new ArrayList<>(); String queryStr = userTypeQueryBuilder.getQuery(userSearch, preparedStatementValues); log.debug(queryStr); List<User> users = jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), userResultSetExtractor); enrichRoles(users); return users; } @Autowired  UserRepository(RoleRepository roleRepository, UserTypeQueryBuilder userTypeQueryBuilder,
                   AddressRepository addressRepository, UserResultSetExtractor userResultSetExtractor,
                   JdbcTemplate jdbcTemplate,
                   NamedParameterJdbcTemplate namedParameterJdbcTemplate); List<User> findAll(UserSearchCriteria userSearch); boolean isUserPresent(String userName, String tenantId, UserType userType); User create(User user); void update(final User user, User oldUser); void fetchFailedLoginAttemptsByUser(String uuid); List<FailedLoginAttempt> fetchFailedAttemptsByUserAndTime(String uuid, long attemptStartDate); FailedLoginAttempt insertFailedLoginAttempt(FailedLoginAttempt failedLoginAttempt); void resetFailedLoginAttemptsForUser(String uuid);  }