Search in sources :

Example 6 with AfterDeleteEvent

use of org.springframework.data.cassandra.core.mapping.event.AfterDeleteEvent in project spring-data-cassandra by spring-projects.

the class ReactiveCassandraTemplate method doDelete.

Mono<WriteResult> doDelete(Query query, Class<?> entityClass, CqlIdentifier tableName) {
    StatementBuilder<Delete> builder = getStatementFactory().delete(query, getRequiredPersistentEntity(entityClass), tableName);
    SimpleStatement delete = builder.build();
    Mono<WriteResult> writeResult = doExecuteAndFlatMap(delete, ReactiveCassandraTemplate::toWriteResult).doOnSubscribe(it -> maybeEmitEvent(new BeforeDeleteEvent<>(delete, entityClass, tableName)));
    return writeResult.doOnNext(it -> maybeEmitEvent(new AfterDeleteEvent<>(delete, entityClass, tableName)));
}
Also used : Delete(com.datastax.oss.driver.api.querybuilder.delete.Delete) AfterDeleteEvent(org.springframework.data.cassandra.core.mapping.event.AfterDeleteEvent) SimpleStatement(com.datastax.oss.driver.api.core.cql.SimpleStatement) BeforeDeleteEvent(org.springframework.data.cassandra.core.mapping.event.BeforeDeleteEvent)

Aggregations

SimpleStatement (com.datastax.oss.driver.api.core.cql.SimpleStatement)6 AfterDeleteEvent (org.springframework.data.cassandra.core.mapping.event.AfterDeleteEvent)6 Delete (com.datastax.oss.driver.api.querybuilder.delete.Delete)5 CqlIdentifier (com.datastax.oss.driver.api.core.CqlIdentifier)4 AsyncResultSet (com.datastax.oss.driver.api.core.cql.AsyncResultSet)3 BeforeDeleteEvent (org.springframework.data.cassandra.core.mapping.event.BeforeDeleteEvent)3 Truncate (com.datastax.oss.driver.api.querybuilder.truncate.Truncate)2 DriverException (com.datastax.oss.driver.api.core.DriverException)1 DefaultDriverOption (com.datastax.oss.driver.api.core.config.DefaultDriverOption)1 DriverContext (com.datastax.oss.driver.api.core.context.DriverContext)1 BatchType (com.datastax.oss.driver.api.core.cql.BatchType)1 BoundStatement (com.datastax.oss.driver.api.core.cql.BoundStatement)1 PreparedStatement (com.datastax.oss.driver.api.core.cql.PreparedStatement)1 Row (com.datastax.oss.driver.api.core.cql.Row)1 Statement (com.datastax.oss.driver.api.core.cql.Statement)1 QueryBuilder (com.datastax.oss.driver.api.querybuilder.QueryBuilder)1 Insert (com.datastax.oss.driver.api.querybuilder.insert.Insert)1 RegularInsert (com.datastax.oss.driver.api.querybuilder.insert.RegularInsert)1 Select (com.datastax.oss.driver.api.querybuilder.select.Select)1 Update (com.datastax.oss.driver.api.querybuilder.update.Update)1