Java Code Examples for me.prettyprint.hector.api.beans.HColumn#getValue()
The following examples show how to use
me.prettyprint.hector.api.beans.HColumn#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: CassandraUserStoreManager.java From carbon-identity with Apache License 2.0 | 6 votes |
/** * Checks if the role is existing the role store. */ @Override protected boolean doCheckExistingRole(String roleNameWithTenantDomain) throws UserStoreException { RoleContext roleContext = createRoleContext(roleNameWithTenantDomain); boolean isExisting = false; String roleName = roleContext.getRoleName(); Composite key = new Composite(); key.addComponent(roleName, stringSerializer); key.addComponent(tenantIdString, stringSerializer); ColumnQuery<Composite, String, String> getCredentialQuery = HFactory.createColumnQuery(keyspace, CompositeSerializer.get(), stringSerializer, stringSerializer); getCredentialQuery.setColumnFamily(CFConstants.UM_ROLES).setKey(key).setName(CFConstants.UM_ROLE_NAME); HColumn<String, String> result = getCredentialQuery.execute().get(); if (result != null && result.getValue() != null) { isExisting = true; } return isExisting; }
Example 2
Source File: CassandraUserStoreManager.java From carbon-identity with Apache License 2.0 | 6 votes |
/** * Checks if the user is existing in the user store. */ @Override protected boolean doCheckExistingUser(String userName) throws UserStoreException { Boolean isExist = false; Composite key = new Composite(); key.addComponent(userName, stringSerializer); key.addComponent(tenantIdString, stringSerializer); ColumnQuery<Composite, String, String> getCredentialQuery = HFactory.createColumnQuery(keyspace, CompositeSerializer.get(), stringSerializer, stringSerializer); getCredentialQuery.setColumnFamily(CFConstants.UM_USER).setKey(key).setName(CFConstants.UM_USER_NAME); HColumn<String, String> result = getCredentialQuery.execute().get(); if (result != null && result.getValue() != null) { isExist = true; } return isExist; }
Example 3
Source File: Cassandra12xMapDAO.java From cumulusrdf with Apache License 2.0 | 5 votes |
@Override public V get(final K key) throws DataAccessLayerException { final ColumnQuery<K, byte[], V> q = createColumnQuery(_keyspace, _serializer_k, BYTE_SERIALIZER, _serializer_v); final QueryResult<HColumn<byte[], V>> r = q.setKey(key).setName(COLUMN_NAME).setColumnFamily(_cf_name).execute(); final HColumn<byte[], V> c = r.get(); if (c == null) { return (_default_value != null) ? _default_value : null; } else { return c.getValue(); } }
Example 4
Source File: CassandraUtils.java From archiva with Apache License 2.0 | 5 votes |
public static String getStringValue( ColumnSlice<String, String> columnSlice, String columnName ) { if ( StringUtils.isEmpty( columnName ) ) { return null; } HColumn<String, String> hColumn = columnSlice.getColumnByName( columnName ); return hColumn == null ? null : hColumn.getValue(); }
Example 5
Source File: CassandraUtils.java From archiva with Apache License 2.0 | 5 votes |
public static Long getLongValue( ColumnSlice<String, Long> columnSlice, String columnName ) { if ( StringUtils.isEmpty( columnName ) ) { return null; } HColumn<String, Long> hColumn = columnSlice.getColumnByName( columnName ); return hColumn == null ? null : hColumn.getValue(); }
Example 6
Source File: AbstractSearch.java From usergrid with Apache License 2.0 | 5 votes |
/** * Get the position in the queue for the given appId, consumer and queu * * @param queueId The queueId * @param consumerId The consumerId */ public UUID getConsumerQueuePosition( UUID queueId, UUID consumerId ) { HColumn<UUID, UUID> result = HFactory.createColumnQuery( ko, ue, ue, ue ).setKey( consumerId ).setName( queueId ) .setColumnFamily( CONSUMERS.getColumnFamily() ).execute().get(); if ( result != null ) { return result.getValue(); } return null; }
Example 7
Source File: Util.java From carbon-identity-framework with Apache License 2.0 | 4 votes |
public static String getExistingUserId(String credentialTypeName, String identifier, Keyspace keyspace) { identifier = createRowKeyForReverseLookup(identifier, credentialTypeName); ColumnQuery<String, String, String> usernameIndexQuery = HFactory.createColumnQuery(keyspace, stringSerializer, stringSerializer, stringSerializer); usernameIndexQuery.setColumnFamily(CFConstants.USERNAME_INDEX).setKey(identifier).setName(CFConstants.USER_ID); QueryResult<HColumn<String, String>> result = usernameIndexQuery.execute(); HColumn<String, String> userIdCol = result.get(); if (userIdCol == null) { return null; } return userIdCol.getValue(); }
Example 8
Source File: Util.java From carbon-identity with Apache License 2.0 | 4 votes |
public static String getExistingUserId(String credentialTypeName, String identifier, Keyspace keyspace) { identifier = createRowKeyForReverseLookup(identifier, credentialTypeName); ColumnQuery<String, String, String> usernameIndexQuery = HFactory.createColumnQuery(keyspace, stringSerializer, stringSerializer, stringSerializer); usernameIndexQuery.setColumnFamily(CFConstants.USERNAME_INDEX).setKey(identifier).setName(CFConstants.USER_ID); QueryResult<HColumn<String, String>> result = usernameIndexQuery.execute(); HColumn<String, String> userIdCol = result.get(); if (userIdCol == null) { return null; } return userIdCol.getValue(); }
Example 9
Source File: ConsumerTransaction.java From usergrid with Apache License 2.0 | 4 votes |
/** * Renew the existing transaction. Does so by deleting the exiting timeout, and replacing it with a new value * * @param queuePath The queue path * @param transactionId The transaction id * @param query The query params * * @return The new transaction uuid */ public UUID renewTransaction( String queuePath, UUID transactionId, QueueQuery query ) throws TransactionNotFoundException { long now = System.currentTimeMillis(); if ( query == null ) { query = new QueueQuery(); } UUID queueId = getQueueId( queuePath ); UUID consumerId = getConsumerId( queueId, query ); ByteBuffer key = getQueueClientTransactionKey( queueId, consumerId ); // read the original transaction, if it's not there, then we can't possibly // extend it SliceQuery<ByteBuffer, UUID, UUID> q = createSliceQuery( ko, be, ue, ue ); q.setColumnFamily( CONSUMER_QUEUE_TIMEOUTS.getColumnFamily() ); q.setKey( key ); q.setColumnNames( transactionId ); HColumn<UUID, UUID> col = q.execute().get().getColumnByName( transactionId ); if ( col == null ) { throw new TransactionNotFoundException( String.format( "No transaction with id %s exists", transactionId ) ); } UUID origTrans = col.getName(); UUID messageId = col.getValue(); // Generate a new expiration and insert it UUID expirationId = UUIDUtils.newTimeUUID( now + query.getTimeout() ); if (logger.isTraceEnabled()) { logger.trace("Writing new timeout at '{}' for message '{}'", expirationId, messageId); } Mutator<ByteBuffer> mutator = CountingMutator.createFlushingMutator( ko, be ); mutator.addInsertion( key, CONSUMER_QUEUE_TIMEOUTS.getColumnFamily(), createColumn( expirationId, messageId, cass.createTimestamp(), ue, ue ) ); mutator.execute(); // now delete the old value deleteTransaction( queueId, consumerId, origTrans ); return expirationId; }