org.apache.openjpa.jdbc.meta
Class ValueMappingImpl

java.lang.Object
  extended by org.apache.openjpa.meta.ValueMetaDataImpl
      extended by org.apache.openjpa.jdbc.meta.ValueMappingImpl
All Implemented Interfaces:
Serializable, ValueMapping, MetaDataContext, MetaDataModes, ValueMetaData

public class ValueMappingImpl
extends ValueMetaDataImpl
implements ValueMapping

Standalone ValueMapping implementation.

Since:
0.4.0
Author:
Abe White
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.apache.openjpa.jdbc.meta.ValueMapping
JOIN_EXPECTED_INVERSE, JOIN_FORWARD, JOIN_INVERSE, POLY_FALSE, POLY_JOINABLE, POLY_TRUE
 
Fields inherited from interface org.apache.openjpa.meta.ValueMetaData
CASCADE_AUTO, CASCADE_IMMEDIATE, CASCADE_NONE, MAPPED_BY_PK
 
Fields inherited from interface org.apache.openjpa.meta.MetaDataModes
MODE_ALL, MODE_ANN_MAPPING, MODE_MAPPING, MODE_MAPPING_INIT, MODE_META, MODE_NONE, MODE_QUERY
 
Constructor Summary
protected ValueMappingImpl()
          Constructor for deserialization.
  ValueMappingImpl(FieldMapping owner)
          Constructor.
 
Method Summary
 void clearMapping()
          Clear mapping information, including strategy.
 void copy(ValueMetaData vmd)
          Copy state from the given value to this one.
 void copyMappingInfo(ValueMapping vm)
          Copy mapping info from the given instance to this one.
 ColumnIO getColumnIO()
          I/O information on the foreign key, or columns if this value doesn't have a key.
 Column[] getColumns()
          The columns that hold the data for this value.
 ClassMapping getDeclaredTypeMapping()
          Convenience method to perform cast from ValueMetaData.getDeclaredTypeMetaData().
 ClassMapping getEmbeddedMapping()
          Convenience method to perform cast from ValueMetaData.getEmbeddedMetaData().
 FieldMapping getFieldMapping()
          Convenience method to perform cast from ValueMetaData.getFieldMetaData().
 ForeignKey getForeignKey()
          If this value joins to another record, the foreign key.
 ForeignKey getForeignKey(ClassMapping target)
          Return an equivalent of this value's foreign key, but joining to the given target, which may be an unjoined subclass of this value's related type.
 ForeignKey getForeignKey(ClassMapping target, int targetNumber)
           
 ValueHandler getHandler()
          The handler used for this value, or null if none.
 ClassMapping[] getIndependentTypeMappings()
          Return all independently-mapped joinable types for this value, depending on whether this value is polymorphic and how the related type is mapped.
 int getJoinDirection()
          The join direction.
 MappingRepository getMappingRepository()
          Convenience method to perform cast from MetaDataContext.getRepository().
 int getPolymorphic()
          The degree to which this relation is polymorphic.
 int getSelectSubclasses()
          Return the org.apache.openjpa.sql.Select subclasses constant for loading this relation, based on how the related type is mapped, whether this relation is polymorphic, and whether it is configured to use class criteria.
 ClassMapping getTypeMapping()
          Convenience method to perform cast from ValueMetaData.getTypeMetaData().
 boolean getUseClassCriteria()
          Whether to use class criteria when joining to related type.
 Index getValueIndex()
          Index on this value's columns, or null if none.
 ValueMappingInfo getValueInfo()
          Raw mapping data.
 FieldMapping getValueMappedByMapping()
          Convenience method to perform cast from ValueMetaData.getValueMappedByMetaData().
 Unique getValueUnique()
          Unique constraint on this value's columns, or null if none.
 void mapConstraints(DBIdentifier name, boolean adapt)
          Map indexes and constraints for this value, using the current ValueMappingInfo.
 void mapConstraints(String name, boolean adapt)
          Deprecated.  
 void refSchemaComponents()
          Increase the reference count on used schema components.
 boolean resolve(int mode)
          Resolve and validate metadata.
 void setColumnIO(ColumnIO io)
          I/O information on the foreign key, or columns if this value doesn't have a key.
 void setColumns(Column[] cols)
          The columns that hold the data for this value.
 void setForeignKey(ForeignKey fk)
          If this value joins to another record, the foreign key.
 void setForeignKey(Row row, OpenJPAStateManager rel)
          Sets this value's foreign key to the given related object.
 void setForeignKey(Row row, OpenJPAStateManager rel, int targetNumber)
          Sets this value's foreign key to the given related object.
 void setHandler(ValueHandler handler)
          The handler used for this value, or null if none.
 void setJoinDirection(int direction)
          The join direction.
 void setPolymorphic(int poly)
          The degree to which this relation is polymorphic.
 void setUseClassCriteria(boolean criteria)
          Whether to use class criteria when joining to related type.
 void setValueIndex(Index idx)
          Index on this value's columns, or null if none.
 void setValueUnique(Unique unq)
          Unique constraint on this value's columns, or null if none.
 void syncMappingInfo()
          Update MappingInfo with our current mapping information.
 void whereForeignKey(Row row, OpenJPAStateManager rel)
          Sets this value's foreign key to the given related object.
 
