use of org.apache.nifi.registry.db.entity.BucketItemEntity in project nifi-registry by apache.
the class TestDatabaseMetadataService method testGetBucketItemsForBucket.
// ----------------- BucketItems ---------------------------------
@Test
public void testGetBucketItemsForBucket() {
final BucketEntity bucket = metadataService.getBucketById("1");
assertNotNull(bucket);
final List<BucketItemEntity> items = metadataService.getBucketItems(bucket.getId());
assertNotNull(items);
assertEquals(2, items.size());
items.stream().forEach(i -> assertNotNull(i.getBucketName()));
}
use of org.apache.nifi.registry.db.entity.BucketItemEntity in project nifi-registry by apache.
the class DatabaseMetadataService method getBucketItems.
// ----------------- BucketItems ---------------------------------
@Override
public List<BucketItemEntity> getBucketItems(final String bucketIdentifier) {
final String sql = "SELECT " + "item.id as ID, " + "item.name as NAME, " + "item.description as DESCRIPTION, " + "item.created as CREATED, " + "item.modified as MODIFIED, " + "item.item_type as ITEM_TYPE, " + "b.id as BUCKET_ID, " + "b.name as BUCKET_NAME " + "FROM " + "bucket_item item, bucket b " + "WHERE " + "item.bucket_id = b.id " + "AND " + "item.bucket_id = ?";
final List<BucketItemEntity> items = jdbcTemplate.query(sql, new Object[] { bucketIdentifier }, new BucketItemEntityRowMapper());
return getItemsWithCounts(items);
}
Aggregations