info.archinnov.achilles.generated.dsl.EntityWithComplexCounters_UpdateStatic Maven / Gradle / Ivy
The newest version!
package info.archinnov.achilles.generated.dsl;
import com.datastax.driver.core.querybuilder.QueryBuilder;
import com.datastax.driver.core.querybuilder.Update;
import info.archinnov.achilles.generated.meta.entity.EntityWithComplexCounters_AchillesMeta;
import info.archinnov.achilles.internals.dsl.query.update.AbstractUpdate;
import info.archinnov.achilles.internals.dsl.query.update.AbstractUpdateColumns;
import info.archinnov.achilles.internals.dsl.query.update.AbstractUpdateEnd;
import info.archinnov.achilles.internals.dsl.query.update.AbstractUpdateFrom;
import info.archinnov.achilles.internals.dsl.query.update.AbstractUpdateWhere;
import info.archinnov.achilles.internals.entities.EntityWithComplexCounters;
import info.archinnov.achilles.internals.metamodel.AbstractEntityProperty;
import info.archinnov.achilles.internals.options.CassandraOptions;
import info.archinnov.achilles.internals.runtime.RuntimeEngine;
import info.archinnov.achilles.type.SchemaNameProvider;
import info.archinnov.achilles.validation.Validator;
import java.lang.Class;
import java.lang.Long;
import java.lang.Object;
import java.lang.Override;
import java.lang.SuppressWarnings;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import org.apache.commons.lang3.ArrayUtils;
public final class EntityWithComplexCounters_UpdateStatic extends AbstractUpdate {
protected final EntityWithComplexCounters_AchillesMeta meta;
protected final Class entityClass = EntityWithComplexCounters.class;
public EntityWithComplexCounters_UpdateStatic(RuntimeEngine rte, EntityWithComplexCounters_AchillesMeta meta) {
super(rte);
this.meta = meta;
}
/**
* Generate an UPDATE FROM ... */
public final EntityWithComplexCounters_UpdateStatic.F fromBaseTable() {
final String currentKeyspace = meta.getKeyspace().orElse("unknown_keyspace_for_" + meta.entityClass.getCanonicalName());
final Update.Where where = QueryBuilder.update(currentKeyspace, meta.getTableOrViewName()).where();
return new EntityWithComplexCounters_UpdateStatic.F(where, new CassandraOptions());
}
/**
* Generate an UPDATE FROM ... using the given SchemaNameProvider */
public final EntityWithComplexCounters_UpdateStatic.F from(final SchemaNameProvider schemaNameProvider) {
final String currentKeyspace = lookupKeyspace(schemaNameProvider, meta.entityClass);
final String currentTable = lookupTable(schemaNameProvider, meta.entityClass);
final Update.Where where = QueryBuilder.update(currentKeyspace, currentTable).where();
return new EntityWithComplexCounters_UpdateStatic.F(where, CassandraOptions.withSchemaNameProvider(schemaNameProvider));
}
public class Cols extends AbstractUpdateColumns {
Cols(Update.Where where, CassandraOptions cassandraOptions) {
super(where, cassandraOptions);
}
public final Cols.StaticCounter staticCounter() {
return new Cols.StaticCounter();
}
public final EntityWithComplexCounters_UpdateStatic.W_Id where() {
return new EntityWithComplexCounters_UpdateStatic.W_Id(where, cassandraOptions);
}
public final class StaticCounter {
/**
* Generate an UPDATE FROM ... SET static_count = static_count + 1 */
public final EntityWithComplexCounters_UpdateStatic.Cols Incr() {
where.with(QueryBuilder.incr("static_count"));
return EntityWithComplexCounters_UpdateStatic.Cols.this;
}
/**
* Generate an UPDATE FROM ... SET staticCounter = staticCounter + ? */
@SuppressWarnings("static-access")
public final EntityWithComplexCounters_UpdateStatic.Cols Incr(final Long staticCounter_increment) {
where.with(QueryBuilder.incr("static_count", QueryBuilder.bindMarker("static_count")));
boundValues.add(staticCounter_increment);
encodedValues.add(meta.staticCounter.encodeFromJava(staticCounter_increment, Optional.of(cassandraOptions)));
return EntityWithComplexCounters_UpdateStatic.Cols.this;
}
/**
* Generate an UPDATE FROM ... SET staticCounter = staticCounter - 1 */
public final EntityWithComplexCounters_UpdateStatic.Cols Decr() {
where.with(QueryBuilder.decr("static_count"));
return EntityWithComplexCounters_UpdateStatic.Cols.this;
}
/**
* Generate an UPDATE FROM ... SET staticCounter = staticCounter - ? */
@SuppressWarnings("static-access")
public final EntityWithComplexCounters_UpdateStatic.Cols Decr(final Long staticCounter_decrement) {
where.with(QueryBuilder.decr("static_count", QueryBuilder.bindMarker("static_count")));
boundValues.add(staticCounter_decrement);
encodedValues.add(meta.staticCounter.encodeFromJava(staticCounter_decrement, Optional.of(cassandraOptions)));
return EntityWithComplexCounters_UpdateStatic.Cols.this;
}
}
}
public class F extends AbstractUpdateFrom {
F(Update.Where where, CassandraOptions cassandraOptions) {
super(where, cassandraOptions);
}
public final F.StaticCounter staticCounter() {
return new F.StaticCounter();
}
public final class StaticCounter {
/**
* Generate an UPDATE FROM ... SET static_count = static_count + 1 */
public final EntityWithComplexCounters_UpdateStatic.Cols Incr() {
where.with(QueryBuilder.incr("static_count"));
return new EntityWithComplexCounters_UpdateStatic.Cols(where, cassandraOptions);
}
/**
* Generate an UPDATE FROM ... SET staticCounter = staticCounter + ? */
@SuppressWarnings("static-access")
public final EntityWithComplexCounters_UpdateStatic.Cols Incr(final Long staticCounter_increment) {
where.with(QueryBuilder.incr("static_count", QueryBuilder.bindMarker("static_count")));
boundValues.add(staticCounter_increment);
encodedValues.add(meta.staticCounter.encodeFromJava(staticCounter_increment, Optional.of(cassandraOptions)));
return new EntityWithComplexCounters_UpdateStatic.Cols(where, cassandraOptions);
}
/**
* Generate an UPDATE FROM ... SET staticCounter = staticCounter - 1 */
public final EntityWithComplexCounters_UpdateStatic.Cols Decr() {
where.with(QueryBuilder.decr("static_count"));
return new EntityWithComplexCounters_UpdateStatic.Cols(where, cassandraOptions);
}
/**
* Generate an UPDATE FROM ... SET staticCounter = staticCounter - ? */
@SuppressWarnings("static-access")
public final EntityWithComplexCounters_UpdateStatic.Cols Decr(final Long staticCounter_decrement) {
where.with(QueryBuilder.decr("static_count", QueryBuilder.bindMarker("static_count")));
boundValues.add(staticCounter_decrement);
encodedValues.add(meta.staticCounter.encodeFromJava(staticCounter_decrement, Optional.of(cassandraOptions)));
return new EntityWithComplexCounters_UpdateStatic.Cols(where, cassandraOptions);
}
}
}
public final class W_Id extends AbstractUpdateWhere {
public W_Id(Update.Where where, CassandraOptions cassandraOptions) {
super(where, cassandraOptions);
}
public final EntityWithComplexCounters_UpdateStatic.W_Id.Relation id() {
return new EntityWithComplexCounters_UpdateStatic.W_Id.Relation();
}
public final class Relation {
/**
* Generate a SELECT ... FROM ... WHERE ... id = ? */
@SuppressWarnings("static-access")
public final EntityWithComplexCounters_UpdateStatic.E Eq(Long id) {
where.and(QueryBuilder.eq("id", QueryBuilder.bindMarker("id")));
boundValues.add(id);
encodedValues.add(meta.id.encodeFromJava(id, Optional.of(cassandraOptions)));
return new EntityWithComplexCounters_UpdateStatic.E(where, cassandraOptions);
}
/**
* Generate a SELECT ... FROM ... WHERE ... id IN ? */
@SuppressWarnings("static-access")
public final EntityWithComplexCounters_UpdateStatic.E IN(Long... id) {
Validator.validateTrue(ArrayUtils.isNotEmpty(id), "Varargs for field '%s' should not be null/empty", "id");
where.and(QueryBuilder.in("id",QueryBuilder.bindMarker("id")));
final List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy