public final class TemporaryBuffer extends RecordBuffer
define(java.lang.Class<T>, java.lang.String, boolean)
method,
which, like the superclass' method of the same name, creates a proxy
object which client code uses to interact with the database.
Implementation Notes
Multiplexing. Because of limitations imposed by Hibernate's lack
of direct support for temp tables, a single temp table instance in the
backing database is multiplexed if multiple buffers of the same type of
DMO class are opened simultaneously in the same context. This can happen
either when calling code explicitly defines multiple temp table buffers
using the same DMO type, or when method calls pass a temp table DMO proxy
as a parameter. Multiplexing is used to enable Progress' semantic of
copying data between temp tables when they are passed as parameters to
nested procedure calls.
Multiplexing is achieved by adding a multiplex ID column to every temp table schema. Each buffer instance is assigned a unique multiplex ID the first time a scope is opened on it. Every access to the backing temp table (i.e., queries, updates, inserts, deletes) take the multiplex ID into account, such that the backing table is managed as multiple, virtual table instances, one per distinct multiplex ID.
A temp table is created (along with its indexes, if any) the first time a particular DMO type is accessed. It is only dropped when no buffers reference it. As buffers go in and out of scope, a context local "in-use" map is updated to reflect which buffers reference which physical temp tables. When a buffer goes out of scope, cleanup processing checks whether it is the last buffer to reference its backing table. If so, the table is dropped. If not, the table is not dropped, but all records with that buffer's multiplex ID are removed from the table.
Temporary buffers may be scoped globally, or to the top-level (i.e., method) scope. If global, cleanup is performed only when the context itself is about to go out of scope. If not global, cleanup is performed when the method scope is popped by the transaction manager. The latter coincides with the external procedure scope in Progress.
There is a notion of a master buffer and slave buffers. The former is created as the result of converting a DEFINE TEMP-TABLE Progress statement. The latter is created as the result of converting a DEFINE BUFFER FOR temp-table Progress statement. A master buffer and all of the associated slave buffers share the same multiplex ID, since these buffers must all point to the same backing, virtual temp table for their backing data. The first time any buffer in such a group has a multiplex ID assigned, all buffers in the group have their multiplex IDs assigned to the same value.
Modifier and Type | Class and Description |
---|---|
private static interface |
TemporaryBuffer.BeforeFieldUpdater
Functional interface for setting a BEFORE-BUFFER field.
|
private static class |
TemporaryBuffer.Context
Helper which tracks the multiplex IDs currently in use by DMO interface
in the current client context, as well as the reference count of temp
tables created in the database using the context's current connection,
and domains of master/slave buffers.
|
static class |
TemporaryBuffer.CopyTableMode
Table copy mode.
|
private static class |
TemporaryBuffer.DefaultUndoState
A class that holds the default UNDO attibute for a TEMP-TABLE.
|
private class |
TemporaryBuffer.Multiplexer
An object registered with the
TransactionManager to be
notified when its enclosing buffer's scope is closing. |
private class |
TemporaryBuffer.NoUndoValidator
An object of this class is registered at all blocks within a no-undo buffer's scope, except
internal procedures (TODO: further testing is needed to verify that this is correct).
|
private static class |
TemporaryBuffer.ReclaimTable
Identify a temp-table which reclaims primary keys.
|
private static class |
TemporaryBuffer.ReferenceProxy
The handler to switch between references, when binding a definition table to another one.
|
RecordBuffer.DatumAccess, RecordBuffer.LightweightUndoable, RecordBuffer.MethodType, RecordBuffer.OperationType
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
bulkDeleteEventSQL
SQL used to check whether a record was deleted by a bulk delete
|
private static ContextLocal<TemporaryBuffer.Context> |
context
Multiplex ID sets currently in use for this context by DMO interface
|
private java.lang.reflect.Constructor<? extends Record> |
dmoCtor
Constructor used to create new instances of the backing DMO
|
private TemporaryBuffer.Multiplexer |
dynamicMultiplexer
Globally-scoped multiplexer for dynamic temp-tables (
null for others) |
static java.lang.String |
ERROR_EXTENT_MISMATCH_TEMPLATE
Error text template for error 8029.
|
static java.lang.String |
ERROR_FIELD_TYPE_MISMATCH_TEMPLATE
Error text template for error 8028.
|
static java.lang.String |
ERROR_MISMATCHED_FIELDS
Error text for error 12324.
|
static java.lang.String |
ERROR_TABLE_MISMATCH_TEMPLATE
Error text template for error 8030.
|
private java.util.Set<Temporary> |
explicitBuffers
For a master buffer, all explicit buffers created for it.
|
private static java.util.Set<java.lang.String> |
forceNoUndoConflicts
Names of tables which are not NO-UNDO when forcing NO-UNDO temp-table behavior globally
|
private boolean |
global
Does this buffer represent a global temp table?
|
private TemporaryBuffer.Context |
local
Context associated with this buffer instance
|
private static java.util.logging.Logger |
LOG
Logger
|
private boolean |
loopingDelete
Flag indicating that the
loopDelete(com.goldencode.p2j.persist.DataModelObject[], java.lang.String, java.lang.Object[]) is being executed, so the PKs can be reclaimed for the
record delete. |
private TemporaryBuffer |
master
Master buffer for this buffer; null indicates this is the master
|
static java.lang.String |
MULTIPLEX_FIELD_NAME
Name of the multiplex ID field in temp table DMO classes
|
private java.lang.Integer |
multiplexID
Multiplex ID assigned to this buffer instance
|
private TemporaryBuffer.ReferenceProxy |
mutableHandler
The handler used to bound to another instance at runtime.
|
private Temporary |
mutableProxy
The actual proxy instance wrapping the DMO proxy.
|
private java.util.Set<TableParameter> |
outputParameters
Destination table parameters for output copy if necessary before scope closes
|
private java.lang.String |
primaryOrderBy
Order by clause associated with primary index of backing temp-table, if any
|
private boolean |
referenceOnly
Flag indicating if REFERENCE-ONLY option was set for this TEMP-TABLE.
|
private java.util.Map<java.lang.String,java.util.function.Supplier> |
registeredCodePages
Map of code pages of the CLOB fields, which were declared with COLUMN-CODEPAGE option.
|
private TempTable |
tempTableRef
Reference to parent temp table; if master buffer exists this field is
null |
private UndoStateProvider |
undoStateProvider
Can property changes on this buffer be undone?
|
private boolean |
usePendingReclaimed
Flag indicating that the
pending PKs need to be reclaimed when a
new record is created. |
activeScopeDepth, bufferManager, changeBroker, createRowCallback, delayed, ffCache, ignoreBeforeTracking, ooFields, openScopeCount, persistenceContext, registeredWithGlobalScope, relatedQueries, txHelper
Modifier | Constructor and Description |
---|---|
private |
TemporaryBuffer(java.lang.Class<?> def,
java.lang.Class<T> dmoBufIface,
java.lang.String variable,
boolean global,
UndoStateProvider undoable,
int blockDepth)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static java.util.Iterator<java.lang.String> |
activeTables()
Get an iterator on the names of all temp tables which currently exist
in the current context.
|
protected boolean |
allowsBulkActions()
Indicate whether this buffer implementation allows bulk actions.
|
static void |
associate(TableParameter src,
Temporary dstDMO,
boolean input,
boolean output)
Associate two temp tables with one another, such that all relevant
records can be copied between them at prescribed times.
|
static void |
associate(TableParameter src,
Temporary dstDMO,
boolean input,
boolean output,
boolean appendInput)
Associate two temp tables with one another, such that all relevant
records can be copied between them at prescribed times.
|
static void |
associate(TableParameter src,
Temporary dstDMO,
boolean input,
boolean output,
boolean appendInput,
ParameterOption mode)
Associate two temp tables with one another, such that all relevant records can be copied
between them at prescribed times.
|
Temporary |
bind(TemporaryBuffer other)
Bind this instance to the other buffer.
|
protected void |
cleanupSlaveBuffers()
Remove all the domains associated with this buffer.
|
protected void |
closeMultiplexScope()
Close multiplex scope and mark the underlying table to be dropped when the session closes.
|
(package private) static boolean |
copyAllRows(rowid srcRec,
Temporary srcDMO,
Temporary dstDMO,
boolean append,
TemporaryBuffer.CopyTableMode errorMode)
Copy all records from one temp table to another, optionally appending
to records already present in the destination table.
|
(package private) static boolean |
copyAllRows(rowid srcRecId,
Temporary srcDMO,
Temporary dstDMO,
boolean append,
TemporaryBuffer.CopyTableMode errorMode,
boolean skipUniqueConflicts,
boolean replaceMode,
boolean looseCopy)
Copy all records from one temp table to another, optionally appending to records already present in the
destination table.
|
(package private) static boolean |
copyAllRows(Temporary srcDMO,
Temporary dstDMO,
boolean append,
TemporaryBuffer.CopyTableMode errorMode)
Copy all records from one temp table to another, optionally appending
to records already present in the destination table.
|
(package private) static boolean |
copyChanges(TemporaryBuffer srcBefore,
TemporaryBuffer srcAfter,
TemporaryBuffer dstBefore,
TemporaryBuffer dstAfter)
This is the actual implementation of TEMP-TABLE buffer's GET-CHANGES method.
|
protected static boolean |
copyParentUnchangedRecords(BufferImpl parentDst,
BufferImpl parentSrc,
BufferImpl childSrc,
java.lang.String whereStr)
Helper method for
DataSet GET-CHANGES. |
int |
count()
Counts the number of records in the TEMP-TABLE behind this buffer.
|
protected static Temporary |
createDefaultDynamicBufferForTempTable(TempTableBuilder tempTable)
Create the default dynamic buffer for the dynamic temporary table.
|
protected static Temporary |
createDynamicBufferForTempTable(java.lang.String bufferName,
TemporaryBuffer master)
Create a dynamic buffer for the temporary table.
|
private static Temporary |
createDynamicBufferForTempTable(java.lang.String bufferName,
TemporaryBuffer master,
TempTable tempTable)
Create a dynamic buffer for the temporary table.
|
static void |
createDynamicTable(TableParameter src,
handle target,
boolean input,
boolean output)
Creates a dynamic temporary table for the given temp table handle.
|
static void |
createDynamicTable(TableParameter src,
handle target,
boolean input,
boolean output,
boolean append,
ParameterOption mode)
Creates a dynamic temporary table for the given temp table handle.
|
private static java.util.Map<RecordBuffer.DatumAccess,RecordBuffer.DatumAccess> |
createPropsMap(boolean looseCopy,
BufferImpl srcDMO,
BufferImpl dstDMO,
TemporaryBuffer.CopyTableMode errorMode)
Create a
DatumAccess mapping for the source and destination DMOs. |
private static boolean |
createRecords(TableWrapper srcResultSet,
TemporaryBuffer dstBuf,
java.util.Map<java.lang.Long,TempRecord> dstNewIds,
java.lang.String[] dstProperties,
java.util.Map<java.lang.String,java.lang.reflect.Method> dstSetters,
java.util.Map<java.lang.String,java.lang.Integer> dstExtents)
Create records from the given result set.
|
void |
datasourceRowid(rowid sourceRowid)
Sets the
datasource-rowid for AFTER-TABLE record. |
protected void |
decrementObjectCountRef(object<?> obj)
Decrements the counter-reference for the specified object.
|
private static void |
decrementObjectCountRef(TemporaryBuffer.Context local,
java.lang.Class<?> dmoIface,
object<?> obj)
Decrements the counter-reference for the specified object.
|
static void |
deferCopyError()
Defer error that has occurred during
copyAllRows(com.goldencode.p2j.persist.Temporary, com.goldencode.p2j.persist.Temporary, boolean, com.goldencode.p2j.persist.TemporaryBuffer.CopyTableMode) processing. |
static <T extends TempTableBuffer> |
define(java.lang.Class<?> def,
java.lang.Class<T> dmoBufIface,
java.lang.String variable,
java.lang.String legacyName,
boolean global)
Define a new buffer which is based upon the specified interface.
|
static <T extends TempTableBuffer> |
define(java.lang.Class<?> def,
java.lang.Class<T> dmoBufIface,
java.lang.String variable,
java.lang.String legacyName,
boolean global,
boolean undoable)
Define a new buffer which is based upon the specified interface.
|
static <T extends TempTableBuffer> |
define(java.lang.Class<?> def,
java.lang.Class<T> dmoBufIface,
java.lang.String variable,
java.lang.String legacyName,
boolean global,
UndoStateProvider undoable,
int blockDepth)
Define a new buffer which is based upon the specified interface.
|
(package private) static <T extends TempTableBuffer> |
define(java.lang.Class<?> def,
java.lang.Class<T> dmoBufIface,
java.lang.String variable,
java.lang.String legacyName,
boolean global,
UndoStateProvider undoable,
int blockDepth,
boolean mutable)
Define a new buffer which is based upon the specified interface.
|
static <T extends TempTableBuffer> |
define(java.lang.Class<?> def,
Temporary template,
java.lang.String variable,
java.lang.String legacyName)
Define a new buffer which is based upon a "master" buffer.
|
static <T extends TempTableBuffer> |
define(java.lang.Class<?> def,
Temporary template,
java.lang.String variable,
java.lang.String legacyName,
int blockDepth,
boolean shared)
Define a new buffer which is based upon a "master" buffer.
|
(package private) static <T extends TempTableBuffer> |
define(java.lang.Class<?> def,
Temporary template,
java.lang.String variable,
java.lang.String legacyName,
int blockDepth,
boolean shared,
boolean mutable)
Define a new buffer which is based upon a "master" buffer.
|
static <T extends TempTableBuffer> |
define(java.lang.Class<T> dmoBufIface,
java.lang.String variable,
boolean global)
Define a new buffer which is based upon the specified interface.
|
static <T extends TempTableBuffer> |
define(java.lang.Class<T> dmoBufIface,
java.lang.String variable,
boolean global,
boolean undoable)
Define a new buffer which is based upon the specified interface.
|
static <T extends TempTableBuffer> |
define(java.lang.Class<T> dmoBufIface,
java.lang.String variable,
boolean global,
UndoStateProvider undoable)
Define a new buffer which is based upon the specified interface.
|
static <T extends TempTableBuffer> |
define(java.lang.Class<T> dmoBufIface,
java.lang.String variable,
java.lang.String legacyName,
boolean global)
Define a new buffer which is based upon the specified interface.
|
static <T extends TempTableBuffer> |
define(java.lang.Class<T> dmoBufIface,
java.lang.String variable,
java.lang.String legacyName,
boolean global,
boolean undoable)
Define a new buffer which is based upon the specified interface.
|
static <T extends TempTableBuffer> |
define(java.lang.Class<T> dmoBufIface,
java.lang.String variable,
java.lang.String legacyName,
boolean global,
boolean undoable,
int blockDepth)
Define a new buffer which is based upon the specified interface.
|
static <T extends TempTableBuffer> |
define(java.lang.Class<T> dmoBufIface,
java.lang.String variable,
java.lang.String legacyName,
boolean global,
UndoStateProvider undoable)
Define a new buffer which is based upon the specified interface.
|
static <T extends TempTableBuffer> |
define(java.lang.Class<T> dmoBufIface,
java.lang.String variable,
java.lang.String legacyName,
boolean global,
UndoStateProvider undoable,
int blockDepth)
Define a new buffer which is based upon the specified interface.
|
static <T extends TempTableBuffer> |
define(Temporary template,
java.lang.String variable)
Define a new buffer which is based upon a "master" buffer.
|
static <T extends TempTableBuffer> |
define(Temporary template,
java.lang.String variable,
int blockDepth)
Define a new buffer which is based upon a "master" buffer.
|
static <T extends TempTableBuffer> |
define(Temporary template,
java.lang.String variable,
java.lang.String legacyName)
Define a new buffer which is based upon a "master" buffer.
|
static <T extends TempTableBuffer> |
define(Temporary template,
java.lang.String variable,
java.lang.String legacyName,
boolean shared)
Define a new buffer which is based upon a "master" buffer.
|
static <T extends TempTableBuffer> |
define(Temporary template,
java.lang.String variable,
java.lang.String legacyName,
int blockDepth)
Define a new buffer which is based upon a "master" buffer.
|
protected void |
delete(DataModelObject[] suppDMOs,
java.lang.String where,
java.lang.Object... args)
Perform a bulk delete, restricted by the given where clause and query
substitution parameters.
|
protected void |
delete(java.lang.String where,
java.lang.Object... args)
Perform a bulk delete, restricted by the given where clause and query
substitution parameters.
|
protected boolean |
delete(java.util.function.Supplier<logical> valexp,
java.util.function.Supplier<character> valmsg)
Delete the current record from the database.
|
protected void |
deleteAll()
Perform a bulk delete of all records in the table associated with this buffer.
|
private void |
doCloseMultiplexScope()
Close the current multiplex scope for the underlying DMO type in the current context.
|
protected java.lang.Integer |
errorFlags()
Gets
errorFlag of this record. |
protected character |
errorString()
Gets
errorString of this record. |
protected void |
errorString(Text string)
Sets the
error string of this record. |
protected void |
finishedImpl()
Called by the transaction manager just before a buffer scope closes.
|
protected boolean |
forceLoopingDelete()
Check if the delete must be forced using a loop, and not a batch sql.
|
protected java.util.Set<TemporaryBuffer> |
getAllSlaveBuffers()
Get all slave buffers associated with this buffer.
|
protected java.util.Map<java.lang.String,java.lang.String> |
getBoundPropertyMappings()
Get the mappings of property names, from definition to bound buffer.
|
java.lang.String |
getCodePage(java.lang.String property)
Get code page of the specified CLOB field.
|
(package private) static Commitable |
getContextCommitable()
Get a context-local
Commitable which needs to have its
methods invoked on commit/rollback. |
long |
getCurrentPrimaryKey(java.lang.Class<? extends DataModelObject> dmoInterface)
Get the current primary key for the specified temp-table.
|
TempRecord |
getCurrentRecord()
Get the DMO which represents the database record currently held in the buffer.
|
static Temporary |
getDefaultBuffer(handle tempTableHandle)
Get default buffer for a temporary table.
|
protected java.lang.String |
getDynamicName()
Gets the legacy name assigned to a dynamically prepared temp-table.
|
java.lang.String |
getImplicitIndexName(java.lang.Class<? extends DataModelObject> dmoInterface)
Get the implicit index name.
|
java.lang.String |
getImplicitSqlIndexName(java.lang.Class<? extends DataModelObject> dmoInterface)
Get the implicit SQL index name.
|
protected java.lang.String |
getLDBName(java.lang.String ldbOrAlias)
Get the logical database name associated with this buffer.
|
protected RecordBuffer |
getMasterBuffer()
Retrieve the master record buffer for this buffer.
|
java.lang.Integer |
getMultiplexID()
Get the multiplex ID of this temporary buffer.
|
protected Database |
getPDB(java.lang.String ldbName)
Get the database information object associated with this buffer.
|
LockType |
getPinnedLockType(java.lang.Long id)
Override the superclass method to always return LockType.NONE.
|
private java.lang.String |
getPrimaryOrderByClause()
Get the order by clause determined by this buffer's backing table's primary index, if any.
|
java.lang.String |
getSequenceName()
Get this user's sequence name in the temporary database.
|
static int |
getTableCount()
Report the number of temp tables which currently exist in the current context.
|
protected static void |
handleTablesDoNotMatch(TemporaryBuffer.CopyTableMode errorMode,
java.lang.String srcBufName,
java.lang.String dstBufName)
If
copyTempTableErrorMode is true then dispaly "The caller's
temp-table parameter {srcBufName} does not match to the target temp-table {dstBufName}"
error message and abend. |
protected boolean |
hasExplicitBuffers()
Check if this buffer is referenced by other
buffers . |
private boolean |
hasOoDestructors()
Check whether in this temp-table there are any objects that have pending destructors to be
called in case they are deleted.
|
private static void |
incrementObjectCountRef(TemporaryBuffer.Context local,
java.lang.Class<?> dmoIface,
object<?> obj)
Increments the counter-reference for the specified object.
|
boolean |
initialize()
Initialize the core data on which this buffer relies.
|
protected void |
initPinnedLockTypes()
Override the superclass method to do nothing.
|
static boolean |
insertAllRows(TableWrapper srcResultSet,
Temporary dstDMO,
boolean append,
TemporaryBuffer.CopyTableMode errorMode,
int tableParameterIndex)
Populate the temp table with records created using the specified result set.
|
protected TempRecord |
instantiateDMO()
Create a new instance of the DMO implementation class associated with
this buffer, and assign this buffer's multiplex ID to it.
|
boolean |
isAutoCommit()
Indicate whether this is a temp-table buffer and we are not currently within an existing
database transaction.
|
boolean |
isGlobal()
Check if this buffer is associated with a global temp-table.
|
protected boolean |
isMultiplexed()
Indicate whether the backing table for this buffer is multiplexed; that
is, whether the backing table represents multiple, virtual tables by
using a multiplex ID to differentiate table segments.
|
private boolean |
isMultiplexScopeClosed()
Determine if the multiplex scope for the underlying DMO type in the current context is
closed.
|
protected boolean |
isQueried()
Check if this temp-table is currently being queried.
|
protected boolean |
isTableDefinitelyEmpty()
Indicate whether the table backing this buffer is known to either: (a) not exist; or (b) contain no
rows.
|
boolean |
isTemporary()
Convenience method to indicate whether this buffer is backed by a
temporary table.
|
protected boolean |
isUndoable()
Indicate whether changes made to records managed by this buffer can be undone during a
rollback.
|
protected int |
lookupNumFields()
Look up the number of fields in the legacy table represented by this buffer.
|
private void |
loopDelete(DataModelObject[] suppDMOs,
java.lang.String where,
java.lang.Object[] args)
Emulate a loop for deleting a set of records from this table.
|
private static <T extends TempTableBuffer> |
makeBuffer(java.lang.Class<?> def,
java.lang.Class<T> dmoBufIface,
java.lang.String variable,
boolean global,
UndoStateProvider undoable)
Factory method to construct a new temporary buffer.
|
private static <T extends TempTableBuffer> |
makeBuffer(java.lang.Class<?> def,
java.lang.Class<T> dmoBufIface,
java.lang.String variable,
boolean global,
UndoStateProvider undoable,
int blockDepth)
Factory method to construct a new temporary buffer.
|
protected static <T> T |
makeMutable(java.lang.Class<T> dmoBufIface,
T proxy)
Make the specified proxy buffer instance mutable, to allow runtime buffer binding.
|
protected boolean |
markNew(BufferImpl before)
Actual implementation of
MARK-NEW method. |
protected java.lang.Long |
nextPrimaryKey()
Returns the primary key for a new DMO associated with this buffer.
|
protected void |
onCloseOutermostScope()
Perform any actions needed when this buffer's outermost scope closes.
|
protected void |
onOpenOutermostScope()
Perform any actions needed when this buffer's outermost scope opens (or if the buffer was not active
when that scope was opened, when the buffer is first activated thereafter).
|
private boolean |
openMultiplexScope()
Open a new multiplex scope for this buffer.
|
protected void |
openScope()
Open a new buffer scope for this record buffer.
|
protected void |
openScopeAt(int blockDepth)
Open a new buffer scope for this record buffer at the given block depth.
|
static void |
openScopeAt(int blockDepth,
DataModelObject... dmos)
Open scope for the dynamic buffers which back the specified DMO instances at the given block
depth.
|
void |
originRowid(rowid peer)
Sets the
origin-rowid for AFTER-TABLE record. |
protected rowid |
peerRowid()
Gets
rowid of the peer record. |
void |
peerRowid(rowid peer)
Sets the
rowid value of the peer record. |
protected void |
performOutputCopy(TableParameter outputParameter)
Copy output data for the linked table parameter, if any.
|
private void |
processCodePages()
Set code pages for the CLOB fields of the parent
TempTable . |
void |
readAllRows(java.util.function.Consumer<TempRecord> rowHandler)
Read all rows from the virtual temp-table backing this buffer (i.e., only those rows with
this buffer's multiplex ID) and allow the given row handler to process each found row.
|
protected static java.util.List<java.lang.Object[][]> |
readAllRows(Temporary srcDMO,
java.util.List<PropertyDefinition> props)
Read all rows from the table targeted by the specified buffer and return each row as an
array, each row's values in the ordered specified by the given property list.
|
private static void |
readFromXml(java.lang.String xmlTable,
boolean append,
handle table)
Read the TABLE from XML.
|
protected void |
reclaimKeys(java.util.List<java.lang.Long> keys)
Reclaim the given list of primary keys for re-use.
|
static void |
referenceOnly(Temporary... dmos)
Mark the specified temp-tables as having the REFERENCE-ONLY option.
|
private void |
registerCodePage(java.lang.String property,
java.util.function.Supplier codePageExpr)
Register code page expression for the CLOB field.
|
static void |
registerCodePage(Temporary dmo,
java.lang.String property,
java.util.function.Supplier codePageExpr)
Register code page expression for the CLOB field.
|
protected boolean |
rejectChanges(BufferImpl after)
Rejects changes to the data in the AFTER-BUFFER of this BEFORE-BUFFER.
|
private void |
removeRecords(DataModelObject[] extDMOs,
java.lang.String where,
java.lang.Object[] args,
boolean forceDelete)
Remove or change the multiplex ID for all record rows from the backing table which meet the
specified criteria.
|
private java.lang.String |
resolveCodePage(java.util.function.Supplier supplier)
Resolves the supplier and returns the code page.
|
protected void |
resourceDeleted()
Deregister a dynamic multiplexer object from the transaction manager's global finalizables
when this buffer goes out of scope and invoke the multiplexer's scope closure processing.
|
void |
rollback(boolean transaction)
Restores this buffer's state to that which it had at the beginning of
the current block.
|
protected integer |
rowState()
Gets the current value of the
ROW-STATE property for this record. |
void |
rowState(java.lang.Integer state)
Sets the value of the
ROW-STATUS property for this record. |
void |
setCurrentPrimaryKey(java.lang.Class<? extends DataModelObject> dmoIface,
long value)
Set the primary key sequence for the specified temp-table to the new value.
|
private void |
setIgnoreBeforeTracking(boolean ignore)
Activate or deactivate the CHANGE-TRACKING for this buffer.
|
void |
setPinnedLockType(java.lang.Long id,
LockType pinnedLockType)
Override the superclass method to do nothing.
|
protected void |
setTempTableRef(TempTable tempTableRef)
Set reference to the parent temp table.
|
private void |
setupBeforeFlagImpl(TemporaryBuffer.BeforeFieldUpdater updater,
java.lang.String changedField,
java.lang.String legacy,
boolean updatePeer)
Common implementation for all setters of BEFORE-BUFFER special (hidden) fields.
|
protected void |
setUsePendingReclaimed(boolean state)
Set the
usePendingReclaimed flag. |
void |
stateChanged(RecordChangeEvent event)
Respond to a record change event.
|
handle |
tableHandle()
Returns TABLE-HANDLE for the buffer.
|
private TempTable |
tempTableResource()
Get the
TempTable resource associated with this temporary buffer. |
void |
unbind(Temporary old)
Unbind this buffer and re-bind it to its old buffer.
|
protected void |
updateErrorFlags(int errFlag,
boolean set)
Sets or removes the
errorFlag value this peer record. |
(package private) static void |
updateObjectRefCount(java.lang.Class<?> dmoIface,
object<?> oldVal,
object<?> newVal)
Update the object reference count.
|
void |
upgradeLock()
Override the superclass method to do nothing.
|
static Temporary |
useShared(java.lang.String variable,
java.lang.Class<? extends Temporary> expected)
Define a new buffer which is based upon a "master" buffer
stored in the
SharedVariableManager . |
static Temporary |
useShared(Temporary master,
java.lang.Class<?> expected,
java.lang.String name)
Create a buffer which is bound to the master buffer, for use in a child shared buffer case.
|
(package private) static java.lang.String |
writeToXml(handle tableHandle,
boolean isHandle)
Write the specified TABLE handle to a XML.
|
_setDynamic, addAllBufferScope, addByLegacyNameScope, addLegacyForeignKeys, addLoadedBuffersScope, addOpenBuffersScope, areDMOsSame, armCurrentChanged, average, batch, buffer, cleanupBatchMode, cleanupBatchMode, closeRelatedQueries, commit, compare, compare, copy, copy, copy, copyCommonFields, count, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, createDynamicBufferForPermTable, createProxy, createSimplePropsMap, decrementDMOUseCount, define, define, define, define, defineAlias, defineReadOnly, definition, delete, deleted, describe, disableReleaseOnIterate, endBatch, equals, errorNotOnFile, evictDMOIfUnused, finished, flush, get, getAllBuferScopes, getBufferManager, getBufferType, getByLegacyNameScopes, getChangeBroker, getCodePage, getCodePage, getCommonFields, getDatabase, getDataModelAst, getDefaultBuffer, getDialect, getDirtyContext, getDMOAlias, getDMOBufInterface, getDMOBufInterfaceForObject, getDMOImplementationClass, getDMOImplementationName, getDmoInfo, getDMOInterface, getDMOName, getDMOProxy, getEntityName, getExtentMap, getGetterDatums, getIndexHelper, getLegacyFieldNameMap, getLegacyGetterMap, getLegacyName, getLegacySetterMap, getLoadedBuffersScope, getLogicalDatabase, getNumFields, getNursery, getOffEnd, getOpenBuffersScope, getOpenScopeCount, getParentTable, getPDBName, getPersistence, getPersistenceContext, getPersistentProc, getPojoGetterMap, getPojoSetterMap, getProcedureManager, getPropsByGetter, getPropsBySetter, getQueryOffEndListener, getRecordLockContext, getSchema, getSchemaDictionary, getSchemaTableAst, getScopeOpenDepth, getSession, getSession, getSetterDatums, getSnapshot, getTable, getTriggerTracker, getTxHelper, getTxNestingId, getUndoable, getValue, hashCode, inChangeScope, incrementDMOUseCount, invalidateFFCache, isActive, isAvailable, isBulkCopy, isDirtyCopy, isDynamic, isFake, isNewlyCreated, isPendingRollbackProcessed, isPropertyIndexed, isReadonly, isRecordChanged, isTouched, isTransient, isUnknownMode, isVst, isWorldScope, iterate, listDirtyIndexes, loadRecord, loadTemplateRecord, makeArgumentBuffer, markChangeScope, markPersisted, maximum, maybeFireWriteTrigger, minimum, openScope, overrideDMOAlias, popTempContext, pruneSessionCache, pushTempContext, recordBuffers, recordID, recordInserted, recordNotAvailableCharacter, recordNotAvailableComhandle, recordNotAvailableDate, recordNotAvailableDatetime, recordNotAvailableDatetimetz, recordNotAvailableDecimal, recordNotAvailableHandle, recordNotAvailableInt64, recordNotAvailableInteger, recordNotAvailableLogical, recordNotAvailableRaw, recordNotAvailableRecid, recordNotAvailableRowid, registerRelatedQuery, release, release, reload, reportChange, reportValidationException, reset, resetChangeScope, resetPendingRollbackProcessed, restoreDMOAlias, retry, rowID, setAmbiguous, setBulkCopy, setDataModelAst, setDMOAlias, setDynamic, setLocked, setOffEnd, setRecord, setSchemaTableAst, setTempRecord, setUnknownMode, shareDirty, silentBatch, sqlTableContent, startBatch, sum, tableDefinition, throwOffEnd, toString, toString, unregisterRelatedQuery, updateCurrentChanged, validate, validate, validate, wasAmbiguous, wasLocked
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
entry, initFailure, weight
public static final java.lang.String MULTIPLEX_FIELD_NAME
public static final java.lang.String ERROR_MISMATCHED_FIELDS
public static final java.lang.String ERROR_TABLE_MISMATCH_TEMPLATE
public static final java.lang.String ERROR_EXTENT_MISMATCH_TEMPLATE
public static final java.lang.String ERROR_FIELD_TYPE_MISMATCH_TEMPLATE
private static final java.util.logging.Logger LOG
private static final ContextLocal<TemporaryBuffer.Context> context
private static final java.util.Set<java.lang.String> forceNoUndoConflicts
private final boolean global
private UndoStateProvider undoStateProvider
private final TemporaryBuffer.Context local
private java.lang.reflect.Constructor<? extends Record> dmoCtor
private java.lang.String bulkDeleteEventSQL
private java.util.Set<TableParameter> outputParameters
private java.lang.Integer multiplexID
private TemporaryBuffer.Multiplexer dynamicMultiplexer
null
for others)private TemporaryBuffer master
private TempTable tempTableRef
null
private java.lang.String primaryOrderBy
private boolean referenceOnly
private java.util.Map<java.lang.String,java.util.function.Supplier> registeredCodePages
openScope()
. Keyed by hibernate
property names of the CLOB fields.private TemporaryBuffer.ReferenceProxy mutableHandler
private Temporary mutableProxy
private final java.util.Set<Temporary> explicitBuffers
private boolean loopingDelete
loopDelete(com.goldencode.p2j.persist.DataModelObject[], java.lang.String, java.lang.Object[])
is being executed, so the PKs can be reclaimed for the
record delete.private boolean usePendingReclaimed
pending PKs
need to be reclaimed when a
new record is created.private TemporaryBuffer(java.lang.Class<?> def, java.lang.Class<T> dmoBufIface, java.lang.String variable, boolean global, UndoStateProvider undoable, int blockDepth)
define(java.lang.Class<T>, java.lang.String, boolean)
factory method. The implementation class associated with the given
dmoIface
must have a constructor which accepts a multiplex
ID and must contain a _multiplex
instance variable of type
Integer
.def
- The currently executing OE class or external program.dmoBufIface
- Interface which defines DMO's API. This interface MUST extend
Temporary
.variable
- Name of the variable with which the record buffer is associated
in the transaction manager whenever it is registered.global
- true
if the buffer survives until end of context
life; false
if it expires upon leaving the top
level procedure scope.undoable
- An UndoStateProvider
that manages the UNDO status of the table of this
buffer.blockDepth
- Zero-based depth of the block (starting from the outermost scope) at which the
buffer is defined or -1
for the current scope.public static void deferCopyError()
copyAllRows(com.goldencode.p2j.persist.Temporary, com.goldencode.p2j.persist.Temporary, boolean, com.goldencode.p2j.persist.TemporaryBuffer.CopyTableMode)
processing.public static <T extends TempTableBuffer> T define(java.lang.Class<T> dmoBufIface, java.lang.String variable, boolean global)
T
- Type of constructed instance.dmoBufIface
- Interface which defines DMO's public API. This must be a
sub-interface of Temporary
.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.global
- true
if the buffer survives until end of context
life; false
if it expires upon leaving the top
level procedure scope.java.lang.IllegalArgumentException
- if dmoIface
is not assignable from Temporary
.public static <T extends TempTableBuffer> T define(java.lang.Class<T> dmoBufIface, java.lang.String variable, java.lang.String legacyName, boolean global)
T
- Type of constructed instance.dmoBufIface
- Interface which defines DMO's public API. This must be a
sub-interface of Temporary
.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.legacyName
- Legacy name of the buffer.global
- true
if the buffer survives until end of context
life; false
if it expires upon leaving the top
level procedure scope.java.lang.IllegalArgumentException
- if dmoIface
is not assignable from Temporary
.public static <T extends TempTableBuffer> T define(java.lang.Class<?> def, java.lang.Class<T> dmoBufIface, java.lang.String variable, java.lang.String legacyName, boolean global)
T
- Type of constructed instance.def
- The currently executing OE class or external program.dmoBufIface
- Interface which defines DMO's public API. This must be a
sub-interface of Temporary
.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.legacyName
- Legacy name of the buffer.global
- true
if the buffer survives until end of context
life; false
if it expires upon leaving the top
level procedure scope.java.lang.IllegalArgumentException
- if dmoIface
is not assignable from
Temporary
.public static <T extends TempTableBuffer> T define(java.lang.Class<T> dmoBufIface, java.lang.String variable, boolean global, UndoStateProvider undoable)
T
- Type of constructed instance.dmoBufIface
- Interface which defines DMO's public API. This must be a
sub-interface of Temporary
.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.global
- true
if the buffer survives until end of context
life; false
if it expires upon leaving the top
level procedure scope.undoable
- An UndoStateProvider
that manages the UNDO status of the table of this
buffer.java.lang.IllegalArgumentException
- if dmoIface
is not assignable from Temporary
.public static <T extends TempTableBuffer> T define(java.lang.Class<T> dmoBufIface, java.lang.String variable, boolean global, boolean undoable)
T
- Type of constructed instance.dmoBufIface
- Interface which defines DMO's public API. This must be a
sub-interface of Temporary
.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.global
- true
if the buffer survives until end of context
life; false
if it expires upon leaving the top
level procedure scope.undoable
- true
if changes made to records managed by this
buffer can be undone; false
if such changes are
committed immediately, such that they cannot be undone.java.lang.IllegalArgumentException
- if dmoIface
is not assignable from Temporary
.public static <T extends TempTableBuffer> T define(java.lang.Class<T> dmoBufIface, java.lang.String variable, java.lang.String legacyName, boolean global, UndoStateProvider undoable)
T
- Type of constructed instance.dmoBufIface
- Interface which defines DMO's public API. This must be a
sub-interface of Temporary
.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.legacyName
- Legacy name of the buffer.global
- true
if the buffer survives until end of context
life; false
if it expires upon leaving the top
level procedure scope.undoable
- An UndoStateProvider
that manages the UNDO status of the table of this
buffer.java.lang.IllegalArgumentException
- if dmoIface
is not assignable from Temporary
.public static <T extends TempTableBuffer> T define(java.lang.Class<T> dmoBufIface, java.lang.String variable, java.lang.String legacyName, boolean global, boolean undoable)
T
- Type of constructed instance.dmoBufIface
- Interface which defines DMO's public API. This must be a
sub-interface of Temporary
.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.legacyName
- Legacy name of the buffer.global
- true
if the buffer survives until end of context
life; false
if it expires upon leaving the top
level procedure scope.undoable
- true
if changes made to records managed by this
buffer can be undone; false
if such changes are
committed immediately, such that they cannot be undone.java.lang.IllegalArgumentException
- if dmoIface
is not assignable from Temporary
.public static <T extends TempTableBuffer> T define(java.lang.Class<?> def, java.lang.Class<T> dmoBufIface, java.lang.String variable, java.lang.String legacyName, boolean global, boolean undoable)
T
- Type of constructed instance.def
- The currently executing OE class or external program.dmoBufIface
- Interface which defines DMO's public API. This must be a
sub-interface of Temporary
.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.legacyName
- Legacy name of the buffer.global
- true
if the buffer survives until end of context
life; false
if it expires upon leaving the top
level procedure scope.undoable
- true
if changes made to records managed by this
buffer can be undone; false
if such changes are
committed immediately, such that they cannot be undone.java.lang.IllegalArgumentException
- if dmoIface
is not assignable from
Temporary
.public static <T extends TempTableBuffer> T define(java.lang.Class<T> dmoBufIface, java.lang.String variable, java.lang.String legacyName, boolean global, UndoStateProvider undoable, int blockDepth)
T
- Type of constructed instance.dmoBufIface
- Interface which defines DMO's public API. This must be a sub-interface of
Temporary
.variable
- Name of the variable with which the record buffer will be associated in the
transaction manager.legacyName
- Legacy name of the buffer.global
- true
if the buffer survives until end of context life; false
if it
expires upon leaving the top level procedure scope.undoable
- An UndoStateProvider
that manages the UNDO status of the table of this
buffer.blockDepth
- Zero-based depth of the block (starting from the outermost scope) at which the
buffer is defined or -1
for the current scope.java.lang.IllegalArgumentException
- if dmoIface
is not assignable from Temporary
.public static <T extends TempTableBuffer> T define(java.lang.Class<?> def, java.lang.Class<T> dmoBufIface, java.lang.String variable, java.lang.String legacyName, boolean global, UndoStateProvider undoable, int blockDepth)
T
- Type of constructed instance.def
- The currently executing OE class or external program.dmoBufIface
- Interface which defines DMO's public API. This must be a
sub-interface of Temporary
.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.legacyName
- Legacy name of the buffer.global
- true
if the buffer survives until end of context
life; false
if it expires upon leaving the top
level procedure scope.undoable
- An UndoStateProvider
that manages the UNDO status of the table of this
buffer.blockDepth
- Zero-based depth of the block (starting from the outermost scope) at which the
buffer is defined or -1
for the current scope.java.lang.IllegalArgumentException
- if dmoIface
is not assignable from
Temporary
.static <T extends TempTableBuffer> T define(java.lang.Class<?> def, java.lang.Class<T> dmoBufIface, java.lang.String variable, java.lang.String legacyName, boolean global, UndoStateProvider undoable, int blockDepth, boolean mutable)
T
- Type of constructed instance.def
- The currently executing OE class or external program.dmoBufIface
- Interface which defines DMO's public API. This must be a
sub-interface of Temporary
.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.legacyName
- Legacy name of the buffer.global
- true
if the buffer survives until end of context
life; false
if it expires upon leaving the top
level procedure scope.undoable
- An UndoStateProvider
that manages the UNDO status of the table of this
buffer.blockDepth
- Zero-based depth of the block (starting from the outermost scope) at which the
buffer is defined or -1
for the current scope.mutable
- Flag indicating if the buffer must be mutable.java.lang.IllegalArgumentException
- if dmoIface
is not assignable from
Temporary
.public static <T extends TempTableBuffer> T define(java.lang.Class<T> dmoBufIface, java.lang.String variable, java.lang.String legacyName, boolean global, boolean undoable, int blockDepth)
T
- Type of constructed instance.dmoBufIface
- Interface which defines DMO's public API. This must be a
sub-interface of Temporary
.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.legacyName
- Legacy name of the buffer.global
- true
if the buffer survives until end of context
life; false
if it expires upon leaving the top
level procedure scope.undoable
- An UndoStateProvider
that manages the UNDO status of the table of this
buffer.blockDepth
- Zero-based depth of the block (starting from the outermost scope) at which the
buffer is defined or -1
for the current scope.java.lang.IllegalArgumentException
- if dmoIface
is not assignable from Temporary
.public static <T extends TempTableBuffer> T define(Temporary template, java.lang.String variable)
T
- Type of constructed instance.template
- An instance of Temporary
which is associated with
a temporary buffer that serves as a template for the new
buffer.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.java.lang.IllegalArgumentException
- if master
's DMO interface is not assignable from
Temporary
.public static <T extends TempTableBuffer> T define(Temporary template, java.lang.String variable, java.lang.String legacyName)
T
- Type of constructed instance.template
- An instance of Temporary
which is associated with
a temporary buffer that serves as a template for the new
buffer.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.legacyName
- Legacy name of the buffer.java.lang.IllegalArgumentException
- if master
's DMO interface is not assignable from
Temporary
.public static <T extends TempTableBuffer> T define(java.lang.Class<?> def, Temporary template, java.lang.String variable, java.lang.String legacyName)
T
- Type of constructed instance.def
- The currently executing OE class or external program.template
- An instance of Temporary
which is associated with
a temporary buffer that serves as a template for the new
buffer.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.legacyName
- Legacy name of the buffer.java.lang.IllegalArgumentException
- if master
's DMO interface is not assignable from
Temporary
.public static <T extends TempTableBuffer> T define(Temporary template, java.lang.String variable, java.lang.String legacyName, boolean shared)
T
- Type of constructed instance.template
- An instance of Temporary
which is associated with a temporary buffer
that serves as a template for the new
buffer.variable
- Name of the variable with which the record buffer will be associated in the
transaction manager.legacyName
- Legacy name of the buffer.shared
- When true
, this flag indicates we are defining a new shared buffer.java.lang.IllegalArgumentException
- if master
's DMO interface is not assignable from
Temporary
.public static <T extends TempTableBuffer> T define(Temporary template, java.lang.String variable, int blockDepth)
T
- Type of constructed instance.template
- An instance of Temporary
which is associated with
a temporary buffer that serves as a template for the new
buffer.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.blockDepth
- Zero-based depth of the block (starting from the outermost scope) at which the
buffer is defined or -1
for the current scope.java.lang.IllegalArgumentException
- if master
's DMO interface is not assignable from
Temporary
.public static <T extends TempTableBuffer> T define(Temporary template, java.lang.String variable, java.lang.String legacyName, int blockDepth)
T
- Type of constructed instance.template
- An instance of Temporary
which is associated with
a temporary buffer that serves as a template for the new
buffer.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.legacyName
- Legacy name of the buffer.blockDepth
- Zero-based depth of the block (starting from the outermost scope) at which the
buffer is defined or -1
for the current scope.java.lang.IllegalArgumentException
- if master
's DMO interface is not assignable from
Temporary
.public static <T extends TempTableBuffer> T define(java.lang.Class<?> def, Temporary template, java.lang.String variable, java.lang.String legacyName, int blockDepth, boolean shared)
T
- Type of constructed instance.def
- The currently executing OE class or external program.template
- An instance of Temporary
which is associated with
a temporary buffer that serves as a template for the new
buffer.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.legacyName
- Legacy name of the buffer.blockDepth
- Zero-based depth of the block (starting from the outermost scope) at which the
buffer is defined or -1
for the current scope.shared
- When true
, this flag indicates we are defining a new shared buffer.java.lang.IllegalArgumentException
- if master
's DMO interface is not assignable from
Temporary
.static <T extends TempTableBuffer> T define(java.lang.Class<?> def, Temporary template, java.lang.String variable, java.lang.String legacyName, int blockDepth, boolean shared, boolean mutable)
T
- Type of constructed instance.def
- The currently executing OE class or external program.template
- An instance of Temporary
which is associated with
a temporary buffer that serves as a template for the new
buffer.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.legacyName
- Legacy name of the buffer.blockDepth
- Zero-based depth of the block (starting from the outermost scope) at which the
buffer is defined or -1
for the current scope.shared
- When true
, this flag indicates we are defining a new shared buffer.mutable
- Flag indicating if the buffer must be mutable.java.lang.IllegalArgumentException
- if master
's DMO interface is not assignable from
Temporary
.public static Temporary useShared(java.lang.String variable, java.lang.Class<? extends Temporary> expected)
SharedVariableManager
. This is used as an analog to the DEFINE SHARED
TEMP-TABLE statement when defining a buffer for a shared temp-table or
work-table which has been established elsewhere. The DMO interface,
global, and undoability settings of the master buffer are used for the
new buffer. This buffer will have the same multiplex ID as the master
buffer, which should have been assigned by an enclosing scope by the
time this method is invoked.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager and shared variable
manager.expected
- The expected DMO type of the existing master temp-table.java.lang.IllegalArgumentException
- if master
's DMO interface is not assignable from Temporary
.public static Temporary useShared(Temporary master, java.lang.Class<?> expected, java.lang.String name)
master
- The master buffer.expected
- The child's buffer DMO interface.name
- The child buffer's name.public static void associate(TableParameter src, Temporary dstDMO, boolean input, boolean output)
src
- TableParameter
containing reference to the source
temporary buffer or result set.dstDMO
- DMO instance returned by a previous call to define(java.lang.Class<T>, java.lang.String, boolean)
on
the destination temporary buffer.input
- if true
, records are copied from source table to
destination table immediately upon invocation of this method,
otherwise they are not.output
- if true
, records are copied from destination
table back to source table when the current transaction or
subtransaction is committed; otherwise they are not.ErrorConditionException
- if a recoverable error occurs flushing the source buffer in
preparation for an input copy or while copying records.java.lang.RuntimeException
- if an unrecoverable error occurs invoking methods on the
underlying DMOs to get or set data values.public static void associate(TableParameter src, Temporary dstDMO, boolean input, boolean output, boolean appendInput)
src
- TableParameter
containing reference to the source
temporary buffer or result set.dstDMO
- DMO instance returned by a previous call to define(java.lang.Class<T>, java.lang.String, boolean)
on
the destination temporary buffer.input
- if true
, records are copied from source table to
destination table immediately upon invocation of this method,
otherwise they are not.output
- if true
, records are copied from destination
table back to source table when the current transaction or
subtransaction is committed; otherwise they are not.appendInput
- true
to add new records without affecting
existing records; false
to remove all existing
records before the copy takes place. This option affects the
input
copy only, not the output
copy.ErrorConditionException
- if a recoverable error occurs flushing the source buffer in
preparation for an input copy or while copying records.java.lang.RuntimeException
- if an unrecoverable error occurs invoking methods on the
underlying DMOs to get or set data values.public static void associate(TableParameter src, Temporary dstDMO, boolean input, boolean output, boolean appendInput, ParameterOption mode)
src
- TableParameter
containing reference to the source temporary buffer or
result set.dstDMO
- DMO instance returned by a previous call to define(java.lang.Class<T>, java.lang.String, boolean)
on the destination
temporary buffer.input
- If true
, records are copied from source table to destination table
immediately upon invocation of this method, otherwise they are not.output
- If true
, records are copied from destination table back to source table
when the current transaction or subtransaction is committed; otherwise they are
not.appendInput
- Use true
to add new records without affecting existing records;
false
to remove all existing records before the copy takes place. This
option affects the input
copy only, not the output
copy.mode
- Parameter passing mode BY-VALUE, BIND or BY-REFERENCE option.ErrorConditionException
- if a recoverable error occurs flushing the source buffer in preparation for an
input copy or while copying records.java.lang.RuntimeException
- if an unrecoverable error occurs invoking methods on the underlying DMOs to get or
set data values.public static void createDynamicTable(TableParameter src, handle target, boolean input, boolean output)
src
- TableParameter
containing reference to the source table.target
- Handle for storing the target table.input
- if true
, records are copied from source table to
destination table immediately upon invocation of this method,
otherwise they are not.output
- if true
, records are copied from destination
table back to source table when the current transaction or
subtransaction is committed; otherwise they are not.public static void createDynamicTable(TableParameter src, handle target, boolean input, boolean output, boolean append, ParameterOption mode)
src
- TableParameter
containing reference to the source table.target
- Handle for storing the target table.input
- If true
, records are copied from source table to destination table
immediately upon invocation of this method, otherwise they are not.output
- If true
, records are copied from destination table back to source table
when the current transaction or subtransaction is committed; otherwise they are
not.append
- true
to add new records without affecting existing records; false
to remove all existing records before the copy takes place. This option affects the
input
copy only, not the output
copy.mode
- Parameter passing mode BY-VALUE, BIND or BY-REFERENCE option.public static Temporary getDefaultBuffer(handle tempTableHandle)
tempTableHandle
- Handle to a temporary table.public TempRecord getCurrentRecord()
getCurrentRecord
in class RecordBuffer
null
if the buffer currently is empty.public static java.util.Iterator<java.lang.String> activeTables()
public static int getTableCount()
public static boolean insertAllRows(TableWrapper srcResultSet, Temporary dstDMO, boolean append, TemporaryBuffer.CopyTableMode errorMode, int tableParameterIndex)
srcResultSet
- The source result set.dstDMO
- DMO instance refering the destination DMO buffer.append
- true
to append the data, false
to remove all records
first.errorMode
- Table copy mode, affects error handling.tableParameterIndex
- 1-based index of the corresponding table parameter (in declaration of the
function). Affects error handling.true
if copy was successful. false
if an error occurs
during copying records and error was recorder rather than thrown.ErrorConditionException
- if an error occurs during copying records.private static boolean createRecords(TableWrapper srcResultSet, TemporaryBuffer dstBuf, java.util.Map<java.lang.Long,TempRecord> dstNewIds, java.lang.String[] dstProperties, java.util.Map<java.lang.String,java.lang.reflect.Method> dstSetters, java.util.Map<java.lang.String,java.lang.Integer> dstExtents) throws java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, PersistenceException
srcResultSet
- The source result set.dstBuf
- The destination DMO buffer.dstNewIds
- Map to save the new record IDs. May be null
, in which case the
record is saved immediately; otherwise, the save will be postponed, to be able to
cross-link with the before-table meta information.dstProperties
- The properties to save.dstSetters
- The property setters.dstExtents
- The property extents.true
if at least one record was added.java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
PersistenceException
public static void referenceOnly(Temporary... dmos)
dmos
- Variable length list of DMO instances returned by previous calls to define(java.lang.Class<T>, java.lang.String, boolean)
.public static void registerCodePage(Temporary dmo, java.lang.String property, java.util.function.Supplier codePageExpr)
openScope()
.dmo
- DMO instance returned by previous calls to define(java.lang.Class<T>, java.lang.String, boolean)
.property
- Hibernate property name of the CLOB field.codePageExpr
- Code page expression.public static void openScopeAt(int blockDepth, DataModelObject... dmos)
blockDepth
- Zero-based depth of the block (starting from the outermost scope) at which the
buffer scopes are opened.dmos
- Variable length list of DMO instances returned by previous calls to define(java.lang.Class<T>, java.lang.String, boolean)
.protected static java.util.List<java.lang.Object[][]> readAllRows(Temporary srcDMO, java.util.List<PropertyDefinition> props)
srcDMO
- The source DMO used to read the data.props
- The properties needed for this DMO.protected static Temporary createDynamicBufferForTempTable(java.lang.String bufferName, TemporaryBuffer master)
createDefaultDynamicBufferForTempTable(TempTableBuilder)
.
Because the buffer is created dynamically it is bound to global scope, allowing it to survive the scope where it was created. because of this, it must be manually finalized.
bufferName
- Target buffer name (4GL form).master
- Master buffer (default buffer of the target table).protected static Temporary createDefaultDynamicBufferForTempTable(TempTableBuilder tempTable)
tempTable
- The temp-table builder object associated with the target table.private static Temporary createDynamicBufferForTempTable(java.lang.String bufferName, TemporaryBuffer master, TempTable tempTable)
Because the buffer is created dynamically it is bound to global scope, allowing it to survive the scope where it was created. because of this, it must be manually finalized.
bufferName
- Target buffer name (4GL form).master
- Master buffer (default buffer of the target table). Can be null
if the
default buffer for the table is created.tempTable
- The temp-table object associated with the target table.private static <T extends TempTableBuffer> TemporaryBuffer makeBuffer(java.lang.Class<?> def, java.lang.Class<T> dmoBufIface, java.lang.String variable, boolean global, UndoStateProvider undoable)
def
- The currently executing OE class or external program.dmoBufIface
- Interface which defines DMO's public API. This must be a
subinterface of Temporary
.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.global
- true
if the buffer survives until end of context
life; false
if it expires upon leaving the top
level procedure scope.undoable
- An UndoStateProvider
that manages the UNDO status of the table of this
buffer.private static <T extends TempTableBuffer> TemporaryBuffer makeBuffer(java.lang.Class<?> def, java.lang.Class<T> dmoBufIface, java.lang.String variable, boolean global, UndoStateProvider undoable, int blockDepth)
def
- The currently executing OE class or external program.dmoBufIface
- Interface which defines DMO's public API. This must be a subinterface of
TempTableBuffer
.variable
- Name of the variable with which the record buffer will be
associated in the transaction manager.global
- true
if the buffer survives until end of context life; false
if it
expires upon leaving the top level procedure scope.undoable
- An UndoStateProvider
that manages the UNDO status of the table of this
buffer.blockDepth
- Zero-based depth of the block (starting from the outermost scope) at which the
buffer is defined or -1
for the current scope.static Commitable getContextCommitable()
Commitable
which needs to have its
methods invoked on commit/rollback.Commitable
object for the current context.static boolean copyAllRows(Temporary srcDMO, Temporary dstDMO, boolean append, TemporaryBuffer.CopyTableMode errorMode)
TODO: it seems this method can be optimized to use a DMO's deepCopy() method instead of reflection when the source and destination DMO types are the same.
srcDMO
- DMO instance returned by a previous call to define(java.lang.Class<T>, java.lang.String, boolean)
on
the source temporary buffer.dstDMO
- DMO instance returned by a previous call to define(java.lang.Class<T>, java.lang.String, boolean)
on
the destination temporary buffer.append
- true
to add new records without affecting
existing records; false
to remove all existing
records before the copy takes place.errorMode
- Table copy mode, affects error handling.true
if copy was successful. false
if validation error
has occurred or the table is appended to itself.ErrorConditionException
- if a recoverable error occurs copying records.java.lang.RuntimeException
- if an unrecoverable error occurs invoking methods on the
underlying DMOs to get or set data values.static boolean copyAllRows(rowid srcRec, Temporary srcDMO, Temporary dstDMO, boolean append, TemporaryBuffer.CopyTableMode errorMode)
TODO: it seems this method can be optimized to use a DMO's deepCopy() method instead of reflection when the source and destination DMO types are the same.
srcRec
- The rowid
of the current record in the source buffer - if not null, it will
be set in the destination buffer, too.srcDMO
- DMO instance returned by a previous call to define(java.lang.Class<T>, java.lang.String, boolean)
on
the source temporary buffer.dstDMO
- DMO instance returned by a previous call to define(java.lang.Class<T>, java.lang.String, boolean)
on
the destination temporary buffer.append
- true
to add new records without affecting
existing records; false
to remove all existing
records before the copy takes place.errorMode
- Table copy mode, affects error handling.true
if copy was successful. false
if validation error
has occurred or the table is appended to itself.ErrorConditionException
- if a recoverable error occurs copying records.java.lang.RuntimeException
- if an unrecoverable error occurs invoking methods on the
underlying DMOs to get or set data values.static boolean copyAllRows(rowid srcRecId, Temporary srcDMO, Temporary dstDMO, boolean append, TemporaryBuffer.CopyTableMode errorMode, boolean skipUniqueConflicts, boolean replaceMode, boolean looseCopy)
srcRecId
- The rowid
of the current record in the source buffer - if not null, it will be set in
the destination buffer, too.srcDMO
- DMO instance returned by a previous call to define(java.lang.Class<T>, java.lang.String, boolean)
on the source temporary buffer.dstDMO
- DMO instance returned by a previous call to define(java.lang.Class<T>, java.lang.String, boolean)
on the destination temporary
buffer.append
- true
to add new records without affecting existing records;
false
to remove all existing records before the copy takes place.errorMode
- Table copy mode, affects error handling.skipUniqueConflicts
- Corresponds append-mode in COPY-TEMP-TABLE. If there is a unique index on the target temp-table
and a row with a duplicate key is found, the row is not replaced. This parameter is ignored if
replaceMode
is true
.replaceMode
- Corresponds replace-mode in COPY-TEMP-TABLE. When true
records in the target temp-table
are replaced with corresponding records from the source temp-table. The target temp-table must
have a unique primary index that be can used to find the corresponding record. When the
corresponding record is found in the target temp-table, the target record is replaced with the
source record.looseCopy
- Corresponds loose-copy-mode in COPY-TEMP-TABLE. Only the fields with the same name that appear
in both the source and target temp-table are copied. Other fields are ignored.
Note:
Because of an undocumented bug in OE, if the replaceMode
is true
the value will
'leak' and overwrite this parameter. As result, a temp-table can be copied to another,
incompatible temp-table even if looseCopy
is explicitly set to false
, just by
passing true
for the previous parameter.
true
if copy was successful.
false
if validation error has occurred or the table is appended to itself.ErrorConditionException
- if a recoverable error occurs copying records.java.lang.RuntimeException
- if an unrecoverable error occurs invoking methods on the underlying DMOs to get or set data
values.private static java.util.Map<RecordBuffer.DatumAccess,RecordBuffer.DatumAccess> createPropsMap(boolean looseCopy, BufferImpl srcDMO, BufferImpl dstDMO, TemporaryBuffer.CopyTableMode errorMode)
DatumAccess
mapping for the source and destination DMOs.looseCopy
- Corresponds loose-copy-mode in COPY-TEMP-TABLE. Only the fields with the same name
that appear in both the source and target temp-table are copied. Other fields are
ignored.srcDMO
- The source buffer.dstDMO
- The destination buffer.errorMode
- Table copy mode, affects error handling.static boolean copyChanges(TemporaryBuffer srcBefore, TemporaryBuffer srcAfter, TemporaryBuffer dstBefore, TemporaryBuffer dstAfter)
What this method actually does is copy all records from source buffers to destination, skipping the UNMODIFIED records from AFTER source, into destination. During the process, the BEFORE/AFTER ROWIDs relation between the new records is maintained.
srcBefore
- The buffer for BEFORE buffer source. All records from this table are copied.srcAfter
- The buffer for AFTER buffer source. The non-modified records of this table are
dropped.dstBefore
- The destination buffer for BEFORE records. With the exception of DELETEd records
from this table will have a link (AFTER-ROWID) to a record in dstAfter
.dstAfter
- The destination buffer for AFTER records. All records from this table will have
a link (BEFORE-ROWID) to a record in dstBefore
.protected boolean rejectChanges(BufferImpl after)
after
- The AFTER-BUFFER to be processed.true
if operation is successful.protected boolean markNew(BufferImpl before)
MARK-NEW
method. Called from BufferImpl.markNew()
.before
- The before buffer.true
if operation is successful.protected static boolean copyParentUnchangedRecords(BufferImpl parentDst, BufferImpl parentSrc, BufferImpl childSrc, java.lang.String whereStr)
DataSet
GET-CHANGES. This method copies the difference of records
that results from parent-mode
flag of this method.
this
to parentDst
for all changed records
from dst
, using an UNIQUE index for iteration. These are normally skipped when
parentDst
was populated from parentSrc
but now are required because of the
parentMode
flag. Only AFTER
records are copied: since they were NOT modified
they do not have a BEFORE pair.parentDst
- The buffer that will receive the copied records.parentSrc
- The buffer that will receive the copied records.childSrc
- The buffer/table that contains the changes in the child table.whereStr
- The where predicate that represents the relation between the original buffers, used
for locating parent-records.true
on success and false
if any error is detected.protected static void handleTablesDoNotMatch(TemporaryBuffer.CopyTableMode errorMode, java.lang.String srcBufName, java.lang.String dstBufName)
copyTempTableErrorMode
is true
then dispaly "The caller's
temp-table parameter {srcBufName} does not match to the target temp-table {dstBufName}"
error message and abend. Else display "COPY-TEMP-TABLE requires {srcBufName} and
{dstBufName} columns to match exactly unless the fourth loose-mode parameter is passed as
TRUE" error message.errorMode
- Table copy mode, affects error handling.srcBufName
- Source buffer name.dstBufName
- Destination buffer name.protected static <T> T makeMutable(java.lang.Class<T> dmoBufIface, T proxy)
dmoBufIface
- The DMO buffer interface.proxy
- The DMO proxy.static void updateObjectRefCount(java.lang.Class<?> dmoIface, object<?> oldVal, object<?> newVal)
dmoIface
- The DMO interface.oldVal
- The old value.newVal
- The new value.static java.lang.String writeToXml(handle tableHandle, boolean isHandle)
This is used when the remote call sent the TABLE as XML and it must receive it in the same format (used by SOAP callers).
tableHandle
- The handle referencing the table.isHandle
- Flag indicating that this is used for a DATASET-HANDLE parameter.private static void readFromXml(java.lang.String xmlTable, boolean append, handle table)
This is used when the remote call sent the TABLE as XML and it must receive it in the same format (used by SOAP callers).
xmlTable
- The XML serialized table.append
- Flag indicating if the read mode is 'append'. Otherwise, is 'empty.table
- The handle where to read the table.private static void decrementObjectCountRef(TemporaryBuffer.Context local, java.lang.Class<?> dmoIface, object<?> obj)
local
- The context-local instance.dmoIface
- The DMO interface.obj
- The object whose reference need to be decremented.private static void incrementObjectCountRef(TemporaryBuffer.Context local, java.lang.Class<?> dmoIface, object<?> obj)
local
- The context-local instance.dmoIface
- The DMO interface.obj
- The object whose reference need to be decremented.public Temporary bind(TemporaryBuffer other)
other
- The other buffer.public void unbind(Temporary old)
old
- The previous buffer to which this instance was bound.public boolean isGlobal()
isGlobal
in class RecordBuffer
global
flag.public void rollback(boolean transaction)
BufferManager
.
Auto-commit buffers are never rolled back.
rollback
in interface Commitable
rollback
in class RecordBuffer
transaction
- true
if this commit represents the master
transaction rollback; false
if it represents a
sub-transaction rollback.public void stateChanged(RecordChangeEvent event) throws PersistenceException
stateChanged
in interface RecordChangeListener
stateChanged
in class RecordBuffer
event
- Event which describes the DMO state change.PersistenceException
- if an error occurs executing a query to detect whether current
record still exists.public LockType getPinnedLockType(java.lang.Long id)
getPinnedLockType
in class RecordBuffer
id
- Not used.RecordLockContext
public void setPinnedLockType(java.lang.Long id, LockType pinnedLockType)
setPinnedLockType
in class RecordBuffer
id
- Not used.pinnedLockType
- Not used.RecordLockContext
public handle tableHandle()
tableHandle
in class RecordBuffer
public boolean initialize()
initialize
in class RecordBuffer
true
if the buffer was initialized with this call;
false
if the buffer had been initialized with a
previous call to this method.java.lang.IllegalArgumentException
- if no implementation class is found for the given database and
interface.java.lang.RuntimeException
- if the backing DMO implementation class does not implement a
constructor which accepts a multiplex ID.public void readAllRows(java.util.function.Consumer<TempRecord> rowHandler)
rowHandler
- Consumer function which will handle each result row according to the needs of the
caller.ErrorConditionException
- if there is any error querying the rows in the table.public java.lang.String getCodePage(java.lang.String property)
getCodePage
in class RecordBuffer
property
- The ORM property name of the CLOB field.public int count()
This is a SILENCED method. If a persistence error occur, -1 is returned and NO exception is thrown. In fact the method was created to be used internally, by FWD.
public final void upgradeLock() throws PersistenceException
upgradeLock
in class RecordBuffer
PersistenceException
- never.public boolean isAutoCommit()
isAutoCommit
in class RecordBuffer
true
if auto-commit, else false
.public boolean isTemporary()
isTemporary
in class RecordBuffer
true
.public long getCurrentPrimaryKey(java.lang.Class<? extends DataModelObject> dmoInterface)
dmoInterface
- Data model object interface.public void setCurrentPrimaryKey(java.lang.Class<? extends DataModelObject> dmoIface, long value)
dmoIface
- Data model object interface.value
- The new value for the primary key sequence.public java.lang.String getSequenceName()
public java.lang.String getImplicitSqlIndexName(java.lang.Class<? extends DataModelObject> dmoInterface)
dmoInterface
- DMO interface which represents the temp table.public java.lang.String getImplicitIndexName(java.lang.Class<? extends DataModelObject> dmoInterface)
dmoInterface
- DMO interface which represents the temp table.protected java.lang.String getLDBName(java.lang.String ldbOrAlias)
DatabaseManager.TEMP_TABLE_DB
, regardless of the value of the
ldbOrAlias
parameter.getLDBName
in class RecordBuffer
ldbOrAlias
- A logical database name or database alias.protected Database getPDB(java.lang.String ldbName)
DatabaseManager.TEMP_TABLE_DB
, regardless of the value of the
ldbName
parameter.getPDB
in class RecordBuffer
ldbName
- A logical database name.protected void onOpenOutermostScope()
This implementation overrides the parent method to do nothing. The parent implementation notifies the connection manager that this buffer is active, but accesses to the temp table database are outside of the connection manager's responsibilities.
onOpenOutermostScope
in class RecordBuffer
protected void onCloseOutermostScope()
This implementation overrides the parent method to not interact with the connection manager. The parent implementation notifies the connection manager that this buffer is no longer active, but accesses to the temp table database are outside of the connection manager's responsibilities.
onCloseOutermostScope
in class RecordBuffer
protected TempRecord instantiateDMO() throws java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
instantiateDMO
in class RecordBuffer
java.lang.InstantiationException
- if the class cannot be instantiated.java.lang.IllegalAccessException
- if the DMO class' target constructor cannot be accessed.java.lang.reflect.InvocationTargetException
- if the underlying constructor throws an exception.protected int lookupNumFields()
lookupNumFields
in class RecordBuffer
protected boolean isTableDefinitelyEmpty()
This implementation involves only the virtual table backing the current buffer (i.e., whose multiplex ID matches that of this buffer), not the entire physical table.
isTableDefinitelyEmpty
in class RecordBuffer
false
to indicate the backing table does not exist or is known to be empty; true
if the table exists and might have rows.protected boolean isUndoable()
We override this method for temp-tables, which can be marked NO-UNDO when defined. There also is a directory configuration option to treat all temp-tables as NO-UNDO, regardless of how they originally were defined.
isUndoable
in class RecordBuffer
true
if record changes can be undone, else false
.public java.lang.Integer getMultiplexID()
null
if this method is invoked before a buffer scope is
opened on this buffer for the first time. Otherwise, it will be a
unique identifier within the current context.getMultiplexID
in class RecordBuffer
protected boolean isMultiplexed()
Temp tables always are multiplexed.
isMultiplexed
in class RecordBuffer
true
.protected boolean allowsBulkActions()
allowsBulkActions
in class RecordBuffer
true
.protected RecordBuffer getMasterBuffer()
This only has meaning for shared temp tables. For a temp table defined as NEW SHARED, this buffer is returned. For a temp table defined as SHARED, the domain master buffer is returned.
getMasterBuffer
in class RecordBuffer
protected java.lang.String getDynamicName()
getDynamicName
in class RecordBuffer
null
if this buffer
represents a static temp-table.protected void openScope()
openScope
in class RecordBuffer
protected void openScopeAt(int blockDepth)
openScopeAt
in class RecordBuffer
blockDepth
- Zero-based depth of the block (starting from the outermost scope) at which the
buffer scope is opened.protected void finishedImpl()
finishedImpl
in class RecordBuffer
protected boolean hasExplicitBuffers()
buffers
.protected void resourceDeleted()
resourceDeleted
in class RecordBuffer
protected void initPinnedLockTypes()
initPinnedLockTypes
in class RecordBuffer
protected void deleteAll()
deleteAll
in class RecordBuffer
ErrorConditionException
- if an error occurs performing the bulk delete operation.protected java.util.Set<TemporaryBuffer> getAllSlaveBuffers()
protected void cleanupSlaveBuffers()
protected void decrementObjectCountRef(object<?> obj)
decrementObjectCountRef
in class RecordBuffer
obj
- The object whose reference need to be decremented.protected java.util.Map<java.lang.String,java.lang.String> getBoundPropertyMappings()
getBoundPropertyMappings
in class RecordBuffer
TemporaryBuffer.ReferenceProxy.properties
mappings.protected integer rowState()
ROW-STATE
property for this record. Valid values
are defined as constants in Buffer
interface. Additionally, unknown
value is
returned if property is not available.rowState
in class RecordBuffer
ROW-STATUS
property for this record as explained above.public void rowState(java.lang.Integer state)
ROW-STATUS
property for this record. Valid values are defined
as constants in Buffer
interface. Additionally null
value is allowed if
property is not available.rowState
in class RecordBuffer
state
- The new value of the ROW-STATE
property for this record as explained above.protected rowid peerRowid()
rowid
of the peer record. Exclusively, for a BEFORE-TABLE record this is the
after-rowid
and before-rowid
for AFTER-TABLE record.peerRowid
in class RecordBuffer
unknown
if there is none.public void peerRowid(rowid peer)
rowid
value of the peer record. Exclusively, for a BEFORE-TABLE record this
is the after-rowid
and before-rowid
for AFTER-TABLE record.peerRowid
in class RecordBuffer
peer
- The new long rowid value of the peer record or null
.public void originRowid(rowid peer)
origin-rowid
for AFTER-TABLE record.originRowid
in class RecordBuffer
peer
- The new long rowid value of the record or null
.public void datasourceRowid(rowid sourceRowid)
datasource-rowid
for AFTER-TABLE record.datasourceRowid
in class RecordBuffer
sourceRowid
- The new long rowid value of the record or null
.protected java.lang.Integer errorFlags()
errorFlag
of this record.errorFlags
in class RecordBuffer
errorFlag
of this record or null
if it was not configured. If not null,
the value is a bitwise combination of ERROR and REJECTED attribute. It's up to the called to
extract the bit(s) it needs.Buffer.__ERROR_FLAG__
,
Buffer.ERROR_ERROR
,
Buffer.ERROR_REJECTED
protected void updateErrorFlags(int errFlag, boolean set)
errorFlag
value this peer record. The error
attribute of the record
is composed of multiple bit flags. This method manages its value based on the parameters it receives.updateErrorFlags
in class RecordBuffer
errFlag
- The error bit to be set or removed.set
- Use true
to set the flag and false
to remove it.Buffer.__ERROR_FLAG__
,
Buffer.ERROR_ERROR
,
Buffer.ERROR_REJECTED
protected character errorString()
errorString
of this record.errorString
in class RecordBuffer
errorFlag
of this record or unknown
if it was not configured.Buffer.__ERROR_STRING__
protected void errorString(Text string)
error string
of this record.errorString
in class RecordBuffer
string
- The new error string
of this record.Buffer.__ERROR_STRING__
protected void setTempTableRef(TempTable tempTableRef)
tempTableRef
- Parent temp table.protected void closeMultiplexScope()
protected void performOutputCopy(TableParameter outputParameter)
outputParameter
- The table parameter where to copy the data.private void setIgnoreBeforeTracking(boolean ignore)
true
this
flag makes the change-tracking of this dataset AFTER-BUFFER ignore changes and skip storing
changes to associated BEFORE-BUFFER. This is needed by REJECT-CHANGES when CHANGE-TRACKING
is still on.ignore
- true
to deactivate the changes-tracking for this buffer.private boolean hasOoDestructors()
true
when there is at least one object store in this temp-table that has at
least one active destructor.private void registerCodePage(java.lang.String property, java.util.function.Supplier codePageExpr)
openScope()
.property
- Hibernate property name of the CLOB field.codePageExpr
- Code page expression.private void processCodePages()
TempTable
. A code page can be
inherited through LIKE option (either table- or field-level) or specified in
COLUMN-CODEPAGE option.private java.lang.String resolveCodePage(java.util.function.Supplier supplier)
supplier
- Supplier to be resolved.private void loopDelete(DataModelObject[] suppDMOs, java.lang.String where, java.lang.Object[] args)
This is only used when the table contains Progress.Lang.Object
fields and there is
at least one record that holds an objects that has defined any destructors to be called when
it is deleted.
Because the method fetches every affected record instead of executing a bulk operation, this method has a performance penalty associated.
where
- An HQL where clause snippet which defines the restriction criteria to apply to the
delete. All references to properties in a DMO must be unqualified. null
to
delete all records whose multiplex IDs match that of this buffer.args
- Query substitution parameters required by the where clause. null
if there
are no substitutions or no where clause.private java.lang.String getPrimaryOrderByClause()
private boolean openMultiplexScope()
true
if this is the first multiplex scope opened for the underlying DMO
type; false
if multiplex scopes are already open in this context for this
DMO type.protected void delete(java.lang.String where, java.lang.Object... args) throws PersistenceException
The targeted records are not actually removed from the buffer; instead, they are assigned another multiplex ID, which marks them as deleted.
Note: primary keys surrendered via bulk deletes are not currently recycled.
delete
in class RecordBuffer
where
- An HQL where clause snippet which defines the restriction
criteria to apply to the delete. All references to properties
in a DMO must be unqualified.args
- Query substitution parameters required by the where clause.PersistenceException
- if an error occurs performing the bulk delete operation.protected void delete(DataModelObject[] suppDMOs, java.lang.String where, java.lang.Object... args) throws PersistenceException
The targeted records are not actually removed from the buffer; instead, they are assigned another multiplex ID, which marks them as deleted.
Note: primary keys surrendered via bulk deletes are not currently recycled.
delete
in class RecordBuffer
suppDMOs
- The DMOs for the external (additional) buffers that are accessed in inner
subselect, or null
in case of a simple where
predicate.where
- An HQL where clause snippet which defines the restriction
criteria to apply to the delete. All references to properties
in a DMO must be unqualified.args
- Query substitution parameters required by the where clause.PersistenceException
- if an error occurs performing the bulk delete operation.protected boolean delete(java.util.function.Supplier<logical> valexp, java.util.function.Supplier<character> valmsg) throws PersistenceException
null
if the deletion is
successful. Reclaim the record's primary key for later re-use.delete
in class RecordBuffer
valexp
- The validation expression to evaluate.valmsg
- The error message to display when validation fails.true
if operation is successful and false
otherwise.PersistenceException
- if no record currently is loaded in the buffer, or if there is an error deleting the current
record from the database.protected void reclaimKeys(java.util.List<java.lang.Long> keys)
reclaimKeys
in class RecordBuffer
keys
- A list of primary keys which are available for re-use. Must
not be null
.protected java.lang.Long nextPrimaryKey() throws PersistenceException
nextPrimaryKey
in class RecordBuffer
PersistenceException
- if there was an error while retrieving the next primary key.protected boolean isQueried()
ChangeBroker.isQueried(java.lang.Class<? extends com.goldencode.p2j.persist.DataModelObject>, java.lang.Integer)
protected boolean forceLoopingDelete()
true
if the buffer is currently being queried or any object fields have a
destructor.protected void setUsePendingReclaimed(boolean state)
usePendingReclaimed
flag. When set, the pending PKs
need to be used when creating a new record.state
- The new flag state.private void doCloseMultiplexScope() throws PersistenceException
TableMapper
. If this is the last
scope to be closed for this DMO type, also request the context to drop the backing temp table from the
database when the database session is closed.PersistenceException
- if any error occurs within a listener while processing a change event.private boolean isMultiplexScopeClosed()
closeMultiplexScope()
for more information.true
if multiplex scope is closed.private void removeRecords(DataModelObject[] extDMOs, java.lang.String where, java.lang.Object[] args, boolean forceDelete) throws PersistenceException
deleteAll()
and
RecordBuffer.delete(DataModelObject[], String, Object[])
methods.extDMOs
- The DMOs for the external (additional) buffers that are accessed in inner
subselect, or null
in case of a simple where
predicate.where
- An HQL where clause snippet which defines the restriction
criteria to apply to the delete. All references to properties
in a DMO must be unqualified. null
to delete all
records whose multiplex IDs match that of this buffer.args
- Query substitution parameters required by the where clause.
null
if there are no substitutions or no where clause.forceDelete
- Force the records to be deleted from the table, not just
marking them with a negative multiplex ID.PersistenceException
- if an error occurs performing the bulk delete operation.private TempTable tempTableResource()
TempTable
resource associated with this temporary buffer.private void setupBeforeFlagImpl(TemporaryBuffer.BeforeFieldUpdater updater, java.lang.String changedField, java.lang.String legacy, boolean updatePeer)
updater
- The (lambda) code that does the actual field update.changedField
- The java name of the field to be updated. used to notify the ChangeBroker
.legacy
- The legacy name of the field. Only used for logging when operation fails.updatePeer
- Update the peer too: make the same change to the peer record.