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

com.github.jinahya.sql.database.metadata.bind.Table Maven / Gradle / Ivy

There is a newer version: 4.2.9
Show newest version
/*
 * Copyright 2013 Jin Kwon .
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


package com.github.jinahya.sql.database.metadata.bind;


import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;


/**
 * A entity class for binding the result of
 * {@link java.sql.DatabaseMetaData#getTables(java.lang.String, java.lang.String, java.lang.String, java.lang.String[])}.
 *
 * @author Jin Kwon <jinahya_at_gmail.com>
 */
@XmlRootElement
@XmlType(
    propOrder = {
        "tableName", "tableType", "remarks", "typeCat", "typeSchem", "typeName",
        "selfReferencingColName", "refGeneration",
        // ---------------------------------------------------------------------
        "bestRowIdentifiers", "columns", "exportedKeys", "importedKeys",
        "indexInfo", "primaryKeys", "pseudoColumns", "superTables",
        "tablePrivileges", "versionColumns"
    }
)
public class Table extends AbstractChild {


    @Override
    public String toString() {

        return super.toString() + "{"
               + "tableCat=" + tableCat
               + ", tableSchem=" + tableSchem
               + ", tableName=" + tableName
               + ", tableType=" + tableType
               + ", remarks=" + remarks
               + ", typeCat=" + typeCat
               + ", typeSchem=" + typeSchem
               + ", typeName=" + typeName
               + ", selfReferencingColName=" + selfReferencingColName
               + ", refGeneration=" + refGeneration
               + "}";
    }


    // ---------------------------------------------------------------- tableCat
    public String getTableCat() {

        return tableCat;
    }


    public void setTableCat(final String tableCat) {

        this.tableCat = tableCat;
    }


    // -------------------------------------------------------------- tableSchem
    public String getTableSchem() {

        return tableSchem;
    }


    public void setTableSchem(final String tableSchem) {

        this.tableSchem = tableSchem;
    }


    // --------------------------------------------------------------- tableName
    public String getTableName() {

        return tableName;
    }


    public void setTableName(final String tableName) {

        this.tableName = tableName;
    }


    // --------------------------------------------------------------- tableType
    public String getTableType() {

        return tableType;
    }


    public void setTableType(final String tableType) {

        this.tableType = tableType;
    }


    // ----------------------------------------------------------------- remarks
    public String getRemarks() {

        return remarks;
    }


    public void setRemarks(final String remarks) {

        this.remarks = remarks;
    }


    // ----------------------------------------------------------------- typeCat
    public String getTypeCat() {

        return typeCat;
    }


    public void setTypeCat(final String typeCat) {

        this.typeCat = typeCat;
    }


    // --------------------------------------------------------------- typeSchem
    public String getTypeSchem() {

        return typeSchem;
    }


    public void setTypeSchem(final String typeSchem) {

        this.typeSchem = typeSchem;
    }


    // ---------------------------------------------------------------- typeName
    public String getTypeName() {

        return typeName;
    }


    public void setTypeName(final String typeName) {

        this.typeName = typeName;
    }


    // -------------------------------------------------- selfReferencingColName
    public String getSelfReferencingColName() {

        return selfReferencingColName;
    }


    public void setSelfReferencingColName(final String selfReferencingColName) {

        this.selfReferencingColName = selfReferencingColName;
    }


    // ----------------------------------------------------------- refGeneration
    public String getRefGeneration() {

        return refGeneration;
    }


    public void setRefGeneration(final String refGeneration) {

        this.refGeneration = refGeneration;
    }


    // ------------------------------------------------------------------ schema
    // just for class diagram
    @Deprecated
    private Schema getSchema() {

        return getParent();
    }


//    public void setSchema(final Schema schema) {
//
//        setParent(schema);
//    }
    // ------------------------------------------------------ bestRowIdentifiers
    public List getBestRowIdentifiers() {

        if (bestRowIdentifiers == null) {
            bestRowIdentifiers = new ArrayList();
        }

        return bestRowIdentifiers;
    }


