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

com.rapleaf.jack.queries.ModelDelete Maven / Gradle / Ivy

There is a newer version: 1.8
Show newest version
package com.rapleaf.jack.queries;

import java.util.Collection;

/**
 * Represents a delete statement that may not explicitly list IDs.
 */
public class ModelDelete {
  private WhereClause whereClause;

  /**
   * This class should only be constructed in {@link AbstractDeleteBuilder}.
   */
  ModelDelete() {
    this.whereClause = new WhereClause();
  }

  public WhereClause getWhereClause() {
    return this.whereClause;
  }

  public void addConstraint(WhereConstraint constraint) {
    whereClause.addConstraint(constraint);
  }

  public void addIds(Collection ids) {
    whereClause.addIds(ids);
  }

  public void addId(Long id) {
    whereClause.addId(id);
  }

  public String getStatement(String tableName) {
    String statement = "DELETE FROM " + tableName + " ";
    statement += whereClause.getSqlString();
    return statement;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy