private List<ColumnFamilyDefinition> createColumnFamilyDefinitions(DataSet dataSet) {
KeyspaceModel dataSetKeyspace = dataSet.getKeyspace();
List<ColumnFamilyDefinition> columnFamilyDefinitions = new ArrayList<ColumnFamilyDefinition>();
for (ColumnFamilyModel columnFamily : dataSet.getColumnFamilies()) {
ColumnFamilyDefinition cfDef = HFactory.createColumnFamilyDefinition(dataSetKeyspace.getName(),
columnFamily.getName(),
ComparatorType.getByClassName(columnFamily.getComparatorType().getClassName()),
createColumnsDefinition(columnFamily.getColumnsMetadata()));
cfDef.setColumnType(columnFamily.getType());
cfDef.setComment(columnFamily.getComment());
if (columnFamily.getCompactionStrategy() != null) {
cfDef.setCompactionStrategy(columnFamily.getCompactionStrategy());
}
if (columnFamily.getCompactionStrategyOptions() != null && !columnFamily.getCompactionStrategyOptions().isEmpty()) {
Map<String, String> compactionStrategyOptions = new HashMap<String, String>();
for (CompactionStrategyOptionModel compactionStrategyOption : columnFamily.getCompactionStrategyOptions()) {
compactionStrategyOptions.put(compactionStrategyOption.getName(), compactionStrategyOption.getValue());
}
cfDef.setCompactionStrategyOptions(compactionStrategyOptions);
}
if (columnFamily.getGcGraceSeconds() != null) {
cfDef.setGcGraceSeconds(columnFamily.getGcGraceSeconds());
}
if (columnFamily.getMaxCompactionThreshold() != null) {
cfDef.setMaxCompactionThreshold(columnFamily.getMaxCompactionThreshold());
}
if (columnFamily.getMinCompactionThreshold() != null) {
cfDef.setMinCompactionThreshold(columnFamily.getMinCompactionThreshold());
}
if (columnFamily.getReadRepairChance() != null) {
cfDef.setReadRepairChance(columnFamily.getReadRepairChance());
}
if (columnFamily.getReplicationOnWrite() != null) {
cfDef.setReplicateOnWrite(columnFamily.getReplicationOnWrite());
}
cfDef.setKeyValidationClass(columnFamily.getKeyType().getTypeName() + columnFamily.getKeyTypeAlias());
if (columnFamily.getDefaultColumnValueType() != null) {
cfDef.setDefaultValidationClass(columnFamily.getDefaultColumnValueType().getClassName());
}
if (columnFamily.getType().equals(ColumnType.SUPER) && columnFamily.getSubComparatorType() != null) {
cfDef.setSubComparatorType(columnFamily.getSubComparatorType());
}
if (ComparatorType.COMPOSITETYPE.equals(columnFamily.getComparatorType())
|| StringUtils.containsIgnoreCase(columnFamily.getComparatorTypeAlias(), ColumnFamilyModel.REVERSED_QUALIFIER)) {
cfDef.setComparatorTypeAlias(columnFamily.getComparatorTypeAlias());
}
columnFamilyDefinitions.add(cfDef);
}
return columnFamilyDefinitions;