info.archinnov.achilles.generated.dsl.EntityForAggregate_Update Maven / Gradle / Ivy
package info.archinnov.achilles.generated.dsl;
import com.datastax.driver.core.querybuilder.NonEscapingSetAssignment;
import com.datastax.driver.core.querybuilder.NotEq;
import com.datastax.driver.core.querybuilder.QueryBuilder;
import com.datastax.driver.core.querybuilder.Update;
import info.archinnov.achilles.generated.meta.entity.EntityForAggregate_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.EntityForAggregate;
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.Double;
import java.lang.Integer;
import java.lang.Long;
import java.lang.Object;
import java.lang.Override;
import java.lang.String;
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 EntityForAggregate_Update extends AbstractUpdate {
protected final EntityForAggregate_AchillesMeta meta;
protected final Class entityClass = EntityForAggregate.class;
public EntityForAggregate_Update(RuntimeEngine rte, EntityForAggregate_AchillesMeta meta) {
super(rte);
this.meta = meta;
}
/**
* Generate an UPDATE FROM ... */
public final EntityForAggregate_Update.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 EntityForAggregate_Update.F(where, new CassandraOptions());
}
/**
* Generate an UPDATE FROM ... using the given SchemaNameProvider */
public final EntityForAggregate_Update.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 EntityForAggregate_Update.F(where, CassandraOptions.withSchemaNameProvider(schemaNameProvider));
}
public class Cols extends AbstractUpdateColumns {
Cols(Update.Where where, CassandraOptions cassandraOptions) {
super(where, cassandraOptions);
}
public final Cols.StringVal stringVal() {
return new Cols.StringVal();
}
public final Cols.DoubleVal doubleVal() {
return new Cols.DoubleVal();
}
public final EntityForAggregate_Update.W_Partition where() {
return new EntityForAggregate_Update.W_Partition(where, cassandraOptions);
}
public final class StringVal {
/**
* Generate an UPDATE FROM ... SET stringval = ? */
@SuppressWarnings("static-access")
public final EntityForAggregate_Update.Cols Set(final String stringVal) {
where.with(NonEscapingSetAssignment.of("stringval", QueryBuilder.bindMarker("stringval")));
boundValues.add(stringVal);
encodedValues.add(meta.stringVal.encodeFromJava(stringVal, Optional.of(cassandraOptions)));
return EntityForAggregate_Update.Cols.this;
}
/**
* Generate an UPDATE FROM ... SET stringval = fromJson(?) */
public final EntityForAggregate_Update.Cols Set_FromJSON(final String stringVal_element) {
where.with(NonEscapingSetAssignment.of("stringval", QueryBuilder.fromJson(QueryBuilder.bindMarker("stringval"))));
boundValues.add(stringVal_element);
encodedValues.add(stringVal_element);
return EntityForAggregate_Update.Cols.this;
}
}
public final class DoubleVal {
/**
* Generate an UPDATE FROM ... SET doubleval = ? */
@SuppressWarnings("static-access")
public final EntityForAggregate_Update.Cols Set(final Double doubleVal) {
where.with(NonEscapingSetAssignment.of("doubleval", QueryBuilder.bindMarker("doubleval")));
boundValues.add(doubleVal);
encodedValues.add(meta.doubleVal.encodeFromJava(doubleVal, Optional.of(cassandraOptions)));
return EntityForAggregate_Update.Cols.this;
}
/**
* Generate an UPDATE FROM ... SET doubleval = fromJson(?) */
public final EntityForAggregate_Update.Cols Set_FromJSON(final String doubleVal_element) {
where.with(NonEscapingSetAssignment.of("doubleval", QueryBuilder.fromJson(QueryBuilder.bindMarker("doubleval"))));
boundValues.add(doubleVal_element);
encodedValues.add(doubleVal_element);
return EntityForAggregate_Update.Cols.this;
}
}
}
public class F extends AbstractUpdateFrom {
F(Update.Where where, CassandraOptions cassandraOptions) {
super(where, cassandraOptions);
}
public final F.StringVal stringVal() {
return new F.StringVal();
}
public final F.DoubleVal doubleVal() {
return new F.DoubleVal();
}
public final class StringVal {
/**
* Generate an UPDATE FROM ... SET stringval = ? */
@SuppressWarnings("static-access")
public final EntityForAggregate_Update.Cols Set(final String stringVal) {
where.with(NonEscapingSetAssignment.of("stringval", QueryBuilder.bindMarker("stringval")));
boundValues.add(stringVal);
encodedValues.add(meta.stringVal.encodeFromJava(stringVal, Optional.of(cassandraOptions)));
return new EntityForAggregate_Update.Cols(where, cassandraOptions);
}
/**
* Generate an UPDATE FROM ... SET stringval = fromJson(?) */
public final EntityForAggregate_Update.Cols Set_FromJSON(final String stringVal_element) {
where.with(NonEscapingSetAssignment.of("stringval", QueryBuilder.fromJson(QueryBuilder.bindMarker("stringval"))));
boundValues.add(stringVal_element);
encodedValues.add(stringVal_element);
return new EntityForAggregate_Update.Cols(where, cassandraOptions);
}
}
public final class DoubleVal {
/**
* Generate an UPDATE FROM ... SET doubleval = ? */
@SuppressWarnings("static-access")
public final EntityForAggregate_Update.Cols Set(final Double doubleVal) {
where.with(NonEscapingSetAssignment.of("doubleval", QueryBuilder.bindMarker("doubleval")));
boundValues.add(doubleVal);
encodedValues.add(meta.doubleVal.encodeFromJava(doubleVal, Optional.of(cassandraOptions)));
return new EntityForAggregate_Update.Cols(where, cassandraOptions);
}
/**
* Generate an UPDATE FROM ... SET doubleval = fromJson(?) */
public final EntityForAggregate_Update.Cols Set_FromJSON(final String doubleVal_element) {
where.with(NonEscapingSetAssignment.of("doubleval", QueryBuilder.fromJson(QueryBuilder.bindMarker("doubleval"))));
boundValues.add(doubleVal_element);
encodedValues.add(doubleVal_element);
return new EntityForAggregate_Update.Cols(where, cassandraOptions);
}
}
}
public final class W_Partition extends AbstractUpdateWhere {
public W_Partition(Update.Where where, CassandraOptions cassandraOptions) {
super(where, cassandraOptions);
}
public final EntityForAggregate_Update.W_Partition.Relation partition() {
return new EntityForAggregate_Update.W_Partition.Relation();
}
public final class Relation {
/**
* Generate a SELECT ... FROM ... WHERE ... partition = ? */
@SuppressWarnings("static-access")
public final EntityForAggregate_Update.W_Clustering Eq(Long partition) {
where.and(QueryBuilder.eq("partition", QueryBuilder.bindMarker("partition")));
boundValues.add(partition);
encodedValues.add(meta.partition.encodeFromJava(partition, Optional.of(cassandraOptions)));
return new EntityForAggregate_Update.W_Clustering(where, cassandraOptions);
}
/**
* Generate a SELECT ... FROM ... WHERE ... partition IN ? */
@SuppressWarnings("static-access")
public final EntityForAggregate_Update.W_Clustering IN(Long... partition) {
Validator.validateTrue(ArrayUtils.isNotEmpty(partition), "Varargs for field '%s' should not be null/empty", "partition");
where.and(QueryBuilder.in("partition",QueryBuilder.bindMarker("partition")));
final List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy