Search in sources :

Example 36 with BoundStatement

use of com.datastax.driver.core.BoundStatement in project cassandra-driver-mapping by valchkou.

the class MappingSession method append.

/**
     * Append value or values to the Set, List or Map.
     * 
     * @param id Primary Key
     * @param class Entity.class
     * @param propertyName Entity property
     * @param item can be a single value, a List, Set or a Map of values
     * @param options WriteOptions
     */
public void append(Object id, Class<?> clazz, String propertyName, Object item, WriteOptions options) {
    maybeSync(clazz);
    BoundStatement bs = MappingBuilder.prepareAppendItemToCollection(id, clazz, propertyName, item, options, keyspace, session);
    execute(bs);
}
Also used : BoundStatement(com.datastax.driver.core.BoundStatement)

Example 37 with BoundStatement

use of com.datastax.driver.core.BoundStatement in project cassandra-driver-mapping by valchkou.

the class MappingSession method prepend.

/**
     * Place item or items at the beginning of the List.
     * 
     * @param id Primary Key
     * @param class Entity.class
     * @param propertyName Entity property
     * @param item can be a single item or a List of items
     * @param options WriteOptions
     */
public void prepend(Object id, Class<?> clazz, String propertyName, Object item, WriteOptions options) {
    maybeSync(clazz);
    BoundStatement bs = MappingBuilder.preparePrependItemToList(id, clazz, propertyName, item, options, keyspace, session);
    execute(bs);
}
Also used : BoundStatement(com.datastax.driver.core.BoundStatement)

Example 38 with BoundStatement

use of com.datastax.driver.core.BoundStatement in project cassandra-driver-mapping by valchkou.

the class MappingSession method appendAsync.

/**
     * Asynchronously Append value or values to the Set, List or Map.
     * 
     * @param id Primary Key
     * @param class Entity.class
     * @param propertyName Entity property
     * @param item can be a single value, a List, Set or a Map of values
     * @param options WriteOptions
     * @return ResultSetFuture.
     */
public ResultSetFuture appendAsync(Object id, Class<?> clazz, String propertyName, Object item, WriteOptions options) {
    maybeSync(clazz);
    BoundStatement bs = MappingBuilder.prepareAppendItemToCollection(id, clazz, propertyName, item, options, keyspace, session);
    return executeAsync(bs);
}
Also used : BoundStatement(com.datastax.driver.core.BoundStatement)

Example 39 with BoundStatement

use of com.datastax.driver.core.BoundStatement in project cassandra-driver-mapping by valchkou.

the class MappingSession method updateValuesAsync.

/**
     * Update values with options.
     * 
     * @param id Primary Key
     * @param class Entity.class
     * @param propertyNames Array of properties to update
     * @param value array of values to update
     */
public ResultSetFuture updateValuesAsync(Object id, Class<?> clazz, String[] propertyNames, Object[] values, WriteOptions options) {
    maybeSync(clazz);
    BoundStatement bs = MappingBuilder.prepareUpdateValues(id, clazz, propertyNames, values, options, keyspace, session);
    return executeAsync(bs);
}
Also used : BoundStatement(com.datastax.driver.core.BoundStatement)

Aggregations

BoundStatement (com.datastax.driver.core.BoundStatement)39 ResultSet (com.datastax.driver.core.ResultSet)7 ResultSetFuture (com.datastax.driver.core.ResultSetFuture)5 Row (com.datastax.driver.core.Row)5 Test (org.junit.Test)5 PreparedStatement (com.datastax.driver.core.PreparedStatement)4 ArrayList (java.util.ArrayList)4 RegularStatement (com.datastax.driver.core.RegularStatement)3 Session (com.datastax.driver.core.Session)3 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)3 List (java.util.List)3 Map (java.util.Map)3 MetricRegistry (com.codahale.metrics.MetricRegistry)2 Statement (com.datastax.driver.core.Statement)2 ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableSet (com.google.common.collect.ImmutableSet)2 Futures.allAsList (com.google.common.util.concurrent.Futures.allAsList)2 LinkedHashMap (java.util.LinkedHashMap)2 UUID (java.util.UUID)2 ExecutionException (java.util.concurrent.ExecutionException)2