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

dk.eobjects.metamodel.schema.JdbcTable Maven / Gradle / Ivy

/**
 *  This file is part of MetaModel.
 *
 *  MetaModel is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  MetaModel 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 General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with MetaModel.  If not, see .
 */
package dk.eobjects.metamodel.schema;

import java.util.List;

import dk.eobjects.metamodel.JdbcDataContextStrategy;

public class JdbcTable extends Table {

	private static final long serialVersionUID = 5952310469458880330L;
	private JdbcDataContextStrategy _strategy;
	private boolean _columnsLoaded = false;
	private boolean _indexesLoaded = false;

	public JdbcTable(String name, TableType type, JdbcSchema schema,
			JdbcDataContextStrategy strategy) {
		super(name, type, schema);
		_strategy = strategy;
	}

	@Override
	protected List getColumnsInternal() {
		if (!_columnsLoaded) {
			_columnsLoaded = true;
			_strategy.loadColumns(this);
		}
		return super.getColumnsInternal();
	}

	@Override
	protected List getRelationshipsInternal() {
		JdbcSchema schema = (JdbcSchema) getSchema();
		schema.loadRelations();
		return super.getRelationshipsInternal();
	}

	protected void loadIndexes() {
		if (!_indexesLoaded) {
			_indexesLoaded = true;
			_strategy.loadIndexes(this);
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy