Java Code Examples for org.apache.cassandra.thrift.ColumnDef#setIndex_type()
The following examples show how to use
org.apache.cassandra.thrift.ColumnDef#setIndex_type() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CassandraPersistenceUtils.java From usergrid with Apache License 2.0 | 6 votes |
public static List<ColumnDefinition> getIndexMetadata( String indexes ) { if ( indexes == null ) { return null; } String[] index_entries = split( indexes, ',' ); List<ColumnDef> columns = new ArrayList<ColumnDef>(); for ( String index_entry : index_entries ) { String column_name = stringOrSubstringBeforeFirst( index_entry, ':' ).trim(); String comparer = substringAfterLast( index_entry, ":" ).trim(); if ( StringUtils.isBlank( comparer ) ) { comparer = "UUIDType"; } if ( StringUtils.isNotBlank( column_name ) ) { ColumnDef cd = new ColumnDef( bytebuffer( column_name ), comparer ); cd.setIndex_name( column_name ); cd.setIndex_type( IndexType.KEYS ); columns.add( cd ); } } return ThriftColumnDef.fromThriftList( columns ); }
Example 2
Source File: ColumnDefinition.java From stratio-cassandra with Apache License 2.0 | 5 votes |
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; }