@Test public void testFindDevicesByTenantId() { UUID tenantId1 = UUIDs.timeBased(); UUID tenantId2 = UUIDs.timeBased(); UUID customerId1 = UUIDs.timeBased(); UUID customerId2 = UUIDs.timeBased(); createDevices(tenantId1, tenantId2, customerId1, customerId2, 40); TextPageLink pageLink1 = new TextPageLink(15, "SEARCH_TEXT"); List<Device> devices1 = deviceDao.findDevicesByTenantId(tenantId1, pageLink1); assertEquals(15, devices1.size()); TextPageLink pageLink2 = new TextPageLink(15, "SEARCH_TEXT", devices1.get(14).getId().getId(), null); List<Device> devices2 = deviceDao.findDevicesByTenantId(tenantId1, pageLink2); assertEquals(5, devices2.size()); }
@Override public List<Device> findDevicesByTenantId(UUID tenantId, TextPageLink pageLink) { return DaoUtil.convertDataList( deviceRepository.findByTenantId( fromTimeUUID(tenantId), Objects.toString(pageLink.getTextSearch(), ""), pageLink.getIdOffset() == null ? NULL_UUID_STR : fromTimeUUID(pageLink.getIdOffset()), new PageRequest(0, pageLink.getLimit()))); }
JpaDeviceDao extends JpaAbstractSearchTextDao<DeviceEntity, Device> implements DeviceDao { @Override public List<Device> findDevicesByTenantId(UUID tenantId, TextPageLink pageLink) { return DaoUtil.convertDataList( deviceRepository.findByTenantId( fromTimeUUID(tenantId), Objects.toString(pageLink.getTextSearch(), ""), pageLink.getIdOffset() == null ? NULL_UUID_STR : fromTimeUUID(pageLink.getIdOffset()), new PageRequest(0, pageLink.getLimit()))); } }
JpaDeviceDao extends JpaAbstractSearchTextDao<DeviceEntity, Device> implements DeviceDao { @Override public List<Device> findDevicesByTenantId(UUID tenantId, TextPageLink pageLink) { return DaoUtil.convertDataList( deviceRepository.findByTenantId( fromTimeUUID(tenantId), Objects.toString(pageLink.getTextSearch(), ""), pageLink.getIdOffset() == null ? NULL_UUID_STR : fromTimeUUID(pageLink.getIdOffset()), new PageRequest(0, pageLink.getLimit()))); }  }
JpaDeviceDao extends JpaAbstractSearchTextDao<DeviceEntity, Device> implements DeviceDao { @Override public List<Device> findDevicesByTenantId(UUID tenantId, TextPageLink pageLink) { return DaoUtil.convertDataList( deviceRepository.findByTenantId( fromTimeUUID(tenantId), Objects.toString(pageLink.getTextSearch(), ""), pageLink.getIdOffset() == null ? NULL_UUID_STR : fromTimeUUID(pageLink.getIdOffset()), new PageRequest(0, pageLink.getLimit()))); }  @Override List<Device> findDevicesByTenantId(UUID tenantId, TextPageLink pageLink); @Override ListenableFuture<List<Device>> findDevicesByTenantIdAndIdsAsync(UUID tenantId, List<UUID> deviceIds); @Override List<Device> findDevicesByTenantIdAndCustomerId(UUID tenantId, UUID customerId, TextPageLink pageLink); @Override ListenableFuture<List<Device>> findDevicesByTenantIdCustomerIdAndIdsAsync(UUID tenantId, UUID customerId, List<UUID> deviceIds); @Override Optional<Device> findDeviceByTenantIdAndName(UUID tenantId, String name); @Override List<Device> findDevicesByTenantIdAndType(UUID tenantId, String type, TextPageLink pageLink); @Override List<Device> findDevicesByTenantIdAndCustomerIdAndType(UUID tenantId, UUID customerId, String type, TextPageLink pageLink); @Override ListenableFuture<List<EntitySubtype>> findTenantDeviceTypesAsync(UUID tenantId); }
JpaDeviceDao extends JpaAbstractSearchTextDao<DeviceEntity, Device> implements DeviceDao { @Override public List<Device> findDevicesByTenantId(UUID tenantId, TextPageLink pageLink) { return DaoUtil.convertDataList( deviceRepository.findByTenantId( fromTimeUUID(tenantId), Objects.toString(pageLink.getTextSearch(), ""), pageLink.getIdOffset() == null ? NULL_UUID_STR : fromTimeUUID(pageLink.getIdOffset()), new PageRequest(0, pageLink.getLimit()))); }  @Override List<Device> findDevicesByTenantId(UUID tenantId, TextPageLink pageLink); @Override ListenableFuture<List<Device>> findDevicesByTenantIdAndIdsAsync(UUID tenantId, List<UUID> deviceIds); @Override List<Device> findDevicesByTenantIdAndCustomerId(UUID tenantId, UUID customerId, TextPageLink pageLink); @Override ListenableFuture<List<Device>> findDevicesByTenantIdCustomerIdAndIdsAsync(UUID tenantId, UUID customerId, List<UUID> deviceIds); @Override Optional<Device> findDeviceByTenantIdAndName(UUID tenantId, String name); @Override List<Device> findDevicesByTenantIdAndType(UUID tenantId, String type, TextPageLink pageLink); @Override List<Device> findDevicesByTenantIdAndCustomerIdAndType(UUID tenantId, UUID customerId, String type, TextPageLink pageLink); @Override ListenableFuture<List<EntitySubtype>> findTenantDeviceTypesAsync(UUID tenantId);  }