|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.openjpa.jdbc.meta.MappingDefaultsImpl
public class MappingDefaultsImpl
Default implementation of MappingDefaults
.
Field Summary | |
---|---|
protected DBDictionary |
dict
|
Constructor Summary | |
---|---|
MappingDefaultsImpl()
|
Method Summary | |
---|---|
protected boolean |
areAllPrimaryKeyColumns(Column[] cols)
Return whether all the given columns are primary key columns. |
protected void |
correctName(Table table,
Column col)
Correct the given column's name. |
boolean |
defaultMissingInfo()
Whether to fill in missing mapping information at runtime with the default values supplied by this plugin. |
void |
endConfiguration()
Invoked upon completion of bean property configuration for this object. |
boolean |
getAddNullIndicator()
Whether to add a synthetic null indicator column to embedded mappings by default. |
String |
getBaseClassStrategy()
Default base class strategy alias. |
DBIdentifier |
getDataStoreIdColumnIdentifier()
|
String |
getDataStoreIdColumnName()
Deprecated. |
boolean |
getDeferConstraints()
Whether to defer constraints by default. |
DBIdentifier |
getDiscriminatorColumnIdentifier()
|
String |
getDiscriminatorColumnName()
Deprecated. |
String |
getDiscriminatorStrategy()
Default discriminator strategy alias. |
Object |
getDiscriminatorValue(Discriminator disc,
boolean adapt)
Provides a default value for the given Discriminator. |
String |
getFieldStrategy(String valueType)
Association of a field value type name with the handler or strategy class name. |
ForeignKey |
getForeignKey(ValueMapping vm,
DBIdentifier name,
Table local,
Table foreign,
boolean inverse)
Return a default foreign key for the join from this value to its related type, or null for a logical foreign key only. |
ForeignKey |
getForeignKey(ValueMapping vm,
String name,
Table local,
Table foreign,
boolean inverse)
Deprecated. |
int |
getForeignKeyDeleteAction()
Default foreign key action for relation keys. |
Index |
getIndex(Discriminator disc,
Table table,
Column[] cols)
Return a default index for the discriminator, or null if the discriminator columns should not be indexed by default. |
Index |
getIndex(ValueMapping vm,
DBIdentifier name,
Table table,
Column[] cols)
Return a default index for the value, or null if the value columns should not be indexed by default. |
Index |
getIndex(ValueMapping vm,
String name,
Table table,
Column[] cols)
Deprecated. |
Index |
getIndex(Version vers,
Table table,
Column[] cols)
Return a default index for the version, or null if the version columns should not be indexed by default. |
boolean |
getIndexDiscriminator()
Whether to index discriminator columns by default. |
boolean |
getIndexLogicalForeignKeys()
Whether to index logical foreign keys by default. |
protected DBIdentifier |
getIndexName(DBIdentifier name,
Table table,
Column[] cols)
|
protected String |
getIndexName(String name,
Table table,
Column[] cols)
Deprecated. |
boolean |
getIndexVersion()
Whether to index version columns by default. |
ForeignKey |
getJoinForeignKey(ClassMapping cls,
Table local,
Table foreign)
Return a default foreign key for the join from this class' table to its superclass' table, or null for a logical foreign key only. |
ForeignKey |
getJoinForeignKey(FieldMapping fm,
Table local,
Table foreign)
Return a default foreign key for the join from this field's table to its defining class' table, or null for a logical foreign key only. |
int |
getJoinForeignKeyDeleteAction()
Default foreign key action for join keys. |
Index |
getJoinIndex(FieldMapping fm,
Table table,
Column[] cols)
Return a default index for the join, or null if the join columns should not be indexed by default. |
Unique |
getJoinUnique(FieldMapping fm,
Table table,
Column[] cols)
Return a default constraint for the join, or null if the join columns should not be constrained by default. |
DBIdentifier |
getNullIndicatorColumnIdentifier()
|
String |
getNullIndicatorColumnName()
Deprecated. |
DBIdentifier |
getOrderColumnIdentifier()
|
String |
getOrderColumnName()
Deprecated. |
boolean |
getOrderLists()
Whether to order lists and arrays using a dedicated ordering column by default. |
DBIdentifier |
getPrimaryKeyIdentifier(ClassMapping cm,
Table table)
Return the name of the primary key for the table of the given class, or null for database default. |
String |
getPrimaryKeyName(ClassMapping cm,
Table table)
Deprecated. |
boolean |
getStoreEnumOrdinal()
Whether to store enums as the ordinal value rather than the enum name. |
boolean |
getStoreUnmappedObjectIdString()
Whether to store a relation to an unmapped class by stringifying the oid of the related object, rather than storing primary key values. |
Object |
getStrategy(ClassMapping cls,
boolean adapt)
Default mapping strategy when there is no explicit strategy and no hierarchy strategy given. |
Object |
getStrategy(Discriminator disc,
boolean adapt)
Default discriminator mapping strategy when there is no explicit strategy. |
Object |
getStrategy(ValueMapping vm,
Class<?> type,
boolean adapt)
Custom handler or strategy for the given field, or null if none has been registered. |
Object |
getStrategy(Version vers,
boolean adapt)
Default version mapping strategy when there is no explicit strategy. |
String |
getSubclassStrategy()
Default subclass strategy alias. |
DBIdentifier |
getTableIdentifier(ClassMapping cls,
Schema schema)
Return the default table name for the given class. |
DBIdentifier |
getTableIdentifier(FieldMapping fm,
Schema schema)
Return the default secondary table name for the given field. |
String |
getTableName(ClassMapping cls,
Schema schema)
Return the default table name for the given class. |
String |
getTableName(FieldMapping fm,
Schema schema)
Return the default secondary table name for the given field. |
Unique |
getUnique(ValueMapping vm,
DBIdentifier name,
Table table,
Column[] cols)
Return a default constraint for the value, or null if the value columns should not be constrained by default. |
Unique |
getUnique(ValueMapping vm,
String name,
Table table,
Column[] cols)
Deprecated. |
DBIdentifier |
getVersionColumnIdentifier()
|
String |
getVersionColumnName()
Deprecated. |
String |
getVersionStrategy()
Default version strategy alias. |
void |
installPrimaryKey(FieldMapping fm,
Table table)
If desired, install a primary key on the given secondary table. |
boolean |
isRemoveHungarianNotation()
|
void |
populateColumns(Discriminator disc,
Table table,
Column[] cols)
Fill in default information for the given discriminator columns. |
void |
populateColumns(ValueMapping vm,
DBIdentifier name,
Table table,
Column[] cols)
Fill in default information for the given value columns. |
void |
populateColumns(ValueMapping vm,
String name,
Table table,
Column[] cols)
Fill in default information for the given value columns. |
void |
populateColumns(Version vers,
Table table,
Column[] cols)
Fill in default information for the given version columns. |
void |
populateDataStoreIdColumns(ClassMapping cls,
Table table,
Column[] cols)
Fill in default information for the given datastore identity columns. |
void |
populateForeignKeyColumn(ValueMapping vm,
DBIdentifier name,
Table local,
Table foreign,
Column col,
Object target,
boolean inverse,
int pos,
int cols)
Fill in default information for the given column used to join a value to its related type. |
void |
populateForeignKeyColumn(ValueMapping vm,
String name,
Table local,
Table foreign,
Column col,
Object target,
boolean inverse,
int pos,
int cols)
Deprecated. |
void |
populateJoinColumn(ClassMapping cm,
Table local,
Table foreign,
Column col,
Object target,
int pos,
int cols)
Fill in default information for the given column used to join a class to its superclass table. |
void |
populateJoinColumn(FieldMapping fm,
Table local,
Table foreign,
Column col,
Object target,
int pos,
int cols)
Fill in default information for the given column used to join a field to its defining class' table. |
boolean |
populateNullIndicatorColumns(ValueMapping vm,
DBIdentifier name,
Table table,
Column[] cols)
Fill in default information for the given null indicator columns. |
boolean |
populateNullIndicatorColumns(ValueMapping vm,
String name,
Table table,
Column[] cols)
Deprecated. |
boolean |
populateOrderColumns(FieldMapping fm,
Table table,
Column[] cols)
Fill in default information for the given order columns. |
protected String |
removeHungarianNotation(String columnName)
|
void |
setAddNullIndicator(boolean addNullInd)
Whether to add a synthetic null indicator column to embedded mappings by default. |
void |
setBaseClassStrategy(String baseClassStrategy)
Default base class strategy alias. |
void |
setConfiguration(Configuration conf)
Invoked prior to setting bean properties. |
void |
setDataStoreIdColumnIdentifier(DBIdentifier dsIdName)
|
void |
setDataStoreIdColumnName(String dsIdName)
Deprecated. |
void |
setDefaultMissingInfo(boolean defMissing)
|
void |
setDeferConstraints(boolean defer)
Whether to defer constraints by default. |
void |
setDiscriminatorColumnIdentifier(DBIdentifier discName)
|
void |
setDiscriminatorColumnName(String discName)
Deprecated. |
void |
setDiscriminatorStrategy(String discStrategy)
Default discriminator strategy alias. |
void |
setFieldStrategies(String fieldMapString)
Property string mapping field type names to value handler or field mapping class names. |
void |
setFieldStrategy(String valueType,
String handlerType)
Association of a field value type name with the handler or strategy class name. |
void |
setForeignKeyDeleteAction(int fkAction)
Default foreign key action for relation keys. |
void |
setForeignKeyDeleteAction(String fkAction)
Default foreign key action name for relation keys. |
void |
setIndexDiscriminator(boolean indexDisc)
Whether to index discriminator columns by default. |
void |
setIndexLogicalForeignKeys(boolean indexFK)
Whether to index logical foreign keys by default. |
void |
setIndexVersion(boolean indexVers)
Whether to index version columns by default. |
void |
setJoinForeignKeyDeleteAction(int joinFKAction)
Default foreign key action for join keys. |
void |
setJoinForeignKeyDeleteAction(String joinFKAction)
Default foreign key action name for join keys. |
void |
setNullIndicatorColumnIdentifier(DBIdentifier nullIndName)
|
void |
setNullIndicatorColumnName(String nullIndName)
Deprecated. |
void |
setOrderColumnIdentifier(DBIdentifier orderName)
|
void |
setOrderColumnName(String orderName)
Deprecated. |
void |
setOrderLists(boolean orderLists)
Whether to order lists and arrays using a dedicated ordering column by default. |
void |
setRemoveHungarianNotation(boolean removeHungarianNotation)
|
void |
setStoreEnumOrdinal(boolean ordinal)
Whether to store enums as the ordinal value rather than the enum name. |
void |
setStoreUnmappedObjectIdString(boolean stringify)
Whether to store a relation to an unmapped class by stringifying the oid of the related object, rather than storing primary key values. |
void |
setSubclassStrategy(String subclassStrategy)
Default subclass strategy alias. |
void |
setUseClassCriteria(boolean classCriteria)
|
void |
setVersionColumnIdentifier(DBIdentifier versName)
|
void |
setVersionColumnName(String versName)
Deprecated. |
void |
setVersionStrategy(String versionStrategy)
Default version strategy alias. |
void |
startConfiguration()
Invoked before bean property configuration is begun on this object. |
boolean |
useClassCriteria()
The default for whether relations use the related object's expected class as part of the join criteria. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected transient DBDictionary dict
Constructor Detail |
---|
public MappingDefaultsImpl()
Method Detail |
---|
public boolean isRemoveHungarianNotation()
public void setRemoveHungarianNotation(boolean removeHungarianNotation)
public String getBaseClassStrategy()
public void setBaseClassStrategy(String baseClassStrategy)
public String getSubclassStrategy()
public void setSubclassStrategy(String subclassStrategy)
public String getVersionStrategy()
public void setVersionStrategy(String versionStrategy)
public String getDiscriminatorStrategy()
public void setDiscriminatorStrategy(String discStrategy)
public void setFieldStrategies(String fieldMapString)
public void setFieldStrategy(String valueType, String handlerType)
public String getFieldStrategy(String valueType)
public boolean getStoreEnumOrdinal()
public void setStoreEnumOrdinal(boolean ordinal)
public boolean getStoreUnmappedObjectIdString()
public void setStoreUnmappedObjectIdString(boolean stringify)
public int getJoinForeignKeyDeleteAction()
public void setJoinForeignKeyDeleteAction(int joinFKAction)
public void setJoinForeignKeyDeleteAction(String joinFKAction)
public int getForeignKeyDeleteAction()
public void setForeignKeyDeleteAction(int fkAction)
public void setForeignKeyDeleteAction(String fkAction)
public boolean getIndexLogicalForeignKeys()
public void setIndexLogicalForeignKeys(boolean indexFK)
public boolean getIndexDiscriminator()
public void setIndexDiscriminator(boolean indexDisc)
public boolean getIndexVersion()
public void setIndexVersion(boolean indexVers)
public boolean getOrderLists()
public void setOrderLists(boolean orderLists)
public boolean getAddNullIndicator()
public void setAddNullIndicator(boolean addNullInd)
public boolean getDeferConstraints()
public void setDeferConstraints(boolean defer)
public String getDataStoreIdColumnName()
public DBIdentifier getDataStoreIdColumnIdentifier()
public void setDataStoreIdColumnName(String dsIdName)
public void setDataStoreIdColumnIdentifier(DBIdentifier dsIdName)
public String getVersionColumnName()
public DBIdentifier getVersionColumnIdentifier()
public void setVersionColumnName(String versName)
public void setVersionColumnIdentifier(DBIdentifier versName)
public String getDiscriminatorColumnName()
public DBIdentifier getDiscriminatorColumnIdentifier()
public void setDiscriminatorColumnName(String discName)
public void setDiscriminatorColumnIdentifier(DBIdentifier discName)
public String getOrderColumnName()
public DBIdentifier getOrderColumnIdentifier()
public void setOrderColumnName(String orderName)
public void setOrderColumnIdentifier(DBIdentifier orderName)
public String getNullIndicatorColumnName()
public DBIdentifier getNullIndicatorColumnIdentifier()
public void setNullIndicatorColumnName(String nullIndName)
public void setNullIndicatorColumnIdentifier(DBIdentifier nullIndName)
public boolean defaultMissingInfo()
MappingDefaults
defaultMissingInfo
in interface MappingDefaults
public void setDefaultMissingInfo(boolean defMissing)
public boolean useClassCriteria()
MappingDefaults
useClassCriteria
in interface MappingDefaults
public void setUseClassCriteria(boolean classCriteria)
public Object getStrategy(ClassMapping cls, boolean adapt)
MappingDefaults
getStrategy
in interface MappingDefaults
cls
- the class; will not be mapped, but superclass and raw
MappingInfo
will be availableadapt
- whether we can adapt the mapping or schema
public Object getStrategy(Version vers, boolean adapt)
MappingDefaults
getStrategy
in interface MappingDefaults
vers
- the version; will not be mapped, but raw
MappingInfo
will be availableadapt
- whether we can adapt the mapping or schema
public Object getStrategy(Discriminator disc, boolean adapt)
MappingDefaults
getStrategy
in interface MappingDefaults
disc
- the discriminator; will not be mapped, but raw
MappingInfo
will be availableadapt
- whether we can adapt the mapping or schema
public Object getStrategy(ValueMapping vm, Class<?> type, boolean adapt)
MappingDefaults
getStrategy
in interface MappingDefaults
vm
- the value mapping; will not be mapped, but raw
MappingInfo
will be availabletype
- the value typeadapt
- whether we can adapt the mapping or schema
public Object getDiscriminatorValue(Discriminator disc, boolean adapt)
The type of the object returned relies on the javaType field being set on the Discriminator which is provided.
JavaType | Default value |
---|---|
JavaTypes.INT | The hashcode of the entity name |
JavaTypes.CHAR | The first character of the entity name |
JavaTypes.STRING | The entity name |
getDiscriminatorValue
in interface MappingDefaults
disc
- The discriminator that needs a default valueadapt
-
public String getTableName(ClassMapping cls, Schema schema)
MappingDefaults
getTableName
in interface MappingDefaults
public DBIdentifier getTableIdentifier(ClassMapping cls, Schema schema)
MappingDefaults
getTableIdentifier
in interface MappingDefaults
public String getTableName(FieldMapping fm, Schema schema)
MappingDefaults
getTableName
in interface MappingDefaults
public DBIdentifier getTableIdentifier(FieldMapping fm, Schema schema)
MappingDefaults
getTableIdentifier
in interface MappingDefaults
public void populateDataStoreIdColumns(ClassMapping cls, Table table, Column[] cols)
MappingDefaults
populateDataStoreIdColumns
in interface MappingDefaults
protected void correctName(Table table, Column col)
protected String removeHungarianNotation(String columnName)
public void populateColumns(Version vers, Table table, Column[] cols)
MappingDefaults
populateColumns
in interface MappingDefaults
public void populateColumns(Discriminator disc, Table table, Column[] cols)
MappingDefaults
populateColumns
in interface MappingDefaults
public void populateJoinColumn(ClassMapping cm, Table local, Table foreign, Column col, Object target, int pos, int cols)
MappingDefaults
populateJoinColumn
in interface MappingDefaults
target
- the target of this column in the join; may be
another column or a constant valuepos
- the index of this column in the logical foreign keycols
- the number of columns in the logical foreign keypublic void populateJoinColumn(FieldMapping fm, Table local, Table foreign, Column col, Object target, int pos, int cols)
MappingDefaults
populateJoinColumn
in interface MappingDefaults
target
- the target of this column in the join; may be
another column or a constant valuepos
- the index of this column in the logical foreign keycols
- the number of columns in the logical foreign keypublic void populateForeignKeyColumn(ValueMapping vm, String name, Table local, Table foreign, Column col, Object target, boolean inverse, int pos, int cols)
MappingDefaults
populateForeignKeyColumn
in interface MappingDefaults
name
- base name for value, as decided by mappingtarget
- the target of this column in the join; may be
another column or a constant valueinverse
- whether this is an inverse foreign keypos
- the index of this column in the logical foreign keycols
- the number of columns in the logical foreign keypublic void populateForeignKeyColumn(ValueMapping vm, DBIdentifier name, Table local, Table foreign, Column col, Object target, boolean inverse, int pos, int cols)
MappingDefaults
populateForeignKeyColumn
in interface MappingDefaults
name
- base name for value, as decided by mappingtarget
- the target of this column in the join; may be
another column or a constant valueinverse
- whether this is an inverse foreign keypos
- the index of this column in the logical foreign keycols
- the number of columns in the logical foreign keypublic void populateColumns(ValueMapping vm, String name, Table table, Column[] cols)
MappingDefaults
populateColumns
in interface MappingDefaults
name
- base name for value, as decided by mappingpublic void populateColumns(ValueMapping vm, DBIdentifier name, Table table, Column[] cols)
MappingDefaults
populateColumns
in interface MappingDefaults
name
- base name for value, as decided by mappingpublic boolean populateOrderColumns(FieldMapping fm, Table table, Column[] cols)
MappingDefaults
populateOrderColumns
in interface MappingDefaults
public boolean populateNullIndicatorColumns(ValueMapping vm, String name, Table table, Column[] cols)
MappingDefaults
populateNullIndicatorColumns
in interface MappingDefaults
name
- base name for value, as decided by mapping
public boolean populateNullIndicatorColumns(ValueMapping vm, DBIdentifier name, Table table, Column[] cols)
MappingDefaults
populateNullIndicatorColumns
in interface MappingDefaults
name
- base name for value, as decided by mapping
public ForeignKey getJoinForeignKey(ClassMapping cls, Table local, Table foreign)
MappingDefaults
getJoinForeignKey
in interface MappingDefaults
public ForeignKey getJoinForeignKey(FieldMapping fm, Table local, Table foreign)
MappingDefaults
getJoinForeignKey
in interface MappingDefaults
public ForeignKey getForeignKey(ValueMapping vm, String name, Table local, Table foreign, boolean inverse)
MappingDefaults
getForeignKey
in interface MappingDefaults
name
- base name for value, as decided by mappinginverse
- whether this is an inverse keypublic ForeignKey getForeignKey(ValueMapping vm, DBIdentifier name, Table local, Table foreign, boolean inverse)
MappingDefaults
getForeignKey
in interface MappingDefaults
name
- base name for value, as decided by mappinginverse
- whether this is an inverse keypublic Index getJoinIndex(FieldMapping fm, Table table, Column[] cols)
MappingDefaults
getJoinIndex
in interface MappingDefaults
protected boolean areAllPrimaryKeyColumns(Column[] cols)
protected String getIndexName(String name, Table table, Column[] cols)
protected DBIdentifier getIndexName(DBIdentifier name, Table table, Column[] cols)
public Index getIndex(ValueMapping vm, String name, Table table, Column[] cols)
MappingDefaults
getIndex
in interface MappingDefaults
name
- base name for value, as decided by mappingpublic Index getIndex(ValueMapping vm, DBIdentifier name, Table table, Column[] cols)
MappingDefaults
getIndex
in interface MappingDefaults
name
- base name for value, as decided by mappingpublic Index getIndex(Version vers, Table table, Column[] cols)
MappingDefaults
getIndex
in interface MappingDefaults
public Index getIndex(Discriminator disc, Table table, Column[] cols)
MappingDefaults
getIndex
in interface MappingDefaults
public Unique getJoinUnique(FieldMapping fm, Table table, Column[] cols)
MappingDefaults
getJoinUnique
in interface MappingDefaults
public Unique getUnique(ValueMapping vm, String name, Table table, Column[] cols)
MappingDefaults
getUnique
in interface MappingDefaults
name
- base name for value, as decided by mappingpublic Unique getUnique(ValueMapping vm, DBIdentifier name, Table table, Column[] cols)
MappingDefaults
getUnique
in interface MappingDefaults
name
- base name for value, as decided by mappingpublic String getPrimaryKeyName(ClassMapping cm, Table table)
MappingDefaults
getPrimaryKeyName
in interface MappingDefaults
public DBIdentifier getPrimaryKeyIdentifier(ClassMapping cm, Table table)
MappingDefaults
getPrimaryKeyIdentifier
in interface MappingDefaults
public void installPrimaryKey(FieldMapping fm, Table table)
MappingDefaults
installPrimaryKey
in interface MappingDefaults
public void setConfiguration(Configuration conf)
Configurable
setConfiguration
in interface Configurable
public void startConfiguration()
Configurable
startConfiguration
in interface Configurable
public void endConfiguration()
Configurable
endConfiguration
in interface Configurable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |