@Test public void testFindDashboardsByTenantId() { UUID tenantId1 = UUIDs.timeBased(); UUID tenantId2 = UUIDs.timeBased(); for (int i = 0; i < 20; i++) { createDashboard(tenantId1, i); createDashboard(tenantId2, i * 2); } TextPageLink pageLink1 = new TextPageLink(15, "DASHBOARD"); List<DashboardInfo> dashboardInfos1 = dashboardInfoDao.findDashboardsByTenantId(tenantId1, pageLink1); Assert.assertEquals(15, dashboardInfos1.size()); TextPageLink pageLink2 = new TextPageLink(15, "DASHBOARD", dashboardInfos1.get(14).getId().getId(), null); List<DashboardInfo> dashboardInfos2 = dashboardInfoDao.findDashboardsByTenantId(tenantId1, pageLink2); Assert.assertEquals(5, dashboardInfos2.size()); }
@Override public List<DashboardInfo> findDashboardsByTenantId(UUID tenantId, TextPageLink pageLink) { return DaoUtil.convertDataList(dashboardInfoRepository .findByTenantId( UUIDConverter.fromTimeUUID(tenantId), Objects.toString(pageLink.getTextSearch(), ""), pageLink.getIdOffset() == null ? NULL_UUID_STR : UUIDConverter.fromTimeUUID(pageLink.getIdOffset()), new PageRequest(0, pageLink.getLimit()))); }
JpaDashboardInfoDao extends JpaAbstractSearchTextDao<DashboardInfoEntity, DashboardInfo> implements DashboardInfoDao { @Override public List<DashboardInfo> findDashboardsByTenantId(UUID tenantId, TextPageLink pageLink) { return DaoUtil.convertDataList(dashboardInfoRepository .findByTenantId( UUIDConverter.fromTimeUUID(tenantId), Objects.toString(pageLink.getTextSearch(), ""), pageLink.getIdOffset() == null ? NULL_UUID_STR : UUIDConverter.fromTimeUUID(pageLink.getIdOffset()), new PageRequest(0, pageLink.getLimit()))); } }
JpaDashboardInfoDao extends JpaAbstractSearchTextDao<DashboardInfoEntity, DashboardInfo> implements DashboardInfoDao { @Override public List<DashboardInfo> findDashboardsByTenantId(UUID tenantId, TextPageLink pageLink) { return DaoUtil.convertDataList(dashboardInfoRepository .findByTenantId( UUIDConverter.fromTimeUUID(tenantId), Objects.toString(pageLink.getTextSearch(), ""), pageLink.getIdOffset() == null ? NULL_UUID_STR : UUIDConverter.fromTimeUUID(pageLink.getIdOffset()), new PageRequest(0, pageLink.getLimit()))); }  }
JpaDashboardInfoDao extends JpaAbstractSearchTextDao<DashboardInfoEntity, DashboardInfo> implements DashboardInfoDao { @Override public List<DashboardInfo> findDashboardsByTenantId(UUID tenantId, TextPageLink pageLink) { return DaoUtil.convertDataList(dashboardInfoRepository .findByTenantId( UUIDConverter.fromTimeUUID(tenantId), Objects.toString(pageLink.getTextSearch(), ""), pageLink.getIdOffset() == null ? NULL_UUID_STR : UUIDConverter.fromTimeUUID(pageLink.getIdOffset()), new PageRequest(0, pageLink.getLimit()))); }  @Override List<DashboardInfo> findDashboardsByTenantId(UUID tenantId, TextPageLink pageLink); @Override ListenableFuture<List<DashboardInfo>> findDashboardsByTenantIdAndCustomerId(UUID tenantId, UUID customerId, TimePageLink pageLink); }
JpaDashboardInfoDao extends JpaAbstractSearchTextDao<DashboardInfoEntity, DashboardInfo> implements DashboardInfoDao { @Override public List<DashboardInfo> findDashboardsByTenantId(UUID tenantId, TextPageLink pageLink) { return DaoUtil.convertDataList(dashboardInfoRepository .findByTenantId( UUIDConverter.fromTimeUUID(tenantId), Objects.toString(pageLink.getTextSearch(), ""), pageLink.getIdOffset() == null ? NULL_UUID_STR : UUIDConverter.fromTimeUUID(pageLink.getIdOffset()), new PageRequest(0, pageLink.getLimit()))); }  @Override List<DashboardInfo> findDashboardsByTenantId(UUID tenantId, TextPageLink pageLink); @Override ListenableFuture<List<DashboardInfo>> findDashboardsByTenantIdAndCustomerId(UUID tenantId, UUID customerId, TimePageLink pageLink);  }