K
- The type of the key used by the progress-to-java
map. For permanent
DMOs, this will be a String
. For temporary DMOs, this will be an
Integer
value with the UNIQUE-ID
identifying the
TempTable
resource.public abstract class TableMapper<K>
extends java.lang.Object
TableMapper.LegacyTableInfo
instance.
For physical DBs, the mappings for the permanent DBs (connected at server startup) will be registered at server startup. For permanent DBs connected at application runtime, the mappings will be registered and deregistered at the appropriate DB connection/disconnection times.
All the mappings for temporary tables will be registered during application lifetime, as the temp tables get created or dropped.
APIs which resolve a legacy name for a converted name may return null, when resolving an index,
field or property name; this is to allow checks for synthetic properties or indexes, which do
not exist in the legacy code. In all cases, it is expected that the given table name is for a
table which has registered mappings; else, a NullPointerException
will be thrown.
Modifier and Type | Class and Description |
---|---|
private static class |
TableMapper.DynamicTempTableMapper |
private static class |
TableMapper.LegacyFieldInfo
A container with a field's legacy and DMO property name and field attributes.
|
private static class |
TableMapper.LegacyIndexComponentInfo
A container with an index component information.
|
private static class |
TableMapper.LegacyIndexInfo
A container with a index information, holding index attributes and components.
|
private static class |
TableMapper.LegacyTableInfo
A container with the legacy info for a table.
|
private static class |
TableMapper.PermanentTableMapper
Mapper for permanent tables.
|
private static class |
TableMapper.StaticTempTableMapper |
private static class |
TableMapper.TempTableMapper
Mapper for temporary tables.
|
Modifier and Type | Field and Description |
---|---|
private static ContextLocal<TableMapper.TempTableMapper> |
dynamicDB
Context-local mapper for all dynamic temporary tables
|
private static java.util.Map<java.lang.String,TableMapper.PermanentTableMapper> |
permanentDBs
Holds the mappers for all permanent databases by their schema name
|
private java.lang.String |
schema
The schema name
|
private static TableMapper.TempTableMapper |
staticTempDB
Holds the mapper for all statically defined temp tables
|
Modifier | Constructor and Description |
---|---|
private |
TableMapper(java.lang.String schema)
Create a new mapper for the given schema.
|
Modifier and Type | Method and Description |
---|---|
protected void |
clear()
Clear all the mappings.
|
java.lang.String |
denormalizedProperty(java.lang.Class<?> dmoIface,
java.lang.String property,
java.lang.Integer index)
Get new field name for denormalized legacy field name and index.
|
(package private) static P2JIndex |
findJoiningIndex(RecordBuffer buffer,
java.util.Set<java.lang.String> commonFields)
Given a table and a map of fields which this table class has in common (by name and type)
with another table, find the index which can be used to join this table with the other.
|
(package private) static java.util.Set<java.lang.String> |
getCommonFields(RecordBuffer buf1,
RecordBuffer buf2)
Compose a set of legacy field names which represents the intersection of the fields (by name
and type) of the two tables.
|
static java.lang.String |
getDenormalizedProperty(java.lang.Class<?> dmoIface,
java.lang.String property,
java.lang.Integer index)
Get new field name for denormalized legacy field name and index.
|
static java.lang.Class<?> |
getDMOClass(java.lang.String schema,
java.lang.String table)
Get the DMO implementation class for the legacy table name (part of the specified schema).
|
static java.lang.Class<?> |
getDMOClass(TempTable table)
Get the DMO implementation class for the specified
TempTable resource. |
static java.lang.String |
getExtent4GLName(java.lang.Class<?> dmoIface,
java.lang.String fieldNameHibernate)
Get the 4GL name of the extent field
|
static BaseDataType |
getExtentValue(java.lang.Class<?> dmoIface,
java.lang.String fieldNameHibernate)
Get the value of the extent field
|
static BaseDataType |
getFieldValue(java.lang.Class<?> dmoIface,
java.lang.String fieldNameHibernate)
Get the value of the non-extent field
|
(package private) static java.util.Set<java.lang.String> |
getIndexFieldNames(RecordBuffer buffer,
P2JIndex index)
Compose a set of all legacy field names defined for the given index.
|
protected java.lang.String |
getIndexName(K legacyKey,
java.lang.String idx)
Get the converted index name for the specified legacy index.
|
static java.lang.String |
getIndexName(java.lang.String schema,
java.lang.String table,
java.lang.String idx)
Resolve the converted index name for a legacy index belonging to the specified legacy table.
|
static java.lang.String |
getIndexName(TempTable table,
java.lang.String idx)
Resolve the converted index name for a legacy index belonging to the temp-table defined
by the
TempTable resource. |
static java.lang.String |
getLegacyFieldColumnLabel(Buffer buffer,
java.lang.String property)
Get the COLUMN-LABEL field attribute for the property associated with the DMO referenced
by the given buffer.
|
static java.lang.String |
getLegacyFieldFormat(Buffer buffer,
java.lang.String property)
Get the FORMAT field attribute for the property associated with the DMO referenced by the
given buffer.
|
static integer |
getLegacyFieldId(Buffer buffer,
java.lang.String property)
Get the id of field in the sequence of the fields of the buffer.
|
private static TableMapper.LegacyFieldInfo |
getLegacyFieldInfo(Buffer buffer,
java.lang.String property)
Get the legacy field info for the property associated with the DMO referenced by the given
buffer.
|
static TableMapper.LegacyFieldInfo |
getLegacyFieldInfo(java.lang.Class<?> dmoIface,
java.lang.String property)
Get the legacy field for the given property, which is defined by a DMO part of a
permanent DB.
|
static TableMapper.LegacyFieldInfo |
getLegacyFieldInfo(TempTable tt,
java.lang.String property)
Get the legacy field for the given
TempTable resource and property. |
static java.lang.String |
getLegacyFieldInitial(Buffer buffer,
java.lang.String property)
Get the INITIAL field attribute for the property associated with the DMO referenced by the
given buffer.
|
static java.lang.String |
getLegacyFieldLabel(Buffer buffer,
java.lang.String property)
Get the LABEL field attribute for the property associated with the DMO referenced
by the given buffer.
|
static logical |
getLegacyFieldLiteralQuestion(Buffer buffer,
java.lang.String property)
Get the LITERAL-QUESTION field attribute for the property associated with the DMO
referenced by the given buffer.
|
static java.lang.String |
getLegacyFieldName(Buffer buffer,
java.lang.String property)
Get the legacy field name for the property associated with the DMO referenced by the given
buffer.
|
static java.lang.String |
getLegacyFieldName(java.lang.Class<?> dmoIface,
java.lang.String property)
Get the legacy field name for the given property, which is defined by a DMO part of a
permanent DB.
|
static java.lang.String |
getLegacyFieldName(TempTable tt,
java.lang.String property)
Get the legacy field name for the given
TempTable resource and property. |
(package private) static LegacyFieldNameMap |
getLegacyFieldNameMap(RecordBuffer buffer)
A helper method to return bi-directional mapping of (lower case) legacy field names to
their DMO property counterparts, optimized to gather information about all fields at once.
|
static java.lang.String |
getLegacyFieldValidateExpression(Buffer buffer,
java.lang.String property)
Get the VALIDATE-EXPRESSION field attribute for the property associated with the DMO
referenced by the given buffer.
|
static java.lang.String |
getLegacyFieldValidateMessage(Buffer buffer,
java.lang.String property)
Get the VALIDATE-MESSAGE field attribute for the property associated with the DMO
referenced by the given buffer.
|
static TableMapper.LegacyIndexInfo |
getLegacyIndexInfo(Buffer buffer,
int indexNum)
Get information about the index associated with the DMO referenced by the given buffer,
as a string.
|
static TableMapper.LegacyIndexInfo |
getLegacyIndexInfo(java.lang.Class<?> dmoIface,
int indexNum)
Get information about the index associated with the given DMO class, as a string.
|
static TableMapper.LegacyIndexInfo |
getLegacyIndexInfo(TempTable tt,
int indexNum)
Get information about the index associated with the given temporary table, as a string.
|
static java.lang.String |
getLegacyIndexInfoString(Buffer buffer,
int indexNum)
Get information about the index associated with the DMO referenced by the given buffer,
as a string.
|
static java.lang.String |
getLegacyIndexName(Buffer buffer,
java.lang.String idx)
Get the legacy index name of a converted index, defined by the backing table of the
specified buffer.
|
static java.lang.String |
getLegacyIndexName(java.lang.Class<?> dmoIface,
java.lang.String idx)
Get the legacy name of a converted index, which is defined by the backing table for the
specified buffer, part of a permanent DB.
|
static java.lang.String |
getLegacyIndexName(TempTable tt,
java.lang.String idx)
Get the legacy index name for the given
TempTable resource and converted index name. |
static java.lang.String |
getLegacyName(Buffer buffer)
Get the legacy table name for the DMO referenced by the given buffer.
|
static java.lang.String |
getLegacyName(java.lang.Class<?> dmoIface)
Get the legacy table name for the given DMO, which is part of a permanent DB.
|
static java.lang.String |
getLegacyName(TempTable tt)
Get the legacy table name for the given
TempTable resource. |
static java.util.List<java.lang.String> |
getLegacyProperties(java.lang.Class<?> dmoIface)
Get the legacy fields' list which are defined by a DMO part of a permanent DB.
|
protected int |
getNumFields(K legacyKey)
Get the number of fields in the table mapped to the given key.
|
static int |
getNumFields(java.lang.String schema,
java.lang.String table)
Get the number of fields belonging to the specified legacy table.
|
static int |
getNumFields(TempTable table)
Resolve the number of fields belonging to the specified
TempTable resource. |
static java.lang.String |
getPropertyName(Buffer buffer,
java.lang.String legacyFieldName)
Get the DMO property name for the given buffer and legacy field name.
|
static java.lang.String |
getPropertyName(java.lang.Class<?> dmoIface,
int fieldId)
Get the DMO property name for a field index belonging to the specified legacy table.
|
protected java.lang.String |
getPropertyName(K legacyKey,
int fieldId,
java.lang.Integer index)
Get the property name for the specified field index.
|
protected java.lang.String |
getPropertyName(K legacyKey,
java.lang.String field,
java.lang.Integer index)
Get the property name for the specified field.
|
static java.lang.String |
getPropertyName(java.lang.String schema,
java.lang.String table,
int fieldId)
Get the DMO property name for a field index belonging to the specified legacy table.
|
static java.lang.String |
getPropertyName(java.lang.String schema,
java.lang.String table,
int fieldId,
java.lang.Integer index)
Get the DMO property name for a field index belonging to the specified legacy table.
|
static java.lang.String |
getPropertyName(java.lang.String schema,
java.lang.String table,
java.lang.String field)
Get the DMO property name for a legacy field name belonging to the specified legacy table.
|
static java.lang.String |
getPropertyName(java.lang.String schema,
java.lang.String table,
java.lang.String field,
java.lang.Integer index)
Get the DMO property name for a legacy field name belonging to the specified legacy table.
|
private static java.lang.String |
getPropertyName(TableMapper.LegacyTableInfo tableInfo,
TableMapper.LegacyFieldInfo fieldInfo,
java.lang.Integer index)
Get the property name for the specified table info, field info and null-based index.
|
static java.lang.String |
getPropertyName(TempTable table,
int fieldId)
Resolve the DMO property name for a field index name belonging to the specified
TempTable resource. |
static java.lang.String |
getPropertyName(TempTable table,
int fieldId,
java.lang.Integer index)
Resolve the DMO property name for a field index name belonging to the specified
TempTable resource. |
static java.lang.String |
getPropertyName(TempTable table,
java.lang.String field)
Resolve the DMO property name for a legacy field name belonging to the specified
TempTable resource. |
static java.lang.String |
getPropertyName(TempTable table,
java.lang.String field,
java.lang.Integer index)
Resolve the DMO property name for a legacy field name belonging to the specified
TempTable resource. |
static boolean |
hasValidation(java.lang.Class<?> dmoIface)
Determine if the permanent table has table-level delete validation.
|
static logical |
isLegacyFieldMandatory(Buffer buffer,
java.lang.String property)
Get the MANDATORY field attribute for the property associated with the DMO
referenced by the given buffer.
|
protected abstract java.util.Map<java.lang.Class<?>,TableMapper.LegacyTableInfo> |
j2p()
Get the mapping of DMO implementation classes to
TableMapper.LegacyTableInfo instances. |
protected TableMapper.LegacyFieldInfo |
legacyFieldInfo(java.lang.Class<?> dmoIface,
java.lang.String property)
Get legacy field info for a field from the specified legacy table.
|
protected java.lang.String |
legacyFieldName(java.lang.Class<?> dmoIface,
java.lang.String property)
Get the legacy field name for given property defined by the specified DMO.
|
protected TableMapper.LegacyIndexInfo |
legacyIndexInfo(java.lang.Class<?> dmoIface,
int indexNum)
Get information about the index associated with the given DMO class.
|
protected java.lang.String |
legacyIndexName(java.lang.Class<?> dmoIface,
java.lang.String idx)
Get the legacy index name of converted index, which is defined by the backing table for the
specified DMO implementation class.
|
protected java.lang.String |
legacyName(java.lang.Class<?> dmoIface)
Get the legacy table name associated with the given DMO implementation class.
|
private static TableMapper.PermanentTableMapper |
locatePerm(java.lang.String schema)
Locate the
TableMapper.PermanentTableMapper instance for the given schema. |
private static TableMapper.TempTableMapper |
locateTemp(TempTable tt)
Locate the appropriate
TableMapper.TempTableMapper for the given temp-table. |
(package private) static void |
mapPermanentDMO(java.lang.String schema,
java.lang.Class<?> dmoClass)
Add the legacy mappings for the specified DMO.
|
(package private) static void |
mapTemporaryTable(TempTable table)
Add the legacy mappings for the given temporary table.
|
protected abstract java.util.Map<K,TableMapper.LegacyTableInfo> |
p2j()
Get the mapping of legacy table keys to
TableMapper.LegacyTableInfo instances. |
protected java.lang.String |
propertyName(java.lang.Class<?> dmoIface,
int fieldId)
Get the DMO property name for a field index belonging to the specified legacy table.
|
protected void |
removeClass(java.lang.Class<?> dmoIface)
Remove the mappings for the specified DMO implementation class.
|
(package private) static void |
removeDynamicTempTables()
Remove all the temporary tables for this context.
|
(package private) static void |
removePermanentSchema(java.lang.String schema)
Remove the mappings for the specified schema.
|
(package private) static void |
removeTemporaryTable(TempTable table)
Remove the mappings for the given temporary table.
|
static void |
setLegacyFieldColumnLabel(Buffer buffer,
java.lang.String property,
java.lang.String columnLabel)
Set the COLUMN-LABEL field attribute for the property associated with the DMO referenced
by the given buffer.
|
static void |
setLegacyFieldFormat(Buffer buffer,
java.lang.String property,
java.lang.String format)
Set the FORMAT field attribute for the property associated with the DMO referenced by the
given buffer.
|
static void |
setLegacyFieldLabel(Buffer buffer,
java.lang.String property,
java.lang.String label)
Set the LABEL field attribute for the property associated with the DMO referenced
by the given buffer.
|
static void |
setLegacyFieldLiteralQuestion(Buffer buffer,
java.lang.String property,
logical literalQuestion)
Set the LITERAL-QUESTION field attribute for the property associated with the DMO
referenced by the given buffer.
|
static void |
setLegacyFieldValidateExpression(Buffer buffer,
java.lang.String property,
java.lang.String validateExpression)
Set the VALIDATE-EXPRESSION field attribute for the property associated with the DMO
referenced by the given buffer.
|
static void |
setLegacyFieldValidateMessage(Buffer buffer,
java.lang.String property,
java.lang.String validateMessage)
Set the VALIDATE-MESSAGE field attribute for the property associated with the DMO
referenced by the given buffer.
|
protected boolean |
validation(java.lang.Class<?> dmoIface)
Determine if the table has table-level delete validation.
|
private static final java.util.Map<java.lang.String,TableMapper.PermanentTableMapper> permanentDBs
private static final TableMapper.TempTableMapper staticTempDB
private static final ContextLocal<TableMapper.TempTableMapper> dynamicDB
private final java.lang.String schema
private TableMapper(java.lang.String schema)
schema
- The schema name.public static java.lang.String getDenormalizedProperty(java.lang.Class<?> dmoIface, java.lang.String property, java.lang.Integer index)
dmoIface
- The DMO interface for a permanent DMO.property
- The DMO property name.index
- zero-based index of this property in denormalization hints or null.public static java.lang.String getLegacyName(Buffer buffer)
buffer
- A buffer instance.public static java.lang.String getLegacyFieldColumnLabel(Buffer buffer, java.lang.String property)
buffer
- A buffer instance.property
- The DMO property name.null
if there is no such field.public static void setLegacyFieldColumnLabel(Buffer buffer, java.lang.String property, java.lang.String columnLabel)
buffer
- A buffer instance.property
- The DMO property name.columnLabel
- COLUMN-LABEL field attribute.public static java.lang.String getLegacyFieldLabel(Buffer buffer, java.lang.String property)
buffer
- A buffer instance.property
- The DMO property name.null
if there is no such field.public static void setLegacyFieldLabel(Buffer buffer, java.lang.String property, java.lang.String label)
buffer
- A buffer instance.property
- The DMO property name.label
- LABEL field attribute.public static integer getLegacyFieldId(Buffer buffer, java.lang.String property)
buffer
- A buffer instance.property
- The DMO property name.public static logical getLegacyFieldLiteralQuestion(Buffer buffer, java.lang.String property)
buffer
- A buffer instance.property
- The DMO property name.null
if there is no such field.public static void setLegacyFieldLiteralQuestion(Buffer buffer, java.lang.String property, logical literalQuestion)
buffer
- A buffer instance.property
- The DMO property name.literalQuestion
- LITERAL-QUESTION field attribute.public static logical isLegacyFieldMandatory(Buffer buffer, java.lang.String property)
buffer
- A buffer instance.property
- The DMO property name.null
if there is no such field.public static java.lang.String getLegacyFieldValidateExpression(Buffer buffer, java.lang.String property)
buffer
- A buffer instance.property
- The DMO property name.null
if there is no such
field.public static void setLegacyFieldValidateExpression(Buffer buffer, java.lang.String property, java.lang.String validateExpression)
buffer
- A buffer instance.property
- The DMO property name.validateExpression
- VALIDATE-EXPRESSION field attribute.public static java.lang.String getLegacyFieldValidateMessage(Buffer buffer, java.lang.String property)
buffer
- A buffer instance.property
- The DMO property name.null
if there is no
such field.public static void setLegacyFieldValidateMessage(Buffer buffer, java.lang.String property, java.lang.String validateMessage)
buffer
- A buffer instance.property
- The DMO property name.validateMessage
- VALIDATE-MESSAGE field attribute.public static java.lang.String getLegacyFieldFormat(Buffer buffer, java.lang.String property)
buffer
- A buffer instance.property
- The DMO property name.null
if there is no such field.public static void setLegacyFieldFormat(Buffer buffer, java.lang.String property, java.lang.String format)
buffer
- A buffer instance.property
- The DMO property name.format
- FORMAT field attribute.public static java.lang.String getLegacyFieldInitial(Buffer buffer, java.lang.String property)
buffer
- A buffer instance.property
- The DMO property name.null
if there is no such field.public static java.lang.String getLegacyFieldName(Buffer buffer, java.lang.String property)
buffer
- A buffer instance.property
- The DMO property name.null
if there is no such field.public static java.lang.String getLegacyIndexInfoString(Buffer buffer, int indexNum)
buffer
- A buffer instance which specifies the DMO class associated with the target index.indexNum
- 0-based index number in the index definition order.null
if there is no index
with the given number. Format of the string is described in
Buffer.indexInformation(int)
.public static java.lang.String getLegacyIndexName(Buffer buffer, java.lang.String idx)
buffer
- A buffer instance.idx
- The converted index name.null
if there is no such index defined.public static java.lang.String getLegacyName(java.lang.Class<?> dmoIface)
dmoIface
- The DMO interface for a permanent DMO.java.lang.IllegalStateException
- If a DMO belonging to the DatabaseManager.TEMP_TABLE_SCHEMA
temp schema
is passed as a parameter; for these cases, getLegacyName(TempTable)
or getLegacyName(Buffer)
must be used.public static boolean hasValidation(java.lang.Class<?> dmoIface)
dmoIface
- The DMO interface for a permanent DMO which defines the target table.true
if the table has table-level delete validation.java.lang.IllegalStateException
- If a DMO belonging to the DatabaseManager.TEMP_TABLE_SCHEMA
temp schema
is passed as a parameter.public static java.lang.String getLegacyFieldName(java.lang.Class<?> dmoIface, java.lang.String property)
dmoIface
- The DMO interface for a permanent DMO.property
- The DMO property name.null
if there is no such field.java.lang.IllegalStateException
- If a DMO belonging to the DatabaseManager.TEMP_TABLE_SCHEMA
temp schema
is passed as a parameter; for these cases, getLegacyFieldName(TempTable,
String)
or getLegacyFieldName(Buffer, String)
must be used.public static BaseDataType getExtentValue(java.lang.Class<?> dmoIface, java.lang.String fieldNameHibernate)
dmoIface
- The DMO interface for a permanent DMO.fieldNameHibernate
- the field's Hibernate namepublic static BaseDataType getFieldValue(java.lang.Class<?> dmoIface, java.lang.String fieldNameHibernate)
dmoIface
- The DMO interface for a permanent DMO.fieldNameHibernate
- the field's Hibernate namepublic static java.lang.String getExtent4GLName(java.lang.Class<?> dmoIface, java.lang.String fieldNameHibernate)
dmoIface
- The DMO interface for a permanent DMO.fieldNameHibernate
- the field's Hibernate namepublic static TableMapper.LegacyFieldInfo getLegacyFieldInfo(java.lang.Class<?> dmoIface, java.lang.String property)
dmoIface
- The DMO interface for a permanent DMO.property
- The DMO property name.null
if a table belonging to the
DatabaseManager.TEMP_TABLE_SCHEMA
is used or there is no such field.public static java.util.List<java.lang.String> getLegacyProperties(java.lang.Class<?> dmoIface)
dmoIface
- The DMO interface for a permanent DMO.DatabaseManager.TEMP_TABLE_SCHEMA
or empty list if it is not.public static java.lang.String getLegacyIndexName(java.lang.Class<?> dmoIface, java.lang.String idx)
dmoIface
- The DMO interface for a permanent DMO.idx
- The converted index name.null
if there is no such index defined.java.lang.IllegalStateException
- If a DMO belonging to the DatabaseManager.TEMP_TABLE_SCHEMA
temp schema
is passed as a parameter; for these cases, getLegacyFieldName(TempTable,
String)
or getLegacyFieldName(Buffer, String)
must be used.public static java.lang.String getLegacyName(TempTable tt)
TempTable
resource.tt
- The TempTable
resource.public static java.lang.String getLegacyFieldName(TempTable tt, java.lang.String property)
TempTable
resource and property.tt
- The TempTable
resource.property
- The DMO property name.null
if there is no such field.public static TableMapper.LegacyFieldInfo getLegacyFieldInfo(TempTable tt, java.lang.String property)
TempTable
resource and property.tt
- The TempTable
resource.property
- The DMO property name.null
if there is no such field.public static java.lang.String getLegacyIndexName(TempTable tt, java.lang.String idx)
TempTable
resource and converted index name.tt
- The TempTable
resource.idx
- The converted index name.null
if there is no such index defined.public static java.lang.Class<?> getDMOClass(TempTable table)
TempTable
resource.table
- The TempTable
resource.public static java.lang.String getPropertyName(TempTable table, java.lang.String field)
TempTable
resource.table
- The TempTable
resource.field
- The legacy field name.null
if
there is no such field.public static java.lang.String getPropertyName(TempTable table, java.lang.String field, java.lang.Integer index)
TempTable
resource.table
- The TempTable
resource.field
- The legacy field name.index
- null
for usual properties and zero-based index of this property for
denormalized field with extent.null
if
there is no such field.public static java.lang.String getPropertyName(TempTable table, int fieldId)
TempTable
resource.table
- The TempTable
resource.fieldId
- The field index in table declaring sequence.null
if
there is no such field.public static java.lang.String getPropertyName(TempTable table, int fieldId, java.lang.Integer index)
TempTable
resource.table
- The TempTable
resource.fieldId
- The field index in table declaring sequence.index
- null
for usual properties and zero-based index of this property for
denormalized field with extent.null
if
there is no such field.public static int getNumFields(TempTable table)
TempTable
resource.table
- The TempTable
resource.null
if
there is no such field.public static java.lang.String getIndexName(TempTable table, java.lang.String idx)
TempTable
resource.table
- The TempTable
resource.idx
- The legacy index name.null
if there is no such index.public static java.lang.Class<?> getDMOClass(java.lang.String schema, java.lang.String table)
schema
- The schema name.table
- The legacy table name.null
if there is no table with the
given name.java.lang.IllegalArgumentException
- If a table belonging to the DatabaseManager.TEMP_TABLE_SCHEMA
is used.public static java.lang.String getPropertyName(java.lang.String schema, java.lang.String table, java.lang.String field)
schema
- The schema name.table
- The legacy table name.field
- The legacy field name.null
if
there is no such field.java.lang.IllegalArgumentException
- If a table belonging to the DatabaseManager.TEMP_TABLE_SCHEMA
is used.public static java.lang.String getPropertyName(java.lang.String schema, java.lang.String table, java.lang.String field, java.lang.Integer index)
schema
- The schema name.table
- The legacy table name.field
- The legacy field name.index
- null
for usual properties and zero-based index of this property for
denormalized field with extent.null
if
there is no such field.java.lang.IllegalArgumentException
- If a table belonging to the DatabaseManager.TEMP_TABLE_SCHEMA
is used.public static java.lang.String getPropertyName(java.lang.String schema, java.lang.String table, int fieldId)
schema
- The schema name.table
- The legacy table name.fieldId
- The field index.null
if
there is no such field.java.lang.IllegalArgumentException
- If a table belonging to the DatabaseManager.TEMP_TABLE_SCHEMA
is used.public static java.lang.String getPropertyName(java.lang.String schema, java.lang.String table, int fieldId, java.lang.Integer index)
schema
- The schema name.table
- The legacy table name.fieldId
- The field index.index
- null
for usual properties and zero-based index of this property for
denormalized field with extent.null
if
there is no such field.java.lang.IllegalArgumentException
- If a table belonging to the DatabaseManager.TEMP_TABLE_SCHEMA
is used.public static int getNumFields(java.lang.String schema, java.lang.String table)
schema
- The schema name.table
- The legacy table name.java.lang.IllegalArgumentException
- If a table belonging to the DatabaseManager.TEMP_TABLE_SCHEMA
is used.public static java.lang.String getPropertyName(java.lang.Class<?> dmoIface, int fieldId)
dmoIface
- The DMO interface for a permanent DMO.fieldId
- The field index.null
if
there is no such field.java.lang.IllegalArgumentException
- If a table belonging to the DatabaseManager.TEMP_TABLE_SCHEMA
is used.public static java.lang.String getPropertyName(Buffer buffer, java.lang.String legacyFieldName)
buffer
- Buffer which belongs to the target table.legacyFieldName
- Legacy name of the target field.public static java.lang.String getIndexName(java.lang.String schema, java.lang.String table, java.lang.String idx)
schema
- The schema name.table
- The legacy table name.idx
- The legacy index name.null
if there is no such index.java.lang.IllegalArgumentException
- If a table belonging to the DatabaseManager.TEMP_TABLE_SCHEMA
is used.static void mapPermanentDMO(java.lang.String schema, java.lang.Class<?> dmoClass)
schema
- The schema to which the DMO belongs.dmoClass
- The MDO implementation class.static void removePermanentSchema(java.lang.String schema)
schema
- The schema name.static void removeDynamicTempTables()
static void mapTemporaryTable(TempTable table)
table
- The TempTable
resource.static void removeTemporaryTable(TempTable table)
table
- The TempTable
resource to be removed.static java.util.Set<java.lang.String> getCommonFields(RecordBuffer buf1, RecordBuffer buf2)
buf1
- The record buffer which represents the first table.buf2
- The record buffer which represents the second table.static P2JIndex findJoiningIndex(RecordBuffer buffer, java.util.Set<java.lang.String> commonFields) throws PersistenceException
buffer
- The buffer which represents the table to be searched for a suitable index.commonFields
- Map of legacy fields which the given table has in common with another one.commonFields
, or null
if no such
index is found.PersistenceException
static java.util.Set<java.lang.String> getIndexFieldNames(RecordBuffer buffer, P2JIndex index) throws PersistenceException
buffer
- The buffer which represents the table to which the index belongs.index
- The index whose fields are to be included in the set.PersistenceException
static LegacyFieldNameMap getLegacyFieldNameMap(RecordBuffer buffer)
buffer
- Record buffer for which the mapping is needed.private static TableMapper.LegacyFieldInfo getLegacyFieldInfo(Buffer buffer, java.lang.String property)
buffer
- A buffer instance.property
- The DMO property name.null
if there is no such field.public static TableMapper.LegacyIndexInfo getLegacyIndexInfo(Buffer buffer, int indexNum)
buffer
- A buffer instance which specifies the DMO class associated with the target index.indexNum
- 0-based index number in the index definition order.null
if there is no index
with the given number. Format of the string is described in
Buffer.indexInformation(int)
.public static TableMapper.LegacyIndexInfo getLegacyIndexInfo(TempTable tt, int indexNum)
tt
- Temporary table associated with the target index.indexNum
- 0-based index number in the index definition order.null
if there is no index
with the given number. Format of the string is described in
Buffer.indexInformation(int)
.public static TableMapper.LegacyIndexInfo getLegacyIndexInfo(java.lang.Class<?> dmoIface, int indexNum)
dmoIface
- DMO class associated with the target index.indexNum
- 0-based index number in the index definition order.null
if there is no index
with the given number. Format of the string is described in
Buffer.indexInformation(int)
.private static TableMapper.TempTableMapper locateTemp(TempTable tt)
TableMapper.TempTableMapper
for the given temp-table. If it is statically
defined, return the shared, static version, else return the context-local version for
dynamically defined temp-tables.tt
- Temp-table object.private static TableMapper.PermanentTableMapper locatePerm(java.lang.String schema)
TableMapper.PermanentTableMapper
instance for the given schema.schema
- The schema name.protected java.lang.String legacyName(java.lang.Class<?> dmoIface)
dmoIface
- The DMO interface.protected boolean validation(java.lang.Class<?> dmoIface)
dmoIface
- The DMO interface associated with the given table.true
if the table has table-level delete validation.protected java.lang.String legacyFieldName(java.lang.Class<?> dmoIface, java.lang.String property)
dmoIface
- The DMO interface.property
- The DMO property name.null
if there is no such field.protected java.lang.String propertyName(java.lang.Class<?> dmoIface, int fieldId)
dmoIface
- The DMO interface for a permanent DMO.fieldId
- The field index.null
if
there is no such field.protected TableMapper.LegacyFieldInfo legacyFieldInfo(java.lang.Class<?> dmoIface, java.lang.String property)
dmoIface
- The DMO interface for a permanent DMO.property
- Property name.null
if there is no such field.protected TableMapper.LegacyIndexInfo legacyIndexInfo(java.lang.Class<?> dmoIface, int indexNum)
dmoIface
- DMO class associated with the target index.indexNum
- 0-based index number in the index definition order.null
if there is no index
with the given number.protected java.lang.String legacyIndexName(java.lang.Class<?> dmoIface, java.lang.String idx)
dmoIface
- The DMO implementation class.idx
- The converted index name.null
if there is no such index defined.protected void removeClass(java.lang.Class<?> dmoIface)
dmoIface
- The DMO interface.protected java.lang.String getPropertyName(K legacyKey, int fieldId, java.lang.Integer index)
legacyKey
.legacyKey
- The key used to identify the TableMapper.LegacyTableInfo
.fieldId
- The index of the field in the buffer's sequence.index
- null
for usual properties and zero-based index of this property for
denormalized field with extent.null
if
there is no such field.protected int getNumFields(K legacyKey)
legacyKey
- Key to which the target table is matched.private static java.lang.String getPropertyName(TableMapper.LegacyTableInfo tableInfo, TableMapper.LegacyFieldInfo fieldInfo, java.lang.Integer index)
tableInfo
- The key used to identify the TableMapper.LegacyTableInfo
.fieldInfo
- The index of the field in the buffer's sequence.index
- null
for usual properties and zero-based index of this property for
denormalized field with extent.protected java.lang.String getIndexName(K legacyKey, java.lang.String idx)
legacyKey
.legacyKey
- The key used to identify the TableMapper.LegacyTableInfo
.idx
- The legacy index name.null
if there is no such index.protected void clear()
public java.lang.String denormalizedProperty(java.lang.Class<?> dmoIface, java.lang.String property, java.lang.Integer index)
dmoIface
- The DMO implementation class for a permanent DMO.property
- The DMO property name.index
- zero-based index of this property in denormalization hints.protected java.lang.String getPropertyName(K legacyKey, java.lang.String field, java.lang.Integer index)
legacyKey
.legacyKey
- The key used to identify the TableMapper.LegacyTableInfo
.field
- The legacy field name.index
- null
for usual properties and zero-based index of this property for
denormalized field with extent.null
if
there is no such field.protected abstract java.util.Map<K,TableMapper.LegacyTableInfo> p2j()
TableMapper.LegacyTableInfo
instances. The type of key
is implementation specific.protected abstract java.util.Map<java.lang.Class<?>,TableMapper.LegacyTableInfo> j2p()
TableMapper.LegacyTableInfo
instances.