Methods inherited from class org.apache.openjpa.meta.ValueMetaDataImpl
addEmbeddedMetaData, addEmbeddedMetaData, getCascadeAttach, getCascadeDelete, getCascadeDetach, getCascadePersist, getCascadeRefresh, getDeclaredType, getDeclaredTypeCode, getDeclaredTypeMetaData, getEmbeddedMetaData, getFieldMetaData, getRepository, getResolve, getType, getTypeCode, getTypeMetaData, getTypeOverride, getValueMappedBy, getValueMappedByMetaData, isDeclaredTypePC, isEmbedded, isEmbeddedPC, isSerialized, isTypePC, setCascadeAttach, setCascadeDelete, setCascadeDetach, setCascadePersist, setCascadeRefresh, setDeclaredType, setDeclaredTypeCode, setEmbedded, setResolve, setResolve, setSerialized, setType, setTypeCode, setTypeOverride, setValueMappedBy, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.openjpa.meta.ValueMetaData
addEmbeddedMetaData, addEmbeddedMetaData, getCascadeAttach, getCascadeDelete, getCascadeDetach, getCascadePersist, getCascadeRefresh, getDeclaredType, getDeclaredTypeCode, getDeclaredTypeMetaData, getEmbeddedMetaData, getFieldMetaData, getResolve, getType, getTypeCode, getTypeMetaData, getTypeOverride, getValueMappedBy, getValueMappedByMetaData, isDeclaredTypePC, isEmbedded, isEmbeddedPC, isSerialized, isTypePC, setCascadeAttach, setCascadeDelete, setCascadeDetach, setCascadePersist, setCascadeRefresh, setDeclaredType, setDeclaredTypeCode, setEmbedded, setResolve, setResolve, setSerialized, setType, setTypeCode, setTypeOverride, setValueMappedBy
 
Methods inherited from interface org.apache.openjpa.meta.MetaDataContext
getRepository
 

Constructor Detail

ValueMappingImpl

public ValueMappingImpl(FieldMapping owner)
Constructor. Supply owning mapping.


ValueMappingImpl

protected ValueMappingImpl()
Constructor for deserialization.

Method Detail

getValueInfo

public ValueMappingInfo getValueInfo()
Description copied from interface: ValueMapping
Raw mapping data.

Specified by:
getValueInfo in interface ValueMapping

getHandler

public ValueHandler getHandler()
Description copied from interface: ValueMapping
The handler used for this value, or null if none.

Specified by:
getHandler in interface ValueMapping

setHandler

public void setHandler(ValueHandler handler)
Description copied from interface: ValueMapping
The handler used for this value, or null if none.

Specified by:
setHandler in interface ValueMapping

getMappingRepository

public MappingRepository getMappingRepository()
Description copied from interface: ValueMapping
Convenience method to perform cast from MetaDataContext.getRepository().

Specified by:
getMappingRepository in interface ValueMapping

getFieldMapping

