Java Code Examples for com.netflix.astyanax.model.Column#getValue()
The following examples show how to use
com.netflix.astyanax.model.Column#getValue() .
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: MvccEntitySerializationStrategyImpl.java From usergrid with Apache License 2.0 | 6 votes |
@Override public MvccEntity parseColumn( Column<UUID> column ) { final EntityWrapper deSerialized; final UUID version = column.getName(); try { deSerialized = column.getValue( entityJsonSerializer ); } catch ( DataCorruptionException e ) { logger.error( "DATA CORRUPTION DETECTED when de-serializing entity with Id {} and version {}. This means the write was truncated.", id, version, e ); //return an empty entity, we can never load this one, and we don't want it to bring the system //to a grinding halt return new MvccEntityImpl( id, version, MvccEntity.Status.DELETED, Optional.<Entity>absent(),0 ); } //Inject the id into it. if ( deSerialized.entity.isPresent() ) { EntityUtils.setId( deSerialized.entity.get(), id ); } return new MvccEntityImpl( id, version, deSerialized.status, deSerialized.entity, 0 ); }
Example 2
Source File: MvccEntitySerializationStrategyV3Impl.java From usergrid with Apache License 2.0 | 6 votes |
@Override public MvccEntity parseColumn( Column<Boolean> column ) { final EntityWrapper deSerialized; try { deSerialized = column.getValue( entityJsonSerializer ); } catch ( DataCorruptionException e ) { log.error( "DATA CORRUPTION DETECTED when de-serializing entity with Id {}. This means the" + " write was truncated.", id, e ); //return an empty entity, we can never load this one, and we don't want it to bring the system //to a grinding halt //TODO fix this return new MvccEntityImpl( id, UUIDGenerator.newTimeUUID(), MvccEntity.Status.DELETED, Optional.<Entity>absent() ); } Optional<Entity> entity = deSerialized.getOptionalEntity() ; return new MvccEntityImpl( id, deSerialized.getVersion(), deSerialized.getStatus(), entity, deSerialized.getSize()); }
Example 3
Source File: EdgeShardSerializationImpl.java From usergrid with Apache License 2.0 | 4 votes |
/** Example CQL schema for this table * * CREATE TABLE "Usergrid_Applications"."Edge_Shards" ( * key blob, * column1 bigint, * value blob, * PRIMARY KEY (key, column1) * ) WITH COMPACT STORAGE * AND CLUSTERING ORDER BY (column1 DESC) * * * */ @Override public Shard parseColumn( final Column<Long> column ) { // A custom serializer was introduced to handle parsing multiple column formats without re-writing the data. // The column can be stored as a legacy, single boolean, value OR a new, composite, value which contains // every item in the shard. If the legacy value is seen, we return a shard with Long.MIN for index and // createdTime so it can be identified later and handled. try { return column.getValue(SHARD_SERIALIZER); } catch ( Exception e) { // unable to parse the new format so return the old format return new Shard(column.getName(), column.getTimestamp(), column.getBooleanValue()); } }
Example 4
Source File: MvccLogEntrySerializationStrategyImpl.java From usergrid with Apache License 2.0 | 3 votes |
private List<MvccLogEntry> parseResults( final ColumnList<UUID> columns, final Id entityId ) { List<MvccLogEntry> results = new ArrayList<MvccLogEntry>( columns.size() ); for ( Column<UUID> col : columns ) { final UUID storedVersion = col.getName(); final StageStatus stage = col.getValue( SER ); results.add( new MvccLogEntryImpl( entityId, storedVersion, stage.stage, stage.state ) ); } return results; }