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

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

package info.archinnov.achilles.generated.dsl;

import com.datastax.driver.core.querybuilder.Delete;
import com.datastax.driver.core.querybuilder.QueryBuilder;
import info.archinnov.achilles.generated.meta.entity.EntityWithComplexCounters_AchillesMeta;
import info.archinnov.achilles.internals.entities.EntityWithComplexCounters;
import info.archinnov.achilles.internals.metamodel.AbstractEntityProperty;
import info.archinnov.achilles.internals.options.Options;
import info.archinnov.achilles.internals.query.dsl.delete.AbstractDelete;
import info.archinnov.achilles.internals.query.dsl.delete.AbstractDeleteColumns;
import info.archinnov.achilles.internals.query.dsl.delete.AbstractDeleteEnd;
import info.archinnov.achilles.internals.query.dsl.delete.AbstractDeleteFrom;
import info.archinnov.achilles.internals.query.dsl.delete.AbstractDeleteWhere;
import info.archinnov.achilles.internals.query.dsl.delete.AbstractDeleteWherePartition;
import info.archinnov.achilles.internals.runtime.RuntimeEngine;
import info.archinnov.achilles.type.SchemaNameProvider;
import java.lang.Class;
import java.lang.Long;
import java.lang.Object;
import java.lang.Override;
import java.lang.SuppressWarnings;
import java.util.List;
import java.util.UUID;

public final class EntityWithComplexCounters_Delete extends AbstractDelete {
  protected final EntityWithComplexCounters_AchillesMeta meta;

  protected final Class entityClass = EntityWithComplexCounters.class;

  public EntityWithComplexCounters_Delete(RuntimeEngine rte, EntityWithComplexCounters_AchillesMeta meta) {
    super(rte);
    this.meta = meta;
  }

  /**
   * Generate DELETE static_count ... */
  public final EntityWithComplexCounters_Delete.EntityWithComplexCounters_DeleteColumns staticCounter() {
    delete.column("static_count");
    return new EntityWithComplexCounters_Delete.EntityWithComplexCounters_DeleteColumns(delete);
  }

  /**
   * Generate DELETE count ... */
  public final EntityWithComplexCounters_Delete.EntityWithComplexCounters_DeleteColumns simpleCounter() {
    delete.column("count");
    return new EntityWithComplexCounters_Delete.EntityWithComplexCounters_DeleteColumns(delete);
  }

  /**
   * Generate DELETE codec_count ... */
  public final EntityWithComplexCounters_Delete.EntityWithComplexCounters_DeleteColumns counterWithCodec() {
    delete.column("codec_count");
    return new EntityWithComplexCounters_Delete.EntityWithComplexCounters_DeleteColumns(delete);
  }

  /**
   * Generate ... * FROM ... */
  public final EntityWithComplexCounters_Delete.EntityWithComplexCounters_DeleteFrom allColumns_FromBaseTable() {
    final Delete.Where where = delete.all().from(meta.getKeyspace().orElse("unknown_keyspace_for_" + meta.entityClass.getCanonicalName()), meta.getTableOrViewName()).where();
    return new EntityWithComplexCounters_Delete.EntityWithComplexCounters_DeleteFrom(where);
  }

  /**
   * Generate ... * FROM ... using the given SchemaNameProvider */
  public final EntityWithComplexCounters_Delete.EntityWithComplexCounters_DeleteFrom allColumns_From(final SchemaNameProvider schemaNameProvider) {
    final String currentKeyspace = lookupKeyspace(schemaNameProvider, meta.entityClass);
    final String currentTable = lookupTable(schemaNameProvider, meta.entityClass);
    final Delete.Where where = delete.all().from(currentKeyspace, currentTable).where();
    return new EntityWithComplexCounters_Delete.EntityWithComplexCounters_DeleteFrom(where);
  }

  public class EntityWithComplexCounters_DeleteColumns extends AbstractDeleteColumns {
    EntityWithComplexCounters_DeleteColumns(Delete.Selection deleteColumns) {
      super(deleteColumns);
    }