public FieldMapping getFieldMapping()
Description copied from interface: ValueMapping
Convenience method to perform cast from ValueMetaData.getFieldMetaData().

Specified by:
getFieldMapping in interface ValueMapping

getTypeMapping

public ClassMapping getTypeMapping()
Description copied from interface: ValueMapping
Convenience method to perform cast from ValueMetaData.getTypeMetaData().

Specified by:
getTypeMapping in interface ValueMapping

getDeclaredTypeMapping

public ClassMapping getDeclaredTypeMapping()
Description copied from interface: ValueMapping
Convenience method to perform cast from ValueMetaData.getDeclaredTypeMetaData().

Specified by:
getDeclaredTypeMapping in interface ValueMapping

getEmbeddedMapping

public ClassMapping getEmbeddedMapping()
Description copied from interface: ValueMapping
Convenience method to perform cast from ValueMetaData.getEmbeddedMetaData().

Specified by:
getEmbeddedMapping in interface ValueMapping

getValueMappedByMapping

public FieldMapping getValueMappedByMapping()
Description copied from interface: ValueMapping
Convenience method to perform cast from ValueMetaData.getValueMappedByMetaData().

Specified by:
getValueMappedByMapping in interface ValueMapping

getColumns

public Column[] getColumns()
Description copied from interface: ValueMapping
The columns that hold the data for this value.

Specified by:
getColumns in interface ValueMapping

setColumns

public void setColumns(Column[] cols)
Description copied from interface: ValueMapping
The columns that hold the data for this value.

Specified by:
setColumns in interface ValueMapping

getColumnIO

public ColumnIO getColumnIO()
Description copied from interface: ValueMapping
I/O information on the foreign key, or columns if this value doesn't have a key.

Specified by:
getColumnIO in interface ValueMapping

setColumnIO

public void setColumnIO(ColumnIO io)
Description copied from interface: ValueMapping
I/O information on the foreign key, or columns if this value doesn't have a key.

Specified by:
setColumnIO in interface ValueMapping

getForeignKey

public ForeignKey getForeignKey()
Description copied from interface: ValueMapping
If this value joins to another record, the foreign key.

Specified by:
getForeignKey in interface ValueMapping

setForeignKey

public void setForeignKey(ForeignKey fk)
Description copied from interface: ValueMapping
If this value joins to another record, the foreign key.

Specified by:
setForeignKey in interface ValueMapping

getForeignKey

public ForeignKey getForeignKey(ClassMapping target,
                                int targetNumber)

getForeignKey

public ForeignKey getForeignKey(ClassMapping target)
Description copied from interface: ValueMapping
Return an equivalent of this value's foreign key, but joining to the given target, which may be an unjoined subclass of this value's related type.

Specified by:
getForeignKey in interface ValueMapping

getJoinDirection

public int getJoinDirection()
Description copied from interface: ValueMapping
The join direction.

Specified by:
getJoinDirection in interface ValueMapping

setJoinDirection

public void setJoinDirection(int direction)
Description copied from interface: ValueMapping
The join direction.

Specified by:
setJoinDirection in interface ValueMapping

setForeignKey

public void setForeignKey(Row row,
                          OpenJPAStateManager rel,
                          int targetNumber)
                   throws SQLException
Description copied from interface: ValueMapping
Sets this value's foreign key to the given related object. The object may be null. If the object is one of2or more foreign keys with the same target, the targetNumber specifies the one to set.

Specified by:
setForeignKey in interface ValueMapping
Throws:
SQLException

setForeignKey

public void setForeignKey(Row row,
                          OpenJPAStateManager rel)
                   throws SQLException
Description copied from interface: ValueMapping
Sets this value's foreign key to the given related object. The object may be null.

Specified by:
setForeignKey in interface ValueMapping
Throws:
SQLException

whereForeignKey

public void whereForeignKey(Row row,
                            OpenJPAStateManager rel)
                     throws SQLException
Description copied from interface: ValueMapping
Sets this value's foreign key to the given related object. The object may be null.

Specified by:
whereForeignKey in interface ValueMapping
Throws:
SQLException

getIndependentTypeMappings

