public class FastCopyHelper
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
(package private) static class |
FastCopyHelper.CopyMeta
Meta information generated after a table copy.
|
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
BEFORE__PK__MAPPING
Name of a generic use temporary table, used for intermediary operations for before tables
|
private FastCopyHelper.CopyMeta |
beforeCopyMeta
Information produced after copying the before tables
|
private boolean |
beforePkMapping
Flag set when a database level mapping exists for the before table copy operation
|
private java.lang.String |
beforeSort
A cache for the sort clause used when copying before tables
|
private static java.lang.String |
DST__PK
Name of the field in a database-level pk mapping, which stores a destination pk
|
private TemporaryBuffer |
dstB4Buf
A buffer over the destination before temp-table to which the records should be copied
|
private java.util.List<Property> |
dstB4SimpleProps
The list of properties specific to the destination before temp-table
|
private TemporaryBuffer |
dstBuf
A buffer over the destination master temp-table to which the records should be copied
|
private java.util.List<Property> |
dstSimpleProps
The list of properties specific to the destination master temp-table
|
private java.util.Map<java.lang.Integer,java.util.List<Property[]>> |
extentB4Fields
A collection of extent fields specific to the before tables.
|
private java.util.Map<java.lang.Integer,java.util.List<Property[]>> |
extentFields
A collection of extent fields specific to the master tables.
|
private static java.lang.String |
LIST__INDEX__TABLE
Name of a generic use intermediate table, used for storing the indexes of an extent
|
private static java.lang.String |
MASTER__PK__MAPPING
Name of a generic use temporary table, used for intermediary operations for master tables
|
private FastCopyHelper.CopyMeta |
masterCopyMeta
Information produced after copying the master tables
|
private boolean |
masterPkMapping
Flag set when a database level mapping exists for the master copy operation
|
private java.lang.String |
masterSort
A cache for the sort clause used when copying master tables
|
private static java.lang.String |
MULTIPLEX_FIELD_NAME
Name of the multiplex ID field in temp table DMO classes
|
private java.util.Map<RecordBuffer.DatumAccess,RecordBuffer.DatumAccess> |
propsB4Map
A property mapping in case this is not a simple copy - dedicated for before tables
|
private java.util.Map<RecordBuffer.DatumAccess,RecordBuffer.DatumAccess> |
propsMap
A property mapping in case this is not a simple copy - dedicated for master tables
|
private boolean |
simpleCopy
Flag which indicates that this is a simpleCopy (no need for property mapping)
|
private static java.lang.String |
SRC__PK
Name of the field in a database-level pk mapping, which stores a source pk
|
private TemporaryBuffer |
srcB4Buf
A buffer over the source before temp-table from which the records should be copied
|
private java.util.List<Property> |
srcB4SimpleProps
The list of properties specific to the source before temp-table
|
private java.util.Map<java.lang.Long,java.lang.Long[]> |
srcB4ToDstB4Pks
A cache for the primary key mapping after the copying of before tables
|
private TemporaryBuffer |
srcBuf
A buffer over the source master temp-table from which the records should be copied
|
private java.util.List<Property> |
srcSimpleProps
The list of properties specific to the source master temp-table
|
private java.util.Map<java.lang.Long,java.lang.Long[]> |
srcToDstPks
A cache for the primary key mapping after the copying of master tables
|
Constructor and Description |
---|
FastCopyHelper(boolean simpleCopy,
TemporaryBuffer srcBuf,
TemporaryBuffer dstBuf,
java.util.Map<RecordBuffer.DatumAccess,RecordBuffer.DatumAccess> propsMap,
java.util.Map<RecordBuffer.DatumAccess,RecordBuffer.DatumAccess> propsB4Map,
TemporaryBuffer srcB4Buf,
TemporaryBuffer dstB4Buf)
Basic constructor
|
Modifier and Type | Method and Description |
---|---|
private static void |
appendColumnName(DmoMeta srcMeta,
DmoMeta dstMeta,
Property srcProp,
Property dstProp,
java.lang.StringBuilder srcSb,
java.lang.StringBuilder dstSb,
java.util.List<java.lang.Object> args)
A helper method which will append a source and destination property name to correct string builders:
comma separated and having support for datetime-tz data type.
|
(package private) boolean |
canFastCopy(boolean looseCopy)
This should be used in order to detect if this helper can be used in order to execute a fast copy
on the provided temp-tables.
|
private void |
clear()
This method is crucial as long as intermediate database-level primary key mappings were done.
|
private void |
clearBefore()
Particular method which clears the intermediate database-level pk mapping for the before table copy.
|
private void |
clearMaster()
Particular method which clears the intermediate database-level pk mapping for the master table copy.
|
private static java.util.List<java.lang.String> |
computeUniqueConstraintsClauses(DmoMeta srcMeta,
DmoMeta dstMeta,
java.util.List<Property> srcSimpleProps,
java.util.List<Property> dstSimpleProps)
Identify a list of where clauses which rule out duplicate records when copying from a source
to a destination.
|
private void |
copyBeforeTable(boolean append)
This method will call for
copyTable(com.goldencode.p2j.persist.TemporaryBuffer, com.goldencode.p2j.persist.TemporaryBuffer, java.util.List<com.goldencode.p2j.persist.orm.Property>, java.util.List<com.goldencode.p2j.persist.orm.Property>, java.lang.String) with before table specific parameters. |
private void |
copyExtentB4Fields()
This method will call for
copyExtentFields(com.goldencode.p2j.persist.TemporaryBuffer, com.goldencode.p2j.persist.TemporaryBuffer, java.util.Map<java.lang.Integer, java.util.List<com.goldencode.p2j.persist.orm.Property[]>>, java.lang.String) with before table specific parameters. |
private static void |
copyExtentFields(TemporaryBuffer srcBuf,
TemporaryBuffer dstBuf,
java.util.Map<java.lang.Integer,java.util.List<Property[]>> extentFields,
java.lang.String pkMappingTableName)
The procedure which handles the copy between extent tables (only when source and destination properties
are both normalized).
|
private void |
copyExtentMasterFields()
This method will call for
copyExtentFields(com.goldencode.p2j.persist.TemporaryBuffer, com.goldencode.p2j.persist.TemporaryBuffer, java.util.Map<java.lang.Integer, java.util.List<com.goldencode.p2j.persist.orm.Property[]>>, java.lang.String) with master table specific parameters. |
private void |
copyMasterTable(boolean append)
This method will call for
copyTable(com.goldencode.p2j.persist.TemporaryBuffer, com.goldencode.p2j.persist.TemporaryBuffer, java.util.List<com.goldencode.p2j.persist.orm.Property>, java.util.List<com.goldencode.p2j.persist.orm.Property>, java.lang.String) with master table specific parameters. |
private static FastCopyHelper.CopyMeta |
copyTable(TemporaryBuffer srcBuf,
TemporaryBuffer dstBuf,
java.util.List<Property> srcSimpleProps,
java.util.List<Property> dstSimpleProps,
java.lang.String sort)
The main procedure involved when copying the records from a source to a destination.
|
private void |
createBeforePkMapping()
This method will call for
createPkMapping(com.goldencode.p2j.persist.TemporaryBuffer, com.goldencode.p2j.persist.TemporaryBuffer, com.goldencode.p2j.persist.FastCopyHelper.CopyMeta, java.lang.String, java.lang.String) with before table specific parameters. |
private void |
createMasterPkMapping()
This method will call for
createPkMapping(com.goldencode.p2j.persist.TemporaryBuffer, com.goldencode.p2j.persist.TemporaryBuffer, com.goldencode.p2j.persist.FastCopyHelper.CopyMeta, java.lang.String, java.lang.String) with master table specific parameters. |
private static void |
createPkMapping(TemporaryBuffer srcBuf,
TemporaryBuffer dstBuf,
FastCopyHelper.CopyMeta copyMeta,
java.lang.String sort,
java.lang.String pkMappingTableName)
This will create a database-level primary key mapping which can be used in other operations
(through join) in order to speed up the copy process.
|
(package private) rowid |
executeCopy(rowid srcRecId,
boolean append)
Performance improved variant, when we know the destination table can have its
records inserted via
INSERT INTO ... |
private java.util.Map<java.lang.Long,java.lang.Long[]> |
getBeforeMapping()
This method will call for
getMapping(com.goldencode.p2j.persist.Persistence, java.lang.String) with before table specific parameters. |
private java.lang.String |
getBeforeSortClause()
This method will call for
getSortClause(com.goldencode.p2j.persist.TemporaryBuffer, java.lang.String) with before table specific parameters. |
private static java.lang.StringBuilder |
getDstTempColumns()
This builds the columns to which the records should be copied.
|
private static java.lang.String |
getExtentInsertSql(java.lang.String srcExtent,
java.lang.String dstExtent,
java.lang.String extColumnListSrc,
java.lang.String extColumnListDst,
java.lang.String pkMappingTableName)
A generator method which provides a suitable SQL to insert all records from an extent table
to another based on an in-database primary key mapping.
|
private static java.lang.String |
getFastTableCopySql(java.lang.String srcTable,
java.lang.String dstTable,
java.lang.String columnListSrc,
java.lang.String columnListDst,
java.lang.String sqlIndexName,
java.lang.String sort)
A generator method which will copy the records from a source table into a destination table.
|
private static java.lang.Object |
getInitialValue(DmoMeta meta,
Property prop)
Retrieve the initial value of a certain property.
|
private static java.lang.String |
getMappedPropName(java.lang.String propName,
java.util.List<Property> from,
java.util.List<Property> to)
Identify the name of the property in the destination which should match the provided property
from the source.
|
private static java.util.Map<java.lang.Long,java.lang.Long[]> |
getMapping(Persistence persistence,
java.lang.String pkMappingTableName)
This will retrieve the database-level pk mapping into a local mapping.
|
private java.util.Map<java.lang.Long,java.lang.Long[]> |
getMasterMapping()
This method will call for
getMapping(com.goldencode.p2j.persist.Persistence, java.lang.String) with master table specific parameters. |
private java.lang.String |
getMasterSortClause()
This method will call for
getSortClause(com.goldencode.p2j.persist.TemporaryBuffer, java.lang.String) with master table specific parameters. |
private static java.lang.String |
getPkMappingSql(java.lang.String sequenceName,
java.lang.String srcTable,
java.lang.String sqlIndexName,
java.util.List<java.lang.String> extraWhereClauses,
java.lang.String sort,
java.lang.String pkMappingTableName)
A generator method which will create a database-level primary key mapping which can be used
(through join) in order to speed up the copy process.
|
private static java.lang.String |
getShadowCopySql(java.lang.String srcTable,
java.lang.String dstTable,
java.lang.String columnListSrc,
java.lang.String columnListDst,
java.lang.String sort,
java.lang.String pkMappingTableName)
A generator method which will copy the records from a source table into a destination table
based on an already existing database-level pk mapping.
|
private static java.lang.String |
getSimpleExtentInsertSql(int extent,
java.lang.String dstExtent,
java.lang.String extColumnListSrc,
java.lang.String extColumnListDst,
java.lang.String pkMappingTableName)
Special generator method which provides a suitable SQL to insert into a destination table
only default values.
|
private static java.lang.String |
getSortClause(TemporaryBuffer buf,
java.lang.String indexName)
This will return the sort clause which should be used (in case am explicit index name is
provided).
|
private static java.lang.StringBuilder |
getSrcMappedColumns(java.lang.String pkMappingTableName,
java.lang.Integer multiplexId)
A particular method which builds the columns from which the records should be copied in a context
where an intermediate database-level pk mapping is used.
|
private static java.lang.StringBuilder |
getSrcTempColumns(java.lang.String sequenceName,
java.lang.Integer multiplexId)
This builds the columns from which the records should be copied.
|
private void |
processBeforeProperties()
This method will call for
processProperties(boolean, java.util.Map<com.goldencode.p2j.persist.RecordBuffer.DatumAccess, com.goldencode.p2j.persist.RecordBuffer.DatumAccess>, com.goldencode.p2j.persist.orm.DmoMeta, com.goldencode.p2j.persist.orm.DmoMeta, java.util.List<com.goldencode.p2j.persist.orm.Property>, java.util.List<com.goldencode.p2j.persist.orm.Property>, java.util.Map<java.lang.Integer, java.util.List<com.goldencode.p2j.persist.orm.Property[]>>) with before table specific parameters. |
private void |
processMasterProperties()
This method will call for
processProperties(boolean, java.util.Map<com.goldencode.p2j.persist.RecordBuffer.DatumAccess, com.goldencode.p2j.persist.RecordBuffer.DatumAccess>, com.goldencode.p2j.persist.orm.DmoMeta, com.goldencode.p2j.persist.orm.DmoMeta, java.util.List<com.goldencode.p2j.persist.orm.Property>, java.util.List<com.goldencode.p2j.persist.orm.Property>, java.util.Map<java.lang.Integer, java.util.List<com.goldencode.p2j.persist.orm.Property[]>>) with master table specific parameters. |
private static void |
processProperties(boolean simpleCopy,
java.util.Map<RecordBuffer.DatumAccess,RecordBuffer.DatumAccess> propsMap,
DmoMeta srcMeta,
DmoMeta dstMeta,
java.util.List<Property> srcSimpleProps,
java.util.List<Property> dstSimpleProps,
java.util.Map<java.lang.Integer,java.util.List<Property[]>> extentFields)
This extracts information from the source and destination tables.
|
private static void |
restartSequence(Persistence persistence,
java.lang.String sequenceName,
java.lang.Long start)
This is used in order to restart a sequence with a specific value.
|
private static FastCopyHelper.CopyMeta |
safeTableCopy(TemporaryBuffer srcBuf,
TemporaryBuffer dstBuf,
java.util.List<Property> srcSimpleProps,
java.util.List<Property> dstSimpleProps,
java.lang.String sort,
java.lang.String pkMappingTableName)
A more complex way to copy a temp-table which ensures that the unique constraints won't
be violated after copy.
|
private void |
updatePeerRecords()
This method will update the peer values in the master and before tables.
|
private static final java.lang.String MULTIPLEX_FIELD_NAME
private static final java.lang.String MASTER__PK__MAPPING
private static final java.lang.String BEFORE__PK__MAPPING
private static final java.lang.String LIST__INDEX__TABLE
private static final java.lang.String DST__PK
private static final java.lang.String SRC__PK
private boolean simpleCopy
private boolean masterPkMapping
private boolean beforePkMapping
private TemporaryBuffer srcBuf
private TemporaryBuffer dstBuf
private TemporaryBuffer srcB4Buf
private TemporaryBuffer dstB4Buf
private java.util.Map<RecordBuffer.DatumAccess,RecordBuffer.DatumAccess> propsMap
private java.util.Map<RecordBuffer.DatumAccess,RecordBuffer.DatumAccess> propsB4Map
private java.util.List<Property> srcSimpleProps
private java.util.List<Property> dstSimpleProps
private java.util.List<Property> srcB4SimpleProps
private java.util.List<Property> dstB4SimpleProps
private java.util.Map<java.lang.Integer,java.util.List<Property[]>> extentFields
private java.util.Map<java.lang.Integer,java.util.List<Property[]>> extentB4Fields
private FastCopyHelper.CopyMeta masterCopyMeta
private FastCopyHelper.CopyMeta beforeCopyMeta
private java.lang.String masterSort
private java.lang.String beforeSort
private java.util.Map<java.lang.Long,java.lang.Long[]> srcToDstPks
private java.util.Map<java.lang.Long,java.lang.Long[]> srcB4ToDstB4Pks
FastCopyHelper(boolean simpleCopy, TemporaryBuffer srcBuf, TemporaryBuffer dstBuf, java.util.Map<RecordBuffer.DatumAccess,RecordBuffer.DatumAccess> propsMap, java.util.Map<RecordBuffer.DatumAccess,RecordBuffer.DatumAccess> propsB4Map, TemporaryBuffer srcB4Buf, TemporaryBuffer dstB4Buf)
simpleCopy
- Flag identifying if the source and destination tables have the same structure.srcBuf
- The source buffer.dstBuf
- The destination buffer.propsMap
- The property mapping.srcB4Buf
- The source before buffer.dstB4Buf
- The destination before buffer.private static FastCopyHelper.CopyMeta copyTable(TemporaryBuffer srcBuf, TemporaryBuffer dstBuf, java.util.List<Property> srcSimpleProps, java.util.List<Property> dstSimpleProps, java.lang.String sort) throws PersistenceException
srcBuf
- The source buffer.dstBuf
- The destination buffer.srcSimpleProps
- A list of properties in the source table.dstSimpleProps
- A list of properties in the destination table.sort
- The sort clause which should be used when computing the insert SQL.PersistenceException
private static FastCopyHelper.CopyMeta safeTableCopy(TemporaryBuffer srcBuf, TemporaryBuffer dstBuf, java.util.List<Property> srcSimpleProps, java.util.List<Property> dstSimpleProps, java.lang.String sort, java.lang.String pkMappingTableName) throws PersistenceException
canFastCopy(boolean)
.
This technique uses a pre-copy pk mapping, which means that at first we will have a
preselection of the records from the source. Afterwards, we apply a "shadow" copy, meaning
that we won't check the constraints anymore; we just copy the preselected records from
the source to the destination.
This will create a pk mapping. This won't allow post-copy pk mappings as they won't be safe.srcBuf
- The source buffer.dstBuf
- The destination buffer.srcSimpleProps
- A list of properties in the source table.dstSimpleProps
- A list of properties in the destination table.sort
- The sort clause which should be used when computing the insert SQL.pkMappingTableName
- The name of the intermediate table which will be used for pk mapping.PersistenceException
private static java.util.List<java.lang.String> computeUniqueConstraintsClauses(DmoMeta srcMeta, DmoMeta dstMeta, java.util.List<Property> srcSimpleProps, java.util.List<Property> dstSimpleProps)
srcMeta
- The source meta data.dstMeta
- The destination meta data.srcSimpleProps
- A list of properties in the source table.dstSimpleProps
- A list of properties in the destination table.private static java.lang.String getMappedPropName(java.lang.String propName, java.util.List<Property> from, java.util.List<Property> to)
propName
- The property name for which we search a correspondent.from
- The list of properties for the DMO containing the provided property name.to
- The list of properties in which we search for a correspondent.private static void copyExtentFields(TemporaryBuffer srcBuf, TemporaryBuffer dstBuf, java.util.Map<java.lang.Integer,java.util.List<Property[]>> extentFields, java.lang.String pkMappingTableName) throws PersistenceException
srcBuf
- The source buffer.dstBuf
- The destination buffer.extentFields
- The mapping between the source extent fields and destination extent fields. This mapping
is done per extent value.pkMappingTableName
- The name of the table which will be used as a database level primary key mapping.PersistenceException
private static void createPkMapping(TemporaryBuffer srcBuf, TemporaryBuffer dstBuf, FastCopyHelper.CopyMeta copyMeta, java.lang.String sort, java.lang.String pkMappingTableName) throws PersistenceException
srcBuf
- The source buffer.dstBuf
- The destination buffer.copyMeta
- Information generated by the master table copy (which was done before this step).
This is important in order to retrieve the first primary key used by a copied record.sort
- The sort clause used when the records were copied between main tables.pkMappingTableName
- The name which should be used by the table which will store the primary key mapping.
This does not check if the pkMappingTableName already exists.PersistenceException
private static java.lang.String getExtentInsertSql(java.lang.String srcExtent, java.lang.String dstExtent, java.lang.String extColumnListSrc, java.lang.String extColumnListDst, java.lang.String pkMappingTableName)
srcExtent
- The name of the source extent temp-table.dstExtent
- The name of the destination extent temp-table.extColumnListSrc
- A string containing the columns from which the copy should be done.extColumnListDst
- A string containing the columns to which the copy should be done.pkMappingTableName
- The name of the table which stores the primary key mapping.private static java.lang.String getSimpleExtentInsertSql(int extent, java.lang.String dstExtent, java.lang.String extColumnListSrc, java.lang.String extColumnListDst, java.lang.String pkMappingTableName)
extent
- The size of the extent for which the insert sql should be generated.dstExtent
- The name of the destination extent table.extColumnListSrc
- A list of fields from which the copy should be done. This should be formed only by ?,
which will be set on the default values.extColumnListDst
- A list of the names of the extent field properties in the destination.pkMappingTableName
- The name of the in database pk mapping from which the parent-id will be extracted.private static java.lang.String getPkMappingSql(java.lang.String sequenceName, java.lang.String srcTable, java.lang.String sqlIndexName, java.util.List<java.lang.String> extraWhereClauses, java.lang.String sort, java.lang.String pkMappingTableName)
sequenceName
- The name of the sequence which should be used in order to regenerate the destination pksrcTable
- The name of the source table.sqlIndexName
- The SQL name of the index used in the main table copy processsort
- The sort clause used in the main table copy processpkMappingTableName
- The name which should be used for the generated tableprivate static java.lang.String getShadowCopySql(java.lang.String srcTable, java.lang.String dstTable, java.lang.String columnListSrc, java.lang.String columnListDst, java.lang.String sort, java.lang.String pkMappingTableName)
srcTable
- The name of the source table.dstTable
- the name of the destination table.columnListSrc
- A string containing the columns from which the copy should be done.columnListDst
- A string containing the columns to which the copy should be done.sort
- The sort clausepkMappingTableName
- The table which contains the pk mapping.private static java.lang.String getFastTableCopySql(java.lang.String srcTable, java.lang.String dstTable, java.lang.String columnListSrc, java.lang.String columnListDst, java.lang.String sqlIndexName, java.lang.String sort)
srcTable
- The name of the source table.dstTable
- the name of the destination table.columnListSrc
- A string containing the columns from which the copy should be done.columnListDst
- A string containing the columns to which the copy should be done.sqlIndexName
- The name of the index which should be used when copying records.sort
- The sort clauseprivate static void restartSequence(Persistence persistence, java.lang.String sequenceName, java.lang.Long start) throws PersistenceException
persistence
- The persistence instance which is responsible for the sequence.sequenceName
- The sequence which should be restarted.start
- The value with which the sequence should be restarted.PersistenceException
private static java.lang.StringBuilder getSrcTempColumns(java.lang.String sequenceName, java.lang.Integer multiplexId)
sequenceName
- The name of the sequence which will be used when generating destination pk.multiplexId
- The multiplex value which will be stored in the copied records.private static java.lang.StringBuilder getSrcMappedColumns(java.lang.String pkMappingTableName, java.lang.Integer multiplexId)
pkMappingTableName
- The database-level pk mapping which is used when doing the copy.multiplexId
- The multiplex value which will be stored in the copied records.private static java.lang.StringBuilder getDstTempColumns()
private static void processProperties(boolean simpleCopy, java.util.Map<RecordBuffer.DatumAccess,RecordBuffer.DatumAccess> propsMap, DmoMeta srcMeta, DmoMeta dstMeta, java.util.List<Property> srcSimpleProps, java.util.List<Property> dstSimpleProps, java.util.Map<java.lang.Integer,java.util.List<Property[]>> extentFields)
simpleCopy
- A flag indicating if this is a simple copy (the schema of the tables is matching)propsMap
- A mapping between the properties. If the simpleCopy flag is set, this parameter will
be ignored. Otherwise, it is mandatory to have a not-null property mapping.srcMeta
- Meta information regarding the source table.dstMeta
- Meta information regarding the destination table.srcSimpleProps
- The list of properties which will be found in the source (ordered in a compatible fashion
with the destination list of properties)dstSimpleProps
- The list of properties which will be found in the destination (ordered in a compatible fashion
with the source list of properties)extentFields
- A mapping done specifically for extent fields (grouped by extent value)private static void appendColumnName(DmoMeta srcMeta, DmoMeta dstMeta, Property srcProp, Property dstProp, java.lang.StringBuilder srcSb, java.lang.StringBuilder dstSb, java.util.List<java.lang.Object> args)
srcMeta
- The dmo meta of the source.dstMeta
- The dmo meta of the destination. Used to retrieve eventual initial values.srcProp
- The source property which should be appended to the list of source fields.dstProp
- The destination property which should be appended to the list of source fields.srcSb
- The string builder which shall hold the information about the source fields.dstSb
- The string builder which shall hold the information about the destination fields.args
- The list of parameters which will be used in the SQL. Here the default will be appended
if needed.private static java.lang.String getSortClause(TemporaryBuffer buf, java.lang.String indexName) throws PersistenceException
buf
- The buffer for which the index should be searched.indexName
- The index which should be taken in consideration when computing the sort clause.
This can be null, resulting in a default sort clause.PersistenceException
private static java.util.Map<java.lang.Long,java.lang.Long[]> getMapping(Persistence persistence, java.lang.String pkMappingTableName) throws PersistenceException
persistence
- A persistence instance which should be used in order to retrieve the database-level
pk mapping.pkMappingTableName
- The name of the table which stored the database-level pk mapping.PersistenceException
private static java.lang.Object getInitialValue(DmoMeta meta, Property prop)
meta
- The meta of the dmo for the provided property.prop
- The property for which the initial value should be retrieved.boolean canFastCopy(boolean looseCopy)
looseCopy
- A flag indicating if the desired copy is in loose-copy-mode.true
if this helper can be used for fast-copy.rowid executeCopy(rowid srcRecId, boolean append) throws PersistenceException
INSERT INTO ... SELECT FROM
, without having to do any validation on
the records, as the destination table will accept them all.srcRecId
- A source record id for which a destination record id should be computed at the end.
If this is null, then null will be returned.append
- Flag which indicates if this copy is in append mode.PersistenceException
private void updatePeerRecords() throws PersistenceException
PersistenceException
private void processMasterProperties()
processProperties(boolean, java.util.Map<com.goldencode.p2j.persist.RecordBuffer.DatumAccess, com.goldencode.p2j.persist.RecordBuffer.DatumAccess>, com.goldencode.p2j.persist.orm.DmoMeta, com.goldencode.p2j.persist.orm.DmoMeta, java.util.List<com.goldencode.p2j.persist.orm.Property>, java.util.List<com.goldencode.p2j.persist.orm.Property>, java.util.Map<java.lang.Integer, java.util.List<com.goldencode.p2j.persist.orm.Property[]>>)
with master table specific parameters.private void processBeforeProperties()
processProperties(boolean, java.util.Map<com.goldencode.p2j.persist.RecordBuffer.DatumAccess, com.goldencode.p2j.persist.RecordBuffer.DatumAccess>, com.goldencode.p2j.persist.orm.DmoMeta, com.goldencode.p2j.persist.orm.DmoMeta, java.util.List<com.goldencode.p2j.persist.orm.Property>, java.util.List<com.goldencode.p2j.persist.orm.Property>, java.util.Map<java.lang.Integer, java.util.List<com.goldencode.p2j.persist.orm.Property[]>>)
with before table specific parameters.private void copyMasterTable(boolean append) throws PersistenceException
copyTable(com.goldencode.p2j.persist.TemporaryBuffer, com.goldencode.p2j.persist.TemporaryBuffer, java.util.List<com.goldencode.p2j.persist.orm.Property>, java.util.List<com.goldencode.p2j.persist.orm.Property>, java.lang.String)
with master table specific parameters. Also this
will trigger processMasterProperties()
which will analyze the master tables and compute
a list of their properties (and extents) in a copy suitable order.PersistenceException
private void copyBeforeTable(boolean append) throws PersistenceException
copyTable(com.goldencode.p2j.persist.TemporaryBuffer, com.goldencode.p2j.persist.TemporaryBuffer, java.util.List<com.goldencode.p2j.persist.orm.Property>, java.util.List<com.goldencode.p2j.persist.orm.Property>, java.lang.String)
with before table specific parameters. Also this
will trigger processMasterProperties()
which will analyze the before tables and compute
a list of their properties (and extents) in a copy suitable order.PersistenceException
private java.lang.String getMasterSortClause() throws PersistenceException
getSortClause(com.goldencode.p2j.persist.TemporaryBuffer, java.lang.String)
with master table specific parameters. This will
also cache the master sort clause.PersistenceException
private java.lang.String getBeforeSortClause() throws PersistenceException
getSortClause(com.goldencode.p2j.persist.TemporaryBuffer, java.lang.String)
with before table specific parameters. This will
also cache the before sort clause.PersistenceException
private void copyExtentMasterFields() throws PersistenceException
copyExtentFields(com.goldencode.p2j.persist.TemporaryBuffer, com.goldencode.p2j.persist.TemporaryBuffer, java.util.Map<java.lang.Integer, java.util.List<com.goldencode.p2j.persist.orm.Property[]>>, java.lang.String)
with master table specific parameters. This will
also try to create a database-level master primary key mapping if it doesn't already exist.PersistenceException
private void createMasterPkMapping() throws PersistenceException
createPkMapping(com.goldencode.p2j.persist.TemporaryBuffer, com.goldencode.p2j.persist.TemporaryBuffer, com.goldencode.p2j.persist.FastCopyHelper.CopyMeta, java.lang.String, java.lang.String)
with master table specific parameters. This will
take care that a single master pk mapping will be online at once.PersistenceException
private void copyExtentB4Fields() throws PersistenceException
copyExtentFields(com.goldencode.p2j.persist.TemporaryBuffer, com.goldencode.p2j.persist.TemporaryBuffer, java.util.Map<java.lang.Integer, java.util.List<com.goldencode.p2j.persist.orm.Property[]>>, java.lang.String)
with before table specific parameters. This will
also try to create a database-level before primary key mapping if it doesn't already exist.PersistenceException
private void createBeforePkMapping() throws PersistenceException
createPkMapping(com.goldencode.p2j.persist.TemporaryBuffer, com.goldencode.p2j.persist.TemporaryBuffer, com.goldencode.p2j.persist.FastCopyHelper.CopyMeta, java.lang.String, java.lang.String)
with before table specific parameters. This will
take care that a single before pk mapping will be online at once.PersistenceException
private java.util.Map<java.lang.Long,java.lang.Long[]> getMasterMapping() throws PersistenceException
getMapping(com.goldencode.p2j.persist.Persistence, java.lang.String)
with master table specific parameters. This will
cache eventually the mapping. Also, this may trigger a database-level master pk mapping if it
doesn't already exist.PersistenceException
private java.util.Map<java.lang.Long,java.lang.Long[]> getBeforeMapping() throws PersistenceException
getMapping(com.goldencode.p2j.persist.Persistence, java.lang.String)
with before table specific parameters. This will
cache eventually the mapping. Also, this may trigger a database-level before pk mapping if it
doesn't already exist.PersistenceException
private void clear() throws PersistenceException
PersistenceException
private void clearMaster() throws PersistenceException
PersistenceException
private void clearBefore() throws PersistenceException
PersistenceException