    public void setBestRowIdentifiers(List bestRowIdentifiers) {
        this.bestRowIdentifiers = bestRowIdentifiers;
    }


    // ----------------------------------------------------------------- columns
    public List getColumns() {

        if (columns == null) {
            columns = new ArrayList();
        }

        return columns;
    }


    public void setColumns(List columns) {
        this.columns = columns;
    }


    // ------------------------------------------------------------ exportedKeys
    public List getExportedKeys() {

        if (exportedKeys == null) {
            exportedKeys = new ArrayList();
        }

        return exportedKeys;
    }


    public void setExportedKeys(List exportedKeys) {
        this.exportedKeys = exportedKeys;
    }


    // ------------------------------------------------------------ importedKeys
    public List getImportedKeys() {

        if (importedKeys == null) {
            importedKeys = new ArrayList();
        }

        return importedKeys;
    }


    public void setImportedKeys(List importedKeys) {
        this.importedKeys = importedKeys;
    }


    // --------------------------------------------------------------- indexInfo
    public List getIndexInfo() {

        if (indexInfo == null) {
            indexInfo = new ArrayList();
        }

        return indexInfo;
    }


    public List getIndexColumnNames(final String indexName) {

        if (indexName == null) {
            throw new NullPointerException("null indexName");
        }

        final List indexColumnNames = new ArrayList();

        for (final IndexInfo indexInfo_ : getIndexInfo()) {
            if (!indexName.equals(indexInfo_.getIndexName())) {
                continue;
            }
            indexColumnNames.add(indexInfo_.getColumnName());
        }

        return indexColumnNames;
    }


    public void setIndexInfo(List indexInfo) {
        this.indexInfo = indexInfo;
    }


    // ------------------------------------------------------------- primaryKeys
    public List getPrimaryKeys() {

        if (primaryKeys == null) {
            primaryKeys = new ArrayList();
        }

        return primaryKeys;
    }


    public void setPrimaryKeys(List primaryKeys) {
        this.primaryKeys = primaryKeys;
    }


    // ----------------------------------------------------------- pseudoColumns
    public List getPseudoColumns() {

        if (pseudoColumns == null) {
            pseudoColumns = new ArrayList();
        }

        return pseudoColumns;
    }


    public void setPseudoColumns(List pseudoColumns) {
        this.pseudoColumns = pseudoColumns;
    }


    // ------------------------------------------------------------- superTables
    public List getSuperTables() {

        if (superTables == null) {
            superTables = new ArrayList();
        }

        return superTables;
    }


    public void setSuperTables(List superTables) {
        this.superTables = superTables;
    }


    // --------------------------------------------------------- tablePrivileges
    public List getTablePrivileges() {

        if (tablePrivileges == null) {
            tablePrivileges = new ArrayList();
        }

        return tablePrivileges;
    }


    public void setTablePrivileges(List tablePrivileges) {
        this.tablePrivileges = tablePrivileges;
    }


    // ---------------------------------------------------------- versionColumns
    public List getVersionColumns() {

        if (versionColumns == null) {
            versionColumns = new ArrayList();
        }

        return versionColumns;
    }


    public void setVersionColumns(List versionColumns) {
        this.versionColumns = versionColumns;
    }


    // -------------------------------------------------------------------------
    @Label("TABLE_CAT")
    @NillableBySpecification
    @XmlAttribute
    private String tableCat;


    @Label("TABLE_SCHEM")
    @NillableBySpecification
    @XmlAttribute
    private String tableSchem;


    @Label("TABLE_NAME")
    @XmlElement(required = true)
    private String tableName;


    @Label("TABLE_TYPE")
    @XmlElement(required = true)
    private String tableType;


    @Label("REMARKS")
    @XmlElement(required = true)
    private String remarks;


