Search in sources :

Example 1 with FlowEntityRowMapper

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

Aggregations

FlowEntity (org.apache.nifi.registry.db.entity.FlowEntity)1 FlowEntityRowMapper (org.apache.nifi.registry.db.mapper.FlowEntityRowMapper)1