@Test @DatabaseSetup("classpath:dbunit/empty_dataset.xml") public void testFindCustomerUsers() { UUID tenantId = UUIDs.timeBased(); UUID customerId = UUIDs.timeBased(); create30Adminsand60Users(tenantId, customerId); List<User> customerUsers1 = userDao.findCustomerUsers(tenantId, customerId, new TextPageLink(40)); assertEquals(40, customerUsers1.size()); List<User> customerUsers2 = userDao.findCustomerUsers(tenantId, customerId, new TextPageLink(20, null, customerUsers1.get(39).getId().getId(), null)); assertEquals(20, customerUsers2.size()); List<User> customerUsers3 = userDao.findCustomerUsers(tenantId, customerId, new TextPageLink(20, null, customerUsers2.get(19).getId().getId(), null)); assertEquals(0, customerUsers3.size()); }
@Override public List<User> findCustomerUsers(UUID tenantId, UUID customerId, TextPageLink pageLink) { return DaoUtil.convertDataList( userRepository .findUsersByAuthority( fromTimeUUID(tenantId), fromTimeUUID(customerId), pageLink.getIdOffset() == null ? NULL_UUID_STR : fromTimeUUID(pageLink.getIdOffset()), Objects.toString(pageLink.getTextSearch(), ""), Authority.CUSTOMER_USER, new PageRequest(0, pageLink.getLimit()))); }
JpaUserDao extends JpaAbstractSearchTextDao<UserEntity, User> implements UserDao { @Override public List<User> findCustomerUsers(UUID tenantId, UUID customerId, TextPageLink pageLink) { return DaoUtil.convertDataList( userRepository .findUsersByAuthority( fromTimeUUID(tenantId), fromTimeUUID(customerId), pageLink.getIdOffset() == null ? NULL_UUID_STR : fromTimeUUID(pageLink.getIdOffset()), Objects.toString(pageLink.getTextSearch(), ""), Authority.CUSTOMER_USER, new PageRequest(0, pageLink.getLimit()))); } }
JpaUserDao extends JpaAbstractSearchTextDao<UserEntity, User> implements UserDao { @Override public List<User> findCustomerUsers(UUID tenantId, UUID customerId, TextPageLink pageLink) { return DaoUtil.convertDataList( userRepository .findUsersByAuthority( fromTimeUUID(tenantId), fromTimeUUID(customerId), pageLink.getIdOffset() == null ? NULL_UUID_STR : fromTimeUUID(pageLink.getIdOffset()), Objects.toString(pageLink.getTextSearch(), ""), Authority.CUSTOMER_USER, new PageRequest(0, pageLink.getLimit()))); }  }
JpaUserDao extends JpaAbstractSearchTextDao<UserEntity, User> implements UserDao { @Override public List<User> findCustomerUsers(UUID tenantId, UUID customerId, TextPageLink pageLink) { return DaoUtil.convertDataList( userRepository .findUsersByAuthority( fromTimeUUID(tenantId), fromTimeUUID(customerId), pageLink.getIdOffset() == null ? NULL_UUID_STR : fromTimeUUID(pageLink.getIdOffset()), Objects.toString(pageLink.getTextSearch(), ""), Authority.CUSTOMER_USER, new PageRequest(0, pageLink.getLimit()))); }  @Override User findByEmail(String email); @Override List<User> findTenantAdmins(UUID tenantId, TextPageLink pageLink); @Override List<User> findCustomerUsers(UUID tenantId, UUID customerId, TextPageLink pageLink); }
JpaUserDao extends JpaAbstractSearchTextDao<UserEntity, User> implements UserDao { @Override public List<User> findCustomerUsers(UUID tenantId, UUID customerId, TextPageLink pageLink) { return DaoUtil.convertDataList( userRepository .findUsersByAuthority( fromTimeUUID(tenantId), fromTimeUUID(customerId), pageLink.getIdOffset() == null ? NULL_UUID_STR : fromTimeUUID(pageLink.getIdOffset()), Objects.toString(pageLink.getTextSearch(), ""), Authority.CUSTOMER_USER, new PageRequest(0, pageLink.getLimit()))); }  @Override User findByEmail(String email); @Override List<User> findTenantAdmins(UUID tenantId, TextPageLink pageLink); @Override List<User> findCustomerUsers(UUID tenantId, UUID customerId, TextPageLink pageLink);  }