public class TempTableBuilder extends AbstractTempTable
TempTable
interface is needed by CommonHandle
in order to store the handle to a the table.AbstractTempTable.CallingFunction
Modifier and Type | Field and Description |
---|---|
private boolean |
addFunctionCalled
Flag that indicates that an ADD-* function was called for the table (CLEAR function resets
this flag).
|
private static java.util.Set<java.lang.Character> |
allowedSpecialChars
Special characters (not letters or digits) allowed in dynamic table names.
|
private static java.util.Map<java.lang.String,java.lang.Integer> |
datatypesMatchLen
Used during data type name validation.
|
private static java.lang.String |
DATETIMETZ_TYPE_NAME
datetime-tz 4GL type name.
|
private static java.util.Map<java.lang.String,java.lang.String> |
defaultFormatStrings
Data type name to default format string.
|
private boolean |
deleted
Determines if the table object was deleted.
|
private java.lang.Class<?> |
dmoIface
Generated DMO buffer class.
|
private java.util.Map<java.lang.String,P2JField> |
fields
Table fields keyed by their normalized names.
|
private java.util.Map<java.lang.String,P2JIndex> |
indexes
Table indexes keyed by their normalized names.
|
private org.hibernate.mapping.PersistentClass |
persistentClass
Persistence class generated for this temporary table.
|
admData, DEFAULT_COPY_TEMP_TABLE_PREFIX, defaultBufferHandle, error, errorString, undoable
name, nextSibling, prevSibling
instProc
Constructor and Description |
---|
TempTableBuilder()
Create a new TEMP-TABLE resource.
|
Modifier and Type | Method and Description |
---|---|
boolean |
_dynamic()
Checks whether the resource is dynamic or static.
|
boolean |
_prepared()
Returns
true if this temp-table is in prepared state (after a successful call
to tempTablePrepare(java.lang.String) ). |
private void |
addAllFields(java.util.Collection<P2JField> fields)
Add all fields from the given collection to the table.
|
private void |
addAllIndexes(java.util.Collection<P2JIndex> indexes)
Add all indexes from the given collection to the table.
|
private void |
addField(P2JField field)
Add new field to the table.
|
logical |
addFieldLike(character name,
character source)
Adds to the temp-table a field like the one specified.
|
logical |
addFieldLike(character name,
handle source)
Adds to the temp-table a field like the one specified.
|
logical |
addFieldLike(java.lang.String name,
handle source)
Adds to the temp-table a field like the one specified.
|
logical |
addFieldLike(java.lang.String name,
java.lang.String source)
Adds to the temp-table a field like the one specified.
|
logical |
addFieldsFrom(character tableName)
Adds fields from another table into this temp-table.
|
logical |
addFieldsFrom(character tableName,
character except)
Adds fields from another table into this temp-table.
|
logical |
addFieldsFrom(handle hbuf)
Adds fields from another table into this temp-table.
|
logical |
addFieldsFrom(handle hbuf,
character except)
Adds fields from another table into this temp-table.
|
logical |
addFieldsFrom(handle hbuf,
java.lang.String except)
Adds fields from another table into this temp-table.
|
logical |
addFieldsFrom(java.lang.String tableName)
Adds fields from another table into this temp-table.
|
logical |
addFieldsFrom(java.lang.String tableName,
character except)
Adds fields from another table into this temp-table.
|
logical |
addFieldsFrom(java.lang.String tableName,
java.lang.String except)
Adds fields from another table into this temp-table.
|
logical |
addFieldToIndex(character indexName,
character field)
Construct an index of this temp-table by adding a new field to it.
|
logical |
addFieldToIndex(character indexName,
character field,
character ascending)
Construct an index of this temp-table by adding a new field to it.
|
logical |
addFieldToIndex(character indexName,
character field,
java.lang.String ascending)
Construct an index of this temp-table by adding a new field to it.
|
logical |
addFieldToIndex(character indexName,
java.lang.String field)
Construct an index of this temp-table by adding a new field to it.
|
logical |
addFieldToIndex(character indexName,
java.lang.String field,
character ascending)
Construct an index of this temp-table by adding a new field to it.
|
logical |
addFieldToIndex(character indexName,
java.lang.String field,
java.lang.String ascending)
Construct an index of this temp-table by adding a new field to it.
|
logical |
addFieldToIndex(java.lang.String indexName,
character field)
Construct an index of this temp-table by adding a new field to it.
|
logical |
addFieldToIndex(java.lang.String indexName,
character field,
character ascending)
Construct an index of this temp-table by adding a new field to it.
|
logical |
addFieldToIndex(java.lang.String indexName,
character field,
java.lang.String ascending)
Construct an index of this temp-table by adding a new field to it.
|
logical |
addFieldToIndex(java.lang.String indexName,
java.lang.String field)
Construct an index of this temp-table by adding a new field to it.
|
logical |
addFieldToIndex(java.lang.String indexName,
java.lang.String field,
character ascending)
Construct an index of this temp-table by adding a new field to it.
|
logical |
addFieldToIndex(java.lang.String indexName,
java.lang.String field,
java.lang.String ascending)
Construct an index of this temp-table by adding a new field to it.
|
protected boolean |
addFunctionWasCalled()
Determine if an ADD-* function was called for the table (CLEAR function resets the state).
|
private void |
addIndex(P2JIndex index)
Add new index to the table.
|
logical |
addIndexLike(character name,
character sourceName,
character dbTable)
Adds to the temp-table an index like the one specified.
|
logical |
addIndexLike(character name,
character sourceName,
handle sourceBuffer)
Adds to the temp-table an index like the one specified.
|
private logical |
addIndexLike(P2JIndex srcIndex)
Adds to the temp-table an index like the one specified.
|
logical |
addIndexLike(java.lang.String name,
java.lang.String sourceName,
handle sourceBuffer)
Adds to the temp-table an index like the one specified.
|
logical |
addIndexLike(java.lang.String name,
java.lang.String sourceName,
java.lang.String dbTable)
Adds to the temp-table an index like the one specified.
|
logical |
addNewField(character name,
character type)
Adds a field with the specified properties to the temp-table.
|
logical |
addNewField(character name,
character type,
integer extent)
Adds a field with the specified properties to the temp-table.
|
logical |
addNewField(character name,
character type,
integer extent,
character format)
Adds a field with the specified properties to the temp-table.
|
logical |
addNewField(character name,
character type,
integer extent,
character format,
BaseDataType initial)
Adds a field with the specified properties to the temp-table.
|
logical |
addNewField(character name,
character type,
integer extent,
character format,
BaseDataType initial,
character label)
Adds a field with the specified properties to the temp-table.
|
logical |
addNewField(character name,
character type,
integer extent,
character format,
BaseDataType initial,
character label,
character columnLabel)
Adds a field with the specified properties to the temp-table.
|
protected void |
addNewField(PropertyDefinition propertyDefinition)
Add new field from property definition data.
|
logical |
addNewIndex(character name)
Adds a new empty index with the specified name to the temp-table.
|
logical |
addNewIndex(character name,
logical unique)
Adds a new empty index with the specified name to the temp-table.
|
logical |
addNewIndex(character name,
logical unique,
logical primary)
Adds a new empty index with the specified name to the temp-table.
|
logical |
addNewIndex(character name,
logical unique,
logical primary,
logical word)
Adds a new empty index with the specified name to the temp-table.
|
static handle |
asHandle(Temporary buf)
Get the TEMP-TABLE handle associated with this temporary buffer.
|
static TempTable |
asTempTable(Temporary buf)
Get the TEMP-TABLE associated with this temporary buffer.
|
logical |
clear()
Returns the temp-table to it's clear state, removing all defined fields, indexes, all
records in the table and all corresponding buffers.
|
private P2JField |
copyField(java.lang.String targetName,
P2JField srcField)
Returns a new field with the new specified name and all other parameters copied from the
source field.
|
private P2JIndex |
copyIndex(P2JIndex srcIndex)
Returns a new index with all parameters copied from the source index.
|
static void |
create(handle tth)
Dynamically creates a temporary table at runtime and assign it to a
handle.
|
static void |
create(handle tth,
character widgetPool)
Dynamically creates a temporary table at runtime and assign it to a
handle.
|
static void |
create(handle tth,
java.lang.String widgetPool)
Dynamically creates a temporary table at runtime and assign it to a
handle.
|
private void |
createDefaultBuffer()
Create default buffer for the table.
|
void |
createFromTableWrapper(TableWrapper tableWrapper,
int tableParameterIndex)
Build temporary table from a table wrapper object.
|
logical |
createTableLike(character tableName)
Duplicates the structure of an existing table, copying the field
definitions, and optionally, the indexes.
|
logical |
createTableLike(character tableName,
character indexName)
Duplicates the structure of an existing table, copying the field
definitions, and optionally, the indexes.
|
logical |
createTableLike(handle hbuf)
Duplicates the structure of an existing table, copying the field
definitions, and optionally, the indexes.
|
logical |
createTableLike(handle hbuf,
character indexName)
Duplicates the structure of an existing table, copying the field
definitions, and optionally, the indexes.
|
logical |
createTableLike(handle hbuf,
java.lang.String indexName)
Duplicates the structure of an existing table, copying the field
definitions, and optionally, the indexes.
|
logical |
createTableLike(java.lang.String tableName)
Duplicates the structure of an existing table, copying the field
definitions, and optionally, the indexes.
|
logical |
createTableLike(java.lang.String tableName,
java.lang.String indexName)
Duplicates the structure of an existing table, copying the field
definitions, and optionally, the indexes.
|
private logical |
createTableLikeImpl(character tableName,
character indexName,
boolean handleIndex)
Duplicates the structure of an existing table, copying the field
definitions, and optionally, the indexes.
|
private logical |
createTableLikeImpl(handle hbuf,
character indexName,
boolean handleIndex)
Duplicates the structure of an existing table, copying the field
definitions, and optionally, the indexes.
|
handle |
defaultBufferHandle()
Obtain the handle to the buffer that was created by default for this
temporary table.
|
private void |
displayCouldNotFindAddIndex(java.lang.String indexName)
Display "Could not find index {indexName} during ADD-INDEX-FIELD" error message.
|
private void |
displayCouldNotFindLikeField(java.lang.String fieldName)
Display "Could not find source field {fieldName} during ADD-LIKE-FIELD." error message.
|
private void |
displayCouldNotFindLikeIndex(java.lang.String tableName,
java.lang.String indexName)
Display "ADD-LIKE-INDEX could not find index {indexName} in table {tableName}" error
message.
|
private void |
displayCouldNotFindLikeTable(java.lang.String tableName)
Display "Could not find table {tableName} during ADD-LIKE-FIELD.
|
private void |
displayCouldNotFindLikeTableName(java.lang.String tableName)
Display "TEMP-TABLE method could not find LIKE table name {tableName}}" error message.
|
private void |
displayDuplicateIndex(java.lang.String indexName)
Display "Duplicate index name {indexName} for temp-table" error message.
|
private void |
displayDuplicateOrInvalidIndexField(java.lang.String indexName,
java.lang.String fieldName)
Display "Attempt to add duplicate or inappropriate word index field {fieldName} to index
{indexName}" error message.
|
private void |
displayUnableToCreateLikeIndex()
Display "Unable to create index for TEMP-TABLE in ADD-LIKE-INDEX" error message.
|
private void |
displayUnableToEvaluate()
Display "Unable to evaluate arguments for TEMP-TABLE method" error message.
|
private void |
displayUnableToFindIndex(java.lang.String tableName,
java.lang.String indexName)
Display "Unable to find index {indexName} in table {tableName}" error message.
|
private void |
displayUnableToPrepareTableFields()
Display "Unable to prepare TEMP-TABLE fields" error message.
|
private void |
displayUnableToPrepareTableIndices()
Display "Unable to prepare TEMP-TABLE indices" error message.
|
private void |
doAddFieldsFrom(java.util.Collection<P2JField> srcFields,
character except)
Add specified set of fields to the table.
|
logical |
dynamic()
Checks whether the resource is dynamic or static.
|
private Persistence |
findExistingTable(java.lang.String fullTableName,
boolean tableNameSearch)
Search for an existing table with the specified name.
|
private static P2JIndex |
findIndexByName(java.util.Collection<P2JIndex> indexes,
java.lang.String indexName)
Find index in the collection of indexes by its name.
|
private boolean |
forceClear()
Unconditionally delete all buffers for this table, drop DMO definitions and temporary table,
clear TEMP-TABLE data structures.
|
void |
forceDelete()
Unconditionally delete all buffers for this table, drop DMO definitions and temporary table,
clear TEMP-TABLE data structures and mark the table as deleted (i.e.
|
static java.lang.String |
getDefaultDataTypeFormat(java.lang.String datatype)
Get default format for the given data type.
|
java.lang.Class<?> |
getDMOClass()
Get DMO implementation class associated with this table.
|
java.lang.Class<?> |
getDMOInterface()
Get DMO interface which backs this table.
|
static P2JField |
getExistingField(java.lang.Class<?> dmoClass,
java.lang.String fieldNameHibernate,
TempTable tempTable)
Get the field of an existing table.
|
static P2JField |
getExistingField(Persistence persistence,
java.lang.String tableName4GL,
java.lang.String fieldName4GL)
Get the field of an existing table.
|
static P2JField |
getExistingField(RecordBuffer buffer,
java.lang.String fieldNameHibernate)
Get the field of an existing table.
|
static java.util.Collection<P2JField> |
getExistingFields(Persistence persistence,
java.lang.String tableName4GL)
Get the fields of an existing table.
|
static java.util.Collection<P2JField> |
getExistingFields(RecordBuffer buffer)
Get the fields of an existing table.
|
static P2JIndex |
getExistingIndex(Persistence persistence,
java.lang.String tableName4GL,
java.lang.String indexName4GL)
Get the index of an existing table.
|
static P2JIndex |
getExistingIndex(RecordBuffer buffer,
java.lang.String indexName4GL)
Get the index of an existing table.
|
static java.util.Collection<P2JIndex> |
getExistingIndexes(Persistence persistence,
java.lang.String tableName4GL)
Get the indexes of an existing table.
|
static java.util.Collection<P2JIndex> |
getExistingIndexes(RecordBuffer buffer)
Get the indexes of an existing table.
|
P2JField |
getField(java.lang.String fieldName)
Get field by its name.
|
java.util.Collection<P2JField> |
getFields()
Get the collection of table fields.
|
P2JIndex |
getIndex(java.lang.String indexName)
Get index by its name.
|
java.util.Collection<P2JIndex> |
getIndexes()
Get table indexes.
|
static java.lang.String |
getLegacyFieldName(java.lang.Class<?> dmoIface,
java.lang.String fieldNameHibernate,
TempTable tempTable)
Get the legacy name of an existing field (for any kind of table).
|
static java.lang.String |
getLegacyTableName(RecordBuffer buffer)
Get legacy table name.
|
static java.lang.String[] |
getOrderedPropertyNames(java.lang.Class<?> dmoIface,
TempTable tempTable)
Get the array of Hibernate property names ordered in the same way as they were specified in
4GL for the given table.
|
(package private) org.hibernate.mapping.PersistentClass |
getPersistentClass()
Get persistent class which corresponds the table.
|
static java.lang.String[] |
getPropertyNamesArray(java.lang.Class<?> dmoIface,
TempTable tempTable)
Get the array of Hibernate property names ordered in the same way as they were specified in
4GL for the given table (for the possible denormalized tables).
|
private boolean |
hasField(java.lang.String fieldName)
Checks whether the field with specified name already exist.
|
private boolean |
hasIndex(java.lang.String indexName)
Checks whether the index with specified name already exist.
|
protected boolean |
hasNameReadOnly()
Check if this resource supports the NAME attribute only in read-only mode.
|
protected boolean |
hasNextSibling()
Check if this resource supports the NEXT-SIBLING attribute.
|
protected boolean |
hasPrevSibling()
Check if this resource supports the PREV-SIBLING attribute.
|
private boolean |
hasSameNormalizedName(java.lang.String name1,
java.lang.String name2)
Determines if two names has the same normalized form.
|
character |
name()
Get table NAME attribute.
|
void |
name(character name)
Set table NAME attribute.
|
private java.util.Set<java.lang.String> |
parseFieldList(character list)
Split comma-separated list of field names into the set of separate field names.
|
logical |
prepared()
Returns
true if this temp-table is in prepared state (after a successful call
to tempTablePrepare(java.lang.String) ). |
protected boolean |
resourceDelete()
Worker to be implemented by each resource.
|
(package private) void |
setDmoIface(java.lang.Class<?> dmoIface)
Set DMO interface class which corresponds the table.
|
(package private) void |
setPersistentClass(org.hibernate.mapping.PersistentClass persistentClass)
Set persistent class which corresponds the table.
|
logical |
tempTablePrepare(character name)
Signals that all the field and index definitions for a temp-table
have been provided.
|
logical |
tempTablePrepare(java.lang.String name)
Signals that all the field and index definitions for a temp-table
have been provided.
|
boolean |
valid()
Reports if this object is valid for use.
|
static ParmType |
validateDatatype(java.lang.String datatype)
Validates data type name which was passed to ADD-NEW-FIELD function.
|
static void |
validateDateFormatOnAddNewField(java.lang.String fmt)
Validates date format on adding new field.
|
static boolean |
validateFormat(ParmType parmType,
java.lang.String format)
Validate format for the given data type.
|
_hasRecords, canUndo, changeErrorString, copyTempTable, copyTempTable, copyTempTable, copyTempTable, copyTempTable, copyTempTable, copyTempTable, copyTempTable, copyTempTable, defaultBuffer, deleteAllBuffers, displayCannotClear, displayCopyTempTableHalfDefined, displayCopyTempTableInvalidFirstArg, displayCouldNotFindLikeTableFromHandle, displayCreateLikeNotFirst, displayNotPrepared, displayPrepared, displayPreparedIgnoring, displayUnableAddFieldsFrom, displayUnableAssignUnknownUndo, displayUnableCreateLike, errorString, getADMData, getRecordBufferByHandle, getUniqueID, hasRecords, isError, isUndoable, setADMData, setADMData, setCanUndo, setError, setError
delete, firstResource, firstResource, getHead, getNextSibling, getNextSibling, getPrevSibling, getPrevSibling, getPrivateData, getTail, hasName, hasParent, hasPrivateData, interlink, isChained, lastResource, lastResource, name, readOnlyError, setHead, setNextSibling, setNextSibling, setPrevSibling, setPrevSibling, setPrivateData, setPrivateData, setPrivateData
getResourceType, id, id, implicitDeletion, instantiatingProcedure, invalidAttribute, setInstantiatingProcedure, type, unknown
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getNextSibling, getPrevSibling, getPrivateData, setPrivateData, setPrivateData
getResourceType, readOnlyError
id, id, unknown
private static final java.lang.String DATETIMETZ_TYPE_NAME
private static final java.util.Set<java.lang.Character> allowedSpecialChars
private static final java.util.Map<java.lang.String,java.lang.Integer> datatypesMatchLen
private static final java.util.Map<java.lang.String,java.lang.String> defaultFormatStrings
private final java.util.Map<java.lang.String,P2JField> fields
private final java.util.Map<java.lang.String,P2JIndex> indexes
private java.lang.Class<?> dmoIface
private org.hibernate.mapping.PersistentClass persistentClass
private boolean deleted
private boolean addFunctionCalled
public static void create(handle tth, java.lang.String widgetPool)
CREATE TEMP-TABLE
statement of Progress 4GL.tth
- The handle to assign the newly created temporary table to.widgetPool
- The name of the widget pool that contains the temp-table. null
if the
unnamed pool must be used.public static void create(handle tth, character widgetPool)
CREATE TEMP-TABLE
statement of Progress 4GL.tth
- The handle to assign the newly created temporary table to.widgetPool
- The name of the widget pool that contains the temp-table. null
if the
unnamed pool must be used.public static void create(handle tth)
CREATE TEMP-TABLE
statement of Progress 4GL.tth
- The handle to assign the newly created temporary table to.public static handle asHandle(Temporary buf)
buf
- A temporary buffer for which the associated TEMP-TABLE resource is needed.public static TempTable asTempTable(Temporary buf)
buf
- A temporary buffer for which the associated TEMP-TABLE resource is needed.public static P2JField getExistingField(Persistence persistence, java.lang.String tableName4GL, java.lang.String fieldName4GL)
persistence
- Persistence which corresponds the target database.tableName4GL
- 4GL table name.fieldName4GL
- 4GL field name.null
if there is no such field.public static P2JField getExistingField(RecordBuffer buffer, java.lang.String fieldNameHibernate)
buffer
- A record buffer which backs records of the target table.fieldNameHibernate
- Hibernate field name.null
if there is no such field.public static P2JField getExistingField(java.lang.Class<?> dmoClass, java.lang.String fieldNameHibernate, TempTable tempTable)
dmoClass
- DMO interface.fieldNameHibernate
- Hibernate field name.tempTable
- Temp table object. null
for permanent tables.null
if there is no such field.public static P2JIndex getExistingIndex(RecordBuffer buffer, java.lang.String indexName4GL)
buffer
- A record buffer which backs records of the target table.indexName4GL
- 4GL index name.null
if there is no such index.public static P2JIndex getExistingIndex(Persistence persistence, java.lang.String tableName4GL, java.lang.String indexName4GL)
persistence
- Persistence which corresponds the target database.tableName4GL
- 4GL table name.indexName4GL
- 4GL index name.null
if there is no such index.public static java.util.Collection<P2JIndex> getExistingIndexes(Persistence persistence, java.lang.String tableName4GL)
persistence
- Persistence which corresponds the target database.tableName4GL
- 4GL table name.null
if there is no
such table.public static java.util.Collection<P2JIndex> getExistingIndexes(RecordBuffer buffer)
buffer
- A record buffer which backs records of the target table.null
if there is no
such table.public static java.util.Collection<P2JField> getExistingFields(RecordBuffer buffer)
buffer
- A record buffer which backs records of the target table.null
if there is no
such table.public static java.util.Collection<P2JField> getExistingFields(Persistence persistence, java.lang.String tableName4GL)
persistence
- Persistence which corresponds the target database.tableName4GL
- 4GL table name.null
if there is no
such table.public static java.lang.String[] getOrderedPropertyNames(java.lang.Class<?> dmoIface, TempTable tempTable)
dmoIface
- DMO interface associated with the target table.tempTable
- Temp-table object which backs the target table or null
if the table is
a permanent table.public static java.lang.String[] getPropertyNamesArray(java.lang.Class<?> dmoIface, TempTable tempTable)
dmoIface
- DMO interface associated with the target table.tempTable
- Temp-table object which backs the target table or null
if the table is
a permanent table.public static java.lang.String getLegacyTableName(RecordBuffer buffer)
buffer
- A buffer of the target table.public static java.lang.String getLegacyFieldName(java.lang.Class<?> dmoIface, java.lang.String fieldNameHibernate, TempTable tempTable)
dmoIface
- DMO implementation class.fieldNameHibernate
- Hibernate field name.tempTable
- Temp table object. null
for permanent tables.null
if there is no such field.private static P2JIndex findIndexByName(java.util.Collection<P2JIndex> indexes, java.lang.String indexName)
indexes
- Collection of indexes to be searched.indexName
- Name of the target index.null
if there is no such index.public static void validateDateFormatOnAddNewField(java.lang.String fmt) throws ErrorConditionException
fmt
- Date format.ErrorConditionException
- Date format is wrong.public static java.lang.String getDefaultDataTypeFormat(java.lang.String datatype)
datatype
- Data type (string representation as in Enum.toString()
.public static boolean validateFormat(ParmType parmType, java.lang.String format)
parmType
- Data type.format
- Format string to check.true
if format is valid.public static ParmType validateDatatype(java.lang.String datatype)
datatype
- Data type name.ParmType
or null
if validation has failed.public logical createTableLike(handle hbuf, java.lang.String indexName)
CREATE-LIKE
method
of Progress 4GL.hbuf
- A handle to a buffer or table from which to copy the definitions.indexName
- The name of a single index which is copied from the source table.true
on success.public logical createTableLike(handle hbuf, character indexName)
CREATE-LIKE
method
of Progress 4GL.hbuf
- A handle to a buffer or table from which to copy the definitions.indexName
- The name of a single index which is copied from the source table.true
on success.public logical createTableLike(java.lang.String tableName, java.lang.String indexName)
CREATE-LIKE
method
of Progress 4GL.tableName
- The name of a table to create the copy of.indexName
- The name of a single index which is copied from the source table.true
on success.public logical createTableLike(character tableName, character indexName)
CREATE-LIKE
method
of Progress 4GL.tableName
- The name of a table to create the copy of.indexName
- The name of a single index which is copied from the source table.true
on success.public logical createTableLike(handle hbuf)
CREATE-LIKE
method
of Progress 4GL.hbuf
- A handle to a buffer or table from which to copy the definitions.true
on success.public logical createTableLike(java.lang.String tableName)
CREATE-LIKE
method
of Progress 4GL.tableName
- The name of a table to create the copy of.true
on success.public logical createTableLike(character tableName)
CREATE-LIKE
method
of Progress 4GL.tableName
- The name of a table to create the copy of.true
on success.public logical addNewField(character name, character type)
ADD-NEW-FIELD
method
of Progress 4GL.name
- The name of the field to be created in the temp-table.type
- The data type of the specified field.true
on success.public logical addNewField(character name, character type, integer extent)
ADD-NEW-FIELD
method
of Progress 4GL.name
- The name of the field to be created in the temp-table.type
- The data type of the specified field.extent
- An integer expression specifying the extent of an array.true
on success.public logical addNewField(character name, character type, integer extent, character format)
ADD-NEW-FIELD
method
of Progress 4GL.name
- The name of the field to be created in the temp-table.type
- The data type of the specified field.extent
- An integer expression specifying the extent of an array.format
- The data format for the defined data type. If empty or unknown, format is
replaced with default format. Null value means that format is not used in
ADD-NEW-FIELD.true
on success.public logical addNewField(character name, character type, integer extent, character format, BaseDataType initial)
ADD-NEW-FIELD
method
of Progress 4GL.name
- The name of the field to be created in the temp-table.type
- The data type of the specified field.extent
- An integer expression specifying the extent of an array.format
- The data format for the defined data type. If empty or unknown, format is
replaced with default format. Null value means that format is not used in
ADD-NEW-FIELD.initial
- An expression that evaluates to the initial value of the
defined field.
TODO: this method will probably be overloaded because of this.true
on success.public logical addNewField(character name, character type, integer extent, character format, BaseDataType initial, character label)
ADD-NEW-FIELD
method
of Progress 4GL.name
- The name of the field to be created in the temp-table.type
- The data type of the specified field.extent
- An integer expression specifying the extent of an array.format
- The data format for the defined data type. If empty or unknown, format is
replaced with default format. Null value means that format is not used in
ADD-NEW-FIELD.initial
- An expression that evaluates to the initial value of the
defined field.
TODO: this method will probably be overloaded because of this.label
- The label of the defined field. If null or unknown the name
parameter will be used.true
on success.public logical addNewField(character name, character type, integer extent, character format, BaseDataType initial, character label, character columnLabel)
ADD-NEW-FIELD
method
of Progress 4GL.
When a parameter is set to null, it means it was not specified by the business logic.
name
- The name of the field to be created in the temp-table.type
- The data type of the specified field.extent
- An integer expression specifying the extent of an array.format
- The data format for the defined data type. If empty or unknown, format is
replaced with default format. Null value means that format is not used in
ADD-NEW-FIELD.initial
- An expression that evaluates to the initial value of the defined field.
TODO: this method will probably be overloaded because of this.label
- The label of the defined field. If null
or unknown the name
parameter will be used.columnLabel
- The label of the column associated with the defined fieldtrue
on success.public logical addNewIndex(character name)
ADD-INDEX-FIELD()
method.
This method is the P2J equivalent of ADD-NEW-INDEX
method
of Progress 4GL.name
- The name of the index to be created.true
on success.public logical addNewIndex(character name, logical unique)
ADD-INDEX-FIELD()
method.
This method is the P2J equivalent of ADD-NEW-INDEX
method
of Progress 4GL.name
- The name of the index to be created.unique
- TRUE if this index is unique.true
on success.public logical addNewIndex(character name, logical unique, logical primary)
ADD-INDEX-FIELD()
method.
This method is the P2J equivalent of ADD-NEW-INDEX
method
of Progress 4GL.name
- The name of the index to be created.unique
- TRUE if this index is unique.primary
- TRUE if this is the primary index.true
on success.public logical addNewIndex(character name, logical unique, logical primary, logical word)
ADD-INDEX-FIELD()
method.
This method is the P2J equivalent of ADD-NEW-INDEX
method
of Progress 4GL.
If a parameter is null, it means it was not set.
name
- The name of the index to be created.unique
- TRUE if this index is unique.primary
- TRUE if this is the primary index.word
- TRUE if this is a word index.true
on success.public logical addFieldLike(java.lang.String name, java.lang.String source)
ADD-LIKE-FIELD
method
of Progress 4GL.name
- The name of the field to be created in the temp-table.source
- Database field name from which to copy the field. The table
name must be qualified with the database name.true
on success.public logical addFieldLike(character name, character source)
ADD-LIKE-FIELD
method
of Progress 4GL.name
- The name of the field to be created in the temp-table.source
- Database field name from which to copy the field. The table
name must be qualified with the database name.true
on success.public logical addFieldLike(java.lang.String name, handle source)
ADD-LIKE-FIELD
method of Progress 4GL.name
- The name of the field to be created in the temp-table.source
- Handle to field name from which to copy the field.true
on success.public logical addFieldLike(character name, handle source)
ADD-LIKE-FIELD
method
of Progress 4GL.name
- The name of the field to be created in the temp-table.source
- Handle to field name from which to copy the field.true
on success.public logical addFieldToIndex(java.lang.String indexName, java.lang.String field, java.lang.String ascending)
addNewIndex(com.goldencode.p2j.util.character)
and cannot be called after the
prepared()
.indexName
- The name of the index being built.field
- The name of the temp-table to be added to the index.ascending
- "asc" if the ascending ordering, "desc" for descending other -> error.true
for success.public logical addFieldToIndex(java.lang.String indexName, java.lang.String field, character ascending)
addNewIndex(com.goldencode.p2j.util.character)
and cannot be called after the
prepared()
.indexName
- The name of the index being built.field
- The name of the temp-table to be added to the index.ascending
- "asc" if the ascending ordering, "desc" for descending other -> error.true
for success.public logical addFieldToIndex(character indexName, java.lang.String field, java.lang.String ascending)
addNewIndex(com.goldencode.p2j.util.character)
and cannot be called after the
prepared()
.indexName
- The name of the index being built.field
- The name of the temp-table to be added to the index.ascending
- "asc" if the ascending ordering, "desc" for descending other -> error.true
for success.public logical addFieldToIndex(character indexName, java.lang.String field, character ascending)
addNewIndex(com.goldencode.p2j.util.character)
and cannot be called after the
prepared()
.indexName
- The name of the index being built.field
- The name of the temp-table to be added to the index.ascending
- "asc" if the ascending ordering, "desc" for descending other -> error.true
for success.public logical addFieldToIndex(java.lang.String indexName, character field, java.lang.String ascending)
addNewIndex(com.goldencode.p2j.util.character)
and cannot be called after the
prepared()
.indexName
- The name of the index being built.field
- The name of the temp-table to be added to the index.ascending
- "asc" if the ascending ordering, "desc" for descending other -> error.true
for success.public logical addFieldToIndex(java.lang.String indexName, character field, character ascending)
addNewIndex(com.goldencode.p2j.util.character)
and cannot be called after the
prepared()
.indexName
- The name of the index being built.field
- The name of the temp-table to be added to the index.ascending
- "asc" if the ascending ordering, "desc" for descending other -> error.true
for success.public logical addFieldToIndex(character indexName, character field, java.lang.String ascending)
addNewIndex(com.goldencode.p2j.util.character)
and cannot be called after the
prepared()
.indexName
- The name of the index being built.field
- The name of the temp-table to be added to the index.ascending
- "asc" if the ascending ordering, "desc" for descending other -> error.true
for success.public logical addFieldToIndex(character indexName, character field, character ascending)
addNewIndex(com.goldencode.p2j.util.character)
and cannot be called after the
prepared()
.indexName
- The name of the index being built.field
- The name of the temp-table to be added to the index.ascending
- "asc" if the ascending ordering, "desc" for descending other -> error.true
for success.public logical addFieldToIndex(java.lang.String indexName, java.lang.String field)
addNewIndex(com.goldencode.p2j.util.character)
and cannot be called after the prepared()
.indexName
- The name of the index being built.field
- The name of the temp-table to be added to the index.true
for success.public logical addFieldToIndex(character indexName, java.lang.String field)
addNewIndex(com.goldencode.p2j.util.character)
and cannot be called after the prepared()
.indexName
- The name of the index being built.field
- The name of the temp-table to be added to the index.true
for success.public logical addFieldToIndex(java.lang.String indexName, character field)
addNewIndex(com.goldencode.p2j.util.character)
and cannot be called after the prepared()
.indexName
- The name of the index being built.field
- The name of the temp-table to be added to the index.true
for success.public logical addFieldToIndex(character indexName, character field)
addNewIndex(com.goldencode.p2j.util.character)
and cannot be called after the prepared()
.indexName
- The name of the index being built.field
- The name of the temp-table to be added to the index.true
for success.public logical addIndexLike(java.lang.String name, java.lang.String sourceName, java.lang.String dbTable)
ADD-LIKE-FIELD
method
of Progress 4GL.name
- The name of the index to which the source index is being copied. Progress ignores
this option and uses the name of the source index instead.sourceName
- The name of the index in the source table that is being copied
to the temp-table.dbTable
- The database table name from which to copy the index.true
on success.public logical addIndexLike(character name, character sourceName, character dbTable)
ADD-LIKE-FIELD
method
of Progress 4GL.name
- The name of the index to which the source index is being copied. Progress ignores
this option and uses the name of the source index instead.sourceName
- The name of the index in the source table that is being copied
to the temp-table.dbTable
- The database table name from which to copy the index.true
on success.public logical addIndexLike(java.lang.String name, java.lang.String sourceName, handle sourceBuffer)
ADD-LIKE-FIELD
method
of Progress 4GL.name
- The name of the index to which the source index is being copied. Progress ignores
this option and uses the name of the source index instead.sourceName
- The name of the index in the source table that is being copied
to the temp-table.sourceBuffer
- Buffer handle from which to copy the index.true
on success.public logical addIndexLike(character name, character sourceName, handle sourceBuffer)
ADD-LIKE-FIELD
method
of Progress 4GL.name
- The name of the index to which the source index is being copied. Progress ignores
this option and uses the name of the source index instead.sourceName
- The name of the index in the source table that is being copied
to the temp-table.sourceBuffer
- Buffer handle from which to copy the index.true
on success.public logical prepared()
true
if this temp-table is in prepared state (after a successful call
to tempTablePrepare(java.lang.String)
).
This method implements the read-only PREPARED attribute from 4GL.true
if this table is prepared.public boolean _prepared()
true
if this temp-table is in prepared state (after a successful call
to tempTablePrepare(java.lang.String)
).
This method implements the read-only PREPARED attribute from 4GL.true
if this table is prepared.public logical dynamic()
true
if the resource is dynamic, false
otherwise.public boolean _dynamic()
true
if the resource is dynamic, false
otherwise.public logical clear()
public logical tempTablePrepare(java.lang.String name)
TEMP-TABLE-PREPARE
method of Progress 4GL.name
- Temp-table name to be used in subsequent query statements that
refer to this temp-table.true
on success.public logical tempTablePrepare(character name)
TEMP-TABLE-PREPARE
method of Progress 4GL.name
- Temp-table name to be used in subsequent query statements that
refer to this temp-table.true
on success.public logical addFieldsFrom(java.lang.String tableName)
tableName
- The name of the table from which to copy the field definitions.true
for success.public logical addFieldsFrom(handle hbuf)
hbuf
- A handle to a buffer or table from which to copy the field definitions.true
for success.public logical addFieldsFrom(character tableName)
tableName
- The name of the table from which to copy the field definitions.true
for success.public logical addFieldsFrom(handle hbuf, java.lang.String except)
hbuf
- A handle to a buffer or table from which to copy the field definitions.except
- A comma-separated list of field names to be excluded from the copy process.true
for success.public logical addFieldsFrom(java.lang.String tableName, java.lang.String except)
tableName
- The name of the table from which to copy the field definitions.except
- A comma-separated list of field names to be excluded from the copy process.true
for success.public logical addFieldsFrom(java.lang.String tableName, character except)
tableName
- The name of the table from which to copy the field definitions.except
- A comma-separated list of field names to be excluded from the copy process.true
for success.public logical addFieldsFrom(handle hbuf, character except)
hbuf
- A handle to a buffer or table from which to copy the field definitions.except
- A comma-separated list of field names to be excluded from the copy process.true
for success.public logical addFieldsFrom(character tableName, character except)
tableName
- The name of the table from which to copy the field definitions.except
- A comma-separated list of field names to be excluded from the copy process.true
for success.public void createFromTableWrapper(TableWrapper tableWrapper, int tableParameterIndex)
tableWrapper
- Table wrapper containing table definitions.tableParameterIndex
- 1-based index of corresponding TABLE[-HANDLE] parameter (in function declaration).
Used for error handling.public handle defaultBufferHandle()
tempTablePrepare()
method.
This method is the P2J equivalent of DEFAULT-BUFFER-HANDLE
attribute.public void name(character name)
name
in interface Nameable
name
in class HandleChain
name
- New table name.public character name()
name
in interface Nameable
name
in class HandleChain
protected boolean hasPrevSibling()
hasPrevSibling
in class HandleChain
false
.protected boolean hasNextSibling()
hasNextSibling
in class HandleChain
false
.protected boolean hasNameReadOnly()
hasNameReadOnly
in class HandleChain
false
, as NAME attribute is writable.public boolean valid()
true
if we are valid (can be used).protected boolean resourceDelete()
HandleChain.delete()
.resourceDelete
in class HandleChain
true
if the resource was deleted.public void forceDelete()
valid()
calls return false
).public java.util.Collection<P2JField> getFields()
public P2JField getField(java.lang.String fieldName)
fieldName
- Field name.public P2JIndex getIndex(java.lang.String indexName)
indexName
- Index name.public java.util.Collection<P2JIndex> getIndexes()
public java.lang.Class<?> getDMOInterface()
null
if the table is not
initialized yet.public java.lang.Class<?> getDMOClass()
null
if the
table is not initialized yet.void setDmoIface(java.lang.Class<?> dmoIface)
dmoIface
- DMO interface class which corresponds the table.void setPersistentClass(org.hibernate.mapping.PersistentClass persistentClass)
persistentClass
- Persistent class which corresponds the table.org.hibernate.mapping.PersistentClass getPersistentClass()
null
if the table is
not prepared.protected boolean addFunctionWasCalled()
addFunctionWasCalled
in class AbstractTempTable
true
if an ADD-* function was called for the table.protected void addNewField(PropertyDefinition propertyDefinition)
propertyDefinition
- Definition of the field to add.private logical createTableLikeImpl(character tableName, character indexName, boolean handleIndex)
CREATE-LIKE
method
of Progress 4GL.tableName
- The name of a table to create the copy of.indexName
- The name of a single index which is copied from the source table.handleIndex
- true
if indexName
parameter should be taken into
consideration. This parameter is required because unknown
index name
represents an index with empty name rather than "index not specified" case.true
on success.private logical createTableLikeImpl(handle hbuf, character indexName, boolean handleIndex)
CREATE-LIKE
method
of Progress 4GL.hbuf
- A handle to a buffer or table from which to copy the definitions.indexName
- The name of a single index which is copied from the source table.handleIndex
- true
if indexName
parameter should be taken into
consideration. This parameter is required because unknown
index name
represents an index with empty name rather than "index not specified" case.true
on success.private logical addIndexLike(P2JIndex srcIndex)
ADD-LIKE-FIELD
method of Progress 4GL.srcIndex
- The index in the source table that is being copied to the temp-table.true
on success.private void doAddFieldsFrom(java.util.Collection<P2JField> srcFields, character except)
srcFields
- Set of fields to be added.except
- Comma-separated list of field names that should be excluded from the copy process.private void createDefaultBuffer()
private void displayUnableToPrepareTableFields()
private void displayUnableToPrepareTableIndices()
private void displayUnableToEvaluate()
private void displayCouldNotFindLikeTable(java.lang.String tableName)
tableName
- Table name.private void displayCouldNotFindLikeTableName(java.lang.String tableName)
tableName
- Table name.private void displayDuplicateIndex(java.lang.String indexName)
indexName
- Index name.private void displayCouldNotFindLikeField(java.lang.String fieldName)
fieldName
- Field name.private void displayCouldNotFindLikeIndex(java.lang.String tableName, java.lang.String indexName)
tableName
- Table name.indexName
- Index name.private void displayCouldNotFindAddIndex(java.lang.String indexName)
indexName
- Index name.private void displayUnableToCreateLikeIndex()
private void displayDuplicateOrInvalidIndexField(java.lang.String indexName, java.lang.String fieldName)
indexName
- Index name.fieldName
- Field name.private void displayUnableToFindIndex(java.lang.String tableName, java.lang.String indexName)
tableName
- Table name.indexName
- Index name.private boolean forceClear()
true
if operation was successful.private java.util.Set<java.lang.String> parseFieldList(character list)
list
- Comma-separated list of fields.null
if there are no fields in the
input list. Names are returned in lower case, spaces are kept.private Persistence findExistingTable(java.lang.String fullTableName, boolean tableNameSearch)
fullTableName
- Table name in format "databaseName.tableName" or "tableName". In the latter case
table search is performed in all permanent databases and then the temporary
database. Dynamic tables are ignored.tableNameSearch
- true
if it is called from ADD-LIKE-INDEX, ADD-FIELDS-FROM or
CREATE-LIKE, false
if it is called from ADD-FIELD-LIKE. Affects
error messaging.null
if there is
no such table.private boolean hasSameNormalizedName(java.lang.String name1, java.lang.String name2)
DynamicTablesHelper.normalizeName(String)
for more information.name1
- First name to compare.name2
- Second name to compare.true
if two names has the same normalized form.private P2JField copyField(java.lang.String targetName, P2JField srcField)
targetName
- The name of the new field.srcField
- Source field to copy.private P2JIndex copyIndex(P2JIndex srcIndex)
srcIndex
- Source index to copy.private void addField(P2JField field)
field
- Field to add.private void addIndex(P2JIndex index)
index
- Index to add.private boolean hasField(java.lang.String fieldName)
fieldName
- Field name to check.true
if there is a field which has the same name (in normalized form,
see DynamicTablesHelper.normalizeName(String)
).private boolean hasIndex(java.lang.String indexName)
indexName
- Index name to check.true
if there is an index which has the same name (in normalized form,
see DynamicTablesHelper.normalizeName(String)
).private void addAllIndexes(java.util.Collection<P2JIndex> indexes)
indexes
- Indexes to add.private void addAllFields(java.util.Collection<P2JField> fields)
fields
- Fields to add.