use of org.apache.nifi.registry.db.mapper.FlowEntityRowMapper in project nifi-registry by apache.
the class DatabaseMetadataService method getFlowsByBucket.
@Override
public List<FlowEntity> getFlowsByBucket(final String bucketIdentifier) {
final String sql = "SELECT * FROM flow f, bucket_item item WHERE item.bucket_id = ? AND item.id = f.id";
final List<FlowEntity> flows = jdbcTemplate.query(sql, new Object[] { bucketIdentifier }, new FlowEntityRowMapper());
final Map<String, Long> snapshotCounts = getFlowSnapshotCounts();
for (final FlowEntity flowEntity : flows) {
final Long snapshotCount = snapshotCounts.get(flowEntity.getId());
if (snapshotCount != null) {
flowEntity.setSnapshotCount(snapshotCount);
}
}
return flows;
}
Aggregations