TempTable.java

/*
** Module   : TempTable.java
** Abstract : Declaration of some dynamic TEMP-TABLES specific features (attributes, methods).
**
** Copyright (c) 2013-2025, Golden Code Development Corporation.
**
** -#- -I- --Date-- ---------------------------------------Description---------------------------------------
** 001 OM  20130129 Created initial version.
** 002 CA  20130221 Added ADM-DATA and UNIQUE-ID support.
** 003 OM  20130301 Pushed up defaultBufferHandle() to Buffer interface.
** 004 CA  20130311 Added missing ADD-NEW-FIELD and ADD-NEW-INDEX API versions, using wrapper 
**                  types. Note that the conversion will use only the APIs with the wrapper type
**                  parameters; the other APIs (using non-wrapper parameters) are removed.
** 005 SVL 20130822 Removed uniqueId. Added overloaded methods for several functions.
** 006 CA  20130927 Added LegacyResource annotation, to determine resource type.
** 007 EVL 20131002 Adding legacy attributes and methods annotation.
** 008 EVL 20131010 Adding Errorable interface to support ERROR legacy attribute.
** 009 CA  20131021 Adds DynamicResource interface to support DYNAMIC attribute.
** 010 SVL 20131115 Added getDMOClass.
** 011 ECF 20140613 Added CommonHandleChain to extends list to pick up WrappedResource interface.
** 012 OM  20151026 Added UndoStateProvider to extends list.
** 013 EVL 20160223 Javadoc fixes to make compatible with Oracle Java 8 for Solaris 10.
** 014 ECF 20160225 Added getDMOInterface method.
** 015 CA  20171220 Added INSTANTIATING-PROCEDURE interface.
** 016 CA  20181029 The CLEAR() method has its own interface, Clearable.
** 017 OM  20190325 Added method and attribute declarations related to DataSets.
**                  Renamed methods createTableLike() to createLike().
**                  Extracted CREATE-LIKE and COPY-TEMP-TABLE to TempTableDuplicator interface.
** 018 OM  20190513 Extends EmptyTempTable to access EMPTY-TEMP-TABLE method.
** 019 SVL 20190614 Added get/setCodePage.
** 020 OM  20190514 Added P11.7 syntax support for TEMP-TABLE-PREPARE. Extends XmlData interface.
**                  Remove default body for methods that were implemented.
** 021 SVL 20190801 Added get/setCodePageSupplier.
** 022 OM  20190909 Extracted ERROR-STRING API in separate shared interface.
** 023 OM  20191031 Removed method signatures pushed to super interface.
** 024 ECF 20200906 New ORM implementation.
** 025 AIL 20200911 Added Dereferenceable interface.
**     OM  20201002 Use DmoMeta cached information instead of map lookups.
**     OM  20201120 Added declarations for SCHEMA-MARSHALL related accessors.
**     OM  20210106 Fixed 2nd parameter of TEMP-TABLE-PREPARE.
**     OM  20210404 Small javadoc updates.
**     CA  20220426 Added PRIMARY attribute.
**     OM  20220609 Fixed interfaces hierarchy.
**     HC  20230116 Replaced some handle usages with the actual wrapped resources for
**                  performance.
** 026 AI  20240314 Overloaded addFieldLike with String, character.
** 027 AI  20240531 Overloaded addFieldLike with character, String.
** 048 OM  20250206 TEMP-TABLE:ORIGIN-HANDLE it's actually writable, in spite of what docs say.
** 049 ES  20250314 Added label methods.
*/

/*
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU Affero General Public License as
** published by the Free Software Foundation, either version 3 of the
** License, or (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU Affero General Public License for more details.
**
** You may find a copy of the GNU Affero GPL version 3 at the following
** location: https://www.gnu.org/licenses/agpl-3.0.en.html
** 
** Additional terms under GNU Affero GPL version 3 section 7:
** 
**   Under Section 7 of the GNU Affero GPL version 3, the following additional
**   terms apply to the works covered under the License.  These additional terms
**   are non-permissive additional terms allowed under Section 7 of the GNU
**   Affero GPL version 3 and may not be removed by you.
** 
**   0. Attribution Requirement.
** 
**     You must preserve all legal notices or author attributions in the covered
**     work or Appropriate Legal Notices displayed by works containing the covered
**     work.  You may not remove from the covered work any author or developer
**     credit already included within the covered work.
** 
**   1. No License To Use Trademarks.
** 
**     This license does not grant any license or rights to use the trademarks
**     Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks
**     of Golden Code Development Corporation. You are not authorized to use the
**     name Golden Code, FWD, or the names of any author or contributor, for
**     publicity purposes without written authorization.
** 
**   2. No Misrepresentation of Affiliation.
** 
**     You may not represent yourself as Golden Code Development Corporation or FWD.
** 
**     You may not represent yourself for publicity purposes as associated with
**     Golden Code Development Corporation, FWD, or any author or contributor to
**     the covered work, without written authorization.
** 
**   3. No Misrepresentation of Source or Origin.
** 
**     You may not represent the covered work as solely your work.  All modified
**     versions of the covered work must be marked in a reasonable way to make it
**     clear that the modified work is not originating from Golden Code Development
**     Corporation or FWD.  All modified versions must contain the notices of
**     attribution required in this license.
*/

package com.goldencode.p2j.persist;

import com.goldencode.p2j.persist.orm.*;
import com.goldencode.p2j.util.*;
import java.util.function.*;

/**
 * Declaration of dynamic TEMP-TABLES attributes and methods.
 * This interface is needed by {@link CommonHandle} in order to store the handle to a temp table.
 */
