Class MappingReferenceKeyElementImpl
- 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.MappingReferenceKeyElementImpl
-
- All Implemented Interfaces:
MappingElement,MappingElementProperties,MappingMemberElement,MappingReferenceKeyElement,Comparable,org.netbeans.modules.dbschema.ColumnPairElementHolder,org.netbeans.modules.dbschema.ReferenceKey
public class MappingReferenceKeyElementImpl extends MappingMemberElementImpl implements MappingReferenceKeyElement
- 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 MappingReferenceKeyElementImpl()Create new MappingReferenceKeyElementImpl with no corresponding name.MappingReferenceKeyElementImpl(MappingTableElement table)Creates new MappingReferenceKeyElementImpl with a corresponding mapping table.MappingReferenceKeyElementImpl(String name)Creates new MappingReferenceKeyElementImpl with the corresponding name
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddColumnPair(org.netbeans.modules.dbschema.ColumnPairElement pair)Add a new column pair to the holder.voidaddColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs)Add some new column pairs to the holder.org.netbeans.modules.dbschema.ColumnPairElementgetColumnPair(org.netbeans.modules.dbschema.DBIdentifier name)Find a column pair by name.ArrayListgetColumnPairNames()Returns the list of relative column pair names in this referencing key.org.netbeans.modules.dbschema.ColumnPairElement[]getColumnPairs()Get all column pairs in this holder.org.netbeans.modules.dbschema.TableElementgetDeclaringTable()Get the declaring table.StringgetKeyName()Get the name of this element.org.netbeans.modules.dbschema.ColumnElement[]getLocalColumns()Get all local columns in this reference key.org.netbeans.modules.dbschema.ColumnElement[]getReferencedColumns()Get all referenced columns in this reference key.org.netbeans.modules.dbschema.TableElementgetReferencedTable()Get the referenced table of the reference key.MappingTableElementgetTable()Returns the mapping table element for this referencing key.voidremoveColumnPair(String pairName)Remove a column pair from the holder.voidremoveColumnPair(org.netbeans.modules.dbschema.ColumnPairElement pair)Remove a column pair from the holder.voidremoveColumnPairs(ArrayList pairNames)Remove some column pairs from the holder.voidremoveColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs)Remove some column pairs from the holder.voidsetColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs)Set the column pairs for this holder.voidsetDeclaringTable(org.netbeans.modules.dbschema.TableElement tableElement)Set the mapping table for this referencing key to the mapping table based on the name of the supplied table.voidsetKeyName(String name)Set the name of this element.voidsetReferencingKey(ArrayList referencingKey)Set the list of of key column names in this referencing key.voidsetTable(MappingTableElement table)Set the mapping table for this referencing key to the supplied table.protected voidstripSchemaName()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, setName, 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, setName
-
Methods inherited from interface com.sun.jdo.api.persistence.model.mapping.MappingMemberElement
getDeclaringClass
-
-
-
-
Constructor Detail
-
MappingReferenceKeyElementImpl
public MappingReferenceKeyElementImpl()
Create new MappingReferenceKeyElementImpl with no corresponding name. This constructor should only be used for cloning and archiving.
-
MappingReferenceKeyElementImpl
public MappingReferenceKeyElementImpl(String name)
Creates new MappingReferenceKeyElementImpl with the corresponding name- Parameters:
name- the name of the element
-
MappingReferenceKeyElementImpl
public MappingReferenceKeyElementImpl(MappingTableElement table) throws ModelException
Creates new MappingReferenceKeyElementImpl with a corresponding mapping table.- Parameters:
table- mapping table element to be used with this key.- Throws:
ModelException
-
-
Method Detail
-
getKeyName
public String getKeyName()
Get the name of this element.- Specified by:
getKeyNamein interfaceorg.netbeans.modules.dbschema.ReferenceKey- Returns:
- the name
-
setKeyName
public void setKeyName(String name) throws ModelException
Set the name of this element.- Specified by:
setKeyNamein interfaceorg.netbeans.modules.dbschema.ReferenceKey- Parameters:
name- the name- Throws:
ModelException- if impossible
-
getTable
public MappingTableElement getTable()
Returns the mapping table element for this referencing key.- Specified by:
getTablein interfaceMappingReferenceKeyElement- Returns:
- the meta data table for this referencing key
-
setTable
public void setTable(MappingTableElement table) throws ModelException
Set the mapping table for this referencing key to the supplied table.- Specified by:
setTablein interfaceMappingReferenceKeyElement- Parameters:
table- mapping table element to be used with this key.- Throws:
ModelException- if impossible
-
getDeclaringTable
public org.netbeans.modules.dbschema.TableElement getDeclaringTable()
Get the declaring table. This method is provided as part of the implementation of the ReferenceKey interface but should only be used when a ReferenceKey object is used or by the runtime.- Specified by:
getDeclaringTablein interfaceorg.netbeans.modules.dbschema.ReferenceKey- Returns:
- the table that owns this reference key element, or
nullif the element is not attached to any table
-
setDeclaringTable
public void setDeclaringTable(org.netbeans.modules.dbschema.TableElement tableElement)
Set the mapping table for this referencing key to the mapping table based on the name of the supplied table. This method is provided as part of the implementation of the ReferenceKey interface but should only be used when a ReferenceKey object is used or by the runtime.- Specified by:
setDeclaringTablein interfaceorg.netbeans.modules.dbschema.ReferenceKey- Parameters:
tableElement- mapping table element to be used with this key.
-
getReferencedTable
public org.netbeans.modules.dbschema.TableElement getReferencedTable()
Get the referenced table of the reference key. This method is provided as part of the implementation of the ReferenceKey interface but should only be used when a ReferenceKey object is used or by the runtime.- Specified by:
getReferencedTablein interfaceorg.netbeans.modules.dbschema.ReferenceKey- Returns:
- the referenced table
-
getColumnPairNames
public ArrayList getColumnPairNames()
Returns the list of relative column pair names in this referencing key.- Specified by:
getColumnPairNamesin interfaceMappingReferenceKeyElement- Returns:
- the names of the column pairs in this referencing key
-
getLocalColumns
public org.netbeans.modules.dbschema.ColumnElement[] getLocalColumns()
Get all local columns in this reference key. This method is provided as part of the implementation of the ReferenceKey interface but should only be used when a ReferenceKey object is used or by the runtime.- Specified by:
getLocalColumnsin interfaceorg.netbeans.modules.dbschema.ReferenceKey- Returns:
- the columns
-
getReferencedColumns
public org.netbeans.modules.dbschema.ColumnElement[] getReferencedColumns()
Get all referenced columns in this reference key. This method is provided as part of the implementation of the ReferenceKey interface but should only be used when a ReferenceKey object is used or by the runtime.- Specified by:
getReferencedColumnsin interfaceorg.netbeans.modules.dbschema.ReferenceKey- Returns:
- the columns
-
removeColumnPair
public void removeColumnPair(String pairName) throws ModelException
Remove a column pair from the holder. This method can be used to remove a pair by name when it cannot be resolved to an actual pair.- Specified by:
removeColumnPairin interfaceMappingReferenceKeyElement- Parameters:
pairName- the relative name of the column pair to remove- Throws:
ModelException- if impossible
-
removeColumnPairs
public void removeColumnPairs(ArrayList pairNames) throws ModelException
Remove some column pairs from the holder. This method can be used to remove pairs by name when they cannot be resolved to actual pairs.- Specified by:
removeColumnPairsin interfaceMappingReferenceKeyElement- Parameters:
pairNames- the relative names of the column pairs to remove- Throws:
ModelException- if impossible
-
addColumnPair
public void addColumnPair(org.netbeans.modules.dbschema.ColumnPairElement pair) throws ModelExceptionAdd a new column pair to the holder.- Specified by:
addColumnPairin interfaceorg.netbeans.modules.dbschema.ColumnPairElementHolder- Specified by:
addColumnPairin interfaceMappingReferenceKeyElement- Parameters:
pair- the pair to add- Throws:
ModelException- if impossible
-
addColumnPairs
public void addColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs) throws ModelExceptionAdd some new column pairs to the holder.- Specified by:
addColumnPairsin interfaceorg.netbeans.modules.dbschema.ColumnPairElementHolder- Specified by:
addColumnPairsin interfaceMappingReferenceKeyElement- Parameters:
pairs- the column pairs to add- Throws:
ModelException- if impossible
-
removeColumnPair
public void removeColumnPair(org.netbeans.modules.dbschema.ColumnPairElement pair) throws ModelExceptionRemove a column pair from the holder.- Specified by:
removeColumnPairin interfaceorg.netbeans.modules.dbschema.ColumnPairElementHolder- Specified by:
removeColumnPairin interfaceMappingReferenceKeyElement- Parameters:
pair- the column pair to remove- Throws:
ModelException- if impossible
-
removeColumnPairs
public void removeColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs) throws ModelExceptionRemove some column pairs from the holder.- Specified by:
removeColumnPairsin interfaceorg.netbeans.modules.dbschema.ColumnPairElementHolder- Specified by:
removeColumnPairsin interfaceMappingReferenceKeyElement- Parameters:
pairs- the column pairs to remove- Throws:
ModelException- if impossible
-
setColumnPairs
public void setColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs) throws ModelExceptionSet the column pairs for this holder. Previous column pairs are removed.- Specified by:
setColumnPairsin interfaceorg.netbeans.modules.dbschema.ColumnPairElementHolder- Specified by:
setColumnPairsin interfaceMappingReferenceKeyElement- Parameters:
pairs- the new column pairs- Throws:
ModelException- if impossible
-
getColumnPairs
public org.netbeans.modules.dbschema.ColumnPairElement[] getColumnPairs()
Get all column pairs in this holder.- Specified by:
getColumnPairsin interfaceorg.netbeans.modules.dbschema.ColumnPairElementHolder- Returns:
- the column pairs
-
getColumnPair
public org.netbeans.modules.dbschema.ColumnPairElement getColumnPair(org.netbeans.modules.dbschema.DBIdentifier name)
Find a column pair by name.- Specified by:
getColumnPairin interfaceorg.netbeans.modules.dbschema.ColumnPairElementHolder- Parameters:
name- the name of the column pair for which to look- Returns:
- the column pair or
nullif not found
-
setReferencingKey
public void setReferencingKey(ArrayList referencingKey)
Set the list of of key column names in this referencing key. This method should only be used internally and for cloning and archiving.- Parameters:
referencingKey- the list of names of the columns in this referencing key
-
stripSchemaName
protected void stripSchemaName()
Boston to Pilsen conversion. This method converts the name of this MappingReferenceKeyElement and the absolute column names stored in _referencingKey to relative names.
-
-