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 void
addColumnPair(org.netbeans.modules.dbschema.ColumnPairElement pair)
Add a new column pair to the holder.void
addColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs)
Add some new column pairs to the holder.org.netbeans.modules.dbschema.ColumnPairElement
getColumnPair(org.netbeans.modules.dbschema.DBIdentifier name)
Find a column pair by name.ArrayList
getColumnPairNames()
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.TableElement
getDeclaringTable()
Get the declaring table.String
getKeyName()
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.TableElement
getReferencedTable()
Get the referenced table of the reference key.MappingTableElement
getTable()
Returns the mapping table element for this referencing key.void
removeColumnPair(String pairName)
Remove a column pair from the holder.void
removeColumnPair(org.netbeans.modules.dbschema.ColumnPairElement pair)
Remove a column pair from the holder.void
removeColumnPairs(ArrayList pairNames)
Remove some column pairs from the holder.void
removeColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs)
Remove some column pairs from the holder.void
setColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs)
Set the column pairs for this holder.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.void
setKeyName(String name)
Set the name of this element.void
setReferencingKey(ArrayList referencingKey)
Set the list of of key column names in this referencing key.void
setTable(MappingTableElement table)
Set the mapping table for this referencing key 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, 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:
getKeyName
in interfaceorg.netbeans.modules.dbschema.ReferenceKey
- Returns:
- the name
-
setKeyName
public void setKeyName(String name) throws ModelException
Set the name of this element.- Specified by:
setKeyName
in 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:
getTable
in 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:
setTable
in 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:
getDeclaringTable
in interfaceorg.netbeans.modules.dbschema.ReferenceKey
- Returns:
- the table that owns this reference key element, or
null
if 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:
setDeclaringTable
in 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:
getReferencedTable
in 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:
getColumnPairNames
in 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:
getLocalColumns
in 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:
getReferencedColumns
in 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:
removeColumnPair
in 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:
removeColumnPairs
in 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 ModelException
Add a new column pair to the holder.- Specified by:
addColumnPair
in interfaceorg.netbeans.modules.dbschema.ColumnPairElementHolder
- Specified by:
addColumnPair
in interfaceMappingReferenceKeyElement
- Parameters:
pair
- the pair to add- Throws:
ModelException
- if impossible
-
addColumnPairs
public void addColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs) throws ModelException
Add some new column pairs to the holder.- Specified by:
addColumnPairs
in interfaceorg.netbeans.modules.dbschema.ColumnPairElementHolder
- Specified by:
addColumnPairs
in interfaceMappingReferenceKeyElement
- Parameters:
pairs
- the column pairs to add- Throws:
ModelException
- if impossible
-
removeColumnPair
public void removeColumnPair(org.netbeans.modules.dbschema.ColumnPairElement pair) throws ModelException
Remove a column pair from the holder.- Specified by:
removeColumnPair
in interfaceorg.netbeans.modules.dbschema.ColumnPairElementHolder
- Specified by:
removeColumnPair
in interfaceMappingReferenceKeyElement
- Parameters:
pair
- the column pair to remove- Throws:
ModelException
- if impossible
-
removeColumnPairs
public void removeColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs) throws ModelException
Remove some column pairs from the holder.- Specified by:
removeColumnPairs
in interfaceorg.netbeans.modules.dbschema.ColumnPairElementHolder
- Specified by:
removeColumnPairs
in interfaceMappingReferenceKeyElement
- Parameters:
pairs
- the column pairs to remove- Throws:
ModelException
- if impossible
-
setColumnPairs
public void setColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs) throws ModelException
Set the column pairs for this holder. Previous column pairs are removed.- Specified by:
setColumnPairs
in interfaceorg.netbeans.modules.dbschema.ColumnPairElementHolder
- Specified by:
setColumnPairs
in 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:
getColumnPairs
in 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:
getColumnPair
in interfaceorg.netbeans.modules.dbschema.ColumnPairElementHolder
- Parameters:
name
- the name of the column pair for which to look- Returns:
- the column pair or
null
if 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.
-
-