Search in sources :

Example 6 with BucketItemEntity

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()));
}
Also used : BucketEntity(org.apache.nifi.registry.db.entity.BucketEntity) BucketItemEntity(org.apache.nifi.registry.db.entity.BucketItemEntity) Test(org.junit.Test)

Example 7 with BucketItemEntity

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);
}
Also used : BucketItemEntity(org.apache.nifi.registry.db.entity.BucketItemEntity) BucketItemEntityRowMapper(org.apache.nifi.registry.db.mapper.BucketItemEntityRowMapper)

Aggregations

BucketItemEntity (org.apache.nifi.registry.db.entity.BucketItemEntity)7 FlowEntity (org.apache.nifi.registry.db.entity.FlowEntity)4 Test (org.junit.Test)3 BucketItemEntityRowMapper (org.apache.nifi.registry.db.mapper.BucketItemEntityRowMapper)2 ArrayList (java.util.ArrayList)1 BucketEntity (org.apache.nifi.registry.db.entity.BucketEntity)1 BucketItemEntityType (org.apache.nifi.registry.db.entity.BucketItemEntityType)1 Nullable (org.springframework.lang.Nullable)1