Class TdbRecord

  • All Implemented Interfaces:
    com.tietoenator.trip.jxp.internal.utils.DOMSink
    Direct Known Subclasses:
    TdbGraphRecord, TdbGridRecord, TdbXmlRecord

    public class TdbRecord
    extends TdbMessageProvider
    implements com.tietoenator.trip.jxp.internal.utils.DOMSink
    Container and manipulation logic for a particular record from a database
    • Constructor Summary

      Constructors 
      Constructor Description
      TdbRecord​(TdbSession session)
      Constructor, creates a blank record container
      TdbRecord​(TdbSession session, TdbDatabaseDesign design, boolean createFields)
      Constructor, associates the new instance with the design provided.
      TdbRecord​(TdbSession session, TdbControlObject ob, boolean createFields)
      Constructor, associates the new instance with the item referenced by the provided Control object
      TdbRecord​(TdbSession session, java.lang.String name, boolean createFields)
      Constructor, associates the new instance with the named database or thesaurus
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addToTemplate​(TdbFieldTemplate tmpl)
      Add a particular field template to the overall retrieval template.
      void addToTemplate​(java.lang.String name)
      Add a particular field by name to the overall retrieval template.
      void addToTemplate​(java.lang.String fieldName, java.lang.String baseName)
      Add a particular field by name to the overall retrieval template.
      TdbComponent appendComponent()
      Create a new component (part record), link it to this record
      void clear​(boolean all)
      Clear any existing state from the TdbRecord instance.
      void commit()
      Commit the current record to the current database.
      TdbRecord copy​(TdbDatabaseDesign targetDatabase)
      Copies the current record to the specified database.
      TdbRecord copy​(java.lang.String targetDatabase)
      Copies the current record to the specified database.
      void delete()
      Delete the current record from the current database
      void deleteComponent​(int index)
      Delete the identified component from the current record.
      void deleteComponent​(java.lang.String name)
      Delete the named component from the current record.
      void get()
      Retrieve the current record from the current database
      org.w3c.dom.Document get​(TdbDataFormat format)
      Retrieve the current record from the current database.
      java.util.List<java.lang.String> getCategories()
      Retrieves the classification categories that have been assigned to this record.
      TdbComponent getComponent​(int index)
      Retrieve the identified component (0 is head, >= 1 is part)
      Note that by design, the components retrieved by this method are "live" and any updates on them are performed directly on the component representation maintained within the TdbRecord instance.
      TdbComponent getComponent​(java.lang.String name)
      Retrieve the named component
      Note that by design, the components retrieved by this method are "live" and any updates on them are performed directly on the component representation maintained within the TdbRecord instance.
      java.lang.String getDatabaseName()
      Get the name of the database for which this TdbRecord is valid
      java.util.Iterator<TdbFieldTemplate> getFieldTemplates()
      An iterator of the field template objects in this TdbRecord.
      TdbComponent getHead()
      Get the values that comprise the head record
      Note that by design, the component retrieved is "live" and any updates on it are performed directly on the head record representation maintained within the TdbRecord instance.
      boolean getIndexOnCommit()
      Returns true if changes to the record should be indexed on commit.
      TdbNlpInfo getNlpInfo()
      Provides access to an object that allows control and enabling of natural language processing behavior such as keyword and meta-data analysis.
      int getRank()
      Retrieve the rank assigned to this record
      Ranks retrieved using this property are normalized, where appropriate, to a percentage range.
      int getRawRank()
      Retrieve the raw rank assigned to this record
      Ranks retrieved using this property are not normalized.
      int getRecordId()
      Retrieve the current value of the record number field, if any.
      java.lang.String getRecordName()
      Retrieve the current value, if any, of the record name field
      java.util.Date getTimeStamp()
      Returns the time stamp for when the current record was stored.
      java.util.List<TdbAseCall> insertAseList()
      List of ASE routines to be called upon commit of a new record.
      boolean isChanged()
      Returns the change status for the record.
      boolean isDeleted()
      Indicates if this record object represents a deleted record.
      boolean isGraphRecord()
      Indicates if this record is a graph record.
      boolean isXmlRecord()
      Indicates if this record is a TRIPxml record.
      void lock()
      Request an exclusive lock on this record.
      java.util.List<TdbComponent> parts()
      Retrieve the collection of part records (where applicable)
      void removeFromTemplate​(java.lang.String name)
      Remove a field from the retrieval template
      In order to perform a valid retrieval operation, calling applications must establish a retrieval template consisting of all fields (whether in the head record or part record) that should be retrieved, and optionally applying retrieval characteristics to that field.
      void setDatabaseName​(java.lang.String name)
      Set the name of the database for which this TdbRecord is valid
      void setIndexOnCommit​(boolean enable)
      Sets flag indicating if changes to the record should be indexed on commit.
      void setPartId​(int id)
      Set a specific part component Id to be retrieved
      In certain application contexts, it is useful to retrieve a single part component at a time, for example in the face of extremely large part components during operations that may be aborted at any time.
      void setPartNameField​(TdbFieldDesign field)
      Set the part name field, so that automatic assignment from the TdbComponent.getName() and TdbComponent.setName() methods happens appropriately.
      void setRecordId​(int id)
      Establish the value of the record number field
      void setRecordName​(java.lang.String name)
      Set the value of the record name field
      void setRecordNameField​(TdbFieldDesign field)
      Set the record name field, so that automatic assignment from the getRecordName() / setRecordName() methods happens appropriately.
      void setRecordNumberField​(TdbFieldDesign field)
      Set the record number field, so that automatic assignment from the getRecordId() method happens appropriately.
      void setRetrieveHead​(boolean head)
      Set whether retrieval operations using this instance should retrieve any fields from the head component.
      void setRetrieveParts​(boolean parts)
      Set whether retrieval operations using this instance should retrieve part components at all.
      void setTemplateMarkup​(java.lang.String before, java.lang.String after)
      Set a common hit term markup scheme for the entire template; this can only be performed after all field templates have been added to the retrieval template, as it modifies field template instances that are currently part of the retrieval template.
      void unlock()
      Releases an exclusive lock obtained on this record.
      java.util.List<TdbAseCall> updateAseList()
      List of ASE routines to be called upon commit of a modified record.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TdbRecord

        public TdbRecord​(TdbSession session)
                  throws TdbException
        Constructor, creates a blank record container
        Parameters:
        session - Active session
        Throws:
        TdbException
      • TdbRecord

        public TdbRecord​(TdbSession session,
                         TdbDatabaseDesign design,
                         boolean createFields)
                  throws TdbException
        Constructor, associates the new instance with the design provided.
        Parameters:
        session - Active session
        design - Database design
        createFields - If true, the constructor will automatically create a retrieval template using all fields from the database design
        Throws:
        TdbException
      • TdbRecord

        public TdbRecord​(TdbSession session,
                         java.lang.String name,
                         boolean createFields)
                  throws TdbException
        Constructor, associates the new instance with the named database or thesaurus
        Parameters:
        session - Active session
        name - Name of database or thesaurus
        createFields - If true, the constructor will automatically create a retrieval template using all fields from the database design
        Throws:
        TdbException
      • TdbRecord

        public TdbRecord​(TdbSession session,
                         TdbControlObject ob,
                         boolean createFields)
                  throws TdbException
        Constructor, associates the new instance with the item referenced by the provided Control object
        Parameters:
        session - Active session
        ob - Control object reference for the item with which to associate this record, normally a database or thesaurus.
        createFields - If true, the constructor will automatically create a retrieval template using all fields from the database design
        Throws:
        TdbException
    • Method Detail

      • getDatabaseName

        public java.lang.String getDatabaseName()
        Get the name of the database for which this TdbRecord is valid
        Returns:
        The name of the database
      • setDatabaseName

        public void setDatabaseName​(java.lang.String name)
        Set the name of the database for which this TdbRecord is valid
        Parameters:
        name - The name of the database
      • setRecordNameField

        public void setRecordNameField​(TdbFieldDesign field)
        Set the record name field, so that automatic assignment from the getRecordName() / setRecordName() methods happens appropriately.
        Parameters:
        field - A design object for the record name field
      • setPartNameField

        public void setPartNameField​(TdbFieldDesign field)
        Set the part name field, so that automatic assignment from the TdbComponent.getName() and TdbComponent.setName() methods happens appropriately.
        Parameters:
        field - A design object for the part name field
      • setRecordNumberField

        public void setRecordNumberField​(TdbFieldDesign field)
        Set the record number field, so that automatic assignment from the getRecordId() method happens appropriately.
        Parameters:
        field - A design object for the record number field
      • getRecordName

        public java.lang.String getRecordName()
                                       throws TdbException
        Retrieve the current value, if any, of the record name field
        Returns:
        The value of the record name field, or an empty string if not known
        Throws:
        TdbException
      • getIndexOnCommit

        public boolean getIndexOnCommit()
        Returns true if changes to the record should be indexed on commit.

        Indexing a record as it is committed is a form of synchronous indexing which is supported with TRIPsystem version 7.0 and later.

        If you index synchronously, best practise is to regularly schedule a regular index batch job (for large databases, preferably on the server console). Not doing this may degrade performance over time.

        Returns:
        True if the record should be indexed and false otherwise.
      • setIndexOnCommit

        public void setIndexOnCommit​(boolean enable)
        Sets flag indicating if changes to the record should be indexed on commit.

        Indexing a record as it is committed is a form of synchronous indexing which is supported with TRIPsystem version 7.0 and later.

        If you index synchronously, best practise is to regularly schedule a regular index batch job (for large databases, preferably on the server console). Not doing this may degrade performance over time.

        Parameters:
        enable - True if the record should be indexed and false otherwise.
      • getTimeStamp

        public java.util.Date getTimeStamp()
                                    throws TdbException
        Returns the time stamp for when the current record was stored.
        Returns:
        Java Date object with the record timestamp, or a dummy timestamp set to January 1st 1970 for new records not yet committed.
        Throws:
        TdbException
      • setRecordName

        public void setRecordName​(java.lang.String name)
                           throws TdbException
        Set the value of the record name field
        Parameters:
        name - The value of the record name field
        Throws:
        TdbException
      • getRecordId

        public int getRecordId()
                        throws TdbException
        Retrieve the current value of the record number field, if any.

        If the isDeleted property is true, the returned record ID will be zero if connected to TRIPsystem 7.1 and older, and to the likely ID of the deleted record if connected to TRIPsystem 7.2 and later.

        Returns:
        The record number, if defined
        Throws:
        TdbException
        See Also:
        isDeleted()
      • setRecordId

        public void setRecordId​(int id)
                         throws TdbException
        Establish the value of the record number field
        Parameters:
        id - The record number
        Throws:
        TdbException
      • setRetrieveHead

        public void setRetrieveHead​(boolean head)
        Set whether retrieval operations using this instance should retrieve any fields from the head component.
        By default, the head component is always retrieved, so applications should only use this property if they wish to retrieve a specific part component without retrieving the head.
        Parameters:
        head - If set false, retrieval operations will not retrieve fields from the head record structure.
      • setRetrieveParts

        public void setRetrieveParts​(boolean parts)
        Set whether retrieval operations using this instance should retrieve part components at all.
        By default, all part components are retrieved (where appropriate). Use this property to defeat this behavior when the application requires only the head record.
        Parameters:
        parts - If set false, retrieval operations will not retrieve fields from the part record structure.
      • setPartId

        public void setPartId​(int id)
        Set a specific part component Id to be retrieved
        In certain application contexts, it is useful to retrieve a single part component at a time, for example in the face of extremely large part components during operations that may be aborted at any time. Use this property to restrict the retrieval operation to a single part component. To reset the retrieval domain to all parts, set this property to zero.
        Parameters:
        id - To restrict retrieval operations to a single part record, set this value to a non-zero number. To reset to all parts, set this value to zero.
      • getHead

        public TdbComponent getHead()
        Get the values that comprise the head record
        Note that by design, the component retrieved is "live" and any updates on it are performed directly on the head record representation maintained within the TdbRecord instance. This is done so that applications may update in place and then simply call commit() to save any changes to the server. Care should be taken, however, in rollback scenarios as any changes that have been made to the head record representation are not recoverable natively from the TdbRecord itself. Such cancellation logic must be performed within the application.
        Returns:
        A reference to the head record
      • parts

        public java.util.List<TdbComponent> parts()
        Retrieve the collection of part records (where applicable)

        Note that by design, the components retrieved from this collection are "live" and any updates on them are performed directly on the part record representation maintained within the TdbRecord instance. This is done so that applications may update in place and then simply call commit() to save any changes to the server.

        Care should be taken, however, in rollback scenarios as any changes that have been made to the part record representation are not recoverable natively from the TdbRecord itself. Such cancellation logic must be performed within the application.

        Returns:
        If there are no part records, the return value is an empty collection.
      • getCategories

        public java.util.List<java.lang.String> getCategories()
        Retrieves the classification categories that have been assigned to this record.
        Returns:
        A collection of category names (may be an empty collection).
      • updateAseList

        public java.util.List<TdbAseCall> updateAseList()
        List of ASE routines to be called upon commit of a modified record.
        Returns:
        List of TdbAseCall objects.
      • insertAseList

        public java.util.List<TdbAseCall> insertAseList()
        List of ASE routines to be called upon commit of a new record.
        Returns:
        List of TdbAseCall objects.
      • getRank

        public int getRank()
        Retrieve the rank assigned to this record
        Ranks retrieved using this property are normalized, where appropriate, to a percentage range. This only has meaning for non-Boolean and fuzzy logic queries, although the value is reported for all queries.
        Returns:
        Normalized rank
      • getRawRank

        public int getRawRank()
        Retrieve the raw rank assigned to this record
        Ranks retrieved using this property are not normalized. This only has meaning for non-Boolean queries, although the value is reported for all queries. In the context of non-Boolean queries, this value can be used to merge results from different databases, different query servers, etc. whereas the value reported by getRank() is specific to a single search operation and cannot be used to merge results.
        Returns:
        Un-normalized rank
      • isXmlRecord

        public boolean isXmlRecord()
        Indicates if this record is a TRIPxml record.
        Returns:
        True if the record is an XML database record
      • isGraphRecord

        public boolean isGraphRecord()
        Indicates if this record is a graph record.
        Returns:
        True if the record is an graph database record
      • getNlpInfo

        public TdbNlpInfo getNlpInfo()
        Provides access to an object that allows control and enabling of natural language processing behavior such as keyword and meta-data analysis.
      • isDeleted

        public boolean isDeleted()
        Indicates if this record object represents a deleted record.

        If this property is true in sessions against TRIPsystem 7.2 and later, the record ID property will be set to the likely ID of the deleted record.

        If this property is true in sessions against older versions of TRIPsystem, the record ID property will be zero.

        Returns:
        True if this record is a placeholder for a deleted record
        Since:
        TRIPjxp 3.2-0
        See Also:
        getRecordId()
      • isChanged

        public boolean isChanged()
        Returns the change status for the record.
        Returns:
        True if the record has uncommitted changes, otherwise false.
        Since:
        8.0-4
      • addToTemplate

        public void addToTemplate​(TdbFieldTemplate tmpl)
                           throws TdbException
        Add a particular field template to the overall retrieval template.
        In order to perform a valid retrieval operation, calling applications must establish a retrieval template consisting of all fields (whether in the head record or part record) that should be retrieved, and optionally applying retrieval characteristics to that field.
        Parameters:
        tmpl - The field template to add
        Throws:
        TdbException
      • addToTemplate

        public void addToTemplate​(java.lang.String name)
                           throws TdbException
        Add a particular field by name to the overall retrieval template.
        In order to perform a valid retrieval operation, calling applications must establish a retrieval template consisting of all fields (whether in the head record or part record) that should be retrieved, and optionally applying retrieval characteristics to that field.
        Parameters:
        name - The name of the field to add
        Throws:
        TdbException
      • addToTemplate

        public void addToTemplate​(java.lang.String fieldName,
                                  java.lang.String baseName)
                           throws TdbException
        Add a particular field by name to the overall retrieval template.
        In order to perform a valid retrieval operation, calling applications must establish a retrieval template consisting of all fields (whether in the head record or part record) that should be retrieved, and optionally applying retrieval characteristics to that field.
        Parameters:
        fieldName - The name of the field to add
        baseName - The name of the base where is field defined
        Throws:
        TdbException
      • removeFromTemplate

        public void removeFromTemplate​(java.lang.String name)
        Remove a field from the retrieval template
        In order to perform a valid retrieval operation, calling applications must establish a retrieval template consisting of all fields (whether in the head record or part record) that should be retrieved, and optionally applying retrieval characteristics to that field.
        Parameters:
        name - The name of the field to remove
      • getFieldTemplates

        public java.util.Iterator<TdbFieldTemplate> getFieldTemplates()
        An iterator of the field template objects in this TdbRecord.
        Returns:
        An iterator over TdbFieldTemplate instances.
      • setTemplateMarkup

        public void setTemplateMarkup​(java.lang.String before,
                                      java.lang.String after)
        Set a common hit term markup scheme for the entire template; this can only be performed after all field templates have been added to the retrieval template, as it modifies field template instances that are currently part of the retrieval template. Fields added to the template after this call will not receive the markup modifications specified here.
        Parameters:
        before - String to insert before hit terms
        after - String to insert after hit terms
      • lock

        public void lock()
                  throws TdbException
        Request an exclusive lock on this record.

        If this method is successful, the record will be locked for update from other users until the commit() method is called.

        If, once locked, the update is aborted before commit() is called, the lock must be released by a call to Clear(). If this is not done, the lock will remain in effect for the remainder of the lifetime of the session.

        This method can only be called on TdbRecord instances that represent existing records. If called on a TdbRecord instance that does not have record ID or record name associated with it, a TdbException will be thrown with code set to TdbException.INVALID_ARGS.

        This method requires TRIPsystem 7.0-3 or later.

        Throws:
        TdbException - If lock request is unsuccessful.
        See Also:
        clear(boolean), unlock()
      • unlock

        public void unlock()
        Releases an exclusive lock obtained on this record.

        This method is used to cancel an exclusive lock obtained on this record. It can also be used to roll back a copied but not yet committed record. Note that an exclusive lock is automatically released by commit(), in which case the Unlock method does not have to be called.

        This method requires TRIPsystem 7.0-3 or later.

        See Also:
        commit(), lock(), copy(com.tietoenator.trip.jxp.database.TdbDatabaseDesign)
      • appendComponent

        public TdbComponent appendComponent()
        Create a new component (part record), link it to this record
        Returns:
        The new component suitable for filling in with fields, etc.
      • getComponent

        public TdbComponent getComponent​(int index)
        Retrieve the identified component (0 is head, >= 1 is part)
        Note that by design, the components retrieved by this method are "live" and any updates on them are performed directly on the component representation maintained within the TdbRecord instance. This is done so that applications may update in place and then simply call commit() to save any changes to the server. Care should be taken, however, in rollback scenarios as any changes that have been made to the component representation are not recoverable natively from the TdbRecord itself. Such cancellation logic must be performed within the application.
        Parameters:
        index - The ID of the part to retrieve -- 0 is the head record
        Returns:
        A reference to the requested component, if found, or else null
      • getComponent

        public TdbComponent getComponent​(java.lang.String name)
                                  throws TdbException
        Retrieve the named component
        Note that by design, the components retrieved by this method are "live" and any updates on them are performed directly on the component representation maintained within the TdbRecord instance. This is done so that applications may update in place and then simply call commit() to save any changes to the server. Care should be taken, however, in rollback scenarios as any changes that have been made to the component representation are not recoverable natively from the TdbRecord itself. Such cancellation logic must be performed within the application.
        Parameters:
        name - The name of the part to retrieve
        Returns:
        A reference to the requested component, if found, or else null
        Throws:
        TdbException
      • deleteComponent

        public void deleteComponent​(int index)
                             throws TdbException
        Delete the identified component from the current record.
        Attempts to delete the head component, i.e. the component with index 0, will fail with an INVALID_ARGS exception being thrown. Note that successful deletion is a local activity, and the resulting record must still be written to the server using the commit() method.
        Parameters:
        index - The ID of the part to delete
        Throws:
        TdbException
      • deleteComponent

        public void deleteComponent​(java.lang.String name)
                             throws TdbException
        Delete the named component from the current record.
        Note that successful deletion is a local activity, and the resulting record must still be written to the server using the commit() method.
        Parameters:
        name - The name of the part to delete
        Throws:
        TdbException
      • get

        public void get()
                 throws TdbException
        Retrieve the current record from the current database

        Prior to calling this method, the calling application must have established context using the setDatabaseName() method along with one of the setRecordName() or setRecordId() methods. The application must also make use of the addToTemplate() method to request one or more fields to be retrieved as part of the operation. Optionally, calling applications can restrict the domain of retrieval to either just the head record or just one or more part records by using the setRetrieveHead(), setRetrieveParts() and setPartId() methods.

        This method causes network I/O.

        Throws:
        TdbException
      • get

        public org.w3c.dom.Document get​(TdbDataFormat format)
                                 throws TdbException
        Retrieve the current record from the current database.

        Prior to calling this method, the calling application must have established context using the setDatabaseName() method along with one of the setRecordName() or setRecordId() methods. The application must also make use of the addToTemplate() method to request one or more fields to be retrieved as part of the operation. Optionally, calling applications can restrict the domain of retrieval to either just the head record or just one or more part records by using the setRetrieveHead(), setRetrieveParts() and setPartId() methods.

        The result of the retrieval generated by this method is not deserialized internally into a sequence of fields and components. The content of this object following a call to this method is blank.

        Values for any string fields requested are returned inline encoded as base64. This may result in a very large response document and may cause session timeout or lack of enough memory resources to complete processing. Make sure to exclude any unnecessary STRING fields from retrieval.

        This method causes network I/O.

        Parameters:
        format - The format in which to retrieve data
        Returns:
        An XML document containing the record, suitable for transformation or any other custom deserialization technique
        Throws:
        TdbException
      • copy

        public TdbRecord copy​(java.lang.String targetDatabase)
                       throws TdbException
        Copies the current record to the specified database.

        The target database must have the same design as the source database.

        The copy operation is done fully on the server-side. All field values from the source record will be copied to the target record, regardless of what field values have been fetched from the source record prior to the copy operation.

        The copy operation will not commit the record; this must be done separately after the copy operation has completed successfully. This allows the application to modify the target record prior to commit.

        After a successful call to this method, the current TdbRecord instance will refer to the target record.

        If the copy operation succeeds but later should be rolled back instead of committed, it is critical that the application calls the unlock() method or the clear(boolean) method with 'true' as argument in order to release server-side resources held for the uncommitted target record. Failure to do this may cause memory leaks and in the case of database designs with record name fields, retained record locks.

        If the database has a record name field and the target database is the same as the source database, the record name must be set to a new value on the returned copy before commit.

        The TdbRecord returned will not have any of the field values locally; all values are copied on the server. If you wish to modify or assign new values to fields in the copy, use the TdbComponent.createField(TdbFieldDesign) method to add field objects to hold the new or modified values for the copy.

        This method requires TRIPsystem 7.0-4 or later, alternatively version 6.2-11 or later of the TRIPsystem 6.2 series.

        Parameters:
        targetDatabase - Name of database to which the current record is to be copied.
        Returns:
        TdbRecord instance representing an uncommitted copy.
        Throws:
        TdbException - If the copy operation failed
      • copy

        public TdbRecord copy​(TdbDatabaseDesign targetDatabase)
                       throws TdbException
        Copies the current record to the specified database.

        The target database must have the same design as the source database.

        The copy operation is done fully on the server-side. All field values from the source record will be copied to the target record, regardless of what field values have been fetched from the source record prior to the copy operation.

        The copy operation will not commit the record; this must be done separately after the copy operation has completed successfully. This allows the application to modify the target record prior to commit.

        After a successful call to this method, the current TdbRecord instance will refer to the target record.

        If the copy operation succeeds but later should be rolled back instead of committed, it is critical that the application calls the unlock() method or the clear(boolean) method with 'true' as argument in order to release server-side resources held for the uncommitted target record. Failure to do this may cause memory leaks and in the case of database designs with record name fields, retained record locks.

        If the database has a record name field and the target database is the same as the source database, the record name must be set to a new value on the returned copy before commit.

        The TdbRecord returned will not have any of the field values locally; all values are copied on the server. If you wish to modify or assign new values to fields in the copy, use the TdbComponent.createField(TdbFieldDesign) method to add field objects to hold the new or modified values for the copy.

        This method requires TRIPsystem 7.0-4 or later, alternatively version 6.2-11 or later of the TRIPsystem 6.2 series.

        Parameters:
        targetDatabase - Design for the database to which the current record is to be copied.
        Returns:
        TdbRecord instance representing an uncommitted copy.
        Throws:
        TdbException - If the copy operation failed
      • commit

        public void commit()
                    throws TdbException
        Commit the current record to the current database.

        This method will either insert a new record to the database, or update an existing record. The decision as to whether to insert or update depends on the state of the current record. If the record was retrieved using any of the get() methods, or if the record's ID has been set using the setDatabaseName() and setRecordId() methods, then an update will be performed. Failing these conditions, an insert will be performed.

        If an exclusive lock has been obtained on this record, the lock will be automatically released upon successful completion of the commit operation.

        When used with TRIPsystem 7.0 and later, it is possible to index a record synchronously upon committing it. To do this, call the setIndexOnCommit() method with 'true' as argument before calling commit(). However, it should be noted that best practise is to defer indexing until it is absolutely needed, thereby allowing many records to be indexed in one go, resulting in a better index structure in the long run.

        If you index synchronously, best practise is to regularly schedule a regular index batch job (for large databases, preferably on the server console). Not doing this may degrade performance over time.

        If the record is new and the insertAseList list contains names of ASE procedures that exist on the server, these procedures will be called in sequence after the data has been added to the in-memory record control, but before it is actually committed to disk.

        If the record is updated and the updateAseList list contains names of ASE procedures that exist on the server, these procedures will be called in sequence after the modifications have been done in the in-memory the record control, but before it is actually committed to disk.

        The insertAseList and updateAseList behavior requires TRIPsystem version 6.2-4 or later. To index on commit, TRIPsystem 7.0 or later is required.

        This method causes network I/O.

        Throws:
        TdbException
      • delete

        public void delete()
                    throws TdbException
        Delete the current record from the current database

        In order to call this method successfully, the calling application must first establish the database name and record id to be deleted, using the methods setDatabaseName() and setRecordId().

        This method causes network I/O.

        Throws:
        TdbException
      • clear

        public void clear​(boolean all)
        Clear any existing state from the TdbRecord instance.

        If this method is called before commit() and an exclusive lock exists on this record, the lock will be released by this method if the parameter 'all' is set to true.

        Parameters:
        all - If true, all state is cleared, including the database with which the record is associated, the record name/ID, etc. If false, the record structure is initialized, but the basic state of the record's association is maintained.