    /**
     * Generate DELETE static_count ... */
    public final EntityWithComplexCounters_Delete.EntityWithComplexCounters_DeleteColumns staticCounter() {
      delete.column("static_count");
      return this;
    }

    /**
     * Generate DELETE count ... */
    public final EntityWithComplexCounters_Delete.EntityWithComplexCounters_DeleteColumns simpleCounter() {
      delete.column("count");
      return this;
    }

    /**
     * Generate DELETE codec_count ... */
    public final EntityWithComplexCounters_Delete.EntityWithComplexCounters_DeleteColumns counterWithCodec() {
      delete.column("codec_count");
      return this;
    }

    /**
     * Generate a ... FROM xxx ...  */
    public final EntityWithComplexCounters_Delete.EntityWithComplexCounters_DeleteFrom fromBaseTable() {
      final Delete.Where where = deleteColumns.from(meta.getKeyspace().orElse("unknown_keyspace_for_" + meta.entityClass.getCanonicalName()), meta.getTableOrViewName()).where();
      return new EntityWithComplexCounters_Delete.EntityWithComplexCounters_DeleteFrom(where);
    }

    /**
     * Generate a ... FROM xxx ... using the given SchemaNameProvider */
    public final EntityWithComplexCounters_Delete.EntityWithComplexCounters_DeleteFrom from(final SchemaNameProvider schemaNameProvider) {
      final String currentKeyspace = lookupKeyspace(schemaNameProvider, meta.entityClass);
      final String currentTable = lookupTable(schemaNameProvider, meta.entityClass);
      final Delete.Where where = deleteColumns.from(currentKeyspace, currentTable).where();
      return new EntityWithComplexCounters_Delete.EntityWithComplexCounters_DeleteFrom(where);
    }
  }

  public class EntityWithComplexCounters_DeleteFrom extends AbstractDeleteFrom {
    EntityWithComplexCounters_DeleteFrom(Delete.Where where) {
      super(where);
    }

    public final EntityWithComplexCounters_Delete.EntityWithComplexCounters_DeleteWhere_Id where() {
      return new EntityWithComplexCounters_Delete.EntityWithComplexCounters_DeleteWhere_Id(where);
    }
  }

  public final class EntityWithComplexCounters_DeleteWhere_Id extends AbstractDeleteWherePartition {
    public EntityWithComplexCounters_DeleteWhere_Id(Delete.Where where) {
      super(where);
    }

    /**
     * Generate a SELECT ... FROM ... WHERE ... id = ? */
    @SuppressWarnings("static-access")
    public final EntityWithComplexCounters_Delete.EntityWithComplexCounters_DeleteWhere_Uuid id_Eq(Long id) {
      where.and(QueryBuilder.eq("id", QueryBuilder.bindMarker("id_Eq")));
      boundValues.add(id);
      encodedValues.add(meta.id.encodeFromJava(id));
      return new EntityWithComplexCounters_Delete.EntityWithComplexCounters_DeleteWhere_Uuid(where);
    }
  }

  public final class EntityWithComplexCounters_DeleteWhere_Uuid extends AbstractDeleteWhere {
    public EntityWithComplexCounters_DeleteWhere_Uuid(Delete.Where where) {
      super(where);
    }

    /**
     * Generate a SELECT ... FROM ... WHERE ... uuid = ? */
    @SuppressWarnings("static-access")
    public final EntityWithComplexCounters_Delete.EntityWithComplexCounters_DeleteEnd uuid_Eq(UUID uuid) {
      where.and(QueryBuilder.eq("uuid", QueryBuilder.bindMarker("uuid_Eq")));
      boundValues.add(uuid);
      encodedValues.add(meta.uuid.encodeFromJava(uuid));
      return new EntityWithComplexCounters_Delete.EntityWithComplexCounters_DeleteEnd(where);
    }
  }

  public final class EntityWithComplexCounters_DeleteEnd extends AbstractDeleteEnd {
    public EntityWithComplexCounters_DeleteEnd(Delete.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;
    }

    @Override
    protected final EntityWithComplexCounters_Delete.EntityWithComplexCounters_DeleteEnd getThis() {
      return this;
    }
  }
}