public ClassMapping[] getIndependentTypeMappings()
Description copied from interface: ValueMapping
Return all independently-mapped joinable types for this value, depending on whether this value is polymorphic and how the related type is mapped. Return an empty array if value type is not PC.

Specified by:
getIndependentTypeMappings in interface ValueMapping

getSelectSubclasses

public int getSelectSubclasses()
Description copied from interface: ValueMapping
Return the org.apache.openjpa.sql.Select subclasses constant for loading this relation, based on how the related type is mapped, whether this relation is polymorphic, and whether it is configured to use class criteria.

Specified by:
getSelectSubclasses in interface ValueMapping

getValueUnique

public Unique getValueUnique()
Description copied from interface: ValueMapping
Unique constraint on this value's columns, or null if none.

Specified by:
getValueUnique in interface ValueMapping

setValueUnique

public void setValueUnique(Unique unq)
Description copied from interface: ValueMapping
Unique constraint on this value's columns, or null if none.

Specified by:
setValueUnique in interface ValueMapping

getValueIndex

public Index getValueIndex()
Description copied from interface: ValueMapping
Index on this value's columns, or null if none.

Specified by:
getValueIndex in interface ValueMapping

setValueIndex

public void setValueIndex(Index idx)
Description copied from interface: ValueMapping
Index on this value's columns, or null if none.

Specified by:
setValueIndex in interface ValueMapping

getUseClassCriteria

public boolean getUseClassCriteria()
Description copied from interface: ValueMapping
Whether to use class criteria when joining to related type.

Specified by:
getUseClassCriteria in interface ValueMapping

setUseClassCriteria

public void setUseClassCriteria(boolean criteria)
Description copied from interface: ValueMapping
Whether to use class criteria when joining to related type.

Specified by:
setUseClassCriteria in interface ValueMapping

getPolymorphic

public int getPolymorphic()
Description copied from interface: ValueMapping
The degree to which this relation is polymorphic.

Specified by:
getPolymorphic in interface ValueMapping

setPolymorphic

public void setPolymorphic(int poly)
Description copied from interface: ValueMapping
The degree to which this relation is polymorphic.

Specified by:
setPolymorphic in interface ValueMapping

refSchemaComponents

public void refSchemaComponents()
Description copied from interface: ValueMapping
Increase the reference count on used schema components.

Specified by:
refSchemaComponents in interface ValueMapping

mapConstraints

public void mapConstraints(String name,
                           boolean adapt)
Deprecated. 

Description copied from interface: ValueMapping
Map indexes and constraints for this value, using the current ValueMappingInfo. The foreign key or columns of this value must be set before calling this method.

Specified by:
mapConstraints in interface ValueMapping

mapConstraints

public void mapConstraints(DBIdentifier name,
                           boolean adapt)
Description copied from interface: ValueMapping
Map indexes and constraints for this value, using the current ValueMappingInfo. The foreign key or columns of this value must be set before calling this method.

Specified by:
mapConstraints in interface ValueMapping

clearMapping

public void clearMapping()
Description copied from interface: ValueMapping
Clear mapping information, including strategy.

Specified by:
clearMapping in interface ValueMapping

syncMappingInfo

public void syncMappingInfo()
Description copied from interface: ValueMapping
Update MappingInfo with our current mapping information.

Specified by:
syncMappingInfo in interface ValueMapping

copy

public void copy(ValueMetaData vmd)
Description copied from interface: ValueMetaData
Copy state from the given value to this one. Do not copy mapping information.

Specified by:
copy in interface ValueMetaData
Overrides:
copy in class ValueMetaDataImpl

copyMappingInfo

public void copyMappingInfo(ValueMapping vm)
Description copied from interface: ValueMapping
Copy mapping info from the given instance to this one.

Specified by:
copyMappingInfo in interface ValueMapping

resolve

public boolean resolve(int mode)
Description copied from interface: ValueMetaData
Resolve and validate metadata. Return true if already resolved.

Specified by:
resolve in interface ValueMetaData
Overrides:
resolve in class ValueMetaDataImpl


Copyright © 2006-2012 Apache Software Foundation. All Rights Reserved.