info.archinnov.achilles.generated.dsl.EntityWithStaticAnnotations_Update Maven / Gradle / Ivy
The newest version!
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.EntityWithStaticAnnotations_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.EntityWithStaticAnnotations;
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.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 EntityWithStaticAnnotations_Update extends AbstractUpdate {
protected final EntityWithStaticAnnotations_AchillesMeta meta;
protected final Class entityClass = EntityWithStaticAnnotations.class;
public EntityWithStaticAnnotations_Update(RuntimeEngine rte, EntityWithStaticAnnotations_AchillesMeta meta) {
super(rte);
this.meta = meta;
}
/**
* Generate an UPDATE FROM ... */
public final EntityWithStaticAnnotations_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 EntityWithStaticAnnotations_Update.F(where, new CassandraOptions());
}
/**
* Generate an UPDATE FROM ... using the given SchemaNameProvider */
public final EntityWithStaticAnnotations_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 EntityWithStaticAnnotations_Update.F(where, CassandraOptions.withSchemaNameProvider(schemaNameProvider));
}
public class Cols extends AbstractUpdateColumns {
Cols(Update.Where where, CassandraOptions cassandraOptions) {
super(where, cassandraOptions);
}
public final Cols.StringValue stringValue() {
return new Cols.StringValue();
}
public final Cols.OverridenName overridenName() {
return new Cols.OverridenName();
}
public final EntityWithStaticAnnotations_Update.W_PartitionKey where() {
return new EntityWithStaticAnnotations_Update.W_PartitionKey(where, cassandraOptions);
}
public final class StringValue {
/**
* Generate an UPDATE FROM ... SET value = ? */
@SuppressWarnings("static-access")
public final EntityWithStaticAnnotations_Update.Cols Set(final String stringValue) {
where.with(NonEscapingSetAssignment.of("value", QueryBuilder.bindMarker("value")));
boundValues.add(stringValue);
encodedValues.add(meta.stringValue.encodeFromJava(stringValue, Optional.of(cassandraOptions)));
return EntityWithStaticAnnotations_Update.Cols.this;
}
}
public final class OverridenName {
/**
* Generate an UPDATE FROM ... SET "overRiden" = ? */
@SuppressWarnings("static-access")
public final EntityWithStaticAnnotations_Update.Cols Set(final String overridenName) {
where.with(NonEscapingSetAssignment.of("\"overRiden\"", QueryBuilder.bindMarker("\"overRiden\"")));
boundValues.add(overridenName);
encodedValues.add(meta.overridenName.encodeFromJava(overridenName, Optional.of(cassandraOptions)));
return EntityWithStaticAnnotations_Update.Cols.this;
}
}
}
public class F extends AbstractUpdateFrom {
F(Update.Where where, CassandraOptions cassandraOptions) {
super(where, cassandraOptions);
}
public final F.StringValue stringValue() {
return new F.StringValue();
}
public final F.OverridenName overridenName() {
return new F.OverridenName();
}
public final class StringValue {
/**
* Generate an UPDATE FROM ... SET value = ? */
@SuppressWarnings("static-access")
public final EntityWithStaticAnnotations_Update.Cols Set(final String stringValue) {
where.with(NonEscapingSetAssignment.of("value", QueryBuilder.bindMarker("value")));
boundValues.add(stringValue);
encodedValues.add(meta.stringValue.encodeFromJava(stringValue, Optional.of(cassandraOptions)));
return new EntityWithStaticAnnotations_Update.Cols(where, cassandraOptions);
}
}
public final class OverridenName {
/**
* Generate an UPDATE FROM ... SET "overRiden" = ? */
@SuppressWarnings("static-access")
public final EntityWithStaticAnnotations_Update.Cols Set(final String overridenName) {
where.with(NonEscapingSetAssignment.of("\"overRiden\"", QueryBuilder.bindMarker("\"overRiden\"")));
boundValues.add(overridenName);
encodedValues.add(meta.overridenName.encodeFromJava(overridenName, Optional.of(cassandraOptions)));
return new EntityWithStaticAnnotations_Update.Cols(where, cassandraOptions);
}
}
}
public final class W_PartitionKey extends AbstractUpdateWhere {
public W_PartitionKey(Update.Where where, CassandraOptions cassandraOptions) {
super(where, cassandraOptions);
}
public final EntityWithStaticAnnotations_Update.W_PartitionKey.Relation partitionKey() {
return new EntityWithStaticAnnotations_Update.W_PartitionKey.Relation();
}
public final class Relation {
/**
* Generate a SELECT ... FROM ... WHERE ... partition_key = ? */
@SuppressWarnings("static-access")
public final EntityWithStaticAnnotations_Update.E Eq(Long partitionKey) {
where.and(QueryBuilder.eq("partition_key", QueryBuilder.bindMarker("partition_key")));
boundValues.add(partitionKey);
encodedValues.add(meta.partitionKey.encodeFromJava(partitionKey, Optional.of(cassandraOptions)));
return new EntityWithStaticAnnotations_Update.E(where, cassandraOptions);
}
/**
* Generate a SELECT ... FROM ... WHERE ... partition_key IN ? */
@SuppressWarnings("static-access")
public final EntityWithStaticAnnotations_Update.E IN(Long... partitionKey) {
Validator.validateTrue(ArrayUtils.isNotEmpty(partitionKey), "Varargs for field '%s' should not be null/empty", "partitionKey");
where.and(QueryBuilder.in("partition_key",QueryBuilder.bindMarker("partition_key")));
final List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy