All Downloads are FREE. Search and download functionalities are using the official Maven repository.

info.archinnov.achilles.generated.dsl.EntityWithCaseSensitivePK_Select Maven / Gradle / Ivy

package info.archinnov.achilles.generated.dsl;

import com.datastax.driver.core.querybuilder.QueryBuilder;
import com.datastax.driver.core.querybuilder.Select;
import info.archinnov.achilles.generated.meta.entity.EntityWithCaseSensitivePK_AchillesMeta;
import info.archinnov.achilles.internals.entities.EntityWithCaseSensitivePK;
import info.archinnov.achilles.internals.metamodel.AbstractEntityProperty;
import info.archinnov.achilles.internals.metamodel.functions.FunctionCall;
import info.archinnov.achilles.internals.options.Options;
import info.archinnov.achilles.internals.query.dsl.select.AbstractSelect;
import info.archinnov.achilles.internals.query.dsl.select.AbstractSelectColumns;
import info.archinnov.achilles.internals.query.dsl.select.AbstractSelectFrom;
import info.archinnov.achilles.internals.query.dsl.select.AbstractSelectWhere;
import info.archinnov.achilles.internals.query.dsl.select.AbstractSelectWherePartition;
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.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.stream.Collectors;
import org.apache.commons.lang3.ArrayUtils;

public final class EntityWithCaseSensitivePK_Select extends AbstractSelect {
  protected final EntityWithCaseSensitivePK_AchillesMeta meta;

  protected final Class entityClass = EntityWithCaseSensitivePK.class;

  public EntityWithCaseSensitivePK_Select(RuntimeEngine rte, EntityWithCaseSensitivePK_AchillesMeta meta) {
    super(rte);
    this.meta = meta;
  }

  /**
   * Generate a SELECT ... "partitionKey" ... */
  public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectColumns id() {
    select.column("\"partitionKey\"");
    return new EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectColumns(select);
  }

  /**
   * Generate a SELECT ... "clusteringColumn" ... */
  public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectColumns clust() {
    select.column("\"clusteringColumn\"");
    return new EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectColumns(select);
  }

  /**
   * Generate a SELECT ... "listString" ... */
  public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectColumns list() {
    select.column("\"listString\"");
    return new EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectColumns(select);
  }

  /**
   * Generate a SELECT ... "setString" ... */
  public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectColumns set() {
    select.column("\"setString\"");
    return new EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectColumns(select);
  }

  /**
   * Generate a SELECT ... "mapIntString" ... */
  public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectColumns map() {
    select.column("\"mapIntString\"");
    return new EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectColumns(select);
  }

  /**
   * Generate a SELECT ... "udtWithNoKeyspace" ... */
  public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectColumns udt() {
    select.column("\"udtWithNoKeyspace\"");
    return new EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectColumns(select);
  }

