info.archinnov.achilles.generated.dsl.EntityWithComplexIndices_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.EntityWithComplexIndices_AchillesMeta;
import info.archinnov.achilles.internals.entities.EntityWithComplexIndices;
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 EntityWithComplexIndices_Select extends AbstractSelect {
protected final EntityWithComplexIndices_AchillesMeta meta;
protected final Class entityClass = EntityWithComplexIndices.class;
public EntityWithComplexIndices_Select(RuntimeEngine rte, EntityWithComplexIndices_AchillesMeta meta) {
super(rte);
this.meta = meta;
}
/**
* Generate a SELECT ... id ... */
public final EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectColumns id() {
select.column("id");
return new EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectColumns(select);
}
/**
* Generate a SELECT ... simpleindex ... */
public final EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectColumns simpleIndex() {
select.column("simpleindex");
return new EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectColumns(select);
}
/**
* Generate a SELECT ... collectionindex ... */
public final EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectColumns collectionIndex() {
select.column("collectionindex");
return new EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectColumns(select);
}
/**
* Generate a SELECT ... fullindexoncollection ... */
public final EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectColumns fullIndexOnCollection() {
select.column("fullindexoncollection");
return new EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectColumns(select);
}
/**
* Generate a SELECT ... indexonmapkey ... */
public final EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectColumns indexOnMapKey() {
select.column("indexonmapkey");
return new EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectColumns(select);
}
/**
* Generate a SELECT ... indexonmapentry ... */
public final EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectColumns indexOnMapEntry() {
select.column("indexonmapentry");
return new EntityWithComplexIndices_Select.EntityWithComplexIndices_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 EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectColumns function(final FunctionCall functionCall, final String alias) {
functionCall.addToSelect(select, alias);
return new EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectColumns(select);
}
/**
* Generate ... * FROM ... */
public final EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectFrom allColumns_FromBaseTable() {
final Select.Where where = select.all().from(meta.getKeyspace().orElse("unknown_keyspace_for_" + meta.entityClass.getCanonicalName()), meta.getTableOrViewName()).where();
return new EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectFrom(where);
}
/**
* Generate ... * FROM ... using the given SchemaNameProvider */
public final EntityWithComplexIndices_Select.EntityWithComplexIndices_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 EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectFrom(where);
}
public class EntityWithComplexIndices_SelectColumns extends AbstractSelectColumns {
public EntityWithComplexIndices_SelectColumns(Select.Selection selection) {
super(selection);
}
/**
* Generate a SELECT ... id ... */
public final EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectColumns id() {
selection.column("id");
return this;
}
/**
* Generate a SELECT ... simpleindex ... */
public final EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectColumns simpleIndex() {
selection.column("simpleindex");
return this;
}
/**
* Generate a SELECT ... collectionindex ... */
public final EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectColumns collectionIndex() {
selection.column("collectionindex");
return this;
}
/**
* Generate a SELECT ... fullindexoncollection ... */
public final EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectColumns fullIndexOnCollection() {
selection.column("fullindexoncollection");
return this;
}
/**
* Generate a SELECT ... indexonmapkey ... */
public final EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectColumns indexOnMapKey() {
selection.column("indexonmapkey");
return this;
}
/**
* Generate a SELECT ... indexonmapentry ... */
public final EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectColumns indexOnMapEntry() {
selection.column("indexonmapentry");
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 EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectColumns function(final FunctionCall functionCall, final String alias) {
functionCall.addToSelect(selection, alias);
return this;
}
/**
* Generate a ... FROM xxx ... */
public final EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectFrom fromBaseTable() {
final Select.Where where = selection.from(meta.getKeyspace().orElse("unknown_keyspace_for_" + meta.entityClass.getCanonicalName()), meta.getTableOrViewName()).where();
return new EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectFrom(where);
}
/**
* Generate a ... FROM xxx ... using the given SchemaNameProvider */
public final EntityWithComplexIndices_Select.EntityWithComplexIndices_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 EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectFrom(where);
}
}
public class EntityWithComplexIndices_SelectFrom extends AbstractSelectFrom {
EntityWithComplexIndices_SelectFrom(Select.Where where) {
super(where);
}
/**
* Generate a SELECT ... FROM ... WHERE ... */
public final EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectWhere_Id where() {
return new EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectWhere_Id(where);
}
/**
* Generate a SELECT statement without the WHERE clause */
public final EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectEnd without_WHERE_Clause() {
return new EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectEnd(where);
}
}
public final class EntityWithComplexIndices_SelectWhere_Id extends AbstractSelectWherePartition {
public EntityWithComplexIndices_SelectWhere_Id(Select.Where where) {
super(where);
}
/**
* Generate a SELECT ... FROM ... WHERE ... id = ? */
@SuppressWarnings("static-access")
public final EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectEnd id_Eq(Long id) {
where.and(QueryBuilder.eq("id", QueryBuilder.bindMarker("id_Eq")));
boundValues.add(id);
encodedValues.add(meta.id.encodeFromJava(id));
return new EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectEnd(where);
}
/**
* Generate a SELECT ... FROM ... WHERE ... id IN ? */
@SuppressWarnings("static-access")
public final EntityWithComplexIndices_Select.EntityWithComplexIndices_SelectEnd id_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