blob: 5c8fa2f876ba3d10d8a7ba9e8071f007c7900341 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2006, 2007 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
*
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
package org.eclipse.jpt.core.internal.context.java;
import java.util.Iterator;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.internal.ITextRange;
import org.eclipse.jpt.core.internal.context.base.ITable;
import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
import org.eclipse.jpt.db.internal.Schema;
import org.eclipse.jpt.db.internal.Table;
import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
//TODO need a way to morph between mapping types to save any information that is
//comming to the different TypeMappings. For java, we do not know the other types
//of mappings since they are defined in an extension point so we can do this the same
//way as xml.
public abstract class JavaTypeMapping extends JavaContextModel
implements IJavaTypeMapping
{
protected JavaPersistentTypeResource persistentTypeResource;
protected JavaTypeMapping(IJavaPersistentType parent) {
super(parent);
}
public void initializeFromResource(JavaPersistentTypeResource persistentTypeResource) {
this.persistentTypeResource = persistentTypeResource;
}
public String getTableName() {
return null;
}
public IJavaPersistentType persistentType() {
return (IJavaPersistentType) parent();
}
public ITextRange validationTextRange(CompilationUnit astRoot) {
ITextRange textRange = this.persistentTypeResource.textRange(astRoot);
return (textRange != null) ? textRange : this.persistentType().validationTextRange(astRoot);
}
public Table primaryDbTable() {
return null;
}
public Table dbTable(String tableName) {
return null;
}
public Schema dbSchema() {
return null;
}
public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
return true;
}
public Iterator<ITable> associatedTables() {
return EmptyIterator.instance();
}
public Iterator<String> associatedTableNamesIncludingInherited() {
return EmptyIterator.instance();
}
public Iterator<ITable> associatedTablesIncludingInherited() {
return EmptyIterator.instance();
}
public Iterator<String> overridableAssociationNames() {
return EmptyIterator.instance();
}
public Iterator<String> overridableAttributeNames() {
return EmptyIterator.instance();
}
public Iterator<String> allOverridableAttributeNames() {
return EmptyIterator.instance();
}
public Iterator<String> allOverridableAssociationNames() {
return EmptyIterator.instance();
}
public boolean tableNameIsInvalid(String tableName) {
return false;
}
public void update(JavaPersistentTypeResource persistentTypeResource) {
this.persistentTypeResource = persistentTypeResource;
}
}