All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.torodb.backend.tables.MetaIndexFieldTable 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.MetaIndexFieldRecord;
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 MetaIndexFieldTable>
extends SemanticTable {
private static final long serialVersionUID = -7521772531370036757L;
public static final String TABLE_NAME = "index_field";
public enum TableFields {
DATABASE("database"),
COLLECTION("collection"),
INDEX("index"),
POSITION("position"),
TABLE_REF("table_ref"),
NAME("name"),
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.index_field.database
.
*/
public final TableField DATABASE =
createDatabaseField();
/**
* The column torodb.index_field.collection
.
*/
public final TableField COLLECTION =
createCollectionField();
/**
* The column torodb.index_field.index
.
*/
public final TableField INDEX =
createIndexField();
/**
* The column torodb.index_field.position
.
*/
public final TableField POSITION =
createPositionField();
/**
* The column torodb.index_field.path
.
*/
public final TableField TABLE_REF =
createTableRefField();
/**
* The column torodb.index_field.name
.
*/
public final TableField NAME =
createNameField();
/**
* The column torodb.index_field.ordering
.
*/
public final TableField ORDERING =
createOrderingField();
protected abstract TableField createDatabaseField();
protected abstract TableField createCollectionField();
protected abstract TableField createIndexField();
protected abstract TableField createPositionField();
protected abstract TableField createTableRefField();
protected abstract TableField createNameField();
protected abstract TableField createOrderingField();
private final UniqueKeys uniqueKeys;
/**
* Create a torodb.index_field
table reference
*/
public MetaIndexFieldTable() {
this(TABLE_NAME, null);
}
protected MetaIndexFieldTable(String alias, Table aliased) {
this(alias, aliased, null);
}
protected MetaIndexFieldTable(String alias, Table aliased, Field>[] parameters) {
super(alias, TorodbSchema.TORODB, aliased, parameters, "");
this.uniqueKeys = new UniqueKeys(this);
}
/**
* {@inheritDoc}
*/
@Override
public UniqueKey getPrimaryKey() {
return uniqueKeys.INDEX_FIELD_PKEY;
}
/**
* {@inheritDoc}
*/
@Override
public List> getKeys() {
return Arrays.>asList(uniqueKeys.INDEX_FIELD_PKEY,
uniqueKeys.TABLE_REF_NAME_UNIQUE
);
}
/**
* {@inheritDoc}
*/
@Override
public abstract MetaIndexFieldTable as(String alias);
/**
* Rename this table
*/
public abstract MetaIndexFieldTable rename(String name);
public UniqueKeys getUniqueKeys() {
return uniqueKeys;
}
@SuppressWarnings("checkstyle:LineLength")
public static class UniqueKeys>
extends AbstractKeys {
private final UniqueKey INDEX_FIELD_PKEY;
private final UniqueKey TABLE_REF_NAME_UNIQUE;
private UniqueKeys(MetaIndexFieldTable fieldTable) {
INDEX_FIELD_PKEY = createUniqueKey(fieldTable, fieldTable.DATABASE, fieldTable.COLLECTION,
fieldTable.INDEX, fieldTable.POSITION);
TABLE_REF_NAME_UNIQUE =
createUniqueKey(fieldTable, fieldTable.DATABASE, fieldTable.COLLECTION, fieldTable.INDEX,
fieldTable.TABLE_REF, fieldTable.NAME);
}
}
}