org.apache.openjpa.jdbc.meta
Class ClassMappingInfo

java.lang.Object
  extended by org.apache.openjpa.jdbc.meta.MappingInfo
      extended by org.apache.openjpa.jdbc.meta.ClassMappingInfo
All Implemented Interfaces:
Serializable, SourceTracker, Commentable

public class ClassMappingInfo
extends MappingInfo
implements SourceTracker, Commentable

Information about the mapping from a class to the schema, in raw form. The columns and tables used in mapping info will not be part of the SchemaGroup used at runtime. Rather, they will be structs with the relevant pieces of information filled in.

Author:
Abe White
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.openjpa.jdbc.meta.MappingInfo
MappingInfo.ForeignKeyDefaults, MappingInfo.TableDefaults
 
Field Summary
 
Fields inherited from class org.apache.openjpa.jdbc.meta.MappingInfo
JOIN_FORWARD, JOIN_INVERSE, JOIN_NONE
 
Fields inherited from interface org.apache.openjpa.lib.meta.SourceTracker
SRC_ANNOTATIONS, SRC_OTHER, SRC_XML
 
Fields inherited from interface org.apache.openjpa.lib.xml.Commentable
EMPTY_COMMENTS
 
Constructor Summary
ClassMappingInfo()
           
 
Method Summary
 void addSecondaryTable(DBIdentifier second)
           
 void addSecondaryTable(String second)
          Deprecated.  
 void addUnique(DBIdentifier table, Unique unique)
          Add a unique constraint for the given table.
 void addUnique(String table, Unique unique)
          Deprecated.  
protected  void clear(boolean canFlags)
          Clear mapping information.
 void copy(MappingInfo info)
          Copy missing info from the instance to this one.
 String getClassName()
          The described class name.
 int getColNumber()
          Return the column number in the line of the file at which this instance was parsed.
 String[] getComments()
          Return comments, or empty array if none.
 Column[] getDataStoreIdColumns(ClassMapping cls, Column[] tmplates, Table table, boolean adapt)
          Return the datastore identity columns for the given class, based on the given templates.
 String getHierarchyStrategy()
          The default strategy for subclasses in this hierarchy.
 int getLineNumber()
          Return the line number of the file at which this instance was parsed.
 String getResourceName()
          Return the domain-meaningful name of the resource that was loaded from this source.
 DBIdentifier getSchemaIdentifier()
           
 String getSchemaName()
          Deprecated.  
 DBIdentifier getSecondaryTableIdentifier(DBIdentifier tableName)
           
 DBIdentifier[] getSecondaryTableIdentifiers()
           
 List<Column> getSecondaryTableJoinColumns(DBIdentifier tableName)
           
 List<Column> getSecondaryTableJoinColumns(String tableName)
          Deprecated.  
 String getSecondaryTableName(String tableName)
          Deprecated.  
 String[] getSecondaryTableNames()
          Deprecated.  
 File getSourceFile()
          Return the file from which this instance was parsed.
 Object getSourceScope()
          Return the domain-dependent scope of this instance within its file.
 int getSourceType()
          Return the type of source.
 ForeignKey getSuperclassJoin(ClassMapping cls, Table table, boolean adapt)
          Return the join from this class to its superclass.
 Table getTable(ClassMapping cls, boolean adapt)
          Return the primary table for the given class.
 Table getTable(ClassMapping cls, DBIdentifier tableName, boolean adapt)
          Return the named table for the given class.
 Table getTable(ClassMapping cls, String tableName, boolean adapt)
          Deprecated.  
 DBIdentifier getTableIdentifier()
           
 String getTableName()
          Deprecated.  
 Unique[] getUniques(DBIdentifier table)
          Get the unique constraints of the given primary or secondary table.
 Unique[] getUniques(MetaDataContext cm, boolean adapt)
          Get all the unique constraints associated with both the primary and/or secondary tables.
 Unique[] getUniques(String table)
          Deprecated.  
 boolean hasSchemaComponents()
          Return true if this info has columns, foreign key information, index information, etc.
 boolean isJoinedSubclass()
          Whether there is a join to the superclass table.
 void setClassName(String name)
          The described class name.
 void setColNumber(int colNum)
           
 void setComments(String[] comments)
          Set comments.
 void setHierarchyStrategy(String strategy)
          The default strategy for subclasses in this hierarchy.
 void setJoinedSubclass(boolean joined)
          Whether there is a join to the superclass table.
 void setLineNumber(int lineNum)
           
 void setSchemaIdentifier(DBIdentifier schema)
           
 void setSchemaName(String schema)
          Deprecated.  
 void setSecondaryTableJoinColumns(DBIdentifier tableName, List<Column> cols)
           
 void setSecondaryTableJoinColumns(String tableName, List<Column> cols)
          Deprecated.  
 void setSource(File file, int srcType)
           
 void setTableIdentifier(DBIdentifier table)
           
 void setTableName(String table)
          Deprecated.  
 void syncWith(ClassMapping cls)
          Synchronize internal information with the mapping data for the given class.
 
