private ColumnDef toThrift() { ColumnDef d = new ColumnDef(); if ( indexName != null ) { d.setIndex_name(indexName); d.setIndex_type(indexTypeToThrift(indexType)); } d.setName(name); d.setValidation_class(validationClass); return d; }
columnDef.setValidation_class(CounterColumnType.class.getName()); counterColumnDefs.add(columnDef);
columnDef.setValidation_class(CassandraValidationClassMapper.getValidationClass( columnInfo.getType(), isCql3Enabled(tableInfo))); columnDefs.add(columnDef);
@Override public ColumnDefinition setValidationClass(String value) { columnDef.setValidation_class(value); return this; }
@Override public ColumnDefinition setValidationClass(String value) { columnDef.setValidation_class(value); return this; }
ColumnDef def = new ColumnDef(); def.setName("AGE".getBytes()); def.setValidation_class("Int32Type"); def.setIndex_type(IndexType.KEYS); def1.setValidation_class("UTF8Type"); def1.setIndex_type(IndexType.KEYS);
/** * getColumnMetadata use for getting column metadata for specific * columnInfo. * * @param columnInfo * the column info * @param tableInfo * the table info * @return the column metadata */ private ColumnDef getColumnMetadata(ColumnInfo columnInfo, TableInfo tableInfo) { ColumnDef columnDef = new ColumnDef(); columnDef.setName(columnInfo.getColumnName().getBytes()); columnDef.setValidation_class(CassandraValidationClassMapper.getValidationClass(columnInfo.getType(), isCql3Enabled(tableInfo))); if (columnInfo.isIndexable()) { IndexInfo indexInfo = tableInfo.getColumnToBeIndexed(columnInfo.getColumnName()); columnDef.setIndex_type(CassandraIndexHelper.getIndexType(indexInfo.getIndexType())); // if (!indexInfo.getIndexName().equals(indexInfo.getColumnName())) // { // columnDef.setIndex_name(indexInfo.getIndexName()); // } } return columnDef; }
ColumnDef def = new ColumnDef(); def.setName("AGE".getBytes()); def.setValidation_class("UTF8Type"); def.setIndex_type(IndexType.KEYS); def1.setValidation_class("BytesType"); def1.setIndex_type(IndexType.KEYS);
columnDef.setValidation_class(CassandraValidationClassMapper.getValidationClass(columnType, false)); columnDef.setIndex_type(IndexType.KEYS);
columnDef.setValidation_class(CassandraValidationClassMapper.getValidationClass( columnInfo.getType(), isCql3Enabled));
/** * Used to locally update column family definition with new column metadata * @param columnFamily - CfDef record * @param columnName - column name represented as byte[] * @param validationClass - value validation class */ private void updateColumnMetaData(CfDef columnFamily, ByteBuffer columnName, String validationClass) { ColumnDef column = getColumnDefByName(columnFamily, columnName); if (column != null) { // if validation class is the same - no need to modify it if (column.getValidation_class().equals(validationClass)) return; // updating column definition with new validation_class column.setValidation_class(validationClass); } else { List<ColumnDef> columnMetaData = new ArrayList<ColumnDef>(columnFamily.getColumn_metadata()); columnMetaData.add(new ColumnDef(columnName, validationClass)); columnFamily.setColumn_metadata(columnMetaData); } }
private ColumnDef toThrift() { ColumnDef d = new ColumnDef(); if ( indexName != null ) { d.setIndex_name(indexName); d.setIndex_type(indexTypeToThrift(indexType)); } d.setName(name); d.setValidation_class(validationClass); return d; }
private ColumnDef toThrift() { ColumnDef d = new ColumnDef(); if ( indexName != null ) { d.setIndex_name(indexName); d.setIndex_type(indexTypeToThrift(indexType)); } d.setName(name); d.setValidation_class(validationClass); return d; }
/** * * @param tableInfo * @param cfDef */ private void getCounterColumnFamilyMetadata(TableInfo tableInfo, CfDef cfDef) { cfDef.setDefault_validation_class(CounterColumnType.class.getSimpleName()); List<ColumnDef> counterColumnDefs = new ArrayList<ColumnDef>(); List<ColumnInfo> columnInfos = tableInfo.getColumnMetadatas(); if (columnInfos != null) { for (ColumnInfo columnInfo : columnInfos) { ColumnDef columnDef = new ColumnDef(); if (columnInfo.isIndexable()) { IndexInfo indexInfo = tableInfo.getColumnToBeIndexed(columnInfo.getColumnName()); columnDef.setIndex_type(CassandraIndexHelper.getIndexType(indexInfo.getIndexType())); } columnDef.setName(columnInfo.getColumnName().getBytes()); columnDef.setValidation_class(CounterColumnType.class.getName()); counterColumnDefs.add(columnDef); } } cfDef.setColumn_metadata(counterColumnDefs); }
/** * Private helper that adds a c olumn to a column family definition * * @param colAnnotation the column annotation * @param property the property * @param indexed if this property should be indexed in the datastore */ private void addColumnToColumnFamilyDefinition(Column colAnnotation, String property, boolean indexed) throws ClassNotFoundException { if (!property.equals(keyProperty)) { boolean defaults = colAnnotation == null; ColumnDef columnDef = new ColumnDef(); columnDef.setName(StringSerializer.get().toByteBuffer(property)); columnDef.setValidation_class(defaults ? org.firebrandocm.dao.annotations.Column.DEFAULTS.VALIDATION_CLASS.getName() : colAnnotation.validationClass().getName()); indexed = indexed || isMappedContainer(property); if (!indexed) { indexed = defaults ? org.firebrandocm.dao.annotations.Column.DEFAULTS.INDEXED : colAnnotation.indexed(); } if (indexed) { columnDef.setIndex_name(String.format("%s_%s_%s", keySpace, columnFamily, property)); columnDef.setIndex_type(defaults ? org.firebrandocm.dao.annotations.Column.DEFAULTS.INDEX_TYPE : colAnnotation.indexType()); } columnFamilyDefinition.addToColumn_metadata(columnDef); } }
cd.setValidation_class(column.type.toString());
public ColumnDef toThrift() { ColumnDef cd = new ColumnDef(); cd.setName(ByteBufferUtil.clone(name.bytes)); cd.setValidation_class(type.toString()); cd.setIndex_type(indexType == null ? null : org.apache.cassandra.thrift.IndexType.valueOf(indexType.name())); cd.setIndex_name(indexName == null ? null : indexName); cd.setIndex_options(indexOptions == null ? null : Maps.newHashMap(indexOptions)); return cd; }
/** * getColumnMetadata use for getting column metadata for specific * columnInfo. * * @param columnInfo * the column info * @return the column metadata */ private ColumnDef getColumnMetadata(ColumnInfo columnInfo, TableInfo tableInfo) { ColumnDef columnDef = new ColumnDef(); columnDef.setName(columnInfo.getColumnName().getBytes()); columnDef.setValidation_class(CassandraValidationClassMapper.getValidationClass(columnInfo.getType(), isCql3Enabled(tableInfo))); if (columnInfo.isIndexable()) { IndexInfo indexInfo = tableInfo.getColumnToBeIndexed(columnInfo.getColumnName()); columnDef.setIndex_type(CassandraIndexHelper.getIndexType(indexInfo.getIndexType())); } return columnDef; }
private boolean isCfDefUpdated(ColumnInfo columnInfo, CfDef cfDef, boolean isCql3Enabled, TableInfo tableInfo) throws Exception { boolean columnPresent = false; boolean isUpdated = false; for (ColumnDef columnDef : cfDef.getColumn_metadata()) { if (isColumnPresent(columnInfo, columnDef, isCql3Enabled)) { if (!isValidationClassSame(columnInfo, columnDef, isCql3Enabled)) { columnDef.setValidation_class(CassandraValidationClassMapper.getValidationClass( columnInfo.getType(), isCql3Enabled)); columnDef.setIndex_typeIsSet(false); columnDef.setIndex_nameIsSet(false); isUpdated = true; } columnPresent = true; break; } } if (!columnPresent) { cfDef.addToColumn_metadata(getColumnMetadata(columnInfo, tableInfo)); isUpdated = true; } return isUpdated; }
unsetValidation_class(); } else { setValidation_class((String)value);