@LegacyResource(resource = LegacyResource.TEMP_TABLE)
public interface TempTable
extends ADMData,
        BufferHandle,
        Clearable,
        CommonHandleChain,
        CreateLike,
        DataSourceModifiable,
        Deletable,
        Dereferenceable,
        DynamicResource,
        EmptyTempTable,
        Errorable,
        ErrorString,
        InstantiatingProcedure,
        JsonData,
        Nameable,
        NamedSerializable,
        NamespaceURI,
        RefCounter,
        PrimaryIndex,
        Rejectable,
        TempTableDuplicator,
        UndoStateProvider,
        UniqueID,
        XmlData,
        XmlNode
{
   /** The type of this buffer from the {@code DataSet} changes point of view. */
   enum BeforeType
   {
      /** Not yet computed. Will be at next access. */
      UNKNOWN,
      
      /** This is an AFTER-BUFFER or AFTER-TABLE. They store the current changes. */
      AFTER,
      
      /** This is an BEFORE-BUFFER or BEFORE-TABLE. They store the original values. */
      BEFORE,
      
      /**
       * This is a simple BUFFER/TABLE, possible persistent, without backing of the original
       * values.
       */
      SIMPLE
   }
   
   /** Constant for SCHEMA-MARSHAL attribute: the full schema is serialized with table parameter. */
   public static final String SCHEMA_MARSHAL_FULL = "FULL";
   
   /**
    * Constant for SCHEMA-MARSHAL attribute: minimal schema is marshalled. When in use, the field names, data
    * types and extents, and temp-table ERROR-STRING are serialized with table parameter, but index
    * descriptions and other field information (label, help, field validation expression, and so on (?)) are
    * not.
    */
   public static final String SCHEMA_MARSHAL_MIN = "MIN";
   
   /** Constant for SCHEMA-MARSHAL attribute: no schema is marshalled (just table data). */
   public static final String SCHEMA_MARSHAL_NONE = "NONE";
   
   /**
    * Adds a field with the specified properties to the temp-table.
    * This method is the P2J equivalent of <code>ADD-NEW-FIELD</code> method
    * of Progress 4GL.
    * 
    * @param   name
    *          The name of the field to be created in the temp-table.
    * @param   type
    *          The data type of the specified field.
    *
    * @return  <code>true</code> on success.
    */
   @LegacyMethod(name = "ADD-NEW-FIELD")
   public logical addNewField(character name, character type);
   
   /**
    * Adds a field with the specified properties to the temp-table.
    * This method is the P2J equivalent of <code>ADD-NEW-FIELD</code> method
    * of Progress 4GL.
    * 
    * @param   name
    *          The name of the field to be created in the temp-table.
    * @param   type
    *          The data type of the specified field.
    * @param   extent
    *          An integer expression specifying the extent of an array.
    *
    * @return  <code>true</code> on success.
    */
   @LegacyMethod(name = "ADD-NEW-FIELD")
   public logical addNewField(character name, character type, integer extent);
   
   /**
    * Adds a field with the specified properties to the temp-table.
    * This method is the P2J equivalent of <code>ADD-NEW-FIELD</code> method
    * of Progress 4GL.
    * 
    * @param   name
    *          The name of the field to be created in the temp-table.
    * @param   type
    *          The data type of the specified field.
    * @param   extent
    *          An integer expression specifying the extent of an array.
    * @param   format
    *          The data format for the defined data type. If null or unknown, 
    *          the default format will be used.
    *          
    * @return  <code>true</code> on success.
    */
   @LegacyMethod(name = "ADD-NEW-FIELD")
   public logical addNewField(character name, character type, integer extent, character format);
   
   /**
    * Adds a field with the specified properties to the temp-table.
    * This method is the P2J equivalent of <code>ADD-NEW-FIELD</code> method
    * of Progress 4GL.
    * 
    * @param   name
    *          The name of the field to be created in the temp-table.
    * @param   type
    *          The data type of the specified field.
    * @param   extent
    *          An integer expression specifying the extent of an array.
    * @param   format
    *          The data format for the defined data type. If null or unknown, 
    *          the default format will be used.
    * @param   initial
    *          An expression that evaluates to the initial value of the 
    *          defined field. 
    *          TODO: this method will probably be overloaded because of this.
    *
    * @return  <code>true</code> on success.
    */
   @LegacyMethod(name = "ADD-NEW-FIELD")
   public logical addNewField(character    name,
                              character    type,
                              integer      extent,
                              character    format,
                              BaseDataType initial);
   
   /**
    * Adds a field with the specified properties to the temp-table.
    * This method is the P2J equivalent of <code>ADD-NEW-FIELD</code> method
    * of Progress 4GL.
    * 
    * @param   name
    *          The name of the field to be created in the temp-table.
    * @param   type
    *          The data type of the specified field.
    * @param   extent
    *          An integer expression specifying the extent of an array.
    * @param   format
    *          The data format for the defined data type. If null or unknown, 
    *          the default format will be used.
    * @param   initial
    *          An expression that evaluates to the initial value of the 
    *          defined field. 
    *          TODO: this method will probably be overloaded because of this.
    * @param   label
    *          The label of the defined field. If null or unknown the name 
    *          parameter will be used.
    *          
    * @return  <code>true</code> on success.
    */
   @LegacyMethod(name = "ADD-NEW-FIELD")
   public 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.
    * This method is the P2J equivalent of <code>ADD-NEW-FIELD</code> method
    * of Progress 4GL.
    * 
    * @param   name
    *          The name of the field to be created in the temp-table.
    * @param   type
    *          The data type of the specified field.
    * @param   extent
    *          An integer expression specifying the extent of an array.
    * @param   format
    *          The data format for the defined data type. If null or unknown, 
    *          the default format will be used.
    * @param   initial
    *          An expression that evaluates to the initial value of the 
    *          defined field. 
    *          TODO: this method will probably be overloaded because of this.
    * @param   label
    *          The label of the defined field. If null or unknown the name 
    *          parameter will be used.
    * @param   columnLabel
    *          The label of the column associated with the defined field
    *          
    * @return  <code>true</code> on success.
    */
   @LegacyMethod(name = "ADD-NEW-FIELD")
   public logical addNewField(character    name,
                              character    type,
                              integer      extent,
                              character    format,
                              BaseDataType initial,
                              character    label,
                              character    columnLabel);

   /**
    * Adds a new empty index with the specified name to the temp-table. Index 
    * components must be added with the <code>ADD-INDEX-FIELD()</code> method.
    * This method is the P2J equivalent of <code>ADD-NEW-INDEX</code> method
    * of Progress 4GL.
    *
    * @param   name
    *          The name of the index to be created.
    * 
    * @return  <code>true</code> on success.
    */
   @LegacyMethod(name = "ADD-NEW-INDEX")
   public logical addNewIndex(character name);

   /**
    * Adds a new empty index with the specified name to the temp-table. Index 
    * components must be added with the <code>ADD-INDEX-FIELD()</code> method.
    * This method is the P2J equivalent of <code>ADD-NEW-INDEX</code> method
    * of Progress 4GL.
    *
    * @param   name
    *          The name of the index to be created.
    * @param   unique
    *          TRUE if this index is unique.
    * 
    * @return  <code>true</code> on success.
    */
   @LegacyMethod(name = "ADD-NEW-INDEX")
   public logical addNewIndex(character name, logical unique);

   /**
    * Adds a new empty index with the specified name to the temp-table. Index 
    * components must be added with the <code>ADD-INDEX-FIELD()</code> method.
    * This method is the P2J equivalent of <code>ADD-NEW-INDEX</code> method
    * of Progress 4GL.
    *
    * @param   name
    *          The name of the index to be created.
    * @param   unique
    *          TRUE if this index is unique.
    * @param   primary
    *          TRUE if this is the primary index.
    * 
    * @return  <code>true</code> on success.
    */
   @LegacyMethod(name = "ADD-NEW-INDEX")
   public logical addNewIndex(character name, logical unique, logical primary);

   /**
    * Adds a new empty index with the specified name to the temp-table. Index 
    * components must be added with the <code>ADD-INDEX-FIELD()</code> method.
    * This method is the P2J equivalent of <code>ADD-NEW-INDEX</code> method
    * of Progress 4GL.
    *
    * @param   name
    *          The name of the index to be created.
    * @param   unique
    *          TRUE if this index is unique.
    * @param   primary
    *          TRUE if this is the primary index.
    * @param   word
    *          TRUE if this is a word index.
    * 
    * @return  <code>true</code> on success.
    */
   @LegacyMethod(name = "ADD-NEW-INDEX")
   public logical addNewIndex(character name, logical unique, logical primary, logical word);

   /**
    * Adds to the temp-table a field like the one specified.
    * This method is the P2J equivalent of <code>ADD-LIKE-FIELD</code> method of Progress 4GL.
    * 
    * @param   name
    *          The name of the field to be created in the temp-table.
    * @param   source
    *          Database field name from which to copy the field. The table 
    *          name must be qualified with the database name.
    * 
    * @return  <code>true</code> on success.
    */
   @LegacyMethod(name = "ADD-LIKE-FIELD")
   public logical addFieldLike(String name, String source);

   /**
    * Adds to the temp-table a field like the one specified.
    * This method is the P2J equivalent of <code>ADD-LIKE-FIELD</code> method of Progress 4GL.
    * 
    * @param   name
    *          The name of the field to be created in the temp-table.
    * @param   source
    *          Database field name from which to copy the field. The table 
    *          name must be qualified with the database name.
    * 
    * @return  <code>true</code> on success.
    */
   @LegacyMethod(name = "ADD-LIKE-FIELD")
   public logical addFieldLike(String name, character source);
   
   /**
    * Adds to the temp-table a field like the one specified.
    * This method is the P2J equivalent of <code>ADD-LIKE-FIELD</code> method of Progress 4GL.
    * 
    * @param   name
    *          The name of the field to be created in the temp-table.
    * @param   source
    *          Database field name from which to copy the field. The table 
    *          name must be qualified with the database name.
    * 
    * @return  <code>true</code> on success.
    */
   @LegacyMethod(name = "ADD-LIKE-FIELD")
   public logical addFieldLike(character name, String source);
   
   /**
    * Adds to the temp-table a field like the one specified.
    * This method is the P2J equivalent of <code>ADD-LIKE-FIELD</code> method of Progress 4GL.
    * 
    * @param   name
    *          The name of the field to be created in the temp-table.
    * @param   source
    *          Database field name from which to copy the field. The table 
    *          name must be qualified with the database name.
    * 
    * @return  <code>true</code> on success.
    */
   @LegacyMethod(name = "ADD-LIKE-FIELD")
   public logical addFieldLike(character name, character source);

   /**
    * Adds to the temp-table a field like the one specified.
    * This method is the P2J equivalent of <code>ADD-LIKE-FIELD</code> method of Progress 4GL.
    *
    * @param   name
    *          The name of the field to be created in the temp-table.
    * @param   source
    *          Handle to field name from which to copy the field.
    *
    * @return  <code>true</code> on success.
    */
   @LegacyMethod(name = "ADD-LIKE-FIELD")
   public logical addFieldLike(String name, handle source);

   /**
    * Adds to the temp-table a field like the one specified.
    * This method is the P2J equivalent of <code>ADD-LIKE-FIELD</code> method of Progress 4GL.
    * 
    * @param   name
    *          The name of the field to be created in the temp-table.
    * @param   source
    *          Handle to field name from which to copy the field.
    * 
    * @return  <code>true</code> on success.
    */
   @LegacyMethod(name = "ADD-LIKE-FIELD")
   public logical addFieldLike(character name, handle source);

   /**
    * Adds to the temp-table an index like the one specified.
    * This method is the P2J equivalent of <code>ADD-LIKE-INDEX</code> method of Progress 4GL.
    * 
    * @param   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.
    * @param   sourceName
    *          The name of the index in the source table that is being copied 
    *          to the temp-table.
    * @param   dbTable
    *          The database table name from which to copy the index.
    * 
    * @return  <code>true</code> on success.
    */
   @LegacyMethod(name = "ADD-LIKE-INDEX")
   public logical addIndexLike(String name, String sourceName, String dbTable);

   /**
    * Adds to the temp-table an index like the one specified.
    * This method is the P2J equivalent of <code>ADD-LIKE-INDEX</code> method
    * of Progress 4GL.
    * 
    * @param   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.
    * @param   sourceName
    *          The name of the index in the source table that is being copied 
    *          to the temp-table.
    * @param   dbTable
    *          The database table name from which to copy the index.
    * 
    * @return  <code>true</code> on success.
    */
   @LegacyMethod(name = "ADD-LIKE-INDEX")
   public logical addIndexLike(character name, character sourceName, character dbTable);

   /**
    * Adds to the temp-table an index like the one specified.
    * This method is the P2J equivalent of <code>ADD-LIKE-INDEX</code> method
    * of Progress 4GL.
    *
    * @param   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.
    * @param   sourceName
    *          The name of the index in the source table that is being copied
    *          to the temp-table.
    * @param   sourceBuffer
    *          Buffer handle from which to copy the index.
    *
    * @return  <code>true</code> on success.
    */
   @LegacyMethod(name = "ADD-LIKE-INDEX")
   public logical addIndexLike(String name, String sourceName, handle sourceBuffer);

   /**
    * Adds to the temp-table an index like the one specified.
    * This method is the P2J equivalent of <code>ADD-LIKE-INDEX</code> method
    * of Progress 4GL.
    *
    * @param   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.
    * @param   sourceName
    *          The name of the index in the source table that is being copied
    *          to the temp-table.
    * @param   sourceBuffer
    *          Buffer handle from which to copy the index.
    *
    * @return  <code>true</code> on success.
    */
   @LegacyMethod(name = "ADD-LIKE-INDEX")
   public logical addIndexLike(character name, character sourceName, handle sourceBuffer);
   
   /**
    * Signals that all the field and index definitions for a temp-table 
    * have been provided. After the call to this method no fields and indexes
    * can be added to this temporary table.
    * This method is the P2J equivalent of <code>TEMP-TABLE-PREPARE</code> 
    * method of Progress 4GL.
    * 
    * @param   name
    *          Temp-table name to be used in subsequent query statements that refer to 
    *          this temp-table.
    *
    * @return  <code>true</code> on success.
    */
   @LegacyMethod(name = "TEMP-TABLE-PREPARE")
   public logical tempTablePrepare(String name);
   
   /**
    * Signals that all the field and index definitions for a temp-table have been provided. After
    * the call to this method no fields and indexes can be added to this temporary table.
    * This method is the P2J equivalent of <code>TEMP-TABLE-PREPARE</code> 
    * method of Progress 4GL.
    * 
    * @param   name
    *          Temp-table name to be used in subsequent query statements that
    *          refer to this temp-table.
    *          
    * @return  <code>true</code> on success.
    */
   @LegacyMethod(name = "TEMP-TABLE-PREPARE")
   public logical tempTablePrepare(character name);
   
   /**
    * Signals that all the field and index definitions for a temp-table have been provided. After
    * the call to this method no fields and indexes can be added to this temporary table.
    * This method is the P2J equivalent of {@code TEMP-TABLE-PREPARE} method of Progress 4GL.
    * 
    * @param   name
    *          Temp-table name to be used in subsequent query statements which refer to this temp-table.
    * @param   before
    *          Create the {@code BEFORE-TABLE} also if {@code true}.
    *
    * @return  {@code true} on success.
    */
   @LegacyMethod(name = "TEMP-TABLE-PREPARE")
   public logical tempTablePrepare(String name, boolean before);
   
   /**
    * Signals that all the field and index definitions for a temp-table have been provided. After
    * the call to this method no fields and indexes can be added to this temporary table.
    * This method is the P2J equivalent of {@code TEMP-TABLE-PREPARE} method of Progress 4GL.
    * 
    * @param   name
    *          Temp-table name to be used in subsequent query statements which refer to this temp-table.
    * @param   before
    *          Create the {@code BEFORE-TABLE} also if {@code true}.
    *
    * @return  {@code true} on success.
    */
   @LegacyMethod(name = "TEMP-TABLE-PREPARE")
   public logical tempTablePrepare(String name, logical before);
   
   /**
    * Signals that all the field and index definitions for a temp-table have been provided. After
    * the call to this method no fields and indexes can be added to this temporary table.
    * This method is the P2J equivalent of {@code TEMP-TABLE-PREPARE} method of Progress 4GL.
    * 
    * @param   name
    *          Temp-table name to be used in subsequent query statements which refer to this temp-table.
    * @param   before
    *          Create the {@code BEFORE-TABLE} also if {@code true}.
    *
    * @return  {@code true} on success.
    */
   @LegacyMethod(name = "TEMP-TABLE-PREPARE")
   public logical tempTablePrepare(character name, boolean before);
   
   /**
    * Signals that all the field and index definitions for a temp-table have been provided. After
    * the call to this method no fields and indexes can be added to this temporary table.
    * This method is the P2J equivalent of {@code TEMP-TABLE-PREPARE} method of Progress 4GL.
    * 
    * @param   name
    *          Temp-table name to be used in subsequent query statements which refer to this temp-table.
    * @param   before
    *          Create the {@code BEFORE-TABLE} also if {@code true}.
    *
    * @return  {@code true} on success.
    */
   @LegacyMethod(name = "TEMP-TABLE-PREPARE")
   public logical tempTablePrepare(character name, logical before);
   
   /**
    * Returns <code>true</code> if this temp-table is in prepared state (after a successful call 
    * to {@link #tempTablePrepare}). 
    * This method implements the read-only PREPARED attribute from 4GL.
    * 
    * @return  true if operation is successful 
    */
   @LegacyAttribute(name = "PREPARED")
   public logical prepared();
   
   /**
    * Sets the UNDO attribute of 4GL temp-table.
    *
    * @param   undo
    *          The new value for the attribute.
    */
   @LegacyAttribute(name = "UNDO", setter = true)
   public void setCanUndo(logical undo);

   /** 
    * Obtain the current UNDO attribute of 4GL temp-table.
    * 
    * @return  true if the the temp-table can undo.
    */
   @LegacyAttribute(name = "UNDO")
   public logical canUndo();
   
   /**
    * Checks whether this temp-table contains any records.
    * 
    * @return  true if this temp-table has records.
    */
   @LegacyAttribute(name = "HAS-RECORDS")
   public logical hasRecords();

   /**
    * Construct an index of this temp-table by adding a new field to it. This method requires
    * the index to be first declared with {@link #addNewIndex} and cannot be called after the 
    * {@link #prepared()}.
    * 
    * TODO: as the parameters of this methods are all expressions (of type character the first 2 
    * and logical the last), this method will eventually need to be overloaded with those 
    * signatures.
    * 
    * @param   indexName
    *          The name of the index being built.
    * @param   field
    *          The name of the temp-table to be added to the index.
    * @param   ascending
    *          "asc" if the ascending ordering, "desc" for descending other -&gt; error.
    *
    * @return  <code>true</code> for success.
    */
   @LegacyMethod(name = "ADD-INDEX-FIELD")
   public logical addFieldToIndex(String indexName, String field, String ascending);
   
   /**
    * Construct an index of this temp-table by adding a new field to it. This method requires
    * the index to be first declared with {@link #addNewIndex} and cannot be called after the 
    * {@link #prepared()}.
    * 
    * TODO: as the parameters of this methods are all expressions (of type character the first 2 
    * and logical the last), this method will eventually need to be overloaded with those 
    * signatures.
    * 
    * @param   indexName
    *          The name of the index being built.
    * @param   field
    *          The name of the temp-table to be added to the index.
    * @param   ascending
    *          "asc" if the ascending ordering, "desc" for descending other -&gt; error.
    *
    * @return  <code>true</code> for success.
    */
   @LegacyMethod(name = "ADD-INDEX-FIELD")
   public logical addFieldToIndex(String indexName, String field, character ascending);
   
   /**
    * Construct an index of this temp-table by adding a new field to it. This method requires
    * the index to be first declared with {@link #addNewIndex} and cannot be called after the 
    * {@link #prepared()}.
    * 
    * TODO: as the parameters of this methods are all expressions (of type character the first 2 
    * and logical the last), this method will eventually need to be overloaded with those 
    * signatures.
    * 
    * @param   indexName
    *          The name of the index being built.
    * @param   field
    *          The name of the temp-table to be added to the index.
    * @param   ascending
    *          "asc" if the ascending ordering, "desc" for descending other -&gt; error.
    *
    * @return  <code>true</code> for success.
    */
   @LegacyMethod(name = "ADD-INDEX-FIELD")
   public logical addFieldToIndex(character indexName, String field, String ascending);
   
   /**
    * Construct an index of this temp-table by adding a new field to it. This method requires
    * the index to be first declared with {@link #addNewIndex} and cannot be called after the 
    * {@link #prepared()}.
    * 
    * TODO: as the parameters of this methods are all expressions (of type character the first 2 
    * and logical the last), this method will eventually need to be overloaded with those 
    * signatures.
    * 
    * @param   indexName
    *          The name of the index being built.
    * @param   field
    *          The name of the temp-table to be added to the index.
    * @param   ascending
    *          "asc" if the ascending ordering, "desc" for descending other -&gt; error.
    *
    * @return  <code>true</code> for success.
    */
   @LegacyMethod(name = "ADD-INDEX-FIELD")
   public logical addFieldToIndex(character indexName, String field, character ascending);
   
   /**
    * Construct an index of this temp-table by adding a new field to it. This method requires
    * the index to be first declared with {@link #addNewIndex} and cannot be called after the 
    * {@link #prepared()}.
    * 
    * TODO: as the parameters of this methods are all expressions (of type character the first 2 
    * and logical the last), this method will eventually need to be overloaded with those 
    * signatures.
    * 
    * @param   indexName
    *          The name of the index being built.
    * @param   field
    *          The name of the temp-table to be added to the index.
    * @param   ascending
    *          "asc" if the ascending ordering, "desc" for descending other -&gt; error.
    *
    * @return  <code>true</code> for success.
    */
   @LegacyMethod(name = "ADD-INDEX-FIELD")
   public logical addFieldToIndex(String indexName, character field, String ascending);
   
   /**
    * Construct an index of this temp-table by adding a new field to it. This method requires
    * the index to be first declared with {@link #addNewIndex} and cannot be called after the 
    * {@link #prepared()}.
    * 
    * TODO: as the parameters of this methods are all expressions (of type character the first 2 
    * and logical the last), this method will eventually need to be overloaded with those 
    * signatures.
    * 
    * @param   indexName
    *          The name of the index being built.
    * @param   field
    *          The name of the temp-table to be added to the index.
    * @param   ascending
    *          "asc" if the ascending ordering, "desc" for descending other -&gt; error.
    *
    * @return  <code>true</code> for success.
    */
   @LegacyMethod(name = "ADD-INDEX-FIELD")
   public logical addFieldToIndex(String indexName, character field, character ascending);
   
   /**
    * Construct an index of this temp-table by adding a new field to it. This method requires
    * the index to be first declared with {@link #addNewIndex} and cannot be called after the 
    * {@link #prepared()}.
    * 
    * TODO: as the parameters of this methods are all expressions (of type character the first 2 
    * and logical the last), this method will eventually need to be overloaded with those 
    * signatures.
    * 
    * @param   indexName
    *          The name of the index being built.
    * @param   field
    *          The name of the temp-table to be added to the index.
    * @param   ascending
    *          "asc" if the ascending ordering, "desc" for descending other -&gt; error.
    *
    * @return  <code>true</code> for success.
    */
   @LegacyMethod(name = "ADD-INDEX-FIELD")
   public logical addFieldToIndex(character indexName, character field, String ascending);
   
   /**
    * Construct an index of this temp-table by adding a new field to it. This method requires
    * the index to be first declared with {@link #addNewIndex} and cannot be called after the 
    * {@link #prepared()}.
    * 
    * TODO: as the parameters of this methods are all expressions (of type character the first 2 
    * and logical the last), this method will eventually need to be overloaded with those 
    * signatures.
    * 
    * @param   indexName
    *          The name of the index being built.
    * @param   field
    *          The name of the temp-table to be added to the index.
    * @param   ascending
    *          "asc" if the ascending ordering, "desc" for descending other -&gt; error.
    *
    * @return  <code>true</code> for success.
    */
   @LegacyMethod(name = "ADD-INDEX-FIELD")
   public logical addFieldToIndex(character indexName, character field, character ascending);

   /**
    * Construct an index of this temp-table by adding a new field to it. The new added filed will
    * sort ascending the table. This method requires the index to be first declared with 
    * {@link #addNewIndex} and cannot be called after the {@link #prepared()}.
    * 
    * TODO: as the parameters of this methods are all expressions (of type character), this 
    * method will eventually need to be overloaded with those signatures.
    *
    * @param   indexName
    *          The name of the index being built.
    * @param   field
    *          The name of the temp-table to be added to the index.
    *
    * @return  <code>true</code> for success.
    */
   @LegacyMethod(name = "ADD-INDEX-FIELD")
   public logical addFieldToIndex(String indexName, String field);
   
   /**
    * Construct an index of this temp-table by adding a new field to it. The new added filed will
    * sort ascending the table. This method requires the index to be first declared with 
    * {@link #addNewIndex} and cannot be called after the {@link #prepared()}.
    * 
    * TODO: as the parameters of this methods are all expressions (of type character), this 
    * method will eventually need to be overloaded with those signatures.
    *
    * @param   indexName
    *          The name of the index being built.
    * @param   field
    *          The name of the temp-table to be added to the index.
    *
    * @return  <code>true</code> for success.
    */
   @LegacyMethod(name = "ADD-INDEX-FIELD")
   public logical addFieldToIndex(character indexName, String field);
   
   /**
    * Construct an index of this temp-table by adding a new field to it. The new added filed will
    * sort ascending the table. This method requires the index to be first declared with 
    * {@link #addNewIndex} and cannot be called after the {@link #prepared()}.
    * 
    * TODO: as the parameters of this methods are all expressions (of type character), this 
    * method will eventually need to be overloaded with those signatures.
    *
    * @param   indexName
    *          The name of the index being built.
    * @param   field
    *          The name of the temp-table to be added to the index.
    *
    * @return  <code>true</code> for success.
    */
   @LegacyMethod(name = "ADD-INDEX-FIELD")
   public logical addFieldToIndex(String indexName, character field);
   
   /**
    * Construct an index of this temp-table by adding a new field to it. The new added filed will
    * sort ascending the table. This method requires the index to be first declared with 
    * {@link #addNewIndex} and cannot be called after the {@link #prepared()}.
    * 
    * TODO: as the parameters of this methods are all expressions (of type character), this 
    * method will eventually need to be overloaded with those signatures.
    *
    * @param   indexName
    *          The name of the index being built.
    * @param   field
    *          The name of the temp-table to be added to the index.
    *
    * @return  <code>true</code> for success.
    */
   @LegacyMethod(name = "ADD-INDEX-FIELD")
   public logical addFieldToIndex(character indexName, character field);

   /**
    * Adds fields from another table into this temp-table. The fields that are already in the
    * temp-table are ignored.
    * This is the P2J implementation of the ADD-FIELDS-FROM of 4GL. 
    * 
    * @param   hbuf
    *          A handle to a buffer or table from which to copy the field definitions.
    * 
    * @return  <code>true</code> for success.
    */
   @LegacyMethod(name = "ADD-FIELDS-FROM")
   public logical addFieldsFrom(handle hbuf);

   /**
    * Adds fields from another table into this temp-table. The fields that are already in the
    * temp-table are ignored.
    * This is the P2J implementation of the ADD-FIELDS-FROM of 4GL. 
    * 
    * @param   hbuf
    *          A handle to a buffer or table from which to copy the field definitions.
    * @param   except
    *          A comma-separated list of field names to be excluded from the copy process.
    * 
    * @return  <code>true</code> for success.
    */
   @LegacyMethod(name = "ADD-FIELDS-FROM")
   public logical addFieldsFrom(handle hbuf, String except);

   /**
    * Adds fields from another table into this temp-table. The fields that are already in the
    * temp-table are ignored.
    * This is the P2J implementation of the ADD-FIELDS-FROM of 4GL.
    *
    * @param   hbuf
    *          A handle to a buffer or table from which to copy the field definitions.
    * @param   except
    *          A comma-separated list of field names to be excluded from the copy process.
    *
    * @return  <code>true</code> for success.
    */
   @LegacyMethod(name = "ADD-FIELDS-FROM")
   public logical addFieldsFrom(handle hbuf, character except);

   /**
    * Adds fields from another table into this temp-table. The fields that are already in the
    * temp-table are ignored.
    * This is the P2J implementation of the ADD-FIELDS-FROM of 4GL. 
    * 
    * @param   tableName
    *          The name of the table from which to copy the field definitions.
    * 
    * @return  <code>true</code> for success.
    */
   @LegacyMethod(name = "ADD-FIELDS-FROM")
   public logical addFieldsFrom(String tableName);

   /**
    * Adds fields from another table into this temp-table. The fields that are already in the
    * temp-table are ignored.
    * This is the P2J implementation of the ADD-FIELDS-FROM of 4GL.
    *
    * @param   tableName
    *          The name of the table from which to copy the field definitions.
    *
    * @return  <code>true</code> for success.
    */
   @LegacyMethod(name = "ADD-FIELDS-FROM")
   public logical addFieldsFrom(character tableName);

   /**
    * Adds fields from another table into this temp-table. The fields that are already in the
    * temp-table are ignored.
    * This is the P2J implementation of the ADD-FIELDS-FROM of 4GL.
    *
    * @param   tableName
    *          The name of the table from which to copy the field definitions.
    * @param   except
    *          A comma-separated list of field names to be excluded from the copy process.
    *
    * @return  <code>true</code> for success.
    */
   @LegacyMethod(name = "ADD-FIELDS-FROM")
   public logical addFieldsFrom(String tableName, character except);

   /**
    * Adds fields from another table into this temp-table. The fields that are already in the
    * temp-table are ignored.
    * This is the P2J implementation of the ADD-FIELDS-FROM of 4GL.
    *
    * @param   tableName
    *          The name of the table from which to copy the field definitions.
    * @param   except
    *          A comma-separated list of field names to be excluded from the copy process.
    *
    * @return  <code>true</code> for success.
    */
   @LegacyMethod(name = "ADD-FIELDS-FROM")
   public logical addFieldsFrom(character tableName, character except);

   /**
    * Adds fields from another table into this temp-table. The fields that are already in the
    * temp-table are ignored.
    * This is the P2J implementation of the ADD-FIELDS-FROM of 4GL. 
    * 
    * @param   tableName
    *          The name of the table from which to copy the field definitions.
    * @param   except
    *          A comma-separated list of field names to be excluded from the copy process.
    * 
    * @return  <code>true</code> for success.
    */
   @LegacyMethod(name = "ADD-FIELDS-FROM")
   public logical addFieldsFrom(String tableName, String except);
   
   /**
    * Obtain the {@code DmoMeta} structure which contains the legacy meta information.
    *
    * @return  {@code DmoMeta} structure which contains the legacy meta information
    */
   public DmoMeta getDmoMeta();
   
   /**
    * Get DMO interface associated with this table.
    *
    * @return DMO implementation associated with this table or <code>null</code> if the
    *         table is not initialized yet.
    */
   public Class<? extends DataModelObject> getDMOInterface();
   
   /**
    * Get the combined DMO and Buffer grouping interface associated with this table.
    * 
    * @return  DMO and Buffer grouping interface.
    */
   public Class<? extends TempTableBuffer> getDMOBufInterface();
   
   /**
    * Get DMO implementation class associated with this table.
    *
    * @return DMO implementation class associated with this table or <code>null</code> if the
    *         table is not initialized yet.
    */
   public Class<? extends Record> getDMOClass();
   
   /**
    * Implementation of the read access of the {@code LABEL}.
    *
    * @return  The current value of the {@code LABEL}.
    */
   public character label();
   
   /**
    * Implementation of the write access of the {@code LABEL}.
    *
    * @param   sName
    *          the new value for the {@code LABEL}.
    */
   public void label(Text sName);
   
   /**
    * Implementation of the write access of the {@code LABEL}.
    *
    * @param  sName
    *         The new value for the {@code LABEL}.
    */
   public void label(String sName);
   
   /**
    * Checks whether changes in this temp-table is enabled for a {@code DataSet}.
    *
    * @return  The current value for {@code TRACKING-CHANGES} as described above.
    */
   @LegacyAttribute(name = "TRACKING-CHANGES")
   public logical isTrackingChanges();
   
   /**
    * Enable or disable changes tracking this temp-table is enabled for a {@code DataSet}.
    *
    * @param   val
    *          The new value for {@code TRACKING-CHANGES} attribute.
    */
   @LegacyAttribute(name = "TRACKING-CHANGES", setter = true)
   public void setTrackingChanges(logical val);
   
   /**
    * Enable or disable changes tracking this temp-table is enabled for a {@code DataSet}.
    *
    * @param   val
    *          The new value for {@code TRACKING-CHANGES} attribute.
    */
   @LegacyAttribute(name = "TRACKING-CHANGES")
   public void setTrackingChanges(boolean val);
   
   /**
    * Get the handle of the before-image table that corresponds to the after-image table
    * currently associated with this temp-table handle.
    *
    * @return  the value of {@code BEFORE-TABLE} as described above.
    */
   @LegacyAttribute(name = "BEFORE-TABLE")
   public handle getBeforeTable();

   /**
    * Get the handle of the before-image table that corresponds to the after-image table
    * currently associated with this temp-table handle.
    *
    * @return  the value of {@code BEFORE-TABLE} as described above.
    */
   public TempTable getBeforeTableNative();

   /**
    * Get the handle of the after-image table that corresponds to the before-image table
    * currently associated with this temp-table handle.
    *
    * @return  the value of {@code AFTER-TABLE} as described above.
    */
   @LegacyAttribute(name = "AFTER-TABLE")
   public handle getAfterTable();

   /**
    * Get the handle of the after-image table that corresponds to the before-image table
    * currently associated with this temp-table handle.
    *
    * @return  the value of {@code AFTER-TABLE} as described above.
    */
   public TempTable getAfterTableNative();

   /**
    * Set code page supplier for the specified CLOB field.
    *
    * @param   property
    *          The ORM property name of the CLOB field.
    * @param   supplier
    *          The code page supplier of the specified CLOB field.
    */
   public void setCodePageSupplier(String property, Supplier supplier);
   
   /**
    * Set code page for the specified CLOB field.
    *
    * @param   property
    *          The ORM property name of the CLOB field.
    * @param   codePage
    *          The code page of the specified CLOB field.
    */
   public void setCodePage(String property, String codePage);
   
   /**
    * Get code page of the specified CLOB field.
    *
    * @param   property
    *          The ORM property name of the CLOB field.
    *
    * @return  The code page of the specified CLOB field or {@code null} if not configured so the default must
    *          be used.
    */
   public String getCodePage(String property);
   
   /**
    * Get code page supplier of the specified CLOB field.
    *
    * @param   property
    *          The ORM property name of the CLOB field.
    *
    * @return code page supplier of the specified CLOB field.
    */
   public Supplier getCodePageSupplier(String property);
   
   /**
    * Get the handle of the TEMP-TABLE in the original source {@code DataSet} object that
    * corresponds to the TEMP-TABLE currently associated with this TEMP-TABLE handle.
    * 
    * @return  the current value of the {@code ORIGIN-HANDLE} attribute. 
    */
   @LegacyAttribute(name = "ORIGIN-HANDLE")
   public handle getOriginHandle();
   
   /**
    * Set the handle of the TEMP-TABLE in the original source {@code DataSet} object that
    * corresponds to the TEMP-TABLE currently associated with this TEMP-TABLE handle.
    * <p>
    * NOTE:
    * In spite of reference manual specifying this is a read-only attribute, in practice this is not the case! 
    * 
    * @param  newVal
    *         The new value of the {@code ORIGIN-HANDLE} attribute. 
    */
   @LegacyAttribute(name = "ORIGIN-HANDLE", setter = true)
   public void setOriginHandle(handle newVal);
   
   /**
    * Get the handle of the TEMP-TABLE in the original source {@code DataSet} object that
    * corresponds to the TEMP-TABLE currently associated with this TEMP-TABLE handle.
    *
    * @return  the current origin table.
    */
   public TempTable getOriginTable();

   /**
    * Implements the {@code NO-SCHEMA-MARSHAL} attribute getter.
    *
    * @return  {@code true} when {@code SCHEMA-MARSHAL} attribute is set to {@code "NONE"}.
    */
   @LegacyAttribute(name = "NO-SCHEMA-MARSHAL")
   public logical isNoSchemaMarshal();
   
   /**
    * Sets the {@code SCHEMA-MARSHAL} attribute to {@code "NO"} value when {@code on = true} or
    * back to default value {@code on = false}.
    *
    * @param   on
    *          The new value of {@code SCHEMA-MARSHAL} attribute.
    */
   @LegacyAttribute(name = "NO-SCHEMA-MARSHAL", setter = true)
   public void setNoSchemaMarshal(boolean on);
   
   /**
    * Sets the {@code SCHEMA-MARSHAL} attribute to {@code "NO"} value when {@code on = true} or
    * back to default value {@code on = false}.
    *
    * @param   on
    *          The new value of {@code SCHEMA-MARSHAL} attribute.
    */
   @LegacyAttribute(name = "NO-SCHEMA-MARSHAL", setter = true)
   public void setNoSchemaMarshal(logical on);
   
   /**
    * Implements the {@code MIN-SCHEMA-MARSHAL} attribute getter.
    *
    * @return  {@code true} when {@code SCHEMA-MARSHAL} attribute is set to {@code "MIN"}.
    */
   @LegacyAttribute(name = "MIN-SCHEMA-MARSHAL")
   public logical isMinSchemaMarshal();
   
   /**
    * Sets the {@code SCHEMA-MARSHAL} attribute to {@code "MIN"} value when {@code on = true} or
    * back to default value {@code on = false}.
    *
    * @param   on
    *          The new value of {@code MIN-SCHEMA-MARSHAL} attribute.
    */ 
   @LegacyAttribute(name = "MIN-SCHEMA-MARSHAL", setter = true)
   public void setMinSchemaMarshal(boolean on);
   
   /**
    * Sets the {@code SCHEMA-MARSHAL} attribute to {@code "MIN"} value when {@code on = true} or
    * back to default value {@code on = false}.
    *
    * @param   on
    *          The new value of {@code MIN-SCHEMA-MARSHAL} attribute.
    */
   @LegacyAttribute(name = "MIN-SCHEMA-MARSHAL", setter = true)
   public void setMinSchemaMarshal(logical on);
   
   /**
    * Obtain the current value of {@code SCHEMA-MARSHAL} attribute.
    * 
    * @return  the current value of {@code SCHEMA-MARSHAL} attribute.
    */
   @LegacyAttribute(name = "SCHEMA-MARSHAL")
   public character getSchemaMarshal();
   
   /**
    * Sets a new value for {@code SCHEMA-MARSHAL} attribute.
    *
    * @param   level
    *          the new value or {@code SCHEMA-MARSHAL} attribute.
    */
   @LegacyAttribute(name = "SCHEMA-MARSHAL", setter = true)
   public void setSchemaMarshal(String level);
   
   /**
    * Sets a new value for {@code SCHEMA-MARSHAL} attribute.
    *
    * @param   level
    *          the new value or {@code SCHEMA-MARSHAL} attribute.
    */
   @LegacyAttribute(name = "SCHEMA-MARSHAL", setter = true)
   public void setSchemaMarshal(Text level);
}