Methods inherited from class org.apache.openjpa.jdbc.meta.MappingInfo
assertNoForeignKey, assertNoIndex, assertNoJoin, assertNoSchemaComponents, assertNoUnique, assertStrategy, canForeignKey, canIndex, canMerge, canUnique, clear, createColumns, createForeignKey, createIndex, createTable, createTable, createUnique, getColumnIO, getColumns, getColumns, getColumns, getForeignKey, getIndex, getJoinDirection, getStrategy, getUnique, isImplicitRelation, mergeColumn, setCanForeignKey, setCanIndex, setCanUnique, setColumnIO, setColumns, setForeignKey, setImplicitRelation, setIndex, setJoinDirection, setStrategy, setUnique, syncColumn, syncColumns, syncForeignKey, syncIndex, syncUnique
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassMappingInfo

public ClassMappingInfo()
Method Detail

getClassName

public String getClassName()
The described class name.


setClassName

public void setClassName(String name)
The described class name.


getHierarchyStrategy

public String getHierarchyStrategy()
The default strategy for subclasses in this hierarchy.


setHierarchyStrategy

public void setHierarchyStrategy(String strategy)
The default strategy for subclasses in this hierarchy.


getTableName

public String getTableName()
Deprecated. 

The given table name.


getTableIdentifier

public DBIdentifier getTableIdentifier()

setTableName

public void setTableName(String table)
Deprecated. 

The given table name.


setTableIdentifier

public void setTableIdentifier(DBIdentifier table)

getSchemaName

public String getSchemaName()
Deprecated. 

The default schema name for unqualified tables.


getSchemaIdentifier

public DBIdentifier getSchemaIdentifier()

setSchemaName

public void setSchemaName(String schema)
Deprecated. 

The default schema name for unqualified tables.


setSchemaIdentifier

public void setSchemaIdentifier(DBIdentifier schema)

isJoinedSubclass

public boolean isJoinedSubclass()
Whether there is a join to the superclass table.


setJoinedSubclass

public void setJoinedSubclass(boolean joined)
Whether there is a join to the superclass table.


getSecondaryTableNames

public String[] getSecondaryTableNames()
Deprecated. 

Return the class-level joined tables.


getSecondaryTableIdentifiers

public DBIdentifier[] getSecondaryTableIdentifiers()

getSecondaryTableName

public String getSecondaryTableName(String tableName)
Deprecated. 

We allow fields to reference class-level joins using just the table name, whereas the class join might have schema, etc information. This method returns the name of the given table as listed in a class-level join, or the given name if no join exists.


getSecondaryTableIdentifier

public DBIdentifier getSecondaryTableIdentifier(DBIdentifier tableName)

getSecondaryTableJoinColumns

public List<Column> getSecondaryTableJoinColumns(String tableName)
Deprecated. 

Return any columns defined for the given class level join, or empty list if none.


getSecondaryTableJoinColumns

public List<Column> getSecondaryTableJoinColumns(DBIdentifier tableName)

addSecondaryTable

public void addSecondaryTable(String second)
Deprecated. 

Adds a Secondary table of given name to this mapping. A secondary table must be known before unique constraints are added to a Secondary table.


addSecondaryTable

public void addSecondaryTable(DBIdentifier second)

setSecondaryTableJoinColumns

public void setSecondaryTableJoinColumns(String tableName,
                                         List<Column> cols)
Deprecated. 

Declare the given class-level join to the named (secondary) table.


setSecondaryTableJoinColumns

public void setSecondaryTableJoinColumns(DBIdentifier tableName,
                                         List<Column> cols)

getTable

public Table getTable(ClassMapping cls,
                      String tableName,
                      boolean adapt)
Deprecated. 

Return the named table for the given class.


getTable

public Table getTable(ClassMapping cls,
                      DBIdentifier tableName,
                      boolean adapt)
Return the named table for the given class.


getTable

public Table getTable(ClassMapping cls,
                      boolean adapt)
Return the primary table for the given class.


getDataStoreIdColumns

public Column[] getDataStoreIdColumns(ClassMapping cls,
                                      Column[] tmplates,
                                      Table table,
                                      boolean adapt)
Return the datastore identity columns for the given class, based on the given templates.


getSuperclassJoin

public ForeignKey getSuperclassJoin(ClassMapping cls,
                                    Table table,
                                    boolean adapt)
Return the join from this class to its superclass. The table for this class must be set.


syncWith

public void syncWith(ClassMapping cls)
Synchronize internal information with the mapping data for the given class.


hasSchemaComponents

public boolean hasSchemaComponents()
Description copied from class: MappingInfo
Return true if this info has columns, foreign key information, index information, etc.

Overrides:
hasSchemaComponents in class MappingInfo

clear

protected void clear(boolean canFlags)
Description copied from class: MappingInfo
Clear mapping information.

Overrides:
clear in class MappingInfo
Parameters:
canFlags - whether to clear information about whether we can place indexed, foreign keys, etc on this mapping

copy

public void copy(MappingInfo info)
Description copied from class: MappingInfo
Copy missing info from the instance to this one.

Overrides:
copy in class MappingInfo

addUnique

public void addUnique(String table,
                      Unique unique)
Deprecated. 

Add a unique constraint for the given table.

Parameters:
table - must be primary table or secondary table name added a priori to this receiver.
unique - the unique constraint. null means no-op.

addUnique

public void addUnique(DBIdentifier table,
                      Unique unique)
Add a unique constraint for the given table.

Parameters:
table - must be primary table or secondary table name added a priori to this receiver.
unique - the unique constraint. null means no-op.

getUniques

public Unique[] getUniques(String table)
Deprecated. 

Get the unique constraints of the given primary or secondary table.


getUniques

public Unique[] getUniques(DBIdentifier table)
Get the unique constraints of the given primary or secondary table.


getUniques

public Unique[] getUniques(MetaDataContext cm,
                           boolean adapt)
Get all the unique constraints associated with both the primary and/or secondary tables.


getSourceFile

public File getSourceFile()
Description copied from interface: SourceTracker
Return the file from which this instance was parsed.

Specified by:
getSourceFile in interface SourceTracker

getSourceScope

public Object getSourceScope()
Description copied from interface: SourceTracker
Return the domain-dependent scope of this instance within its file.

Specified by:
getSourceScope in interface SourceTracker

getSourceType

public int getSourceType()
Description copied from interface: SourceTracker
Return the type of source.

Specified by:
getSourceType in interface SourceTracker

setSource

public void setSource(File file,
                      int srcType)

getResourceName

public String getResourceName()
Description copied from interface: SourceTracker
Return the domain-meaningful name of the resource that was loaded from this source. I.e., if we had loaded the source for a Java class, this would return the name of the class.

Specified by:
getResourceName in interface SourceTracker

getComments

public String[] getComments()
Description copied from interface: Commentable
Return comments, or empty array if none.

Specified by:
getComments in interface Commentable

setComments

public void setComments(String[] comments)
Description copied from interface: Commentable
Set comments.

Specified by:
setComments in interface Commentable

getLineNumber

public int getLineNumber()
Description copied from interface: SourceTracker
Return the line number of the file at which this instance was parsed.

Specified by:
getLineNumber in interface SourceTracker

setLineNumber

public void setLineNumber(int lineNum)

getColNumber

public int getColNumber()
Description copied from interface: SourceTracker
Return the column number in the line of the file at which this instance was parsed.

Specified by:
getColNumber in interface SourceTracker

setColNumber

public void setColNumber(int colNum)


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.