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

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

Go to download

The eobjects.dk MetaModel is a common domain model, query-engine and optimizer for different kinds of datastores.

The newest version!
/*
 * Copyright 2008 eobjects.dk
 *
 * 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 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