Search in sources :

Example 1 with BucketItemEntityType

use of org.apache.nifi.registry.db.entity.BucketItemEntityType in project nifi-registry by apache.

the class BucketItemEntityRowMapper method mapRow.

@Nullable
@Override
public BucketItemEntity mapRow(ResultSet rs, int rowNum) throws SQLException {
    final BucketItemEntityType type = BucketItemEntityType.valueOf(rs.getString("ITEM_TYPE"));
    // Create the appropriate type of sub-class, eventually populate specific data for each type
    final BucketItemEntity item;
    switch(type) {
        case FLOW:
            item = new FlowEntity();
            break;
        default:
            // should never happen
            item = new BucketItemEntity();
            break;
    }
    // populate fields common to all bucket items
    item.setId(rs.getString("ID"));
    item.setName(rs.getString("NAME"));
    item.setDescription(rs.getString("DESCRIPTION"));
    item.setCreated(rs.getTimestamp("CREATED"));
    item.setModified(rs.getTimestamp("MODIFIED"));
    item.setBucketId(rs.getString("BUCKET_ID"));
    item.setBucketName(rs.getString("BUCKET_NAME"));
    item.setType(type);
    return item;
}
Also used : BucketItemEntityType(org.apache.nifi.registry.db.entity.BucketItemEntityType) BucketItemEntity(org.apache.nifi.registry.db.entity.BucketItemEntity) FlowEntity(org.apache.nifi.registry.db.entity.FlowEntity) Nullable(org.springframework.lang.Nullable)

Aggregations

BucketItemEntity (org.apache.nifi.registry.db.entity.BucketItemEntity)1 BucketItemEntityType (org.apache.nifi.registry.db.entity.BucketItemEntityType)1 FlowEntity (org.apache.nifi.registry.db.entity.FlowEntity)1 Nullable (org.springframework.lang.Nullable)1