com.sun.jdo.api.persistence.model.mapping.impl
Class MappingRelationshipElementImpl

java.lang.Object
  extended by com.sun.jdo.api.persistence.model.mapping.impl.MappingElementImpl
      extended by com.sun.jdo.api.persistence.model.mapping.impl.MappingMemberElementImpl
          extended by com.sun.jdo.api.persistence.model.mapping.impl.MappingFieldElementImpl
              extended by com.sun.jdo.api.persistence.model.mapping.impl.MappingRelationshipElementImpl
All Implemented Interfaces:
MappingElement, MappingElementProperties, MappingFieldElement, MappingMemberElement, MappingRelationshipElement, Comparable

public class MappingRelationshipElementImpl
extends MappingFieldElementImpl
implements MappingRelationshipElement

Version:
%I%
Author:
Mark Munro, Rochelle Raccah

Field Summary
 
Fields inherited from class com.sun.jdo.api.persistence.model.mapping.impl.MappingFieldElementImpl
CLONE_DEEP, CLONE_FIELD, CLONE_MASK, IN_CONCURRENCY_CHECK, LOG_ON_ACCESS, LOG_ON_MASK, LOG_ON_UPDATE, MOD_BI_ON_UPDATE, OBSERVE_ON_ACCESS, READ_ONLY, RECORD_ON_UPDATE, REF_INTEGRITY_UPDATES, SEND_BEFORE_IMAGE, XLATE_FIELD
 
Fields inherited from interface com.sun.jdo.api.persistence.model.mapping.MappingFieldElement
GROUP_DEFAULT, GROUP_INDEPENDENT, GROUP_NONE
 
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
MappingRelationshipElementImpl()
          Create new MappingRelationshipElementImpl with no corresponding name or declaring class.
MappingRelationshipElementImpl(String name, MappingClassElement declaringClass)
          Create new MappingRelationshipElementImpl with the corresponding name and declaring class.
 
Method Summary
 void addAssociatedColumn(org.netbeans.modules.dbschema.ColumnPairElement column)
          Adds a column to the list of associated columns mapped by this mapping field.
 void addColumn(org.netbeans.modules.dbschema.DBMemberElement column)
          Adds a column to the list of columns mapped by this mapping relationship.
 void addLocalColumn(org.netbeans.modules.dbschema.ColumnPairElement column)
          Adds a column to the list of columns mapped by this mapping field.
 ArrayList getAssociatedColumnObjects()
          Returns the list of associated columns (ColumnPairElements) to which this mapping field is mapped.
 ArrayList getAssociatedColumns()
          Returns the list of associated column names to which this mapping field is mapped.
 int getDeleteAction()
          Get the delete action for this relationship element.
 String getElementClass()
          Get the element class for this relationship element.
 int getLowerBound()
          Get the lower cardinality bound for this relationship element.
 int getUpdateAction()
          Get the update action for this relationship element.
 int getUpperBound()
          Get the upper cardinality bound for this relationship element.
 void removeColumn(String columnName)
          Removes a column from the list of columns mapped by this mapping field.
 void setAssociatedColumns(ArrayList associatedColumns)
          Set the list of associated column names to which this mapping field is mapped.
protected  void stripSchemaName()
          Boston to Pilsen conversion.
 
Methods inherited from class com.sun.jdo.api.persistence.model.mapping.impl.MappingFieldElementImpl
getCloneDepth, getColumnObjects, getColumns, getConcurrencyGroups, getFetchGroup, getFieldNumber, getLogOnAccess, getLogOnUpdate, getModifyBeforeImageOnUpdate, getObserveOnAccess, getProperties, getRecordOnUpdate, getReferentialIntegrityUpdates, getSendBeforeImage, isInConcurrencyCheck, isMappedToTable, isReadOnly, isVersion, setCloneDepth, setFetchGroup, setFetchGroupInternal, setInConcurrencyCheck, setLogOnAccess, setLogOnUpdate, setModifyBeforeImageOnUpdate, setObserveOnAccess, setProperty, setReadOnly, setRecordOnUpdate, setReferentialIntegrityUpdates, setSendBeforeImage, setVersion
 
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 com.sun.jdo.api.persistence.model.mapping.MappingFieldElement
getColumns, getFetchGroup, isInConcurrencyCheck, isReadOnly, isVersion, setFetchGroup, setInConcurrencyCheck, setReadOnly, setVersion
 
Methods inherited from interface com.sun.jdo.api.persistence.model.mapping.MappingMemberElement
getDeclaringClass
 
Methods inherited from interface com.sun.jdo.api.persistence.model.mapping.MappingElement
addPropertyChangeListener, addVetoableChangeListener, getName, removePropertyChangeListener, removeVetoableChangeListener, setName
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

MappingRelationshipElementImpl

public MappingRelationshipElementImpl()
Create new MappingRelationshipElementImpl with no corresponding name or declaring class. This constructor should only be used for cloning and archiving.