  /**
   * Use this method to call a system or user-defined function.
All the system functions are accessible from the {@link info.archinnov.achilles.generated.function.SystemFunctions} class
All the user-defined functions and aggregates are accessible from the {@link info.archinnov.achilles.generated.function.FunctionsRegistry} class
System and user-defined functions accept only appropriate type. To pass in an entity field as function argument, use the generated manager.COLUMNS class which exposes all columns with their appropriate type
Example:

   *   {@literal @}Table
   *   public class MyEntity {
   *
   *       ...
   *
   *       {@literal @}Column("value_column")
   *       private String value;
   *
   *       {@literal @}Column("list_of_string")
   *       private List strings;
   *
   *       ...
   *
   *   }
   *
   *   {@literal @}FunctionsRegistry
   *   public interface MyFunctions {
   *
   *        String convertListToJson(List strings);
   *
   *   }
   *
   *
   *   ...
   *
   *
   *   manager
   *      .dsl()
   *      .select()
   *      // This call will generate SELECT cast(writetime(value_column) as text) AS writetimeOfValueAsString, ...
   *      .function(SystemFunctions.castAsText(SystemFunctions.writetime(manager.COLUMNS.VALUE)), "writetimeOfValueAsString")
   *      ...
   *
   *   manager 
   *      .dsl()
   *      .select()
   *      // This call will generate SELECT convertlisttojson(list_of_string) AS strings_as_json, ...
   *      .function(FunctionsRegistry.convertListToJson(manager.COLUMNS.STRINGS), "strings_as_json")
   *      ...
   *
   * 
*
* @param functionCall the function call object * @param alias mandatory alias for this function call for easier retrieval from the ResultSet * @return a built-in function call passed to the QueryBuilder object */ public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectColumns function(final FunctionCall functionCall, final String alias) { functionCall.addToSelect(select, alias); return new EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectColumns(select); } /** * Generate ... * FROM ... */ public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectFrom allColumns_FromBaseTable() { final Select.Where where = select.all().from(meta.getKeyspace().orElse("unknown_keyspace_for_" + meta.entityClass.getCanonicalName()), meta.getTableOrViewName()).where(); return new EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectFrom(where); } /** * Generate ... * FROM ... using the given SchemaNameProvider */ public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectFrom allColumns_From(final SchemaNameProvider schemaNameProvider) { final String currentKeyspace = lookupKeyspace(schemaNameProvider, meta.entityClass); final String currentTable = lookupTable(schemaNameProvider, meta.entityClass); final Select.Where where = select.all().from(currentKeyspace, currentTable).where(); return new EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectFrom(where); } public class EntityWithCaseSensitivePK_SelectColumns extends AbstractSelectColumns { public EntityWithCaseSensitivePK_SelectColumns(Select.Selection selection) { super(selection); } /** * Generate a SELECT ... "partitionKey" ... */ public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectColumns id() { selection.column("\"partitionKey\""); return this; } /** * Generate a SELECT ... "clusteringColumn" ... */ public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectColumns clust() { selection.column("\"clusteringColumn\""); return this; } /** * Generate a SELECT ... "listString" ... */ public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectColumns list() { selection.column("\"listString\""); return this; } /** * Generate a SELECT ... "setString" ... */ public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectColumns set() { selection.column("\"setString\""); return this; } /** * Generate a SELECT ... "mapIntString" ... */ public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectColumns map() { selection.column("\"mapIntString\""); return this; } /** * Generate a SELECT ... "udtWithNoKeyspace" ... */ public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectColumns udt() { selection.column("\"udtWithNoKeyspace\""); return this; } /** * Use this method to call a system or user-defined function.
All the system functions are accessible from the {@link info.archinnov.achilles.generated.function.SystemFunctions} class
All the user-defined functions and aggregates are accessible from the {@link info.archinnov.achilles.generated.function.FunctionsRegistry} class
System and user-defined functions accept only appropriate type. To pass in an entity field as function argument, use the generated manager.COLUMNS class which exposes all columns with their appropriate type
Example:

     *   {@literal @}Table
     *   public class MyEntity {
     *
     *       ...
     *
     *       {@literal @}Column("value_column")
     *       private String value;
     *
     *       {@literal @}Column("list_of_string")
     *       private List strings;
     *
     *       ...
     *
     *   }
     *
     *   {@literal @}FunctionsRegistry
     *   public interface MyFunctions {
     *
     *        String convertListToJson(List strings);
     *
     *   }
     *
     *
     *   ...
     *
     *
     *   manager
     *      .dsl()
     *      .select()
     *      // This call will generate SELECT cast(writetime(value_column) as text) AS writetimeOfValueAsString, ...
     *      .function(SystemFunctions.castAsText(SystemFunctions.writetime(manager.COLUMNS.VALUE)), "writetimeOfValueAsString")
     *      ...
     *
     *   manager 
     *      .dsl()
     *      .select()
     *      // This call will generate SELECT convertlisttojson(list_of_string) AS strings_as_json, ...
     *      .function(FunctionsRegistry.convertListToJson(manager.COLUMNS.STRINGS), "strings_as_json")
     *      ...
     *
     * 
*
* @param functionCall the function call object * @param alias mandatory alias for this function call for easier retrieval from the ResultSet * @return a built-in function call passed to the QueryBuilder object */ public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectColumns function(final FunctionCall functionCall, final String alias) { functionCall.addToSelect(selection, alias); return this; } /** * Generate a ... FROM xxx ... */ public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectFrom fromBaseTable() { final Select.Where where = selection.from(meta.getKeyspace().orElse("unknown_keyspace_for_" + meta.entityClass.getCanonicalName()), meta.getTableOrViewName()).where(); return new EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectFrom(where); } /** * Generate a ... FROM xxx ... using the given SchemaNameProvider */ public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectFrom from(final SchemaNameProvider schemaNameProvider) { final String currentKeyspace = lookupKeyspace(schemaNameProvider, meta.entityClass); final String currentTable = lookupTable(schemaNameProvider, meta.entityClass); final Select.Where where = selection.from(currentKeyspace, currentTable).where(); return new EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectFrom(where); } } public class EntityWithCaseSensitivePK_SelectFrom extends AbstractSelectFrom { EntityWithCaseSensitivePK_SelectFrom(Select.Where where) { super(where); } /** * Generate a SELECT ... FROM ... WHERE ... */ public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectWhere_Id where() { return new EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectWhere_Id(where); } /** * Generate a SELECT statement without the WHERE clause */ public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectEnd without_WHERE_Clause() { return new EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectEnd(where); } } public final class EntityWithCaseSensitivePK_SelectWhere_Id extends AbstractSelectWherePartition { public EntityWithCaseSensitivePK_SelectWhere_Id(Select.Where where) { super(where); } /** * Generate a SELECT ... FROM ... WHERE ... "partitionKey" = ? */ @SuppressWarnings("static-access") public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectWhere_Clust id_Eq(Long id) { where.and(QueryBuilder.eq("\"partitionKey\"", QueryBuilder.bindMarker("id_Eq"))); boundValues.add(id); encodedValues.add(meta.id.encodeFromJava(id)); return new EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectWhere_Clust(where); } /** * Generate a SELECT ... FROM ... WHERE ... "partitionKey" IN ? */ @SuppressWarnings("static-access") public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectWhere_Clust id_IN(Long... id) { Validator.validateTrue(ArrayUtils.isNotEmpty(id), "Varargs for field '%s' should not be null/empty", "id"); where.and(QueryBuilder.in("\"partitionKey\"",QueryBuilder.bindMarker("\"partitionKey\""))); final List varargs = Arrays.asList((Object[])id); final List encodedVarargs = Arrays.stream((Long[])id).map(x -> meta.id.encodeFromJava(x)).collect(Collectors.toList()); boundValues.add(varargs); encodedValues.add(encodedVarargs); return new EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectWhere_Clust(where); } } public final class EntityWithCaseSensitivePK_SelectWhere_Clust extends AbstractSelectWhere { public EntityWithCaseSensitivePK_SelectWhere_Clust(Select.Where where) { super(where); } @Override protected final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectWhere_Clust getThis() { return this; } @Override protected final AbstractEntityProperty getMetaInternal() { return meta; } @Override protected final Class getEntityClass() { return entityClass; } @Override protected final RuntimeEngine getRte() { return rte; } @Override protected final Options getOptions() { return options; } @Override protected final List getBoundValuesInternal() { return boundValues; } @Override protected final List getEncodedValuesInternal() { return encodedValues; } /** * Generate a SELECT ... FROM ... WHERE ... LIMIT :limit */ public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectWhere_Clust limit(final Integer limit) { where.limit(QueryBuilder.bindMarker("lim")); boundValues.add(limit); encodedValues.add(limit); return this; } /** * Generate a SELECT ... FROM ... WHERE ... "clusteringColumn" = ? */ @SuppressWarnings("static-access") public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectEnd clust_Eq(Long clust) { where.and(QueryBuilder.eq("\"clusteringColumn\"", QueryBuilder.bindMarker("clust_Eq"))); boundValues.add(clust); encodedValues.add(meta.clust.encodeFromJava(clust)); return new EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectEnd(where); } /** * Generate a SELECT ... FROM ... WHERE ... "clusteringColumn" IN ? */ @SuppressWarnings("static-access") public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectEnd clust_IN(Long... clust) { Validator.validateTrue(ArrayUtils.isNotEmpty(clust), "Varargs for field '%s' should not be null/empty", "clust"); where.and(QueryBuilder.in("\"clusteringColumn\"",QueryBuilder.bindMarker("\"clusteringColumn\""))); final List varargs = Arrays.asList((Object[])clust); final List encodedVarargs = Arrays.stream((Long[])clust).map(x -> meta.clust.encodeFromJava(x)).collect(Collectors.toList()); boundValues.add(varargs); encodedValues.add(encodedVarargs); return new EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectEnd(where); } /** * Generate a SELECT ... FROM ... WHERE ... "clusteringColumn" > ? */ @SuppressWarnings("static-access") public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectEnd clust_Gt(Long clust) { where.and(QueryBuilder.gt("\"clusteringColumn\"", QueryBuilder.bindMarker("clust_Gt"))); boundValues.add(clust); encodedValues.add(meta.clust.encodeFromJava(clust)); return new EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectEnd(where); } /** * Generate a SELECT ... FROM ... WHERE ... "clusteringColumn" >= ? */ @SuppressWarnings("static-access") public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectEnd clust_Gte(Long clust) { where.and(QueryBuilder.gte("\"clusteringColumn\"", QueryBuilder.bindMarker("clust_Gte"))); boundValues.add(clust); encodedValues.add(meta.clust.encodeFromJava(clust)); return new EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectEnd(where); } /** * Generate a SELECT ... FROM ... WHERE ... "clusteringColumn" < ? */ @SuppressWarnings("static-access") public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectEnd clust_Lt(Long clust) { where.and(QueryBuilder.lt("\"clusteringColumn\"", QueryBuilder.bindMarker("clust_Lt"))); boundValues.add(clust); encodedValues.add(meta.clust.encodeFromJava(clust)); return new EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectEnd(where); } /** * Generate a SELECT ... FROM ... WHERE ... "clusteringColumn" <= ? */ @SuppressWarnings("static-access") public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectEnd clust_Lte(Long clust) { where.and(QueryBuilder.lte("\"clusteringColumn\"", QueryBuilder.bindMarker("clust_Lte"))); boundValues.add(clust); encodedValues.add(meta.clust.encodeFromJava(clust)); return new EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectEnd(where); } /** * Generate a SELECT ... FROM ... WHERE ... "clusteringColumn" > ? AND "clusteringColumn" < ? */ @SuppressWarnings("static-access") public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectEnd clust_Gt_And_Lt(Long clust_Gt, Long clust_Lt) { where.and(QueryBuilder.gt("\"clusteringColumn\"",QueryBuilder.bindMarker("clusteringColumn_Lt"))); where.and(QueryBuilder.lt("\"clusteringColumn\"",QueryBuilder.bindMarker("clusteringColumn_Lt"))); boundValues.add(clust_Gt); encodedValues.add(meta.clust.encodeFromJava(clust_Gt)); boundValues.add(clust_Lt); encodedValues.add(meta.clust.encodeFromJava(clust_Lt)); return new EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectEnd(where); } /** * Generate a SELECT ... FROM ... WHERE ... "clusteringColumn" > ? AND "clusteringColumn" <= ? */ @SuppressWarnings("static-access") public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectEnd clust_Gt_And_Lte(Long clust_Gt, Long clust_Lte) { where.and(QueryBuilder.gt("\"clusteringColumn\"",QueryBuilder.bindMarker("clusteringColumn_Lte"))); where.and(QueryBuilder.lte("\"clusteringColumn\"",QueryBuilder.bindMarker("clusteringColumn_Lte"))); boundValues.add(clust_Gt); encodedValues.add(meta.clust.encodeFromJava(clust_Gt)); boundValues.add(clust_Lte); encodedValues.add(meta.clust.encodeFromJava(clust_Lte)); return new EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectEnd(where); } /** * Generate a SELECT ... FROM ... WHERE ... "clusteringColumn" >= ? AND "clusteringColumn" < ? */ @SuppressWarnings("static-access") public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectEnd clust_Gte_And_Lt(Long clust_Gte, Long clust_Lt) { where.and(QueryBuilder.gte("\"clusteringColumn\"",QueryBuilder.bindMarker("clusteringColumn_Lt"))); where.and(QueryBuilder.lt("\"clusteringColumn\"",QueryBuilder.bindMarker("clusteringColumn_Lt"))); boundValues.add(clust_Gte); encodedValues.add(meta.clust.encodeFromJava(clust_Gte)); boundValues.add(clust_Lt); encodedValues.add(meta.clust.encodeFromJava(clust_Lt)); return new EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectEnd(where); } /** * Generate a SELECT ... FROM ... WHERE ... "clusteringColumn" >= ? AND "clusteringColumn" <= ? */ @SuppressWarnings("static-access") public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectEnd clust_Gte_And_Lte(Long clust_Gte, Long clust_Lte) { where.and(QueryBuilder.gte("\"clusteringColumn\"",QueryBuilder.bindMarker("clusteringColumn_Lte"))); where.and(QueryBuilder.lte("\"clusteringColumn\"",QueryBuilder.bindMarker("clusteringColumn_Lte"))); boundValues.add(clust_Gte); encodedValues.add(meta.clust.encodeFromJava(clust_Gte)); boundValues.add(clust_Lte); encodedValues.add(meta.clust.encodeFromJava(clust_Lte)); return new EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectEnd(where); } /** * Generate a SELECT ... FROM ... WHERE ... ORDER BY clusteringColumn ASC */ public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectWhere_Clust orderByClustAscending() { where.orderBy(QueryBuilder.asc("clusteringColumn")); return this; } /** * Generate a SELECT ... FROM ... WHERE ... ORDER BY clusteringColumn DESC */ public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectWhere_Clust orderByClustDescending() { where.orderBy(QueryBuilder.desc("clusteringColumn")); return this; } } public final class EntityWithCaseSensitivePK_SelectEnd extends AbstractSelectWhere { public EntityWithCaseSensitivePK_SelectEnd(Select.Where where) { super(where); } @Override protected final Class getEntityClass() { return entityClass; } @Override protected final AbstractEntityProperty getMetaInternal() { return meta; } @Override protected final RuntimeEngine getRte() { return rte; } @Override protected final Options getOptions() { return options; } @Override protected final List getBoundValuesInternal() { return boundValues; } @Override protected final List getEncodedValuesInternal() { return encodedValues; } /** * Generate a SELECT ... FROM ... WHERE ... LIMIT :limit */ public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectEnd limit(final Integer limit) { where.limit(QueryBuilder.bindMarker("lim")); boundValues.add(limit); encodedValues.add(limit); return this; } @Override protected final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectEnd getThis() { return this; } /** * Generate a SELECT ... FROM ... WHERE ... ORDER BY clusteringColumn ASC */ public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectEnd orderByClustAscending() { where.orderBy(QueryBuilder.asc("clusteringColumn")); return this; } /** * Generate a SELECT ... FROM ... WHERE ... ORDER BY clusteringColumn DESC */ public final EntityWithCaseSensitivePK_Select.EntityWithCaseSensitivePK_SelectEnd orderByClustDescending() { where.orderBy(QueryBuilder.desc("clusteringColumn")); return this; } } }