@Override
protected RowMapper<Image> createEntityRowMapper() {
return (rs, rowNum) -> {
Image entity = new Image();
entity.setId(getGuidDefaultEmpty(rs, "image_guid"));
entity.setCreationDate(DbFacadeUtils.fromDate(rs.getTimestamp("creation_date")));
entity.setTemplateImageId(getGuidDefaultEmpty(rs, "it_guid"));
entity.setSize(rs.getLong("size"));
entity.setParentId(getGuidDefaultEmpty(rs, "ParentId"));
entity.setStatus(ImageStatus.forValue(rs.getInt("imageStatus")));
entity.setLastModified(DbFacadeUtils.fromDate(rs.getTimestamp("lastModified")));
entity.setSnapshotId(getGuidDefaultEmpty(rs, "vm_snapshot_id"));
entity.setVolumeType(VolumeType.forValue(rs.getInt("volume_type")));
entity.setVolumeFormat(VolumeFormat.forValue(rs.getInt("volume_format")));
if (entity.getVolumeFormat().equals(VolumeFormat.COW)) {
entity.setQcowCompat(QcowCompat.forValue(rs.getInt("qcow_compat")));
}
entity.setDiskId(getGuidDefaultEmpty(rs, "image_group_id"));
entity.setActive((Boolean) rs.getObject("active"));
entity.setVolumeClassification(VolumeClassification.forValue(rs.getInt("volume_classification")));
return entity;
};
}