MappingRelationshipElementImpl

public MappingRelationshipElementImpl(String name,
                                      MappingClassElement declaringClass)
Create new MappingRelationshipElementImpl with the corresponding name and declaring class.

Parameters:
name - the name of the element
declaringClass - the class to attach to
Method Detail

getAssociatedColumns

public ArrayList getAssociatedColumns()
Returns the list of associated column names to which this mapping field is mapped. This is used for join tables.

Specified by:
getAssociatedColumns in interface MappingRelationshipElement
Returns:
the names of the columns mapped by this mapping field
See Also:
MappingFieldElement.getColumns()

addLocalColumn

public void addLocalColumn(org.netbeans.modules.dbschema.ColumnPairElement column)
                    throws ModelException
Adds a column to the list of columns mapped by this mapping field. Call this method instead of addColumn when mapping join tables. This method is used to map between the local column and the join table, while addAssociatedColumn is used to map between the join table and the foreign table.

Specified by:
addLocalColumn in interface MappingRelationshipElement
Parameters:
column - column pair element to be added to the mapping
Throws:
ModelException - if impossible
See Also:
MappingFieldElement.addColumn(org.netbeans.modules.dbschema.DBMemberElement), addAssociatedColumn(org.netbeans.modules.dbschema.ColumnPairElement)

addAssociatedColumn

public void addAssociatedColumn(org.netbeans.modules.dbschema.ColumnPairElement column)
                         throws ModelException
Adds a column to the list of associated columns mapped by this mapping field. Call this method instead of addColumn when mapping join tables. This method is used to map between the join table column and the foreign table column, while addLocalColumn is used to map between the local table and the join table.

Specified by:
addAssociatedColumn in interface MappingRelationshipElement
Parameters:
column - column pair element to be added to the mapping
Throws:
ModelException - if impossible
See Also:
MappingFieldElement.addColumn(org.netbeans.modules.dbschema.DBMemberElement), addLocalColumn(org.netbeans.modules.dbschema.ColumnPairElement)

addColumn

public void addColumn(org.netbeans.modules.dbschema.DBMemberElement column)
               throws ModelException
Adds a column to the list of columns mapped by this mapping relationship. This method overrides the one in MappingFieldElement to check that the argument is a ColumnPairElement.

Specified by:
addColumn in interface MappingFieldElement
Overrides:
addColumn in class MappingFieldElementImpl
Parameters:
column - column element to be added to the mapping
Throws:
ModelException - if impossible

removeColumn

public void removeColumn(String columnName)
                  throws ModelException
Removes a column from the list of columns mapped by this mapping field. This method overrides the one in MappingFieldElement to remove the argument from the associated columns if necessary.

Specified by:
removeColumn in interface MappingFieldElement
Overrides:
removeColumn in class MappingFieldElementImpl
Parameters:
columnName - the relative name of the column to be removed from the mapping
Throws:
ModelException - if impossible

getAssociatedColumnObjects

public ArrayList getAssociatedColumnObjects()
Returns the list of associated columns (ColumnPairElements) to which this mapping field is mapped. This is used for join tables. This method should only be used by the runtime.

Returns:
the columns mapped by this mapping field
See Also:
MappingFieldElement.getColumns()

getElementClass

public String getElementClass()
Get the element class for this relationship element. If primitive types are supported, you can use wrapperclass.TYPE to specify them.

Returns:
the element class

getUpdateAction

public int getUpdateAction()
Get the update action for this relationship element.

Returns:
the update action, one of RelationshipElement.NONE_ACTION, RelationshipElement.NULLIFY_ACTION, RelationshipElement.RESTRICT_ACTION, RelationshipElement.CASCADE_ACTION, or RelationshipElement.AGGREGATE_ACTION

getDeleteAction

public int getDeleteAction()
Get the delete action for this relationship element.

Returns:
the delete action, one of RelationshipElement.NONE_ACTION, RelationshipElement.NULLIFY_ACTION, RelationshipElement.RESTRICT_ACTION, RelationshipElement.CASCADE_ACTION, or RelationshipElement.AGGREGATE_ACTION

getUpperBound

public int getUpperBound()
Get the upper cardinality bound for this relationship element. Returns Integer.MAX_VALUE for n

Returns:
the upper cardinality bound

getLowerBound

public int getLowerBound()
Get the lower cardinality bound for this relationship element.

Returns:
the lower cardinality bound

setAssociatedColumns

public void setAssociatedColumns(ArrayList associatedColumns)
Set the list of associated column names to which this mapping field is mapped. This method should only be used internally and for cloning and archiving.

Parameters:
associatedColumns - the list of names of the columns mapped by this mapping field

stripSchemaName

protected void stripSchemaName()
Boston to Pilsen conversion. This method converts the absolute column names to relative names.

Overrides:
stripSchemaName in class MappingFieldElementImpl


Copyright © 2012 GlassFish Community. All Rights Reserved.