info.archinnov.achilles.generated.dsl.EntitySensor_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.EntitySensor_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.EntitySensor;
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.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 EntitySensor_Update extends AbstractUpdate {
protected final EntitySensor_AchillesMeta meta;
protected final Class entityClass = EntitySensor.class;
public EntitySensor_Update(RuntimeEngine rte, EntitySensor_AchillesMeta meta) {
super(rte);
this.meta = meta;
}
/**
* Generate an UPDATE FROM ... */
public final EntitySensor_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 EntitySensor_Update.F(where, new CassandraOptions());
}
/**
* Generate an UPDATE FROM ... using the given SchemaNameProvider */
public final EntitySensor_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 EntitySensor_Update.F(where, CassandraOptions.withSchemaNameProvider(schemaNameProvider));
}
public class Cols extends AbstractUpdateColumns {
Cols(Update.Where where, CassandraOptions cassandraOptions) {
super(where, cassandraOptions);
}
public final Cols.Type type() {
return new Cols.Type();
}
public final Cols.Value value() {
return new Cols.Value();
}
public final EntitySensor_Update.W_SensorId where() {
return new EntitySensor_Update.W_SensorId(where, cassandraOptions);
}
public final class Type {
/**
* Generate an UPDATE FROM ... SET type = ? */
@SuppressWarnings("static-access")
public final EntitySensor_Update.Cols Set(final EntitySensor.SensorType type) {
where.with(NonEscapingSetAssignment.of("type", QueryBuilder.bindMarker("type")));
boundValues.add(type);
encodedValues.add(meta.type.encodeFromJava(type, Optional.of(cassandraOptions)));
return EntitySensor_Update.Cols.this;
}
/**
* Generate an UPDATE FROM ... SET type = fromJson(?) */
public final EntitySensor_Update.Cols Set_FromJSON(final String type_element) {
where.with(NonEscapingSetAssignment.of("type", QueryBuilder.fromJson(QueryBuilder.bindMarker("type"))));
boundValues.add(type_element);
encodedValues.add(type_element);
return EntitySensor_Update.Cols.this;
}
}
public final class Value {
/**
* Generate an UPDATE FROM ... SET value = ? */
@SuppressWarnings("static-access")
public final EntitySensor_Update.Cols Set(final Double value) {
where.with(NonEscapingSetAssignment.of("value", QueryBuilder.bindMarker("value")));
boundValues.add(value);
encodedValues.add(meta.value.encodeFromJava(value, Optional.of(cassandraOptions)));
return EntitySensor_Update.Cols.this;
}
/**
* Generate an UPDATE FROM ... SET value = fromJson(?) */
public final EntitySensor_Update.Cols Set_FromJSON(final String value_element) {
where.with(NonEscapingSetAssignment.of("value", QueryBuilder.fromJson(QueryBuilder.bindMarker("value"))));
boundValues.add(value_element);
encodedValues.add(value_element);
return EntitySensor_Update.Cols.this;
}
}
}
public class F extends AbstractUpdateFrom {
F(Update.Where where, CassandraOptions cassandraOptions) {
super(where, cassandraOptions);
}
public final F.Type type() {
return new F.Type();
}
public final F.Value value() {
return new F.Value();
}
public final class Type {
/**
* Generate an UPDATE FROM ... SET type = ? */
@SuppressWarnings("static-access")
public final EntitySensor_Update.Cols Set(final EntitySensor.SensorType type) {
where.with(NonEscapingSetAssignment.of("type", QueryBuilder.bindMarker("type")));
boundValues.add(type);
encodedValues.add(meta.type.encodeFromJava(type, Optional.of(cassandraOptions)));
return new EntitySensor_Update.Cols(where, cassandraOptions);
}
/**
* Generate an UPDATE FROM ... SET type = fromJson(?) */
public final EntitySensor_Update.Cols Set_FromJSON(final String type_element) {
where.with(NonEscapingSetAssignment.of("type", QueryBuilder.fromJson(QueryBuilder.bindMarker("type"))));
boundValues.add(type_element);
encodedValues.add(type_element);
return new EntitySensor_Update.Cols(where, cassandraOptions);
}
}
public final class Value {
/**
* Generate an UPDATE FROM ... SET value = ? */
@SuppressWarnings("static-access")
public final EntitySensor_Update.Cols Set(final Double value) {
where.with(NonEscapingSetAssignment.of("value", QueryBuilder.bindMarker("value")));
boundValues.add(value);
encodedValues.add(meta.value.encodeFromJava(value, Optional.of(cassandraOptions)));
return new EntitySensor_Update.Cols(where, cassandraOptions);
}
/**
* Generate an UPDATE FROM ... SET value = fromJson(?) */
public final EntitySensor_Update.Cols Set_FromJSON(final String value_element) {
where.with(NonEscapingSetAssignment.of("value", QueryBuilder.fromJson(QueryBuilder.bindMarker("value"))));
boundValues.add(value_element);
encodedValues.add(value_element);
return new EntitySensor_Update.Cols(where, cassandraOptions);
}
}
}
public final class W_SensorId extends AbstractUpdateWhere {
public W_SensorId(Update.Where where, CassandraOptions cassandraOptions) {
super(where, cassandraOptions);
}
public final EntitySensor_Update.W_SensorId.Relation sensorId() {
return new EntitySensor_Update.W_SensorId.Relation();
}
public final class Relation {
/**
* Generate a SELECT ... FROM ... WHERE ... sensor_id = ? */
@SuppressWarnings("static-access")
public final EntitySensor_Update.W_Date Eq(Long sensorId) {
where.and(QueryBuilder.eq("sensor_id", QueryBuilder.bindMarker("sensor_id")));
boundValues.add(sensorId);
encodedValues.add(meta.sensorId.encodeFromJava(sensorId, Optional.of(cassandraOptions)));
return new EntitySensor_Update.W_Date(where, cassandraOptions);
}
/**
* Generate a SELECT ... FROM ... WHERE ... sensor_id IN ? */
@SuppressWarnings("static-access")
public final EntitySensor_Update.W_Date IN(Long... sensorId) {
Validator.validateTrue(ArrayUtils.isNotEmpty(sensorId), "Varargs for field '%s' should not be null/empty", "sensorId");
where.and(QueryBuilder.in("sensor_id",QueryBuilder.bindMarker("sensor_id")));
final List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy