Class MappingTableElementImpl
java.lang.Object
com.sun.jdo.api.persistence.model.mapping.impl.MappingElementImpl
com.sun.jdo.api.persistence.model.mapping.impl.MappingMemberElementImpl
com.sun.jdo.api.persistence.model.mapping.impl.MappingTableElementImpl
- All Implemented Interfaces:
MappingElement,MappingElementProperties,MappingMemberElement,MappingTableElement,Comparable
public class MappingTableElementImpl
extends MappingMemberElementImpl
implements MappingTableElement
- Version:
- %I%
- Author:
- Mark Munro, Rochelle Raccah
-
Field Summary
Fields inherited from interface com.sun.jdo.api.persistence.model.mapping.MappingElementProperties
PROP_ASSOCIATED_COLUMNS, PROP_COLUMNS, PROP_CONSISTENCY, PROP_DATABASE_ROOT, PROP_FETCH_GROUP, PROP_FIELDS, PROP_IN_CONCURRENCY_CHECK, PROP_KEY_COLUMNS, PROP_MODIFIED, PROP_NAME, PROP_NAVIGABLE, PROP_READ_ONLY, PROP_REFERENCING_KEYS, PROP_TABLE, PROP_TABLES, PROP_VERSION_FIELD -
Constructor Summary
ConstructorsConstructorDescriptionCreate new MappingTableElementImpl with no corresponding name or declaring class.MappingTableElementImpl(String name, MappingClassElement declaringClass) Create new MappingTableElementImpl with the corresponding name and declaring class.MappingTableElementImpl(org.netbeans.modules.dbschema.TableElement table, MappingClassElement declaringClass) Creates new MappingTableElementImpl with a corresponding table and declaring class. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddKeyColumn(org.netbeans.modules.dbschema.ColumnElement column) Adds a column to the primary key of columns in this mapping table.protected voidaddKeyColumnInternal(org.netbeans.modules.dbschema.ColumnElement column) Adds a column to the primary key of columns in this mapping table.voidaddReferencingKey(MappingReferenceKeyElement referencingKey) Adds a referencing key to the list of keys in this mapping table.getKey()Returns the list of column names in the primary key for this mapping table.Returns the list of columns (ColumnElements) in the primary key for this mapping table.Returns the list of keys (MappingReferenceKeyElements) for this mapping table.getTable()Returns the name of the table element used by this mapping table.org.netbeans.modules.dbschema.TableElementReturns the table element (TableElement) used by this mapping table.booleanisEqual(org.netbeans.modules.dbschema.TableElement table) Returns true if the table element used by this mapping table is equal to the supplied table.voidremoveKeyColumn(String columnName) Removes a column from the primary key of columns in this mapping table.voidRemoves the referencing key for the supplied table element from list of keys in this mapping table.voidSet the list of column names in the primary key for this mapping table.voidOverride method in MappingElementImpl to set the _table variable if necessary (used for unarchiving).voidsetReferencingKeys(ArrayList referencingKeys) Set the list of keys (MappingReferenceKeyElements) for this mapping table.voidSet the name of the table element used by this mapping table.voidsetTable(org.netbeans.modules.dbschema.TableElement table) Set the table element for this mapping table to the supplied table.protected voidBoston to Pilsen conversion.Methods inherited from class com.sun.jdo.api.persistence.model.mapping.impl.MappingMemberElementImpl
equals, firePropertyChange, fireVetoableChange, getDeclaringClass, hashCode, setDeclaringClassMethods inherited from class com.sun.jdo.api.persistence.model.mapping.impl.MappingElementImpl
addPropertyChangeListener, addVetoableChangeListener, compareTo, getMessages, getName, removePropertyChangeListener, removeVetoableChangeListener, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface com.sun.jdo.api.persistence.model.mapping.MappingElement
addPropertyChangeListener, addVetoableChangeListener, getName, removePropertyChangeListener, removeVetoableChangeListenerMethods inherited from interface com.sun.jdo.api.persistence.model.mapping.MappingMemberElement
getDeclaringClass
-
Constructor Details
-
MappingTableElementImpl
public MappingTableElementImpl()Create new MappingTableElementImpl with no corresponding name or declaring class. This constructor should only be used for cloning and archiving. -
MappingTableElementImpl
Create new MappingTableElementImpl with the corresponding name and declaring class.- Parameters:
name- the name of the elementdeclaringClass- the class to attach to
-
MappingTableElementImpl
public MappingTableElementImpl(org.netbeans.modules.dbschema.TableElement table, MappingClassElement declaringClass) throws ModelException Creates new MappingTableElementImpl with a corresponding table and declaring class.- Parameters:
table- table element to be used by the mapping table.declaringClass- the class to attach to- Throws:
ModelException
-
-
Method Details
-
getTable
Returns the name of the table element used by this mapping table.- Specified by:
getTablein interfaceMappingTableElement- Returns:
- the table name for this mapping table
-
setTable
Set the table element for this mapping table to the supplied table.- Specified by:
setTablein interfaceMappingTableElement- Parameters:
table- table element to be used by the mapping table.- Throws:
ModelException- if impossible
-
setName
Override method in MappingElementImpl to set the _table variable if necessary (used for unarchiving).- Specified by:
setNamein interfaceMappingElement- Overrides:
setNamein classMappingElementImpl- Parameters:
name- the name- Throws:
ModelException- if impossible
-
isEqual
public boolean isEqual(org.netbeans.modules.dbschema.TableElement table) Returns true if the table element used by this mapping table is equal to the supplied table.- Specified by:
isEqualin interfaceMappingTableElement- Returns:
trueif table elements are equal,falseotherwise.
-
getKey
Returns the list of column names in the primary key for this mapping table.- Specified by:
getKeyin interfaceMappingTableElement- Returns:
- the names of the columns in the primary key for this mapping table
-
addKeyColumn
Adds a column to the primary key of columns in this mapping table. This method should only be used to manipulate the key columns of the primary table. The secondary table key columns should be manipulated using MappingReferenceKeyElement methods for pairs.- Specified by:
addKeyColumnin interfaceMappingTableElement- Parameters:
column- column element to be added- Throws:
ModelException- if impossible
-
addKeyColumnInternal
protected void addKeyColumnInternal(org.netbeans.modules.dbschema.ColumnElement column) throws ModelException Adds a column to the primary key of columns in this mapping table. This method is used internally to manipulate primary key columns that have passed the null and duplicate tests in addKeyColumn and secondary table key columns when pairs are being set up and ignoring duplicates is done at the pair level.- Parameters:
column- column element to be added- Throws:
ModelException- if impossible
-
removeKeyColumn
Removes a column from the primary key of columns in this mapping table. This method should only be used to manipulate the key columns of the primary table. The secondary table key columns should be manipulated using MappingReferenceKeyElement methods for pairs.- Specified by:
removeKeyColumnin interfaceMappingTableElement- Parameters:
columnName- the relative name of the column to be removed- Throws:
ModelException- if impossible
-
getReferencingKeys
Returns the list of keys (MappingReferenceKeyElements) for this mapping table. There will be keys for foreign keys and "fake" foreign keys.- Specified by:
getReferencingKeysin interfaceMappingTableElement- Returns:
- the reference key elements for this mapping table
-
addReferencingKey
Adds a referencing key to the list of keys in this mapping table.- Specified by:
addReferencingKeyin interfaceMappingTableElement- Parameters:
referencingKey- referencing key element to be added- Throws:
ModelException- if impossible
-
removeReference
Removes the referencing key for the supplied table element from list of keys in this mapping table.- Specified by:
removeReferencein interfaceMappingTableElement- Parameters:
table- mapping table element for which to remove referencing keys- Throws:
ModelException- if impossible
-
getTableObject
public org.netbeans.modules.dbschema.TableElement getTableObject()Returns the table element (TableElement) used by this mapping table. This method should only be used by the runtime.- Returns:
- the table element for this mapping table
-
getKeyObjects
Returns the list of columns (ColumnElements) in the primary key for this mapping table. This method should only be used by the runtime.- Returns:
- the column elements in the primary key for this mapping table
-
setTable
Set the name of the table element used by this mapping table. This method should only be used internally and for cloning and archiving.- Parameters:
table- the table name for this mapping table
-
setKey
Set the list of column names in the primary key for this mapping table. This method should only be used internally and for cloning and archiving.- Parameters:
key- the list of names of the columns in the primary key for this mapping table
-
setReferencingKeys
Set the list of keys (MappingReferenceKeyElements) for this mapping table. This method should only be used internally and for cloning and archiving.- Parameters:
referencingKeys- the list of reference key elements for this mapping table
-
stripSchemaName
protected void stripSchemaName()Boston to Pilsen conversion. This method converts the absolute db element names to relative names. This affects the name of the MappingTableElement itself and the column names stored in _keys. The method is recursively called for all MappingReferenceKeyElements attached to this MappingTableElement.
-