    @Label("TYPE_CAT")
    @NillableBySpecification
    @XmlElement(nillable = true, required = true)
    private String typeCat;


    @Label("TYPE_SCHEM")
    @NillableBySpecification
    @XmlElement(nillable = true, required = true)
    private String typeSchem;


    @Label("TYPE_NAME")
    @NillableBySpecification
    @XmlElement(nillable = true, required = true)
    private String typeName;


    @Label("SELF_REFERENCING_COL_NAME")
    @NillableBySpecification
    @XmlElement(nillable = true, required = true)
    private String selfReferencingColName;


    @Label("REF_GENERATION")
    @NillableBySpecification
    @XmlElement(nillable = true, required = true)
    private String refGeneration;


    @Invocation(
        name = "getBestRowIdentifier",
        types = {
            String.class, String.class, String.class, int.class, boolean.class
        },
        argsarr = {
            @InvocationArgs({
            ":tableCat", ":tableSchem", ":tableName",
            "0", // bestRowTemporaty
            "true"
        }),
            @InvocationArgs({
            ":tableCat", ":tableSchem", ":tableName",
            "1", // bestRowTransaction
            "true"
        }),
            @InvocationArgs({
            ":tableCat", ":tableSchem", ":tableName",
            "2", // bestRowSession
            "true"
        })
        }
    )
    @XmlElementRef
    private List bestRowIdentifiers;


    @Invocation(
        name = "getColumns",
        types = {String.class, String.class, String.class, String.class},
        argsarr = {
            @InvocationArgs({":tableCat", ":tableSchem", ":tableName", "null"})
        }
    )
    @XmlElementRef
    private List columns;


    @Invocation(
        name = "getExportedKeys",
        types = {String.class, String.class, String.class},
        argsarr = {
            @InvocationArgs({":tableCat", ":tableSchem", ":tableName"})
        }
    )
    @XmlElementRef
    private List exportedKeys;


    @Invocation(
        name = "getImportedKeys",
        types = {String.class, String.class, String.class},
        argsarr = {
            @InvocationArgs({":tableCat", ":tableSchem", ":tableName"})
        }
    )
    @XmlElementRef
    private List importedKeys;


    @Invocation(
        name = "getIndexInfo",
        types = {
            String.class, String.class, String.class, boolean.class,
            boolean.class
        },
        argsarr = {
            @InvocationArgs({
            ":tableCat", ":tableSchem", ":tableName", "false", "false"
        })
        }
    )
    @XmlElementRef
    private List indexInfo;


    @Invocation(
        name = "getPrimaryKeys",
        types = {String.class, String.class, String.class},
        argsarr = {
            @InvocationArgs({":tableCat", ":tableSchem", ":tableName"})
        }
    )
    @XmlElementRef
    private List primaryKeys;


    @Invocation(
        name = "getPseudoColumns",
        types = {String.class, String.class, String.class, String.class},
        argsarr = {
            @InvocationArgs({":tableCat", ":tableSchem", ":tableName", "null"})
        }
    )
    @XmlElementRef
    private List pseudoColumns;


    @Invocation(
        name = "getSuperTables",
        types = {String.class, String.class, String.class},
        argsarr = {
            @InvocationArgs({":tableCat", ":tableSchem", ":tableName"})
        }
    )
    @XmlElementRef
    private List superTables;


    @Invocation(
        name = "getTablePrivileges",
        types = {String.class, String.class, String.class},
        argsarr = {
            @InvocationArgs({":tableCat", ":tableSchem", ":tableName"})
        }
    )
    @XmlElementRef
    private List tablePrivileges;


    @Invocation(
        name = "getVersionColumns",
        types = {String.class, String.class, String.class},
        argsarr = {
            @InvocationArgs({":tableCat", ":tableSchem", ":tableName"})
        }
    )
    @XmlElementRef
    private List versionColumns;

}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy