com.torodb.backend.tables.MetaDocPartIndexColumnTable Maven / Gradle / Ivy
/*
* ToroDB
* Copyright © 2014 8Kdata Technology (www.8kdata.com)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
package com.torodb.backend.tables;
import com.torodb.backend.meta.TorodbSchema;
import com.torodb.backend.tables.records.MetaDocPartIndexColumnRecord;
import com.torodb.core.transaction.metainf.FieldIndexOrdering;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.jooq.Field;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.UniqueKey;
import org.jooq.impl.AbstractKeys;
import java.util.Arrays;
import java.util.List;
@SuppressFBWarnings(
value = "HE_HASHCODE_NO_EQUALS",
justification =
"Equals comparation is done in TableImpl class, which compares schema, name and fields")
@SuppressWarnings({"checkstyle:LineLength", "checkstyle:AbbreviationAsWordInName",
"checkstyle:MemberName"})
public abstract class MetaDocPartIndexColumnTable>
extends SemanticTable {
private static final long serialVersionUID = 2116451834151644607L;
public static final String TABLE_NAME = "doc_part_index_column";
public enum TableFields {
DATABASE("database"),
INDEX_IDENTIFIER("index_identifier"),
POSITION("position"),
COLLECTION("collection"),
TABLE_REF("table_ref"),
IDENTIFIER("identifier"),
ORDERING("ordering");
public final String fieldName;
TableFields(String fieldName) {
this.fieldName = fieldName;
}
@Override
public String toString() {
return fieldName;
}
}
/**
* The class holding records for this type
*
* @return
*/
@Override
public abstract Class getRecordType();
/**
* The column torodb.doc_part_index_column.database
.
*/
public final TableField DATABASE =
createDatabaseField();
/**
* The column torodb.doc_part_index_column.identifier
.
*/
public final TableField INDEX_IDENTIFIER =
createIndexIdentifierField();
/**
* The column torodb.doc_part_index_column.position
.
*/
public final TableField POSITION =
createPositionField();
/**
* The column torodb.doc_part_index_column.collection
.
*/
public final TableField COLLECTION =
createCollectionField();
/**
* The column torodb.doc_part_index_column.path
.
*/
public final TableField TABLE_REF =
createTableRefField();
/**
* The column torodb.doc_part_index_column.identifier
.
*/
public final TableField IDENTIFIER =
createIdentifierField();
/**
* The column torodb.doc_part_index_column.ordering
.
*/
public final TableField ORDERING =
createOrderingField();
protected abstract TableField createDatabaseField();
protected abstract TableField createIndexIdentifierField();
protected abstract TableField createPositionField();
protected abstract TableField createCollectionField();
protected abstract TableField createTableRefField();
protected abstract TableField createIdentifierField();
protected abstract TableField createOrderingField();
private final UniqueKeys uniqueKeys;
/**
* Create a torodb.doc_part_index_column
table reference
*/
public MetaDocPartIndexColumnTable() {
this(TABLE_NAME, null);
}
protected MetaDocPartIndexColumnTable(String alias, Table aliased) {
this(alias, aliased, null);
}
protected MetaDocPartIndexColumnTable(String alias, Table aliased, Field>[] parameters) {
super(alias, TorodbSchema.TORODB, aliased, parameters, "");
this.uniqueKeys = new UniqueKeys(this);
}
/**
* {@inheritDoc}
*/
@Override
public UniqueKey getPrimaryKey() {
return uniqueKeys.FIELD_INDEX_PKEY;
}
/**
* {@inheritDoc}
*/
@Override
public List> getKeys() {
return Arrays.>asList(uniqueKeys.FIELD_INDEX_PKEY);
}
/**
* {@inheritDoc}
*/
@Override
public abstract MetaDocPartIndexColumnTable as(String alias);
/**
* Rename this table
*/
public abstract MetaDocPartIndexColumnTable rename(String name);
public UniqueKeys getUniqueKeys() {
return uniqueKeys;
}
@SuppressWarnings("checkstyle:LineLength")
public static class UniqueKeys>
extends AbstractKeys {
private final UniqueKey FIELD_INDEX_PKEY;
private UniqueKeys(MetaDocPartIndexColumnTable fieldTable) {
FIELD_INDEX_PKEY = createUniqueKey(fieldTable, fieldTable.DATABASE,
fieldTable.INDEX_IDENTIFIER, fieldTable.POSITION);
}
}
}