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
Constructors Constructor Description MappingTableElementImpl()
Create 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addKeyColumn(org.netbeans.modules.dbschema.ColumnElement column)
Adds a column to the primary key of columns in this mapping table.protected void
addKeyColumnInternal(org.netbeans.modules.dbschema.ColumnElement column)
Adds a column to the primary key of columns in this mapping table.void
addReferencingKey(MappingReferenceKeyElement referencingKey)
Adds a referencing key to the list of keys in this mapping table.ArrayList
getKey()
Returns the list of column names in the primary key for this mapping table.ArrayList
getKeyObjects()
Returns the list of columns (ColumnElements) in the primary key for this mapping table.ArrayList
getReferencingKeys()
Returns the list of keys (MappingReferenceKeyElements) for this mapping table.String
getTable()
Returns the name of the table element used by this mapping table.org.netbeans.modules.dbschema.TableElement
getTableObject()
Returns the table element (TableElement) used by this mapping table.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.void
removeKeyColumn(String columnName)
Removes a column from the primary key of columns in this mapping table.void
removeReference(MappingTableElement table)
Removes the referencing key for the supplied table element from list of keys in this mapping table.void
setKey(ArrayList key)
Set the list of column names in the primary key for this mapping table.void
setName(String name)
Override method in MappingElementImpl to set the _table variable if necessary (used for unarchiving).void
setReferencingKeys(ArrayList referencingKeys)
Set the list of keys (MappingReferenceKeyElements) for this mapping table.void
setTable(String table)
Set the name of the table element used by this mapping table.void
setTable(org.netbeans.modules.dbschema.TableElement table)
Set the table element for this mapping table to the supplied table.protected void
stripSchemaName()
Boston to Pilsen conversion.-
Methods inherited from class com.sun.jdo.api.persistence.model.mapping.impl.MappingMemberElementImpl
equals, firePropertyChange, fireVetoableChange, getDeclaringClass, hashCode, setDeclaringClass
-
Methods inherited from class com.sun.jdo.api.persistence.model.mapping.impl.MappingElementImpl
addPropertyChangeListener, addVetoableChangeListener, compareTo, getMessages, getName, removePropertyChangeListener, removeVetoableChangeListener, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface com.sun.jdo.api.persistence.model.mapping.MappingElement
addPropertyChangeListener, addVetoableChangeListener, getName, removePropertyChangeListener, removeVetoableChangeListener
-
Methods inherited from interface com.sun.jdo.api.persistence.model.mapping.MappingMemberElement
getDeclaringClass
-
-
-
-
Constructor Detail
-
MappingTableElementImpl
public MappingTableElementImpl()
Create new MappingTableElementImpl with no corresponding name or declaring class. This constructor should only be used for cloning and archiving.
-
MappingTableElementImpl
public MappingTableElementImpl(String name, MappingClassElement declaringClass)
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 Detail
-
getTable
public String getTable()
Returns the name of the table element used by this mapping table.- Specified by:
getTable
in interfaceMappingTableElement
- Returns:
- the table name for this mapping table
-
setTable
public void setTable(org.netbeans.modules.dbschema.TableElement table) throws ModelException
Set the table element for this mapping table to the supplied table.- Specified by:
setTable
in interfaceMappingTableElement
- Parameters:
table
- table element to be used by the mapping table.- Throws:
ModelException
- if impossible
-
setName
public void setName(String name) throws ModelException
Override method in MappingElementImpl to set the _table variable if necessary (used for unarchiving).- Specified by:
setName
in interfaceMappingElement
- Overrides:
setName
in 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:
isEqual
in interfaceMappingTableElement
- Returns:
true
if table elements are equal,false
otherwise.
-
getKey
public ArrayList getKey()
Returns the list of column names in the primary key for this mapping table.- Specified by:
getKey
in interfaceMappingTableElement
- Returns:
- the names of the columns in the primary key for this mapping table
-
addKeyColumn
public void addKeyColumn(org.netbeans.modules.dbschema.ColumnElement column) throws ModelException
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:
addKeyColumn
in 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
public void removeKeyColumn(String columnName) throws ModelException
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:
removeKeyColumn
in interfaceMappingTableElement
- Parameters:
columnName
- the relative name of the column to be removed- Throws:
ModelException
- if impossible
-
getReferencingKeys
public ArrayList getReferencingKeys()
Returns the list of keys (MappingReferenceKeyElements) for this mapping table. There will be keys for foreign keys and "fake" foreign keys.- Specified by:
getReferencingKeys
in interfaceMappingTableElement
- Returns:
- the reference key elements for this mapping table
-
addReferencingKey
public void addReferencingKey(MappingReferenceKeyElement referencingKey) throws ModelException
Adds a referencing key to the list of keys in this mapping table.- Specified by:
addReferencingKey
in interfaceMappingTableElement
- Parameters:
referencingKey
- referencing key element to be added- Throws:
ModelException
- if impossible
-
removeReference
public void removeReference(MappingTableElement table) throws ModelException
Removes the referencing key for the supplied table element from list of keys in this mapping table.- Specified by:
removeReference
in 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
public ArrayList 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
public void setTable(String table)
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
public void setKey(ArrayList key)
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
public void setReferencingKeys(ArrayList referencingKeys)
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.
-
-