@Test public void testFindAssetsByTenantIdAndIdsAsync() throws ExecutionException, InterruptedException { UUID tenantId = Uuids.timeBased(); UUID customerId = Uuids.timeBased(); List<UUID> searchIds = new ArrayList<>(); for (int i = 0; i < 30; i++) { UUID assetId = Uuids.timeBased(); saveAsset(assetId, tenantId, customerId, "ASSET_" + i, "TYPE_1"); if (i % 3 == 0) { searchIds.add(assetId); } } ListenableFuture<List<Asset>> assetsFuture = assetDao .findAssetsByTenantIdAndIdsAsync(tenantId, searchIds); List<Asset> assets = assetsFuture.get(); assertNotNull(assets); assertEquals(10, assets.size()); }
@Override public ListenableFuture<List<Asset>> findAssetsByTenantIdAndIdsAsync(UUID tenantId, List<UUID> assetIds) { return service.submit(() -> DaoUtil.convertDataList(assetRepository.findByTenantIdAndIdIn(tenantId, assetIds))); }
JpaAssetDao extends JpaAbstractSearchTextDao<AssetEntity, Asset> implements AssetDao { @Override public ListenableFuture<List<Asset>> findAssetsByTenantIdAndIdsAsync(UUID tenantId, List<UUID> assetIds) { return service.submit(() -> DaoUtil.convertDataList(assetRepository.findByTenantIdAndIdIn(tenantId, assetIds))); } }
JpaAssetDao extends JpaAbstractSearchTextDao<AssetEntity, Asset> implements AssetDao { @Override public ListenableFuture<List<Asset>> findAssetsByTenantIdAndIdsAsync(UUID tenantId, List<UUID> assetIds) { return service.submit(() -> DaoUtil.convertDataList(assetRepository.findByTenantIdAndIdIn(tenantId, assetIds))); }  }
JpaAssetDao extends JpaAbstractSearchTextDao<AssetEntity, Asset> implements AssetDao { @Override public ListenableFuture<List<Asset>> findAssetsByTenantIdAndIdsAsync(UUID tenantId, List<UUID> assetIds) { return service.submit(() -> DaoUtil.convertDataList(assetRepository.findByTenantIdAndIdIn(tenantId, assetIds))); }  @Override AssetInfo findAssetInfoById(TenantId tenantId, UUID assetId); @Override PageData<Asset> findAssetsByTenantId(UUID tenantId, PageLink pageLink); @Override PageData<AssetInfo> findAssetInfosByTenantId(UUID tenantId, PageLink pageLink); @Override ListenableFuture<List<Asset>> findAssetsByTenantIdAndIdsAsync(UUID tenantId, List<UUID> assetIds); @Override PageData<Asset> findAssetsByTenantIdAndCustomerId(UUID tenantId, UUID customerId, PageLink pageLink); @Override PageData<AssetInfo> findAssetInfosByTenantIdAndCustomerId(UUID tenantId, UUID customerId, PageLink pageLink); @Override ListenableFuture<List<Asset>> findAssetsByTenantIdAndCustomerIdAndIdsAsync(UUID tenantId, UUID customerId, List<UUID> assetIds); @Override Optional<Asset> findAssetsByTenantIdAndName(UUID tenantId, String name); @Override PageData<Asset> findAssetsByTenantIdAndType(UUID tenantId, String type, PageLink pageLink); @Override PageData<AssetInfo> findAssetInfosByTenantIdAndType(UUID tenantId, String type, PageLink pageLink); @Override PageData<Asset> findAssetsByTenantIdAndCustomerIdAndType(UUID tenantId, UUID customerId, String type, PageLink pageLink); @Override PageData<AssetInfo> findAssetInfosByTenantIdAndCustomerIdAndType(UUID tenantId, UUID customerId, String type, PageLink pageLink); @Override ListenableFuture<List<EntitySubtype>> findTenantAssetTypesAsync(UUID tenantId); }
JpaAssetDao extends JpaAbstractSearchTextDao<AssetEntity, Asset> implements AssetDao { @Override public ListenableFuture<List<Asset>> findAssetsByTenantIdAndIdsAsync(UUID tenantId, List<UUID> assetIds) { return service.submit(() -> DaoUtil.convertDataList(assetRepository.findByTenantIdAndIdIn(tenantId, assetIds))); }  @Override AssetInfo findAssetInfoById(TenantId tenantId, UUID assetId); @Override PageData<Asset> findAssetsByTenantId(UUID tenantId, PageLink pageLink); @Override PageData<AssetInfo> findAssetInfosByTenantId(UUID tenantId, PageLink pageLink); @Override ListenableFuture<List<Asset>> findAssetsByTenantIdAndIdsAsync(UUID tenantId, List<UUID> assetIds); @Override PageData<Asset> findAssetsByTenantIdAndCustomerId(UUID tenantId, UUID customerId, PageLink pageLink); @Override PageData<AssetInfo> findAssetInfosByTenantIdAndCustomerId(UUID tenantId, UUID customerId, PageLink pageLink); @Override ListenableFuture<List<Asset>> findAssetsByTenantIdAndCustomerIdAndIdsAsync(UUID tenantId, UUID customerId, List<UUID> assetIds); @Override Optional<Asset> findAssetsByTenantIdAndName(UUID tenantId, String name); @Override PageData<Asset> findAssetsByTenantIdAndType(UUID tenantId, String type, PageLink pageLink); @Override PageData<AssetInfo> findAssetInfosByTenantIdAndType(UUID tenantId, String type, PageLink pageLink); @Override PageData<Asset> findAssetsByTenantIdAndCustomerIdAndType(UUID tenantId, UUID customerId, String type, PageLink pageLink); @Override PageData<AssetInfo> findAssetInfosByTenantIdAndCustomerIdAndType(UUID tenantId, UUID customerId, String type, PageLink pageLink); @Override ListenableFuture<List<EntitySubtype>> findTenantAssetTypesAsync(UUID tenantId);  }